SimulateDataSet#

class pyvisgen.simulation.data_set.SimulateDataSet[source]#

Bases: object

Methods Summary

calc_time_steps(i)

Calculates time steps for given sampling parameter set.

create_observation(i)

Creates Observation dataclass object for image i.

create_sampling_rc(size)

Creates sampling runtime configuration containing all relevant parameters for the simulation.

draw_sampling_opts(size)

Draws randomized sampling parameters for the simulation.

from_config(config, /[, image_key, grid, ...])

Simulates data from parameters in a config file.

get_images(i)

Opens bundle with index i and returns tensor() of images.

test_rand_opts(i)

Tests randomized sampling parameters by checking if the source is visible for 50% of the telescopes in the array for 50% of the observation time.

Methods Documentation

calc_time_steps(i: int) Time[source]#

Calculates time steps for given sampling parameter set. Used in testing.

Parameters:
iint

Index of the current set of sampling parameters.

Returns:
time_stepsTime

Observation time steps.

See also

pyvisgen.simulation.data_set.SimulateDataSet.test_rand_opts

Tests randomized sampling parameters.

create_observation(i: int) Observation[source]#

Creates Observation dataclass object for image i.

Parameters:
iint

Index of image for which the observation is created.

Returns:
obsObservation

Observation dataclass object for image i.

create_sampling_rc(size: int) None[source]#

Creates sampling runtime configuration containing all relevant parameters for the simulation.

Parameters:
sizeint

Number of parameters to draw, equal to number of images.

draw_sampling_opts(size: int) dict[source]#

Draws randomized sampling parameters for the simulation.

Parameters:
sizeint

Number of parameters to draw, equal to number of images.

Returns:
samp_optsdict

Sampling options/parameters stored inside a dictionary.

classmethod from_config(config: str | Path | dict, /, image_key: str = 'y', *, grid: bool = True, slurm: bool = False, slurm_job_id: int | None = None, slurm_n: int | None = None, date_fmt: str = '%d-%m-%Y %H:%M:%S', num_images: int | None = None, multiprocess: int | str = 1, stokes: str = 'I')[source]#

Simulates data from parameters in a config file.

Parameters:
configstr or Path or dict

Path to the config file or dict containing the configuration parameters.

image_keystr, optional

Key under which the true sky distributions are saved in the HDF5 file. Default: 'y'

gridbool, optional

If True, apply gridding to visibility data and save to HDF5 files. Default: True

slurmbool, optional

True, if slurm is used, Default: False

slurm_job_idint or None, optional

job_id given by slurm. Default: None

slurm_nint or None, optional

Running index. Default: None

date_fmtstr, optional

Format string for datetime objects. Default: '%d-%m-%Y %H:%M:%S'

num_imagesint or None, optional

Number of combined total images in the bundles. If not None, will skip counting the images before drawing the random parameters. Default: None

multiprocessint or str, optional

Number of jobs to use in multiprocessing during the sampling and testing phase. If -1 or 'all', use all available cores. Default: 1

get_images(i: int) tensor[source]#

Opens bundle with index i and returns tensor() of images.

Parameters:
iint

Bundle index.

Returns:
SIstensor()

tensor() of images from bundle i.

test_rand_opts(i: int) None[source]#

Tests randomized sampling parameters by checking if the source is visible for 50% of the telescopes in the array for 50% of the observation time. If that condition is not fullfilled, the parameters are redrawn and tested again.

Parameters:
iint

Index of the current set of sampling parameters.