quasarnp.model¶
A module defining the QuasarNP model object.
QuasarNP is a pure numpy implementation of the original TensorFlow QuasarNet. This module only defines the QuasarNP model object and provides no other functionality on its own.
- class quasarnp.model.QuasarNP(weights, nlines=7, rescale=False, nlayers=4, config_dict=None)[source]¶
Bases:
objectA QuasarNP model object. The model holds all of the relevant layer information, including layer names, weights and definitions.
- Parameters:
- predict(x_input)[source]¶
Run a set of spectra and generate predictions.
- Parameters:
x_input (numpy.ndarray) – Input array of spectra, with shape (nspectra, nbins, 1)
- Returns:
Moodel predicted values per trained line, with length nlines.
- Return type:
Notes
In order to mimic QuasarNet behaviour in QuasarNP, predict does not directly take as input the output of load_desi_exposure or load_desi_daily. You must first expand the dimensions of the loaded data before loading. For example:
>>> data, w = load_desi_daily("20210107", "00071246", 1) >>> data = data[:, :, None] >>> model.predict(data)