Package documentation¶
Generator class¶
- class Generator.Generator¶
Bases:
objectTransient noise artifacts generator from ‘“Generating transient noise artefacts in gravitational-wave detector data with generative adversarial networks by Powell et. al. “ <https://arxiv.org/abs/2207.00207>’
- clear_queue()¶
Clears the current queue of artifacts.
- generate(glitch, n_images_to_generate)¶
Generates images for the given glitch in the form of numpy arrays, and adds it to the ‘queue’.
- Parameters:
glitch (String) – Name of the glitch to be generated.
n_images_to_generate – Number of images to be generated.
- Returns:
a (n_images_to_generate x 140 x 170) numpy array of the images generated and a (n_images_to_generate) list of corresponding glitch labels.
- Return type:
Returns a tuple
- generate_all(n_images_to_generate)¶
Generates images for all the glitches, in the form of numpy arrays.
- Parameters:
n_images_to_generate – Number of images to be generated, for each glitch
- Returns:
a ((n_images_to_generate * num_of_glitches) x 140 x 170) numpy array of the images generated and a (n_images_to_generate * num_of_glitches) list of corresponding glitch labels.
The array can be accessed through ‘generator.curr_array’ and the glitch labels through ‘generator.curr_glitch’
- Return type:
Returns a tuple
- save_as_hdf5(path, name='timeseries', clear_queue=False)¶
Saves the queue of artifacts in a h5 file. The snippets are 2 seconds long.
- Parameters:
path – Folder where the h5 file should be created.
name (String) – Name for the h5 file (Default: “timeseries”)
clear_queue – Boolean value for if the queue will be cleared after the images are saved. (Default: False)
- save_as_png(path, clear_queue=False)¶
Saves the queue of artifacts, which are in the form of a spectrogram, as png files.
- Parameters:
path – Folder where the images will be saved.
clear_queue – Boolean value for if the queue will be cleared after the images are saved. (Default: False)