Required
iteration| Type: | Iteration[ModelType] |
| Description: | The iteration to check. |
def require_gradient(
iteration: Iteration[ModelType],
) -> HasGradient[ModelType]: ...| Type: | Iteration[ModelType] |
| Description: | The iteration to check. |
def require_parent_id(it: Iteration[ModelType]) -> HasParentID: ...| Type: | Iteration[ModelType] |
| Description: | The iteration to check. |
class Proto(Protocol): def meth(self) -> int: ...
class C: def meth(self) -> int: return 0 def func(x: Proto) -> int: return x.meth() func(C()) # Passes static type check
class GenProto(Protocol[T]): def meth(self) -> T: ...
class HasGradient(typing.Protocol):
def __init__(self):
...class Proto(Protocol): def meth(self) -> int: ...
class C: def meth(self) -> int: return 0 def func(x: Proto) -> int: return x.meth() func(C()) # Passes static type check
class GenProto(Protocol[T]): def meth(self) -> T: ...
class HasParentID(typing.Protocol):
def __init__(self):
...class Iteration(
salvus.flow.utils.serialization_helpers.SerializationMixin, typing.Generic
):
def __init__(
self,
id: int,
model: ModelType,
events: list[str],
misfit_configuration: str,
parent_id: int | None = None,
control_group_events: list[str] | None = None,
): ...| Type: | int |
| Description: | Unique identifier of the iteration. |
| Type: | ModelType |
| Description: | Model of the iteration., |
| Type: | list[str] |
| Description: | Batch of events for this iteration. |
| Type: | str |
| Description: | Misfit configuration. |
| Type: | int | None |
| Default value: | None |
| Description: | ID of the parent iteration that this iteration is derived from. |
| Type: | list[str] | None |
| Default value: | None |
| Description: | Optional subset of events to be used for checking the trial model. Must be a subset of the events of the iteration. If not given, all events will be used. |
float)-Obtain the objective value of this iteration, i.e., the sum of misfit
and regularization term.
Returns:
The aggregated objective value.def from_disk(d: dict, path: pathlib.Path) -> Iteration[ModelType]: ...| Type: | dict |
| Description: | JSON dictionary of the iteration. |
| Type: | pathlib.Path |
| Description: | Path to the folder containing auxiliary files. |
def from_json(d: dict) -> Iteration[ModelType]: ...| Type: | dict |
| Description: | JSON dictionary of the iteration. |
events and/or misfit_configuration are not specified, they will
be inherited from the parent iteration.def from_parent(
id: int,
parent: Iteration[ModelType],
events: list[str] | None = None,
control_group_events: list[str] | None = None,
misfit_configuration: str | None = None,
) -> Iteration[ModelType]: ...| Type: | int |
| Description: | Unique identifier of the new iteration. |
| Type: | Iteration[ModelType] |
| Description: | Parent iteration to inherit from. |
| Type: | list[str] | None |
| Default value: | None |
| Description: | List of iteration-specific events. |
| Type: | list[str] | None |
| Default value: | None |
| Description: | Iteration-specific control group. |
| Type: | str | None |
| Default value: | None |
| Description: | Iteration-specfic misfit configuration. |
def add_trial_model(
self,
model: ModelType,
d: dict | None = None,
status: ModelStatus = "unknown",
) -> None: ...| Type: | ModelType |
| Description: | Trial model to be stored. |
| Type: | dict | None |
| Default value: | None |
| Description: | Auxiliary information for the trial model. |
| Type: | ModelStatus |
| Default value: | 'unknown' |
| Description: | Status of the model. |
def get_final_model(self) -> str: ...def get_gradient(self, event: str, name: str | None = None) -> ModelType: ...| Type: | str |
| Description: | Event name. |
| Type: | str | None |
| Default value: | None |
| Description: | Optional name of the returned gradient. |
def get_model_directory(self) -> pathlib.Path: ...def get_new_trial_model_id(self) -> int: ...def get_trial_models(self, status: str = "all") -> list[TrialModelEntry]: ...| Type: | str |
| Default value: | 'all' |
| Description: | Return only models with a specific status, or all models if status="all". |
def issue_task(self, tasks: Task | typing.Sequence[Task]) -> None: ...def process_current_tasks(self) -> None: ...def set_entry_point(self, next_task: str) -> None: ...| Type: | str |
| Description: | Identifier of the next task. |
def set_model_directory(self, path: pathlib.Path) -> None: ...| Type: | pathlib.Path |
| Description: | Path to model inventory. |
def to_disk(
self, path: pathlib.Path, external_file_hash: str | None = None
) -> dict: ...| Type: | pathlib.Path |
| Description: | Path to store auxiliary files. |
| Type: | str | None |
| 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. |
def to_json(
self,
external_file_hash: str | None = None,
timer: Timer | None = None,
log_to_logger: bool = False,
comm: int | None = None,
) -> dict: ...| Type: | str | None |
| 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: | Timer | None |
| Default value: | None |
| Description: | Execution timer. |
| Type: | bool |
| Default value: | False |
| Description: | Log timings to the logger. |
| Type: | int | None |
| Default value: | None |
| Description: | MPI communicator, if any. |
class TrialModelEntry(typing.Generic, builtins.dict):
def __init__(self): ...