Image sources: FITS, MCFOST, scene files#

Image source modules: a FITS image, an MCFOST model, and the scene FITS interchange file.

toycoronagraph.sources.images.fits_path(name)[source]#

The path of a FITS file named in a parameter file.

Parameters:

name (str) – a path; “example” = the bundled example (DATADIR/example.fits).

Returns:

the path, with “.fits” added when it has no FITS extension (.fits, .fits.gz, .fit, .fts).

Return type:

str

class toycoronagraph.sources.images.FitsImage(**settings)[source]#

Bases: _ImageSource

A 2-D image (or a plane of a cube) from a FITS file, the star at pixel (N-1)/2.

family is None: the unit comes from the header’s BUNIT or the input_unit setting.

Check and store the module’s own parameters.

Parameters:

**settings – {param name: value}; each is converted with toycoronagraph.params.convert (units in text, “auto”, choices…); parameters not given take their default.

Raises:

ParamError – unknown parameter names (with a suggestion) or invalid values, all listed.

class toycoronagraph.sources.images.Mcfost(**settings)[source]#

Bases: _ImageSource

One plane of an MCFOST image cube (axes: plane, azimuth, inclination, y, x); its unit is the header’s BUNIT.

Check and store the module’s own parameters.

Parameters:

**settings – {param name: value}; each is converted with toycoronagraph.params.convert (units in text, “auto”, choices…); parameters not given take their default.

Raises:

ParamError – unknown parameter names (with a suggestion) or invalid values, all listed.

class toycoronagraph.sources.images.SceneFits(**settings)[source]#

Bases: Source

The images of a scene written by write_scene(): one component per 2-D image extension.

Each extension’s unit, pixel scale and wavelength come from its own header (family None); the TOTAL and FINAL_TOTAL extensions are skipped. The star’s distance can come from the primary header (DISTANCE).

Check and store the module’s own parameters.

Parameters:

**settings – {param name: value}; each is converted with toycoronagraph.params.convert (units in text, “auto”, choices…); parameters not given take their default.

Raises:

ParamError – unknown parameter names (with a suggestion) or invalid values, all listed.

inspect()[source]#

The grid size, pixel scale and wavelength (from the first image’s header) and the star’s distance.

Returns:

[(key, value, origin)] for grid.size, grid.pixel_scale (arcsec), observation.wavelength (m) and star.distance (pc), those present.

Return type:

list of tuple

family_of()[source]#

Always None: each extension’s BUNIT decides.

render(grid, star)[source]#

One image per extension.

Parameters:
Returns:

{extension name (lower case): SourceImage} with each header’s unit, pixel scale (arcsec) and wavelength (m).

Return type:

dict

Raises:

ValueError – an extension’s BUNIT is not understood.