pyimcom.config

Encapsulation of pyimcom background settings and configuration.

Classes

Timer

All-purpose timer.

Settings

pyimcom background settings.

fpaCoords

some basic data on the Roman FPA coordinates, needed for some of the tests.

Config

pyimcom configuration, with JSON file interface.

Functions

format_axis

Format a panel (an axis) of a figure.

Attributes

JWST

format_axis_pars

Classes

Timer

All-purpose timer.

Settings

pyimcom background settings.

fpaCoords

This contains some static data on the FPA coordinate system.

Config

pyimcom configuration, with JSON file interface.

Functions

format_axis(ax[, grid_on])

Format a panel (an axis) of a figure.

Module Contents

JWST[source]
class Timer[source]

All-purpose timer.

__init__()[source]

Constructor.

__call__()[source]

Return the time elapsed since tstart in seconds.

tstart[source]
__call__(reset: bool = False) float[source]

Return the time elapsed since tstart in seconds.

Parameters:

reset (bool, optional) – Whether to reset tstart.

Returns:

Time elapsed since tstart in seconds.

Return type:

float

class Settings[source]

pyimcom background settings.

This class contains assorted Roman WFI data needed for the coadd code.

hdu_with_wcs = 'SCI'[source]
degree[source]
arcmin[source]
arcsec[source]
RomanFilters = ['W146', 'F184', 'H158', 'J129', 'Y106', 'Z087', 'R062', 'PRSM', 'DARK', 'GRSM', 'K213'][source]
QFilterNative = [1.155, 1.456, 1.25, 1.021, 0.834, 0.689, 0.491, 1.009, 0.0, 1.159, 1.685][source]
obsc = 0.31[source]
pixscale_native[source]
sca_nside = 4088[source]
sca_ctrpix = 2043.5[source]
sca_sidelength[source]
SCAFov[source]
classmethod jwst()[source]

Method to modify the Settings object to have JWST NIRCam parameters instead of Roman WFI parameters.

Note: Currently only includes those attributes that are used in imdestripe.py, but more can be added as needed.

class fpaCoords[source]

This contains some static data on the FPA coordinate system.

It also has some associated static methods.

xfpa[source]
yfpa[source]
Rfpa = 151.07129575137697[source]
sca_orient[source]
pixsize = 0.01[source]
nside = 4088[source]
classmethod pix2fpa(sca, x, y)[source]

Method to convert pixel (x,y) on a given sca to focal plane coordinates.

Inputs:

sca (in form 1..18) x and y (in pixels) sca, x, y may be scalars or arrays

Outputs:

xfpa, yfpa (in mm)

class Config(cfg_file: str = '', inmode=None)[source]

pyimcom configuration, with JSON file interface.

Parameters:
  • cfg_file (str or None, optional) – File path to or text content of a JSON configuration file. The default is ‘’. This uses pyimcom/configs/default_config.json. Set cfg_file=None to build a configuration from scratch.

  • inmode (str or None, optional) – Directives for special behavior. Right now the only one supported is ‘block’ (meaning the configuration is read from a block output).

__init__()[source]

Constructor.

__call__()[source]

Calculate or update derived quantities.

_from_dict()[source]

Build a configuration from a dictionary.

_get_attrs_wrapper()[source]

Wrapper for getting an attribute or a set of attributes.

_build_config()[source]

Terminal interface to build a configuration from scratch.

to_file()[source]

Save the configuration to a JSON file.

to_dict()[source]

Convert to a dictionary.

__slots__ = ('cfg_file', 'NsideP', 'n1P', 'n2f', 'obsfile', 'inpath', 'informat', 'use_filter',...[source]
cfg_file = ''[source]
__call__() None[source]

Calculate or update derived quantities.

_from_dict(cfg_dict: dict) None[source]

Build a configuration from a dictionary.

Parameters:

cfg_dict (dict) – This is a dictionary, usually built from a JSON file.

Return type:

None

_get_attrs_wrapper(code: str, newline: bool = True) None[source]

Wrapper for getting an attribute or a set of attributes.

Parameters:
  • code (str) – Code segment to execute.

  • newline (bool, optional) – Whether to print a blank line when finished.

Return type:

None

_build_config() None[source]

Terminal interface to build a configuration from scratch.

The prompts are based on comments in old text configuration files. assert statements for further validity checks to be added.

Return type:

None

to_file(fname: str = '') None[source]

Save the configuration to a JSON file.

Parameters:

fname (str or None, optional) – JSON configuration file name to save to. The default is ‘’. This overwrites pyimcom/configs/default_config.json. Set fname=None to get a text version of the configuration.

Returns:

Text version of the configuration.

Return type:

str or None

to_dict()[source]

Save the configuration as a dictionary.

Parameters:

None

Returns:

Dictionary version of the configuration.

Return type:

dict

format_axis_pars[source]
format_axis(ax, grid_on=True)[source]

Format a panel (an axis) of a figure.

Parameters:
  • ax (mpl.axes._axes.Axes) – Panel to be formatted.

  • grid_on (bool, optional) – Whether to add grid to the panel.

Return type:

None