opticam.utils.generate ====================== .. py:module:: opticam.utils.generate Attributes ---------- .. autoapisummary:: opticam.utils.generate.FILTERS opticam.utils.generate.N_SOURCES opticam.utils.generate.RMS opticam.utils.generate.FREQ opticam.utils.generate.PHASE_LAGS opticam.utils.generate.MEDIAN_BKG opticam.utils.generate.MEDIAN_BKG_RMS opticam.utils.generate.MEDIAN_FLAT_FLUX opticam.utils.generate.MEDIAN_FLAT_FLUX_RMS Functions --------- .. autoapisummary:: opticam.utils.generate.two_dimensional_gaussian opticam.utils.generate.variable_function opticam.utils.generate.create_image opticam.utils.generate.poisson_noise opticam.utils.generate.noisy_background 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 :type: List[str] :value: ['g', 'r', 'i'] .. py:data:: N_SOURCES :type: int :value: 6 .. py:data:: RMS :type: float :value: 0.02 .. py:data:: FREQ :type: float :value: 0.135 .. py:data:: PHASE_LAGS :type: Dict[str, float] .. py:data:: MEDIAN_BKG :type: float :value: 100.0 .. py:data:: MEDIAN_BKG_RMS :type: float .. py:data:: MEDIAN_FLAT_FLUX :type: float :value: 10000.0 .. py:data:: MEDIAN_FLAT_FLUX_RMS :type: float .. py:function:: two_dimensional_gaussian(image, x_centroid, y_centroid, flux, a, b, 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. flux : float The total flux of the source. a : float The semi-major standard deviation. b : float The semi-minor standard deviation. 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 blank base image. Parameters ---------- binning_scale : int The binning scale of the image. Returns ------- NDArray The blank image. .. py:function:: poisson_noise(image, i) Create a Poisson noise image. Parameters ---------- image : NDArray The science image. i : int The RNG seed. Returns ------- NDArray The noisy image. .. py:function:: noisy_background(image, i, median, rms) Create a noisy background image. Parameters ---------- image : NDArray The science image. Used to determine the output image's shape. i : int The RNG seed. median : float | NDArray The median background. rms : float | NDArray The background RMS. Returns ------- NDArray The noisy background image. .. py:function:: create_images(out_directory, variable_source, source_positions, fluxes, i, binning_scale, circular_aperture, overwrite) Create the ith image for each filter. Parameters ---------- out_directory : Path The directory path to the output. variable_source : int The index of the variable source. source_positions : NDArray The positions of the sources. fluxes : NDArray The 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_directory, filters, i, binning_scale, overwrite) Create the ith flat-field image for each filter. Parameters ---------- out_directory : Path 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_directory, n_flats = 5, binning_scale = 4, overwrite = False) Create synthetic flat-field images. Parameters ---------- out_directory : Path | 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_directory, binning_scale) Configure the dummy observation parameters. Parameters ---------- out_directory : Path 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_directory, n_images = 100, circular_aperture = True, binning_scale = 4, overwrite = False) Create synthetic observation data for testing and following the tutorials. Parameters ---------- out_directory : Path | 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_directory, n_images = 1000, circular_aperture = True, binning_scale = 4, overwrite = False) Create synthetic observation data for testing and following the tutorials. Parameters ---------- out_directory : Path | 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.