models

Generate and modify Refl1d Python model definitions for neutron reflectometry fitting.

Updated Aug 27, 2026
One-click install
npx skills add https://github.com/mdoucet/analyzer --skill models-mdoucet
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: models
Source: https://github.com/mdoucet/analyzer/tree/main/skills/models
Command: npx skills add https://github.com/mdoucet/analyzer --skill models-mdoucet

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill documents and explains Refl1d Python model files used to describe layered samples for neutron reflectometry fitting, helping users choose, create, and modify models so they can run reliable fits and sensitivity studies.

Core Features & Use Cases

  • Explains the create_fit_experiment(q, dq, data, errors) function signature and how it constructs a refl1d.experiment.Experiment from SLD and Slab definitions.
  • Lists available model variants (for example cu_thf and its minimal/oxide variants), how layers are ordered, and how to set parameter ranges for thickness, SLD, and interface.
  • Describes utility workflows: generating standalone fit scripts from a model+data file and creating temporary models with adjusted parameter ranges for focused fitting campaigns.

Quick Start

Use the models skill to inspect the cu_thf model, summarize its layer stack and parameter ranges, and generate a standalone fit script for the data file REFL_218281_combined_data_auto.txt.

Frequently Asked Questions about models

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I build a layer model for neutron reflectometry fitting in Refl1d?

Refl1d layer models require a create_fit_experiment(q, dq, data, errors) function that constructs a refl1d.experiment.Experiment from SLD and Slab definitions. You must set explicit parameter.range values for thickness, material rho, and interface widths to run reliable fits.

What is the function signature required for a Refl1d model to run experimental reflectivity fits?

The required signature is create_fit_experiment(q, dq, data, errors), accepting q, dq, data, and errors arrays. It must return a refl1d.experiment.Experiment with explicit parameter.range settings for slab thickness, material rho, and interface widths.

How do I set parameter ranges for slab thickness and SLD in a neutron reflectometry model?

You set parameter ranges by applying explicit parameter.range settings within your Refl1d model definition. This directly constrains the fitting bounds for material rho, layer thickness, and interface widths during the neutron reflectometry analysis.

Can I generate a standalone fit script from an existing Refl1d model and experimental data file?

Yes, you can generate a standalone fit script from an existing Refl1d model and an experimental reflectivity data file. The skill produces these scripts to run sensitivity studies and focused fitting campaigns without modifying the original Python model definition.

How do I adjust parameter ranges for a focused neutron reflectometry fitting campaign?

You adjust parameter ranges by creating a temporary Refl1d model with modified thickness and SLD parameter.range settings. This allows you to target specific variables for a focused fitting campaign without altering the original Python model file in the models directory.

Does this models skill support selecting between different reflectometry layer model variants?

Yes, the skill supports selecting between available reflectometry layer model variants, such as cu_thf and its minimal or oxide versions. It documents how layers are ordered and explains how to choose the appropriate model for your experimental data.