SimulateDataSet#
- class pyvisgen.dataset.SimulateDataSet[source]#
Bases:
objectMethods Summary
Calculates time steps for given sampling parameter set.
Creates
Observationdataclass object for imagei.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.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_steps
Time Observation time steps.
- time_steps
See also
pyvisgen.dataset.SimulateDataSet.test_rand_optsTests randomized sampling parameters.
- create_observation(i: int) Observation[source]#
Creates
Observationdataclass object for imagei.- Parameters:
- iint
Index of image for which the observation is created.
- Returns:
- obsObservation
Observationdataclass object for imagei.
- 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', output_format: str = 'wds')[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_idgiven 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
- 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.