opticam.utils.generate

Attributes

FILTERS

N_SOURCES

RMS

FREQ

PHASE_LAGS

MEDIAN_BKG

MEDIAN_BKG_RMS

MEDIAN_FLAT_FLUX

MEDIAN_FLAT_FLUX_RMS

Functions

two_dimensional_gaussian(image, x_centroid, ...)

Add a source to an image.

variable_function(i, fltr)

Variable flux to be added to a source.

create_image(binning_scale)

Create a blank base image.

poisson_noise(image, i)

Create a Poisson noise image.

noisy_background(image, i, median, rms)

Create a noisy background image.

create_images(out_directory, variable_source, ...)

Create the ith image for each filter.

apply_flat_field(image)

Apply a circular aperture shadow to an image.

create_flats(out_directory, filters, i, binning_scale, ...)

Create the ith flat-field image for each filter.

generate_flats(out_directory[, n_flats, ...])

Create synthetic flat-field images.

setup_obs(out_directory, binning_scale)

Configure the dummy observation parameters.

generate_observations(out_directory[, n_images, ...])

Create synthetic observation data for testing and following the tutorials.

generate_gappy_observations(out_directory[, n_images, ...])

Create synthetic observation data for testing and following the tutorials.

Module Contents

opticam.utils.generate.FILTERS: List[str] = ['g', 'r', 'i']
opticam.utils.generate.N_SOURCES: int = 6
opticam.utils.generate.RMS: float = 0.02
opticam.utils.generate.FREQ: float = 0.135
opticam.utils.generate.PHASE_LAGS: Dict[str, float]
opticam.utils.generate.MEDIAN_BKG: float = 100.0
opticam.utils.generate.MEDIAN_BKG_RMS: float
opticam.utils.generate.MEDIAN_FLAT_FLUX: float = 10000.0
opticam.utils.generate.MEDIAN_FLAT_FLUX_RMS: float
opticam.utils.generate.two_dimensional_gaussian(image, x_centroid, y_centroid, flux, a, b, theta)

Add a source to an image.

Parameters

imageNDArray

The image.

x_centroidfloat

The x-coordinate of the source.

y_centroidfloat

The y-coordinate of the source.

fluxfloat

The total flux of the source.

afloat

The semi-major standard deviation.

bfloat

The semi-minor standard deviation.

thetafloat

The rotation angle of the source.

Returns

NDArray

The image with the source added.

Parameters:
  • image (numpy.typing.NDArray)

  • x_centroid (float)

  • y_centroid (float)

  • flux (float)

  • a (float)

  • b (float)

  • theta (float)

Return type:

numpy.typing.NDArray

opticam.utils.generate.variable_function(i, fltr)

Variable flux to be added to a source.

Parameters

ifloat

The image index (equivalent to time).

fltrstr

The filter of the image, used to introduce a lag between filters.

Returns

float

The flux.

Parameters:
  • i (float)

  • fltr (str)

Return type:

float

opticam.utils.generate.create_image(binning_scale)

Create a blank base image.

Parameters

binning_scaleint

The binning scale of the image.

Returns

NDArray

The blank image.

Parameters:

binning_scale (int)

Return type:

numpy.typing.NDArray

opticam.utils.generate.poisson_noise(image, i)

Create a Poisson noise image.

Parameters

imageNDArray

The science image.

iint

The RNG seed.

Returns

NDArray

The noisy image.

Parameters:
  • image (numpy.typing.NDArray)

  • i (int)

Return type:

numpy.typing.NDArray

opticam.utils.generate.noisy_background(image, i, median, rms)

Create a noisy background image.

Parameters

imageNDArray

The science image. Used to determine the output image’s shape.

iint

The RNG seed.

medianfloat | NDArray

The median background.

rmsfloat | NDArray

The background RMS.

Returns

NDArray

The noisy background image.

Parameters:
  • image (numpy.typing.NDArray)

  • i (int)

  • median (float | numpy.typing.NDArray)

  • rms (float | numpy.typing.NDArray)

Return type:

numpy.typing.NDArray

opticam.utils.generate.create_images(out_directory, variable_source, source_positions, fluxes, i, binning_scale, circular_aperture, overwrite)

Create the ith image for each filter.

Parameters

out_directoryPath

The directory path to the output.

variable_sourceint

The index of the variable source.

source_positionsNDArray

The positions of the sources.

fluxesNDArray

The fluxes of the sources.

iint

The image index (equivalent to time).

binning_scaleint

The binning scale of the image.

circular_aperturebool

Whether to apply a circular aperture shadow to the image.

overwritebool

Whether to overwrite the image if it already exists.

Parameters:
  • out_directory (pathlib.Path)

  • variable_source (int)

  • source_positions (numpy.typing.NDArray)

  • fluxes (numpy.typing.NDArray)

  • i (int)

  • binning_scale (int)

  • circular_aperture (bool)

  • overwrite (bool)

Return type:

None

opticam.utils.generate.apply_flat_field(image)

Apply a circular aperture shadow to an image.

Parameters

imageNDArray

The image.

Returns

NDArray

The image with a circular aperture shadow.

Parameters:

image (numpy.typing.NDArray)

Return type:

numpy.typing.NDArray

opticam.utils.generate.create_flats(out_directory, filters, i, binning_scale, overwrite)

Create the ith flat-field image for each filter.

Parameters

out_directoryPath

The directory to save the flat-field images.

filterslist

The filters to create flat-field images for.

iint

The index of the flat-field image (equivalent to time).

binning_scaleint

The binning scale of the flat-field image.

overwritebool

Whether to overwrite the flat-field image if it already exists.

Parameters:
  • out_directory (pathlib.Path)

  • filters (list)

  • i (int)

  • binning_scale (int)

  • overwrite (bool)

Return type:

None

opticam.utils.generate.generate_flats(out_directory, n_flats=5, binning_scale=4, overwrite=False)

Create synthetic flat-field images.

Parameters

out_directoryPath | str

The directory to save the data.

n_flatsint, optional

The number of flats per camera, by default 5.

binning_scaleint, optional

The binning scale of the flat-field images, by default 4 (512x512).

overwritebool, optional

Whether to overwrite data if they currently exist, by default False.

Parameters:
  • out_directory (pathlib.Path | str)

  • n_flats (int)

  • binning_scale (int)

  • overwrite (bool)

Return type:

None

opticam.utils.generate.setup_obs(out_directory, binning_scale)

Configure the dummy observation parameters.

Parameters

out_directoryPath

The output directory.

binning_scaleint

The image binning scale.

Returns

Tuple[List[str], int, int, NDArray, NDArray]

The variable source index, source positions, and peak fluxes.

Parameters:
  • out_directory (pathlib.Path)

  • binning_scale (int)

Return type:

Tuple[int, numpy.typing.NDArray, numpy.typing.NDArray]

opticam.utils.generate.generate_observations(out_directory, n_images=100, circular_aperture=True, binning_scale=4, overwrite=False)

Create synthetic observation data for testing and following the tutorials.

Parameters

out_directoryPath | str

The directory to save the data.

n_imagesint, optional

The number of images to create, by default 100.

circular_aperturebool, optional

Whether to apply a circular aperture shadow to the images, by default True.

binning_scaleint, optional

The binning scale of the images, by default 4 (512x512).

overwritebool, optional

Whether to overwrite data if they currently exist, by default False.

Parameters:
  • out_directory (pathlib.Path | str)

  • n_images (int)

  • circular_aperture (bool)

  • binning_scale (int)

  • overwrite (bool)

Return type:

None

opticam.utils.generate.generate_gappy_observations(out_directory, n_images=1000, circular_aperture=True, binning_scale=4, overwrite=False)

Create synthetic observation data for testing and following the tutorials.

Parameters

out_directoryPath | str

The directory to save the data.

n_imagesint, optional

The number of images to create, by default 100.

circular_aperturebool, optional

Whether to apply a circular aperture shadow to the images, by default True.

binning_scaleint, optional

The binning scale of the images, by default 4 (512x512).

overwritebool, optional

Whether to overwrite data if they currently exist, by default False.

Parameters:
  • out_directory (pathlib.Path | str)

  • n_images (int)

  • circular_aperture (bool)

  • binning_scale (int)

  • overwrite (bool)

Return type:

None