mirage.sim package#
Submodules#
mirage.sim.interp module#
- class mirage.sim.interp.MLPBrightnessModel(obj: SpaceObject | None = None, brdf: Brdf | None = None, path: str | None = None, use_engine: bool = True, layers: tuple[int] = (150, 50, 150), **engine_kwargs)#
Bases:
object
Predicts brightness by evaluating full non-convex rendered brightness over a 6D cloud of lighting and illumination unit vectors, used to train a Multi-Layer Perceptron (MLP)
- brightness(svb: ndarray, ovb: ndarray, output_as: str | None = None) ndarray #
True brightness function, evaluates using the
LightCurveEngine
renderer or a convex BRDF method- Parameters:
svb (np.ndarray [n,3]) – Sun unit vector in the body frame
ovb (np.ndarray [n,3]) – Observer unit vectors in the body frame
output_as (str) – Values to return, ‘irradiance’ or ‘magnitude’, defaults to None (uses
self.train
)
- Returns:
Unit distance irradiance in given observation geometry [W/m^2]
- Return type:
np.ndarray
- eval(svb: ndarray, ovb: ndarray, eval_mode_pref: str = 'sklearn') ndarray #
Evaluates the brightness model with the given observer and sun unit vectors in the body frame
- Parameters:
svb (np.ndarray [n,3]) – Sun vector in body frame, length irrelevant
ovb (np.ndarray [n,3]) – Observer vector in body frame, length irrelevant
eval_mode_pref (str) – Evaluation mode preference, defaults to ‘sklearn’
- Raises:
AttributeError – If the model has not been built yet
- Returns:
Predicted normalized irradiances [W/m^2]
- Return type:
np.ndarray [n,]
- gen_train_dataset(num: int) Tuple[ndarray, ndarray, ndarray, ndarray] #
- load_from_file(path: str) None #
Loads the model from a saved pickle file
- Parameters:
path (str) – Path to the pickle file containing the saved model
- save_to_file(directory: str = '', save_as_format: str = 'onnx') None #
Saves the model to the directory provided
- Parameters:
directory (str, optional) – Directory to save model in, defaults to “”
save_as_format (str) – Format to save the file to, either ‘onnx’ or ‘sklearn’, defaults to ‘onnx’
- train(num_train: int) None #
Builds the MLP model, enables
self.eval(points)
after completion- Parameters:
num_train (int, optional) – Number of data points to train on