Packaged datasets
The nif.demo classes load datasets bundled with NIF and inherit the
point-wise data interface. data_raw contains the source values; data
contains the normalized feature and target columns. mean and std store
the normalization offset and scale used by each loader.
data_raw: the source parameter, coordinate, target and optional weight columns in physical units.data: the normalized parameter, coordinate and target columns.meanandstd: per-column offset and scale for the transformnormalized = (raw - mean) / std. They are derived from the raw data, not statistics recomputed from the normalized array.parameter,xandu: views into the corresponding normalized column groups.n_p,n_xandn_ogive their feature counts.sample_weight: the separated normalized weights forCylinderFlow;Nonefor the two traveling-wave loaders.
from nif.demo import TravelingWave
wave = TravelingWave()
features = wave.data[:, :2] # [time, spatial coordinate]
targets = wave.data[:, 2:3]
physical_targets = targets * wave.std[2:3] + wave.mean[2:3]
Traveling wave
- class nif.demo.TravelingWave
Loads the traveling wave dataset and initializes the object.
The dataset is loaded from the file ‘traveling_wave.npz’ located in the ‘dataset’ directory relative to the current file’s directory. The data is then processed by normalizing it using the standard_normalize function from the base class, PointWiseData. The normalized data is stored in the data attribute, while the mean and standard deviation values are stored in the mean and std attributes, respectively.
This loader uses standard normalization and has one parameter, one coordinate and one field component.
High-frequency traveling wave
- class nif.demo.TravelingWaveHighFreq
A class for loading and normalizing the traveling wave high frequency dataset.
- Variables:
n_p (int) – The number of parameters.
n_x (int) – The number of input features.
n_o (int) – The number of output targets.
- __init__()
Initializes the class and loads the dataset.
- standard_normalize(raw_data, area_weighted=False)
Normalizes the given data using standard normalization.
- minmax_normalize(raw_data, n_para, n_x, n_target, area_weighted=False)
Normalizes the given data using min-max normalization.
This loader uses PointWiseData.minmax_normalize and has one parameter,
one coordinate and one field component.
Cylinder flow
- class nif.demo.CylinderFlow
Load bundled cylinder-flow data: time, two coordinates, two velocity components and sample weights. Offset and scale follow
PointWiseData.minmax_normalize; normalized weights are stored separately insample_weight.
The column groups are time, two spatial coordinates, two velocity components
and sample weight. The loader separates normalized weights into
sample_weight and uses min-max normalization for the field data.