Required
name| Type: | str |
| Description: | Name of the model. |
class GenericModel(salvus.opt.models.base_model.BaseModel):
def __init__(self, name: str, data: str | pathlib.Path | npt.NDArray): ...| Type: | str |
| Description: | Name of the model. |
| Type: | str | pathlib.Path | npt.NDArray |
| Description: | Model data. |
npt.NDArray)-The model data as an arbitrary numpy array.npt.NDArray)-The model as its actual representation.str)-Model name.ModelStatus)-Model status to keep track of whether the model has been modified.npt.NDArray)-The model data as a vector.
Returns:
vector: The model data flattened to a 1D array.def from_disk(parent_folder: pathlib.Path, d: dict) -> GenericModel: ...| Type: | pathlib.Path |
| Description: | Path to store the model. |
| Type: | dict |
| Description: | Dictionary containing meta information of the model. |
def from_json(d: dict) -> Self: ...| Type: | dict |
| Description: | Dictionary containing meta information of the model. |
def compute_inf_norm(self) -> float: ...def compute_norm(self) -> float: ...def copy(self, name: str) -> GenericModel: ...| Type: | str |
| Description: | Name of the new (copied) model. |
def dot(self, other: GenericModel) -> float: ...| Type: | GenericModel |
| Description: | The other model. |
def max(self, other: GenericModel) -> GenericModel: ...| Type: | GenericModel |
| Description: | Model to compare with. |
def min(self, other: GenericModel) -> GenericModel: ...| Type: | GenericModel |
| Description: | Model to compare with. |
def to_disk(self, parent_folder: pathlib.Path | str) -> dict: ...| Type: | pathlib.Path | str |
| Description: | Parent folder where the JSON + npy files should be stored. |
def to_json(
self,
external_file_hash: types = None,
timer: types = None,
log_to_logger: bool = False,
comm: types = None,
) -> builtins.dict: ...| Type: | types |
| Default value: | None |
| Description: | Hash of any external files associated with this object. Can be passed here in which case it will be stored in a centralized location in the JSON file. |
| Type: | types |
| Default value: | None |
| Description: | Execution timer. |
| Type: | bool |
| Default value: | False |
| Description: | Log timings to the logger. |
| Type: | types |
| Default value: | None |
| Description: | MPI communicator, if any. |