orsopy.fileio.base
Implementation of the base classes for the ORSO header.
- class orsopy.fileio.base.Header[source]
Bases:
object
The super class for all the items in the orso module.
- classmethod from_dict(data_dict)[source]
Create class from dictionary as is returned from yaml file reader.
If user-supplied attributes are provided, they are not passed to the constructor but applied after instance generation.
- property user_data
- classmethod empty()[source]
Create an empty instance of this item containing all non-option attributes as
None
.- Return type:
- Returns:
Empty class.
- static asdict(header)[source]
Static method for
to_dict()
.- Parameters:
header (
Header
) – Object to convert to dictionary.- Return type:
dict
- Returns:
Dictionary result.
- class orsopy.fileio.base.OrsoDumper(stream, default_style=None, default_flow_style=False, canonical=None, indent=None, width=None, allow_unicode=None, line_break=None, encoding=None, explicit_start=None, explicit_end=None, version=None, tags=None, sort_keys=True)[source]
Bases:
SafeDumper
- class orsopy.fileio.base.ErrorValue(error_value, error_type=None, value_is=None, distribution=None, comment=None)[source]
Bases:
Header
Information about errors on a value.
-
error_value:
float
-
error_type:
Optional
[Literal
['uncertainty'
,'resolution'
]] = None
-
value_is:
Optional
[Literal
['sigma'
,'FWHM'
]] = None
-
distribution:
Optional
[Literal
['gaussian'
,'triangular'
,'uniform'
,'lorentzian'
]] = None
- yaml_representer(dumper)
- property sigma
Return value converted to standard deviation.
The conversion factors can be found in common statistics and experimental physics text books or derived manually solving the variance definition integral. (e.g. Dekking, Michel (2005). A modern introduction to probability and statistics : understanding why and how. Springer, London, UK:) Values and some references available on Wikipedia, too.
-
comment:
Optional
[str
] = None
-
error_value:
- class orsopy.fileio.base.Value(magnitude, unit=None, error=None, offset=None, comment=None)[source]
Bases:
Header
A value or list of values with an optional unit.
-
magnitude:
float
-
unit:
Optional
[str
] = None
-
error:
Optional
[ErrorValue
] = None
-
offset:
Optional
[float
] = None
- yaml_representer(dumper)
-
comment:
Optional
[str
] = None
-
magnitude:
- class orsopy.fileio.base.ComplexValue(real, imag=None, unit=None, error=None, comment=None)[source]
Bases:
Header
A value or list of values with an optional unit.
-
real:
float
-
imag:
Optional
[float
] = None
-
unit:
Optional
[str
] = None
-
error:
Optional
[ErrorValue
] = None
- yaml_representer(dumper)
-
comment:
Optional
[str
] = None
-
real:
- class orsopy.fileio.base.ValueRange(min, max, unit=None, individual_magnitudes=None, offset=None, comment=None)[source]
Bases:
Header
A range or list of ranges with mins, maxs, and an optional unit.
-
min:
float
-
max:
float
-
unit:
Optional
[str
] = None
-
individual_magnitudes:
Optional
[List
[float
]] = None
-
offset:
Optional
[float
] = None
- yaml_representer(dumper)
-
comment:
Optional
[str
] = None
-
min:
- class orsopy.fileio.base.ValueVector(x, y, z, unit=None, error=None, comment=None)[source]
Bases:
Header
A vector or list of vectors with an optional unit. For vectors relating to the sample, such as polarisation, the follow definitions are used.
- Parameters:
x (
float
) – is defined as parallel to the radiation beam, positive going with the beam direction.y (
float
) – is defined from the other two based on the right hand rule.z (
float
) – is defined as normal to the sample surface, positive direction in scattering direction.unit (
Optional
[str
]) – SI unit string.
-
x:
float
-
y:
float
-
z:
float
-
unit:
Optional
[str
] = None
-
error:
Optional
[ErrorValue
] = None
- yaml_representer(dumper)
-
comment:
Optional
[str
] = None
- class orsopy.fileio.base.AlternatingField(amplitude, frequency, phase=None, comment=None)[source]
Bases:
Header
A physical field with regular variations as AC magnetic field.
-
comment:
Optional
[str
] = None
-
comment:
- class orsopy.fileio.base.Person(name, affiliation, contact=None, comment=None)[source]
Bases:
Header
Information about a person, including name, affiliation(s), and contact information.
-
name:
str
-
affiliation:
str
-
contact:
Optional
[str
] = None
-
comment:
Optional
[str
] = None
-
name:
- class orsopy.fileio.base.Column(name, unit=None, physical_quantity=None, flag_is=None, comment=None)[source]
Bases:
Header
Information about a data column.
-
name:
str
-
unit:
Optional
[str
] = None
-
physical_quantity:
Optional
[str
] = None
-
flag_is:
Optional
[List
[str
]] = None
- yaml_representer(dumper)
-
comment:
Optional
[str
] = None
-
name:
- class orsopy.fileio.base.ErrorColumn(error_of, error_type=None, value_is=None, distribution=None, comment=None)[source]
Bases:
Header
Information about a data column.
-
error_of:
str
-
error_type:
Optional
[Literal
['uncertainty'
,'resolution'
]] = None
-
value_is:
Optional
[Literal
['sigma'
,'FWHM'
]] = None
-
distribution:
Optional
[Literal
['gaussian'
,'triangular'
,'uniform'
,'lorentzian'
]] = None
- yaml_representer(dumper)
- property name
A convenience property to allow programs to get a valid name attribute for any column.
- property to_sigma
The multiplicative factor needed to convert a FWHM to sigma.
The conversion factors can be found in common statistics and experimental physics text books or derived manually solving the variance definition integral. (e.g. Dekking, Michel (2005). A modern introduction to probability and statistics : understanding why and how. Springer, London, UK:) Values and some references available on Wikipedia, too.
-
comment:
Optional
[str
] = None
-
error_of: