opticam.utils.generate ====================== .. py:module:: opticam.utils.generate Attributes ---------- .. autoapisummary:: opticam.utils.generate.FILTERS opticam.utils.generate.N_SOURCES opticam.utils.generate.FREQ opticam.utils.generate.PHASE_LAGS Functions --------- .. autoapisummary:: opticam.utils.generate._add_two_dimensional_gaussian_to_image opticam.utils.generate._variable_function opticam.utils.generate._create_image opticam.utils.generate._add_noise opticam.utils.generate._create_images opticam.utils.generate._apply_flat_field opticam.utils.generate._create_flats opticam.utils.generate.generate_flats opticam.utils.generate.setup_obs opticam.utils.generate.generate_observations opticam.utils.generate.generate_gappy_observations Module Contents --------------- .. py:data:: FILTERS :value: ['g', 'r', 'i'] .. py:data:: N_SOURCES :value: 6 .. py:data:: FREQ :value: 0.135 .. py:data:: PHASE_LAGS .. py:function:: _add_two_dimensional_gaussian_to_image(image, x_centroid, y_centroid, peak_flux, sigma_x, sigma_y, theta) Add a source to an image. Parameters ---------- image : NDArray The image. x_centroid : float The x-coordinate of the source. y_centroid : float The y-coordinate of the source. peak_flux : float The peak flux of the source. sigma_x : float The standard deviation of the source in the x-direction. sigma_y : float The standard deviation of the source in the y-direction. theta : float The rotation angle of the source. Returns ------- NDArray The image with the source added. .. py:function:: _variable_function(i, fltr) Variable flux to be added to a source. Parameters ---------- i : float The image index (equivalent to time). fltr : str The filter of the image, used to introduce a lag between filters. Returns ------- float The flux. .. py:function:: _create_image(binning_scale) Create a base image with Poisson noise. Parameters ---------- binning_scale : int The binning scale of the image. Returns ------- NDArray The noisy image. .. py:function:: _add_noise(image, i) Add Poisson noise to an image. Parameters ---------- image : NDArray The image to add noise to. i : int The image index, used to seed the random number generator. Returns ------- NDArray The noisy image. .. py:function:: _create_images(out_dir, variable_source, source_positions, peak_fluxes, i, binning_scale, circular_aperture, overwrite) Create the ith image for each filter. Parameters ---------- filters : List[str] The filters. N_sources : int The number of sources. variable_source : int The index of the variable source. source_positions : NDArray The positions of the sources. peak_fluxes : NDArray The peak fluxes of the sources. i : int The image index (equivalent to time). binning_scale : int The binning scale of the image. circular_aperture : bool Whether to apply a circular aperture shadow to the image. overwrite : bool Whether to overwrite the image if it already exists. .. py:function:: _apply_flat_field(image) Apply a circular aperture shadow to an image. Parameters ---------- image : NDArray The image. Returns ------- NDArray The image with a circular aperture shadow. .. py:function:: _create_flats(out_dir, filters, i, binning_scale, overwrite) Create the ith flat-field image for each filter. Parameters ---------- out_dir : str The directory to save the flat-field images. filters : list The filters to create flat-field images for. i : int The index of the flat-field image (equivalent to time). binning_scale : int The binning scale of the flat-field image. overwrite : bool Whether to overwrite the flat-field image if it already exists. .. py:function:: generate_flats(out_dir, n_flats = 5, binning_scale = 4, overwrite = False) Create synthetic flat-field images. Parameters ---------- out_dir : str The directory to save the data. n_flats : int, optional The number of flats per camera, by default 5. binning_scale : int, optional The binning scale of the flat-field images, by default 4 (512x512). overwrite : bool, optional Whether to overwrite data if they currently exist, by default False. .. py:function:: setup_obs(out_dir, binning_scale) Configure the dummy observation parameters. Parameters ---------- out_dir : str The output directory. binning_scale : int The image binning scale. Returns ------- Tuple[List[str], int, int, NDArray, NDArray] The variable source index, source positions, and peak fluxes. .. py:function:: 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_dir : str The directory to save the data. n_images : int, optional The number of images to create, by default 100. circular_aperture : bool, optional Whether to apply a circular aperture shadow to the images, by default True. binning_scale : int, optional The binning scale of the images, by default 4 (512x512). overwrite : bool, optional Whether to overwrite data if they currently exist, by default False. .. py:function:: 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_dir : str The directory to save the data. n_images : int, optional The number of images to create, by default 100. circular_aperture : bool, optional Whether to apply a circular aperture shadow to the images, by default True. binning_scale : int, optional The binning scale of the images, by default 4 (512x512). overwrite : bool, optional Whether to overwrite data if they currently exist, by default False.