Model language implementation#83
Conversation
…lution of named items and total layers
…t automatically plots a stack
…t represents an class and allow type Any
| - material: {sld: -3.73401535e-07} | ||
| thickness: 1.4 | ||
| roughness: 3.0 | ||
| represents: refnx.reflect.LipidLeaflet |
There was a problem hiding this comment.
This setup looks interesting. However, what happens if/when the parameterisation of a given function/class changes? Or more generally if there are changes between different versions of an analysis package?
There was a problem hiding this comment.
That's a good point, maybe such a description would need to include the software version, e.g. in the model "origin" attribute.
As alternative it is always possible we define our own "LipidLeaflet" model class that defines the slab-generation. It was just my understanding, that there is not really a consensus in the soft-matter community on how these are parameterized.
So this was a proposal how to deal with that in a generic way.
| thickness: 11.0 | ||
| roughness: 3.0 | ||
| material: | ||
| sld: {real: 4.864311704082625e-06, imag: -4.533346598101179e-07} |
There was a problem hiding this comment.
Is it worth multiplying these values by 1e6? So one would have real: 4.86, with implied units of 1e-6 A**-2
There was a problem hiding this comment.
While this is already possible by defining the correct default units through the "globals" attribute of the model, we will need to find consensus on what the default for non-provided "globals" should be.
Right now I used these:
@orsodataclass
class ModelParameters(Header):
roughness: Optional[Value] = Value(0.3, "nm")
length_unit: Optional[str] = "nm"
mass_density_unit: Optional[str] = "g/cm^3"
number_density_unit: Optional[str] = "1/nm^3"
sld_unit: Optional[str] = "1/angstrom^2"
magnetic_moment_unit: Optional[str] = "muB"|
Am I being slow, or is there a unit difference in the thicknesses between the examples 1/3 and 4? The total thicknesses don't seem to add up for me without 1/3 being in nm and 4 being in A? |
|
@jfkcooper But I noticed now a bug in the example 3, where the attribute is called length_units instead of length_unit, will correct that. |
# Conflicts: # orsopy/fileio/__init__.py # orsopy/fileio/base.py # tests/test_fileio/test_base.py
…r defined resolution
# Conflicts: # orsopy/fileio/data_source.py
…n trying to resolve names, instead
…Name, add relative_density
|
According to @jochenstahn it was decided to merge these developments. Will create another PR for the revision that will include the documentation and proper review. |
Implement the ORSO header classes for the draft simple model language.
The classes include the logic for resolving names and layers to be used easily by other programs.
The examples folder includes YAML from the website examples, a script that plots reflectivity and SLD from a given sample model, a conversion script showcasing the export of GenX models to the sample model and an estimator for measurement uncertainties based on a sample model string.
Some usage of the examples:
simple_model_example_1.yml

python resolve_and_plot_model.py simple_model_example_1.ymlsimple_model_example_3.yml

python resolve_and_plot_model.py simple_model_example_3.ymlsimple_model_example_4.yml

python sample2data.py "air | 5 (Co 31 | Fe 13) | Si"python simple_model_from_genx.py ...\genx\genx\genx\examples\X-ray_Reflectivity.hgx simple_model_export_genx.yml=> simple_model_export_genx.yml