Utility#

class vampires_dpp.constants.CMOSVAMPIRES(**data)#
Parameters:
  • cam_num (Literal[1, 2])

  • readmode (Literal['fast', 'slow'])

model_config: ClassVar[ConfigDict] = {}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class vampires_dpp.constants.EMCCDVAMPIRES(**data)#
Parameters:
  • cam_num (Literal[1, 2])

  • emgain (int)

model_config: ClassVar[ConfigDict] = {}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class vampires_dpp.constants.InstrumentInfo(**data)#
model_config: ClassVar[ConfigDict] = {}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

vampires_dpp.headers.get_instrument_from(header)#

Get the instrument info from a FITS header

Return type:

InstrumentInfo

Parameters:

header (Header)

vampires_dpp.headers.parallactic_angle_altaz(alt, az, lat=np.float64(19.825504000000002))#

Calculate parallactic angle using the altitude/elevation and azimuth directly

Parameters:
  • alt (float) – altitude or elevation, in degrees

  • az (float) – azimuth, in degrees CCW from North

  • lat (float, optional) – latitude of observation in degrees, by default 19.823806

Returns:

parallactic angle, in degrees East of North

Return type:

float

vampires_dpp.headers.parallactic_angle_hadec(ha, dec, lat=np.float64(19.825504000000002))#

Calculate parallactic angle using the hour-angle and declination directly

\[\theta_\mathrm{PA} = \arctan2{\frac{\sin\theta_\mathrm{HA}}{\tan\theta_\mathrm{lat}\cos\delta - \sin\delta \cos\theta_\mathrm{HA}}}\]
Parameters:
  • ha (float) – hour-angle, in hour angles

  • dec (float) – declination in degrees

  • lat (float, optional) – latitude of observation in degrees, by default 19.823806

Returns:

parallactic angle, in degrees East of North

Return type:

float

vampires_dpp.headers.sort_header(header)#

Sort all non-structural FITS header keys

Return type:

Header

Parameters:

header (Header)

vampires_dpp.headers.update_header_iso(header)#

Return the middle point of the exposure for ISO-based timestamps

Parameters:

header (FITSHeader)

Return type:

Header

vampires_dpp.headers.update_header_mjd(header)#

Return the middle point of the exposure for MJD timestamps

Parameters:

header (FITSHeader)

Returns:

The MJD timestamp for the middle point of the exposure

Return type:

str

vampires_dpp.indexing.cutout_inds(frame, window, center=None, **kwargs)#

Get the index slices for a window with size window at center, clipped to the boundaries of frame

Parameters:
  • frame (ArrayLike) – image frame for bound-checking

  • center (Tuple) – (y, x) coordinate of the window

  • window (float,Tuple) – window length, or tuple for each axis

Returns:

tuple of slices for the indices for the window

Return type:

(ys, xs)

vampires_dpp.indexing.frame_angles(frame, center=None, conv='image')#

Return the angles of pixels around center in the image

Parameters:
  • frame (ArrayLike) – Input frame

  • center (Tuple, optional) – The center to calculate radii from. If None, will default to the frame center. By default None

  • conv (str, optional) – The convention to use, either “image” (angle increases CCW from +x axis of image) or “astro” (angle increases degrees East of North). By default, “image”.

Returns:

Matrix with frame angles

Return type:

NDArray

vampires_dpp.indexing.frame_center(image)#

Find the center of the frame or cube in pixel coordinates

Parameters:

image (ArrayLike) – N-D array with the final two dimensions as the (y, x) axes.

Returns:

A tuple of the image center in pixel coordinates

Return type:

(cy, cx)

vampires_dpp.indexing.frame_radii(frame, center=None)#

Return the radii of pixels around center in the image

Parameters:
  • frame (ArrayLike) – Input frame

  • center (Tuple, optional) – The center to calculate radii from. If None, will default to the frame center. By default None

Returns:

Matrix with frame radii

Return type:

NDArray

vampires_dpp.indexing.get_mbi_centers(frame, reduced=False)#

Return (y, x) rough centers for MBI data.

Note this is just multiples of the frame size, not based on anything sensible.

Assumes cam 1 data has already been flipped.

Return type:

dict[str, tuple[float, float]]

Parameters:
  • frame (ndarray[tuple[int, ...], dtype[_ScalarType_co]])

  • reduced (bool)

vampires_dpp.organization.check_file(filename)#

Checks if file can be loaded and if there are empty slices

Parameters:

filename (PathLike)

Returns:

Returns True if file can be loaded and no empty frames

Return type:

bool

vampires_dpp.organization.dict_from_header(header, excluded=('COMMENT', 'HISTORY'), fix=True)#

Parse a FITS header and extract the keys and values as an ordered dictionary. Multi-line keys like COMMENTS and HISTORY will be combined with commas. The resolved path will be inserted with the path key.

Parameters:

header (Header) – FITS header to parse

Return type:

OrderedDict

vampires_dpp.organization.dict_from_header_file(filename, ext=0, **kwargs)#

Parse a FITS header from a file and extract the keys and values as an ordered dictionary. Multi-line keys like COMMENTS and HISTORY will be combined with commas. The resolved path will be inserted with the path key.

Parameters:
  • filename (str) – FITS file to parse

  • **kwargs – All keyword arguments will be passed to load_fits_header

Return type:

OrderedDict

vampires_dpp.organization.header_table(filenames, num_proc=None, quiet=False, **kwargs)#

Generate a pandas dataframe from the FITS headers parsed from the given files.

Parameters:
  • filenames (list[pathlike])

  • num_proc (int, optional) – Number of processes to use in multiprocessing, by default mp.cpu_count()

  • quiet (bool, optional) – Silence the progress bar, by default False

Return type:

pandas.DataFrame

vampires_dpp.synthpsf.generate_pupil(n=256, outer=1, inner=0.3034090909090909, scale=1, angle=0, oversample=8, spiders=True, actuators=True)#

Generate a SCExAO pupil parametrically.

Parameters:
  • n (int, optional) – Grid size in pixels. Default is 256

  • outer (float, optional) – Outer pupil diameter as a fraction of the true diameter. Default is 1.0

  • inner (float, optional) – Diameter of central obstruction as a fraction of the true diameter. Default is 0.303

  • scale (float, optional) – Scale factor for over-sizing spiders and actuator masks. Default is 1.0

  • angle (float, optional) – Pupil rotation angle, in degrees. Default is 0

  • oversample (int, optional) – Oversample factor for supersampling the pupil grid. Default is 8

  • spiders (bool, optional) – Add spiders to pupil. Default is True

  • actuators (bool, optional) – Add bad actuator masks and spider. Default is True

Notes

The smallest element in the SCExAO pupil is the bad actuator spider, which is approximately 89.0 mm wide. This is about 0.7% of the telescope diameter, which means you need to have a miinimum of ~142 pixels across the aperture to sample this element.

vampires_dpp.util.average_angle(angles)#

Return the circular mean of the given angles in degrees.

Parameters:

angles (ArrayLike) – Angles in degrees, between [-180, 180]

Returns:

The average angle in degrees via the circular mean

Return type:

average_angle

vampires_dpp.util.check_version(config, dpp)#

Checks compatibility between versions following semantic versioning.

Parameters:
  • config (str) – Version string for the configuration

  • dpp (str) – Version string for vampires_dpp

Return type:

bool

vampires_dpp.util.delta_angle(alpha, beta)#

Given two angles, determine the total rotation between them

Return type:

float

Parameters:
  • alpha (float)

  • beta (float)

vampires_dpp.util.wrap_angle(angle)#

Wraps an angle into the range [-180, 180]

Parameters:

angle (float) – Input angle, in degrees

Returns:

angle – output angle in degrees

Return type:

float

vampires_dpp.wcs.get_gaia_astrometry(target, catalog='dr3', radius=1)#

Get coordinate from GAIA catalogue with proper motions and parallax

Radius is in arcminute.

Parameters:

target (str)

vampires_dpp.wcs.get_precise_coord(coord, time, scale='utc')#

Use astropy to get proper-motion corrected coordinate

Parameters:
  • coord (SkyCoord)

  • time (str)