sup3r.preprocessing.conditional_moment_batch_handling.ValidationDataMom2
- class ValidationDataMom2(data_handlers, batch_size=8, s_enhance=3, t_enhance=1, temporal_coarsening_method='subsample', temporal_enhancing_method='constant', hr_features_ind=None, smoothing=None, smoothing_ignore=None, model_mom1=None, s_padding=None, t_padding=None, end_t_padding=False)[source]
Bases:
ValidationDataMom1
Iterator for subfilter validation data for second conditional moment
- Parameters:
data_handlers (list[DataHandler]) – List of DataHandler instances
batch_size (int) – Size of validation data batches
s_enhance (int) – Factor by which to coarsen spatial dimensions of the high resolution data
t_enhance (int) – Factor by which to coarsen temporal dimension of the high resolution data
temporal_coarsening_method (str) – [subsample, average, total] Subsample will take every t_enhance-th time step, average will average over t_enhance time steps, total will sum over t_enhance time steps
temporal_enhancing_method (str) – [constant, linear] Method to enhance temporally when constructing subfilter. At every temporal location, a low-res temporal data is substracted from the high-res temporal data predicted. constant will assume that the low-res temporal data is constant between landmarks. linear will linearly interpolate between landmarks to generate the low-res data to remove from the high-res.
hr_features_ind (list | np.ndarray | None) – List/array of feature channel indices that are used for generative output, without any feature indices used only for training.
smoothing (float | None) – Standard deviation to use for gaussian filtering of the coarse data. This can be tuned by matching the kinetic energy of a low resolution simulation with the kinetic energy of a coarsened and smoothed high resolution simulation. If None no smoothing is performed.
smoothing_ignore (list | None) – List of features to ignore for the smoothing filter. None will smooth all features if smoothing kwarg is not None
model_mom1 (Sup3rCondMom | None) – model that predicts the first conditional moments. Useful to prepare data for learning second conditional moment.
s_padding (int | None) – Width of spatial padding to predict only middle part. If None, no padding is used
t_padding (int | None) – Width of temporal padding to predict only middle part. If None, no padding is used
end_t_padding (bool | False) – Zero pad the end of temporal space. Ensures that loss is calculated only if snapshot is surrounded by temporal landmarks. False by default
Methods
any
()Return True if any validation data exists
batch_next
(high_res)Assemble the next batch
Get random handler index based on handler weights
Attributes
Get weights used to sample from different data handlers based on relative sizes
Shape of full validation dataset across all handlers
- any()
Return True if any validation data exists
- batch_next(high_res)
Assemble the next batch
- Parameters:
high_res (np.ndarray) – 4D | 5D array (batch_size, spatial_1, spatial_2, features) (batch_size, spatial_1, spatial_2, temporal, features)
- Returns:
batch (Batch)
- get_handler_index()
Get random handler index based on handler weights
- property handler_weights
Get weights used to sample from different data handlers based on relative sizes
- property shape
Shape of full validation dataset across all handlers
- Returns:
shape (tuple) – (spatial_1, spatial_2, temporal, features) With temporal extent equal to the sum across all data handlers time dimension