scopesim.effects.illumination.Illumination#
- class scopesim.effects.illumination.Illumination(model: ~collections.abc.Callable = <function gaussian2d>, modelargs: ~collections.abc.Mapping | None = None, **kwargs)#
Bases:
EffectLarge-scale illumination variation across the image plane.
Added in version 0.11.3.
- Parameters:
model (callable, optional) – Function
f(shape, **kwargs) -> ndarrayreturning the illumination map. Defaults togaussian2d().modelargs (dict, optional) – Keyword arguments forwarded to
model. If omitted, the model’s own defaults are used.include (str) – Turn effect on/off from the IRDB default.yaml. Defaults to
"!DET.include_illumination".
Examples
Polynomial vignetting with <1 % falloff (auto r_ref from image shape)
>>> eff = Illumination( ... model=quadratic_vignetting, ... modelargs={"falloff": 0.01}, ... )
Custom model
>>> def my_model(shape, slope=-0.001): >>> ny, nx = shape[-2], shape[-1] >>> y, x = np.ogrid[:ny, :nx] >>> r = np.sqrt((x - nx / 2)**2 + (y - ny / 2)**2) >>> return np.clip(1 + slope * r, 0, None) >>> >>> eff = Illumination(model=my_model, modelargs={"slope": -0.0005})
- __init__(model: ~collections.abc.Callable = <function gaussian2d>, modelargs: ~collections.abc.Mapping | None = None, **kwargs) None#
Methods
__init__([model, modelargs])apply_to(obj, **kwargs)Apply the effect to the corresponding object.
get_from_meta(item)info()Print basic information on the effect, notably the description.
plot()Plot effect.
report([filename, output, rst_title_chars])For Effect objects, generates a report based on the data and meta-data.
Attributes
datadisplay_nameincludemeta_stringrequired_keystablez_order- apply_to(obj, **kwargs)#
Apply the effect to the corresponding object.
- plot()#
Plot effect.
- report(filename=None, output='rst', rst_title_chars='*+', **kwargs)#
For Effect objects, generates a report based on the data and meta-data.
This is to aid in the automation of the documentation process of the instrument packages in the IRDB.
Note
If the Effect can generate a plot, this will be saved to disc
- Parameters:
filename (str, optional) – Where to save the RST file
output (str, optional) – [“rst”, “latex”] Output file format
rst_title_chars (2-str, optional) – Two unique characters used to denote rst subsection headings. Options: = - ` : ‘ “ ~ ^ _ * + # < >
parameters (Additional)
---------------------
**kwargs (Either from the self.meta["report"] dictionary or via)
"report_table_include" (False)
"report_table_caption"
"report_plot_caption"
"report_plot_include" (False)
"report_plot_file_formats" (["png"]) – Multiple formats can be saved. The last entry is used for the RST.
"report_plot_filename" (None) – If None, uses self.meta[“name”] as the filename
"file_description" (str) – Taken from the header of a file, if available
"class_description" (str) – Taken from the docstring of the subclass
"changes_str" (list of str) – Take from the header of a file, if available
- Returns:
rst_str – The full reStructureText string
- Return type:
Notes
The format of the RST output is as follows:
<ClassType>: <effect name> ************************** File Description: <description for file meta data> Class Description: <description from class docstring> Changes: <list of changes from file meta data> Data ++++ .. figure:: <Figure_name>.png If the <Effect> object contains a ``.plot()`` function, add plot and write it to disc Figure caption Table caption Table If the <Effect> object contains a ``.table()`` function, add a pprint version of the table Meta-data +++++++++ :: A code block print out of the ``.meta`` dictionary