opticam.utils.generate

Attributes

FILTERS

N_SOURCES

RMS

FREQ

PHASE_LAGS

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 base image with Poisson noise.

add_noise(image, i)

Add Poisson noise to an image.

create_images(out_dir, variable_source, ...)

Create the ith image for each filter.

apply_flat_field(image)

Apply a circular aperture shadow to an image.

create_flats(out_dir, filters, i, binning_scale, overwrite)

Create the ith flat-field image for each filter.

generate_flats(out_dir[, n_flats, binning_scale, ...])

Create synthetic flat-field images.

setup_obs(out_dir, binning_scale)

Configure the dummy observation parameters.

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

Create synthetic observation data for testing and following the tutorials.

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

Create synthetic observation data for testing and following the tutorials.

Module Contents

opticam.utils.generate.FILTERS = ['g', 'r', 'i']
opticam.utils.generate.N_SOURCES = 6
opticam.utils.generate.RMS = 0.02
opticam.utils.generate.FREQ = 0.135
opticam.utils.generate.PHASE_LAGS
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 base image with Poisson noise.

Parameters

binning_scaleint

The binning scale of the image.

Returns

NDArray

The noisy image.

Parameters:

binning_scale (int)

Return type:

numpy.typing.NDArray

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

Add Poisson noise to an image.

Parameters

imageNDArray

The image to add noise to.

iint

The image index, used to seed the random number generator.

Returns

NDArray

The noisy image.

Parameters:
  • image (numpy.typing.NDArray)

  • i (int)

Return type:

numpy.typing.NDArray

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

Create the ith image for each filter.

Parameters

filtersList[str]

The filters.

N_sourcesint

The number of sources.

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_dir (str)

  • 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_dir, filters, i, binning_scale, overwrite)

Create the ith flat-field image for each filter.

Parameters

out_dirstr

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_dir (str)

  • filters (list)

  • i (int)

  • binning_scale (int)

  • overwrite (bool)

Return type:

None

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

Create synthetic flat-field images.

Parameters

out_dirstr

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_dir (str)

  • n_flats (int)

  • binning_scale (int)

  • overwrite (bool)

Return type:

None

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

Configure the dummy observation parameters.

Parameters

out_dirstr

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_dir (str)

  • binning_scale (int)

Return type:

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

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

Create synthetic observation data for testing and following the tutorials.

Parameters

out_dirstr

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_dir (str)

  • n_images (int)

  • circular_aperture (bool)

  • binning_scale (int)

  • overwrite (bool)

Return type:

None

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

Create synthetic observation data for testing and following the tutorials.

Parameters

out_dirstr

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_dir (str)

  • n_images (int)

  • circular_aperture (bool)

  • binning_scale (int)

  • overwrite (bool)

Return type:

None