aimbat.core
Core logic for AIMBAT.
All functions take a SQLModel Session and work with the models in
aimbat.models. The main areas covered are:
- Default event — get and set the default event (
get_default_event,set_default_event). - Data — add data to the project, linking each source to its station,
event, and seismogram records (
add_data_to_project). - Events, seismograms, stations — query, update, and delete records; read and write parameters.
- ICCS / MCCC — run the Iterative Cross-Correlation and Stack (
run_iccs) and Multi-Channel Cross-Correlation (run_mccc) algorithms; update picks, time windows, and correlation thresholds. - Snapshots — save, restore, and delete parameter snapshots
(
create_snapshot,rollback_to_snapshot). - Project — create and delete the project database (
create_project,delete_project).
Classes:
| Name | Description |
|---|---|
BoundICCS |
An ICCS instance explicitly bound to a specific event. |
Functions:
| Name | Description |
|---|---|
add_data_to_project |
Add data sources to the AIMBAT database. |
build_iccs_from_snapshot |
Build a read-only BoundICCS from a snapshot's parameters and live waveform data. |
clear_iccs_cache |
Clear the process-level ICCS cache. |
create_iccs_instance |
Return a BoundICCS instance for the given event. |
create_project |
Initializes a new AIMBAT project database schema and triggers. |
create_snapshot |
Create a snapshot of the AIMBAT processing parameters. |
delete_event |
Delete an AimbatEvent from the database. |
delete_event_by_id |
Delete an AimbatEvent from the database by ID. |
delete_project |
Delete the AIMBAT project. |
delete_seismogram |
Delete an AimbatSeismogram from the database. |
delete_seismogram_by_id |
Delete an AimbatSeismogram from the database by ID. |
delete_snapshot |
Delete an AIMBAT parameter snapshot. |
delete_snapshot_by_id |
Delete an AIMBAT parameter snapshot. |
delete_station |
Delete an AimbatStation from the database. |
delete_station_by_id |
Delete an AimbatStation from the database by ID. |
dump_data_table_to_json |
Dump the table data to json. |
dump_event_parameter_table_to_json |
Dump the event parameter table data to json. |
dump_event_table_to_json |
Dump the table data to json. |
dump_seismogram_parameter_table_to_json |
Dump the seismogram parameter table data to json. |
dump_seismogram_table_to_json |
Create a JSON string from the AimbatSeismogram table data. |
dump_snapshot_tables_to_json |
Dump snapshot data as a dict of lists of dicts. |
dump_station_table_to_json |
Create a JSON string from the AimbatStation table data. |
dump_station_table_with_counts |
Dump station table with associated seismogram and event counts to a list of dicts. |
get_completed_events |
Get the events marked as completed. |
get_data_for_event |
Returns the data sources belonging to the given event. |
get_default_event |
Return the currently default event, or None if no event is set as default. |
get_event_parameter |
Get event parameter value for the given event. |
get_events_using_station |
Get all events that use a particular station. |
get_seismogram_parameter |
Get parameter value from an AimbatSeismogram instance. |
get_seismogram_parameter_by_id |
Get parameter value from an AimbatSeismogram by ID. |
get_selected_seismograms |
Get the selected seismograms for the given event. |
get_snapshots |
Get the snapshots for an event. |
get_stations_in_event |
Get the stations for a particular event. |
get_stations_with_event_and_seismogram_count |
Get stations along with the count of seismograms and events they are associated with. |
reset_seismogram_parameters |
Reset an AimbatSeismogram's parameters to their default values. |
reset_seismogram_parameters_by_id |
Reset an AimbatSeismogram's parameters to their default values by ID. |
resolve_event |
Resolve an event from either an explicit ID or the default event. |
rollback_to_snapshot |
Rollback to an AIMBAT parameters snapshot. |
rollback_to_snapshot_by_id |
Rollback to an AIMBAT parameters snapshot. |
run_iccs |
Run the Iterative Cross-Correlation and Stack (ICCS) algorithm. |
run_mccc |
Run the Multi-Channel Cross-Correlation (MCCC) algorithm. |
set_default_event |
Set the default event (i.e. the one being processed). |
set_default_event_by_id |
Set the currently selected event (i.e. the one being processed) by its ID. |
set_event_parameter |
Set event parameter value for the given event. |
set_seismogram_parameter |
Set parameter value for an AimbatSeismogram instance. |
set_seismogram_parameter_by_id |
Set parameter value for an AimbatSeismogram by ID. |
sync_iccs_parameters |
Sync an existing ICCS instance's parameters from the database. |
validate_iccs_construction |
Try to construct an ICCS instance for the event without caching the result. |
BoundICCS
dataclass
An ICCS instance explicitly bound to a specific event.
Use is_stale to detect whether the event's parameters have been modified
(e.g. by a CLI command) since this instance was created.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
iccs
|
ICCS
|
|
required |
event_id
|
UUID
|
|
required |
created_at
|
Timestamp
|
|
required |
Methods:
| Name | Description |
|---|---|
is_stale |
Return True if the event has been modified since this ICCS was created. |
Source code in src/aimbat/core/_iccs.py
is_stale
is_stale(event: AimbatEvent) -> bool
Return True if the event has been modified since this ICCS was created.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
event
|
AimbatEvent
|
The event to check against. |
required |
Source code in src/aimbat/core/_iccs.py
add_data_to_project
add_data_to_project(
session: Session,
data_sources: Sequence[str | PathLike],
data_type: DataType,
station_id: UUID | None = None,
event_id: UUID | None = None,
dry_run: bool = False,
disable_progress_bar: bool = True,
) -> None
Add data sources to the AIMBAT database.
What gets created depends on which capabilities data_type supports:
- Station + event + seismogram: all three records are created and linked,
and an
AimbatDataSourceentry is stored. - Station or event only (e.g.
JSON_STATION,JSON_EVENT): only the relevant metadata records are created; no seismogram or data source entry is stored.
Use station_id or event_id to skip extracting station or event metadata
from the data source and link to a pre-existing record instead.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session
|
Session
|
The SQLModel database session. |
required |
data_sources
|
Sequence[str | PathLike]
|
List of data sources to add. |
required |
data_type
|
DataType
|
Type of data. |
required |
station_id
|
UUID | None
|
UUID of an existing station to use instead of extracting one from each data source. |
None
|
event_id
|
UUID | None
|
UUID of an existing event to use instead of extracting one from each data source. |
None
|
dry_run
|
bool
|
If True, do not commit changes to the database. |
False
|
disable_progress_bar
|
bool
|
Do not display progress bar. |
True
|
Source code in src/aimbat/core/_data.py
232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 | |
build_iccs_from_snapshot
Build a read-only BoundICCS from a snapshot's parameters and live waveform data.
Uses the snapshot's event and seismogram parameters (window, t1, flip, select, bandpass, etc.) but reads waveform data from the live datasources. Seismograms added after the snapshot was taken are not included in the snapshot — their live parameters are used instead. No DB writes occur at any point.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session
|
Session
|
Database session. |
required |
snapshot_id
|
UUID
|
ID of the AimbatSnapshot to load. |
required |
Returns:
| Type | Description |
|---|---|
BoundICCS
|
BoundICCS instance built from the snapshot parameters. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If no snapshot with the given ID is found. |
Source code in src/aimbat/core/_iccs.py
clear_iccs_cache
create_iccs_instance
create_iccs_instance(
session: Session, event: AimbatEvent
) -> BoundICCS
Return a BoundICCS instance for the given event.
Returns the cached instance when it is still fresh (i.e. event.last_modified
has not advanced since the instance was created). Otherwise builds a new one
and updates the cache.
MiniICCSSeismogram instances are constructed directly from each
AimbatSeismogram, passing data by reference to the read-only io cache.
No waveform data is copied. The session does not need to remain open after
this call.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session
|
Session
|
Database session. |
required |
event
|
AimbatEvent
|
AimbatEvent. |
required |
Returns:
| Type | Description |
|---|---|
BoundICCS
|
BoundICCS instance tied to the given event. |
Source code in src/aimbat/core/_iccs.py
create_project
Initializes a new AIMBAT project database schema and triggers.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
engine
|
Engine
|
The SQLAlchemy/SQLModel Engine instance connected to the target database. |
required |
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If a project schema already exists in the target database. |
Source code in src/aimbat/core/_project.py
create_snapshot
create_snapshot(
session: Session,
event: AimbatEvent,
comment: str | None = None,
) -> None
Create a snapshot of the AIMBAT processing parameters.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session
|
Session
|
Database session. |
required |
event
|
AimbatEvent
|
AimbatEvent. |
required |
comment
|
str | None
|
Optional comment. |
None
|
Source code in src/aimbat/core/_snapshot.py
delete_event
delete_event(session: Session, event: AimbatEvent) -> None
Delete an AimbatEvent from the database.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session
|
Session
|
Database session. |
required |
event
|
AimbatEvent
|
Event to delete. |
required |
Source code in src/aimbat/core/_event.py
delete_event_by_id
delete_event_by_id(
session: Session, event_id: UUID
) -> None
Delete an AimbatEvent from the database by ID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session
|
Session
|
Database session. |
required |
event_id
|
UUID
|
Event ID. |
required |
Raises:
| Type | Description |
|---|---|
NoResultFound
|
If no AimbatEvent is found with the given ID. |
Source code in src/aimbat/core/_event.py
delete_project
Delete the AIMBAT project.
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If unable to delete project. |
Source code in src/aimbat/core/_project.py
delete_seismogram
delete_seismogram(
session: Session, seismogram: AimbatSeismogram
) -> None
Delete an AimbatSeismogram from the database.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session
|
Session
|
Database session. |
required |
seismogram
|
AimbatSeismogram
|
Seismogram to delete. |
required |
Source code in src/aimbat/core/_seismogram.py
delete_seismogram_by_id
delete_seismogram_by_id(
session: Session, seismogram_id: UUID
) -> None
Delete an AimbatSeismogram from the database by ID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session
|
Session
|
Database session. |
required |
seismogram_id
|
UUID
|
Seismogram ID. |
required |
Raises:
| Type | Description |
|---|---|
NoResultFound
|
If no AimbatSeismogram is found with the given ID. |
Source code in src/aimbat/core/_seismogram.py
delete_snapshot
delete_snapshot(
session: Session, snapshot: AimbatSnapshot
) -> None
Delete an AIMBAT parameter snapshot.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session
|
Session
|
Database session. |
required |
snapshot
|
AimbatSnapshot
|
Snapshot. |
required |
Source code in src/aimbat/core/_snapshot.py
delete_snapshot_by_id
delete_snapshot_by_id(
session: Session, snapshot_id: UUID
) -> None
Delete an AIMBAT parameter snapshot.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session
|
Session
|
Database session. |
required |
snapshot_id
|
UUID
|
Snapshot id. |
required |
Source code in src/aimbat/core/_snapshot.py
delete_station
delete_station(
session: Session, station: AimbatStation
) -> None
Delete an AimbatStation from the database.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session
|
Session
|
Database session. |
required |
station
|
AimbatStation
|
Station to delete. |
required |
Source code in src/aimbat/core/_station.py
delete_station_by_id
delete_station_by_id(
session: Session, station_id: UUID
) -> None
Delete an AimbatStation from the database by ID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session
|
Session
|
Database session. |
required |
station_id
|
UUID
|
Station ID. |
required |
Raises:
| Type | Description |
|---|---|
NoResultFound
|
If no AimbatStation is found with the given ID. |
Source code in src/aimbat/core/_station.py
dump_data_table_to_json
dump_data_table_to_json(session: Session) -> str
Dump the table data to json.
Source code in src/aimbat/core/_data.py
dump_event_parameter_table_to_json
dump_event_parameter_table_to_json(
session: Session,
all_events: bool,
as_string: bool,
event: AimbatEvent | None = None,
) -> str | dict[str, Any] | list[dict[str, Any]]
Dump the event parameter table data to json.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session
|
Session
|
Database session. |
required |
all_events
|
bool
|
Include event parameter table data for all events. |
required |
as_string
|
bool
|
Whether to return the result as a string. |
required |
event
|
AimbatEvent | None
|
Event to dump parameter data for (only used when all_events is False). |
None
|
Source code in src/aimbat/core/_event.py
dump_event_table_to_json
Dump the table data to json.
Source code in src/aimbat/core/_event.py
dump_seismogram_parameter_table_to_json
dump_seismogram_parameter_table_to_json(
session: Session,
all_events: bool,
as_string: bool,
event: AimbatEvent | None = None,
) -> str | list[dict[str, Any]]
Dump the seismogram parameter table data to json.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session
|
Session
|
Database session. |
required |
all_events
|
bool
|
Include parameters for all events. |
required |
as_string
|
bool
|
Return as JSON string. |
required |
event
|
AimbatEvent | None
|
Event to dump parameters for (only used when all_events is False). |
None
|
Source code in src/aimbat/core/_seismogram.py
dump_seismogram_table_to_json
dump_seismogram_table_to_json(session: Session) -> str
Create a JSON string from the AimbatSeismogram table data.
Source code in src/aimbat/core/_seismogram.py
dump_snapshot_tables_to_json
dump_snapshot_tables_to_json(
session: Session,
all_events: bool,
as_string: bool,
event: AimbatEvent | None = None,
) -> str | dict[str, list[dict[str, Any]]]
Dump snapshot data as a dict of lists of dicts.
Returns a structure with three keys:
snapshots: flat list of snapshot metadata.event_parameters: flat list of event parameter snapshots.seismogram_parameters: flat list of seismogram parameter snapshots.
Each entry includes a snapshot_id for cross-referencing.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session
|
Session
|
Database session. |
required |
all_events
|
bool
|
Include snapshots for all events. |
required |
as_string
|
bool
|
Return a JSON string when True, otherwise a dict. |
required |
event
|
AimbatEvent | None
|
Event to dump snapshots for (only used when all_events is False). |
None
|
Source code in src/aimbat/core/_snapshot.py
dump_station_table_to_json
dump_station_table_to_json(session: Session) -> str
Create a JSON string from the AimbatStation table data.
Source code in src/aimbat/core/_station.py
dump_station_table_with_counts
Dump station table with associated seismogram and event counts to a list of dicts.
Each dict represents a station and includes additional keys for the seismogram and event counts.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session
|
Session
|
Database session. |
required |
Returns: A list of dictionaries representing the stations with counts.
Source code in src/aimbat/core/_station.py
get_completed_events
get_completed_events(
session: Session,
) -> Sequence[AimbatEvent]
Get the events marked as completed.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session
|
Session
|
SQL session. |
required |
Source code in src/aimbat/core/_event.py
get_data_for_event
get_data_for_event(
session: Session, event: AimbatEvent
) -> Sequence[AimbatDataSource]
Returns the data sources belonging to the given event.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session
|
Session
|
Database session. |
required |
event
|
AimbatEvent
|
AimbatEvent. |
required |
Returns:
| Type | Description |
|---|---|
Sequence[AimbatDataSource]
|
Sequence of AimbatDataSource objects belonging to the event. |
Source code in src/aimbat/core/_data.py
get_default_event
get_default_event(session: Session) -> AimbatEvent | None
Return the currently default event, or None if no event is set as default.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session
|
Session
|
SQL session. |
required |
Returns:
| Type | Description |
|---|---|
AimbatEvent | None
|
Default Event, or None. |
Source code in src/aimbat/core/_default_event.py
get_event_parameter
get_event_parameter(
session: Session,
event: AimbatEvent,
name: EventParameter,
) -> Timedelta | bool | float
Get event parameter value for the given event.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session
|
Session
|
Database session. |
required |
event
|
AimbatEvent
|
AimbatEvent. |
required |
name
|
EventParameter
|
Name of the parameter. |
required |
Source code in src/aimbat/core/_event.py
get_events_using_station
get_events_using_station(
session: Session, station: AimbatStation
) -> Sequence[AimbatEvent]
Get all events that use a particular station.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session
|
Session
|
Database session. |
required |
station
|
AimbatStation
|
Station to return events for. |
required |
Returns: Events that use the station.
Source code in src/aimbat/core/_event.py
get_seismogram_parameter
get_seismogram_parameter(
seismogram: AimbatSeismogram, name: SeismogramParameter
) -> bool | Timestamp
Get parameter value from an AimbatSeismogram instance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
seismogram
|
AimbatSeismogram
|
Seismogram. |
required |
name
|
SeismogramParameter
|
Name of the parameter value to return. |
required |
Returns:
| Type | Description |
|---|---|
bool | Timestamp
|
Seismogram parameter value. |
Source code in src/aimbat/core/_seismogram.py
get_seismogram_parameter_by_id
get_seismogram_parameter_by_id(
session: Session,
seismogram_id: UUID,
name: SeismogramParameter,
) -> bool | Timestamp
Get parameter value from an AimbatSeismogram by ID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session
|
Session
|
Database session. |
required |
seismogram_id
|
UUID
|
Seismogram ID. |
required |
name
|
SeismogramParameter
|
Name of the parameter value to return. |
required |
Returns:
| Type | Description |
|---|---|
bool | Timestamp
|
Seismogram parameter value. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If no AimbatSeismogram is found with the given ID. |
Source code in src/aimbat/core/_seismogram.py
get_selected_seismograms
get_selected_seismograms(
session: Session,
event: AimbatEvent | None = None,
all_events: bool = False,
) -> Sequence[AimbatSeismogram]
Get the selected seismograms for the given event.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session
|
Session
|
Database session. |
required |
event
|
AimbatEvent | None
|
Event to return selected seismograms for. |
None
|
all_events
|
bool
|
Get the selected seismograms for all events. |
False
|
Returns: Selected seismograms.
Source code in src/aimbat/core/_seismogram.py
get_snapshots
get_snapshots(
session: Session,
event: AimbatEvent | None = None,
all_events: bool = False,
) -> Sequence[AimbatSnapshot]
Get the snapshots for an event.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session
|
Session
|
Database session. |
required |
event
|
AimbatEvent | None
|
Event to return snapshots for. |
None
|
all_events
|
bool
|
Get the snapshots for all events. |
False
|
Returns: Snapshots.
Source code in src/aimbat/core/_snapshot.py
get_stations_in_event
get_stations_in_event(
session: Session,
event: AimbatEvent,
as_json: bool = False,
) -> Sequence[AimbatStation] | list[dict[str, Any]]
Get the stations for a particular event.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session
|
Session
|
Database session. |
required |
event
|
AimbatEvent
|
Event to return stations for. |
required |
as_json
|
bool
|
Whether to return the result as JSON. |
False
|
Returns: Stations in event.
Source code in src/aimbat/core/_station.py
get_stations_with_event_and_seismogram_count
get_stations_with_event_and_seismogram_count(
session: Session,
) -> Sequence[tuple[AimbatStation, int, int]]
Get stations along with the count of seismograms and events they are associated with.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session
|
Session
|
Database session. |
required |
A sequence of tuples containing the station, count of seismograms
| Type | Description |
|---|---|
Sequence[tuple[AimbatStation, int, int]]
|
and count of events. |
Source code in src/aimbat/core/_station.py
reset_seismogram_parameters
reset_seismogram_parameters(
session: Session, seismogram: AimbatSeismogram
) -> None
Reset an AimbatSeismogram's parameters to their default values.
All fields defined on AimbatSeismogramParametersBase are reset to the values produced by a fresh default instance, so newly added fields are picked up automatically.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session
|
Session
|
Database session. |
required |
seismogram
|
AimbatSeismogram
|
Seismogram whose parameters should be reset. |
required |
Source code in src/aimbat/core/_seismogram.py
reset_seismogram_parameters_by_id
reset_seismogram_parameters_by_id(
session: Session, seismogram_id: UUID
) -> None
Reset an AimbatSeismogram's parameters to their default values by ID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session
|
Session
|
Database session. |
required |
seismogram_id
|
UUID
|
Seismogram ID. |
required |
Raises:
| Type | Description |
|---|---|
NoResultFound
|
If no AimbatSeismogram is found with the given ID. |
Source code in src/aimbat/core/_seismogram.py
resolve_event
resolve_event(
session: Session, event_id: UUID | None = None
) -> AimbatEvent
Resolve an event from either an explicit ID or the default event.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session
|
Session
|
SQL session. |
required |
event_id
|
UUID | None
|
Optional event ID. |
None
|
Returns:
| Type | Description |
|---|---|
AimbatEvent
|
The specified event or the default event. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If an explicit event_id is given but not found. |
NoResultFound
|
If no event_id is given and no default event is set. |
Source code in src/aimbat/core/_default_event.py
rollback_to_snapshot
rollback_to_snapshot(
session: Session, snapshot: AimbatSnapshot
) -> None
Rollback to an AIMBAT parameters snapshot.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
snapshot
|
AimbatSnapshot
|
Snapshot. |
required |
Source code in src/aimbat/core/_snapshot.py
rollback_to_snapshot_by_id
rollback_to_snapshot_by_id(
session: Session, snapshot_id: UUID
) -> None
Rollback to an AIMBAT parameters snapshot.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session
|
Session
|
Database session. |
required |
snapshot_id
|
UUID
|
Snapshot id. |
required |
Source code in src/aimbat/core/_snapshot.py
run_iccs
Run the Iterative Cross-Correlation and Stack (ICCS) algorithm.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session
|
Session
|
Database session. |
required |
iccs
|
ICCS
|
ICCS instance. |
required |
autoflip
|
bool
|
If True, automatically flip seismograms to maximise cross-correlation. |
required |
autoselect
|
bool
|
If True, automatically deselect seismograms whose cross-correlation falls below the threshold. |
required |
Source code in src/aimbat/core/_iccs.py
run_mccc
run_mccc(
session: Session,
event: AimbatEvent,
iccs: ICCS,
all_seismograms: bool,
) -> None
Run the Multi-Channel Cross-Correlation (MCCC) algorithm.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session
|
Session
|
Database session. |
required |
event
|
AimbatEvent
|
AimbatEvent. |
required |
iccs
|
ICCS
|
ICCS instance. |
required |
all_seismograms
|
bool
|
If True, include deselected seismograms in the alignment. |
required |
Source code in src/aimbat/core/_iccs.py
set_default_event
set_default_event(
session: Session, event: AimbatEvent
) -> None
Set the default event (i.e. the one being processed).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session
|
Session
|
SQL session. |
required |
event
|
AimbatEvent
|
AIMBAT Event to set as default. |
required |
Source code in src/aimbat/core/_default_event.py
set_default_event_by_id
set_default_event_by_id(
session: Session, event_id: UUID
) -> None
Set the currently selected event (i.e. the one being processed) by its ID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session
|
Session
|
SQL session. |
required |
event_id
|
UUID
|
ID of AIMBAT Event to set as default one. |
required |
Raises:
| Type | Description |
|---|---|
ValueError
|
If no event with the given ID is found. |
Source code in src/aimbat/core/_default_event.py
set_event_parameter
set_event_parameter(
session: Session,
event: AimbatEvent,
name: EventParameter,
value: Timedelta | bool | float | str,
*,
validate_iccs: bool = False,
) -> None
Set event parameter value for the given event.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session
|
Session
|
Database session. |
required |
event
|
AimbatEvent
|
AimbatEvent. |
required |
name
|
EventParameter
|
Name of the parameter. |
required |
value
|
Timedelta | bool | float | str
|
Value to set. |
required |
validate_iccs
|
bool
|
If True, attempt ICCS construction with the new value before committing. Raises and leaves the database unchanged on failure. |
False
|
Source code in src/aimbat/core/_event.py
set_seismogram_parameter
set_seismogram_parameter(
session: Session,
seismogram: AimbatSeismogram,
name: SeismogramParameter,
value: Timestamp | bool | str,
) -> None
Set parameter value for an AimbatSeismogram instance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session
|
Session
|
Database session |
required |
seismogram
|
AimbatSeismogram
|
Seismogram to set parameter for. |
required |
name
|
SeismogramParameter
|
Name of the parameter. |
required |
value
|
Timestamp | bool | str
|
Value to set parameter to. |
required |
Source code in src/aimbat/core/_seismogram.py
set_seismogram_parameter_by_id
set_seismogram_parameter_by_id(
session: Session,
seismogram_id: UUID,
name: SeismogramParameter,
value: Timestamp | bool | str,
) -> None
Set parameter value for an AimbatSeismogram by ID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session
|
Session
|
Database session |
required |
seismogram_id
|
UUID
|
Seismogram id. |
required |
name
|
SeismogramParameter
|
Name of the parameter. |
required |
value
|
Timestamp | bool | str
|
Value to set. |
required |
Raises:
| Type | Description |
|---|---|
ValueError
|
If no AimbatSeismogram is found with the given ID. |
Source code in src/aimbat/core/_seismogram.py
sync_iccs_parameters
sync_iccs_parameters(
session: Session, event: AimbatEvent, iccs: ICCS
) -> None
Sync an existing ICCS instance's parameters from the database.
Updates event-level and per-seismogram parameters without re-reading waveform data. Use this after operations that change parameters but not the seismogram list (e.g. rolling back to a snapshot).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session
|
Session
|
Database session. |
required |
event
|
AimbatEvent
|
AimbatEvent. |
required |
iccs
|
ICCS
|
ICCS instance to update in-place. |
required |
Source code in src/aimbat/core/_iccs.py
validate_iccs_construction
validate_iccs_construction(event: AimbatEvent) -> None
Try to construct an ICCS instance for the event without caching the result.
Use this to check whether the event's current (possibly uncommitted) parameters are compatible with ICCS construction before persisting them to the database.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
event
|
AimbatEvent
|
AimbatEvent. |
required |