aimbat
AIMBAT (Automated and Interactive Measurement of Body wave Arrival Times) is an open-source software package for efficiently measuring teleseismic body wave arrival times for large seismic arrays (Lou et al., 2012). It is based on a widely used method called MCCC (Multi-Channel Cross-Correlation) developed by VanDecar and Crosson (1990). The package is automated in the sense of initially aligning seismograms for MCCC which is achieved by an ICCS (Iterative Cross Correlation and Stack) algorithm. Meanwhile, a graphical user interface is built to perform seismogram quality control interactively. Therefore, user processing time is reduced while valuable input from a user's expertise is retained. As a byproduct, SAC (Goldstein et al., 2003) plotting and phase picking functionalities are replicated and enhanced.
Modules:
| Name | Description |
|---|---|
aimbat_types |
Custom types used in AIMBAT. |
app |
AIMBAT command line interface entrypoint for all other commands. |
cli |
|
core |
|
db |
Module to define the AIMBAT project file and create the database engine. |
io |
Functions to read and write data files used with AIMBAT |
logger |
Logging setup. |
models |
Models used in AIMBAT. |
utils |
Utils used in AIMBAT. |
aimbat_types
Custom types used in AIMBAT.
Type Aliases:
| Name | Description |
|---|---|
EventParameterBool |
|
EventParameterFloat |
|
EventParameterTimedelta |
|
Classes:
| Name | Description |
|---|---|
DataType |
Valid AIMBAT data types. |
EventParameter |
[ |
SeismogramParameter |
[ |
EventParameterBool
EventParameterBool = Literal[COMPLETED, BANDPASS_APPLY]
EventParameterFloat
EventParameterFloat = Literal[
MIN_CCNORM, BANDPASS_FMIN, BANDPASS_FMAX
]
EventParameterTimedelta
EventParameterTimedelta = Literal[WINDOW_PRE, WINDOW_POST]
TypeAlias for [AimbatEvent][aimbat.lib.models.AimbatEvent] attributes with [Timedelta][pandas.Timedelta] values.
DataType
EventParameter
Bases: StrEnum
[AimbatEvent][aimbat.lib.models.AimbatEvent] enum class for typing.
This enum class is used for typing, cli args etc. The attributes must be
the same as in the [AimbatEvent][aimbat.lib.models.AimbatEvent] model.
Source code in src/aimbat/aimbat_types/_event.py
SeismogramParameter
Bases: StrEnum
[AimbatSeismograParameters][aimbat.lib.models.AimbatSeismogramParameters] enum class for typing.
This enum class is used for typing, cli args etc. The attributes must be
the same as in the [AimbatParameters][aimbat.lib.models.AimbatParameters] model.
Source code in src/aimbat/aimbat_types/_seismogram.py
app
AIMBAT command line interface entrypoint for all other commands.
This is the main command line interface for AIMBAT. It must be executed with a
command (as specified below) to actually do anything. Help for individual
commands is available by typing aimbat COMMAND --help.
cli
Modules:
| Name | Description |
|---|---|
common |
Common parameters and functions for the AIMBAT CLI. |
data |
Manage seismogram files in an AIMBAT project. |
event |
View and manage events in the AIMBAT project. |
iccs |
ICCS processing tools. |
project |
Manage AIMBAT projects. |
seismogram |
View and manage seismograms in the AIMBAT project. |
snapshot |
View and manage snapshots. |
station |
View and manage stations. |
utils |
Utilities for AIMBAT. |
common
Common parameters and functions for the AIMBAT CLI.
Classes:
| Name | Description |
|---|---|
CliHints |
Hints for error messages. |
GlobalParameters |
|
TableParameters |
|
Functions:
| Name | Description |
|---|---|
simple_exception |
Decorator to handle exceptions and print them to the console. |
CliHints
dataclass
Hints for error messages.
Source code in src/aimbat/cli/common.py
GlobalParameters
dataclass
TableParameters
dataclass
simple_exception
Decorator to handle exceptions and print them to the console.
Using this decorator prints only the exception to the console without traceback, and then exits. In debugging mode this decorator returns the callable unchanged.
Source code in src/aimbat/cli/common.py
data
Manage seismogram files in an AIMBAT project.
Functions:
| Name | Description |
|---|---|
cli_data_add |
Add or update data files in the AIMBAT project. |
cli_data_dump |
Dump the contents of the AIMBAT data table to json. |
cli_data_list |
Print information on the data stored in AIMBAT. |
cli_data_add
cli_data_add(
seismogram_files: Annotated[
list[Path],
Parameter(
name=files,
consume_multiple=True,
validator=Path(exists=True),
),
],
*,
filetype: DataType = SAC,
show_progress_bar: Annotated[
bool, Parameter(name=progress)
] = True,
global_parameters: GlobalParameters | None = None
) -> None
Add or update data files in the AIMBAT project.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
seismogram_files
|
Annotated[list[Path], Parameter(name=files, consume_multiple=True, validator=Path(exists=True))]
|
Seismogram files to be added. |
required |
filetype
|
DataType
|
Specify type of seismogram file. |
SAC
|
show_progress_bar
|
Annotated[bool, Parameter(name=progress)]
|
Display progress bar. |
True
|
Source code in src/aimbat/cli/data.py
cli_data_dump
cli_data_dump(
*, global_parameters: GlobalParameters | None = None
) -> None
Dump the contents of the AIMBAT data table to json.
Source code in src/aimbat/cli/data.py
cli_data_list
cli_data_list(
*,
all_events: Annotated[
bool, Parameter(name=all)
] = False,
table_parameters: TableParameters | None = None,
global_parameters: GlobalParameters | None = None
) -> None
Print information on the data stored in AIMBAT.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
all_events
|
Annotated[bool, Parameter(name=all)]
|
Select data for all events. |
False
|
Source code in src/aimbat/cli/data.py
event
View and manage events in the AIMBAT project.
Functions:
| Name | Description |
|---|---|
cli_event_activate |
Select the event to be active for Processing. |
cli_event_delete |
Delete existing event. |
cli_event_dump |
Dump the contents of the AIMBAT event table to json. |
cli_event_list |
Print information on the events stored in AIMBAT. |
cli_event_parameter_get |
Get parameter value for the active event. |
cli_event_parameter_set |
Set parameter value for the active event. |
cli_event_activate
cli_event_activate(
event_id: Annotated[UUID | str, Parameter(name=id)],
*,
global_parameters: GlobalParameters | None = None
) -> None
Select the event to be active for Processing.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
event_id
|
Annotated[UUID | str, Parameter(name=id)]
|
Event ID number. |
required |
Source code in src/aimbat/cli/event.py
cli_event_delete
cli_event_delete(
event_id: Annotated[UUID | str, Parameter(name=id)],
*,
global_parameters: GlobalParameters | None = None
) -> None
Delete existing event.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
event_id
|
Annotated[UUID | str, Parameter(name=id)]
|
Event ID. |
required |
Source code in src/aimbat/cli/event.py
cli_event_dump
cli_event_dump(
*, global_parameters: GlobalParameters | None = None
) -> None
Dump the contents of the AIMBAT event table to json.
Source code in src/aimbat/cli/event.py
cli_event_list
cli_event_list(
*,
table_parameters: TableParameters | None = None,
global_parameters: GlobalParameters | None = None
) -> None
Print information on the events stored in AIMBAT.
Source code in src/aimbat/cli/event.py
cli_event_parameter_get
cli_event_parameter_get(
name: EventParameter,
*,
global_parameters: GlobalParameters | None = None
) -> None
Get parameter value for the active event.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
EventParameter
|
Event parameter name. |
required |
Source code in src/aimbat/cli/event.py
cli_event_parameter_set
cli_event_parameter_set(
name: EventParameter,
value: Timedelta | str,
*,
global_parameters: GlobalParameters | None = None
) -> None
Set parameter value for the active event.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
EventParameter
|
Event parameter name. |
required |
value
|
Timedelta | str
|
Event parameter value. |
required |
Source code in src/aimbat/cli/event.py
iccs
ICCS processing tools.
Launches various processing tools related to ICCS.
Classes:
| Name | Description |
|---|---|
IccsPlotParameters |
|
Functions:
| Name | Description |
|---|---|
cli_iccs_plot_seismograms |
Plot the ICCS seismograms of the active event as an image. |
cli_iccs_plot_stack |
Plot the ICCS stack of the active event. |
cli_iccs_run |
Run the ICCS algorithm. |
cli_iccs_update_min_ccnorm |
Pick a new minimum cross-correlation norm for auto-selection. |
cli_iccs_update_pick |
Pick a new arrival time. |
cli_iccs_update_timewindow |
Pick a new time window. |
IccsPlotParameters
dataclass
cli_iccs_plot_seismograms
cli_iccs_plot_seismograms(
*,
iccs_parameters: IccsPlotParameters | None = None,
global_parameters: GlobalParameters | None = None
) -> None
Plot the ICCS seismograms of the active event as an image.
Source code in src/aimbat/cli/iccs.py
cli_iccs_plot_stack
cli_iccs_plot_stack(
*,
iccs_parameters: IccsPlotParameters | None = None,
global_parameters: GlobalParameters | None = None
) -> None
Plot the ICCS stack of the active event.
Source code in src/aimbat/cli/iccs.py
cli_iccs_run
cli_iccs_run(
*,
autoflip: bool = False,
autoselect: bool = False,
global_parameters: GlobalParameters | None = None
) -> None
Run the ICCS algorithm.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
autoflip
|
bool
|
Whether to automatically flip seismograms (multiply data by -1). |
False
|
autoselect
|
bool
|
Whether to automatically de-select seismograms. |
False
|
Source code in src/aimbat/cli/iccs.py
cli_iccs_update_min_ccnorm
cli_iccs_update_min_ccnorm(
*,
iccs_parameters: IccsPlotParameters | None = None,
global_parameters: GlobalParameters | None = None
) -> None
Pick a new minimum cross-correlation norm for auto-selection.
Source code in src/aimbat/cli/iccs.py
cli_iccs_update_pick
cli_iccs_update_pick(
*,
iccs_parameters: IccsPlotParameters | None = None,
use_seismogram_image: Annotated[
bool, Parameter(name=img)
] = False,
global_parameters: GlobalParameters | None = None
) -> None
Pick a new arrival time.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
use_seismogram_image
|
Annotated[bool, Parameter(name=img)]
|
Use the seismogram image to update pick. |
False
|
Source code in src/aimbat/cli/iccs.py
cli_iccs_update_timewindow
cli_iccs_update_timewindow(
*,
iccs_parameters: IccsPlotParameters | None = None,
use_seismogram_image: Annotated[
bool, Parameter(name=img)
] = False,
global_parameters: GlobalParameters | None = None
) -> None
Pick a new time window.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
use_seismogram_image
|
Annotated[bool, Parameter(name=img)]
|
Use the seismogram image to pick the time window. |
False
|
Source code in src/aimbat/cli/iccs.py
project
Manage AIMBAT projects.
This command manages projects. By default, the project consists
of a file called aimbat.db in the current working directory. All aimbat
commands must be executed from the same directory. The location (and name) of
the project file may also be specified by setting the AIMBAT_PROJECT
environment variable to the desired filename. Alternatively, aimbat can be
executed with a database url directly.
Functions:
| Name | Description |
|---|---|
cli_project_create |
Create new AIMBAT project. |
cli_project_delete |
Delete project (note: this does not delete seismogram files). |
cli_project_info |
Show information on an exisiting project. |
cli_project_create
cli_project_create(
*, global_parameters: GlobalParameters | None = None
) -> None
Create new AIMBAT project.
Source code in src/aimbat/cli/project.py
cli_project_delete
cli_project_delete(
*, global_parameters: GlobalParameters | None = None
) -> None
Delete project (note: this does not delete seismogram files).
Source code in src/aimbat/cli/project.py
cli_project_info
cli_project_info(
*, global_parameters: GlobalParameters | None = None
) -> None
Show information on an exisiting project.
Source code in src/aimbat/cli/project.py
seismogram
View and manage seismograms in the AIMBAT project.
Functions:
| Name | Description |
|---|---|
cli_seismogram_delete |
Delete existing seismogram. |
cli_seismogram_dump |
Dump the contents of the AIMBAT seismogram table to json. |
cli_seismogram_get |
Get the value of a processing parameter. |
cli_seismogram_list |
Print information on the seismograms in the active event. |
cli_seismogram_plot |
Plot seismograms for the active event. |
cli_seismogram_set |
Set value of a processing parameter. |
cli_seismogram_delete
cli_seismogram_delete(
seismogram_id: Annotated[
UUID | str, Parameter(name=id)
],
*,
global_parameters: GlobalParameters | None = None
) -> None
Delete existing seismogram.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
seismogram_id
|
Annotated[UUID | str, Parameter(name=id)]
|
Seismogram ID. |
required |
Source code in src/aimbat/cli/seismogram.py
cli_seismogram_dump
cli_seismogram_dump(
*, global_parameters: GlobalParameters | None = None
) -> None
Dump the contents of the AIMBAT seismogram table to json.
Source code in src/aimbat/cli/seismogram.py
cli_seismogram_get
cli_seismogram_get(
seismogram_id: Annotated[
UUID | str, Parameter(name=id)
],
name: SeismogramParameter,
*,
global_parameters: GlobalParameters | None = None
) -> None
Get the value of a processing parameter.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
seismogram_id
|
Annotated[UUID | str, Parameter(name=id)]
|
Seismogram ID number. |
required |
name
|
SeismogramParameter
|
Name of the seismogram parameter. |
required |
Source code in src/aimbat/cli/seismogram.py
cli_seismogram_list
cli_seismogram_list(
*,
all_events: Annotated[bool, Parameter(all)] = False,
table_parameters: TableParameters | None = None,
global_parameters: GlobalParameters | None = None
) -> None
Print information on the seismograms in the active event.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
all_events
|
Annotated[bool, Parameter(all)]
|
Select seismograms for all events. |
False
|
Source code in src/aimbat/cli/seismogram.py
cli_seismogram_plot
cli_seismogram_plot(
*, global_parameters: GlobalParameters | None = None
) -> None
Plot seismograms for the active event.
Source code in src/aimbat/cli/seismogram.py
cli_seismogram_set
cli_seismogram_set(
seismogram_id: Annotated[
UUID | str, Parameter(name=id)
],
name: SeismogramParameter,
value: str,
*,
global_parameters: GlobalParameters | None = None
) -> None
Set value of a processing parameter.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
seismogram_id
|
Annotated[UUID | str, Parameter(name=id)]
|
Seismogram ID number. |
required |
name
|
SeismogramParameter
|
Name of the seismogram parameter. |
required |
value
|
str
|
Value of the seismogram parameter. |
required |
Source code in src/aimbat/cli/seismogram.py
snapshot
View and manage snapshots.
Functions:
| Name | Description |
|---|---|
cli_snapshop_delete |
Delete existing snapshot. |
cli_snapshot_create |
Create new snapshot. |
cli_snapshot_list |
Print information on the snapshots for the active event. |
cli_snapshot_rollback |
Rollback to snapshot. |
cli_snapshop_delete
cli_snapshop_delete(
snapshot_id: Annotated[UUID | str, Parameter(name=id)],
*,
global_parameters: GlobalParameters | None = None
) -> None
Delete existing snapshot.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
snapshot_id
|
Annotated[UUID | str, Parameter(name=id)]
|
Snapshot ID Number. |
required |
Source code in src/aimbat/cli/snapshot.py
cli_snapshot_create
cli_snapshot_create(
comment: str | None = None,
*,
global_parameters: GlobalParameters | None = None
) -> None
Create new snapshot.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
comment
|
str | None
|
Create snapshot with optional comment. |
None
|
Source code in src/aimbat/cli/snapshot.py
cli_snapshot_list
cli_snapshot_list(
*,
all_events: Annotated[bool, Parameter(all)] = False,
table_parameters: TableParameters | None = None,
global_parameters: GlobalParameters | None = None
) -> None
Print information on the snapshots for the active event.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
all_events
|
Annotated[bool, Parameter(all)]
|
Select snapshots for all events. |
False
|
Source code in src/aimbat/cli/snapshot.py
cli_snapshot_rollback
cli_snapshot_rollback(
snapshot_id: Annotated[UUID | str, Parameter(name=id)],
*,
global_paramaters: GlobalParameters | None = None
) -> None
Rollback to snapshot.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
snapshot_id
|
Annotated[UUID | str, Parameter(name=id)]
|
Snapshot ID Number. |
required |
Source code in src/aimbat/cli/snapshot.py
station
View and manage stations.
Functions:
| Name | Description |
|---|---|
cli_station_delete |
Delete existing station. |
cli_station_dump |
Dump the contents of the AIMBAT station table to json. |
cli_station_list |
Print information on the stations used in the active event. |
cli_station_delete
cli_station_delete(
station_id: Annotated[UUID | str, Parameter(name=id)],
*,
global_parameters: GlobalParameters | None = None
) -> None
Delete existing station.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
station_id
|
Annotated[UUID | str, Parameter(name=id)]
|
Station ID. |
required |
Source code in src/aimbat/cli/station.py
cli_station_dump
cli_station_dump(
*, global_parameters: GlobalParameters | None = None
) -> None
Dump the contents of the AIMBAT station table to json.
Source code in src/aimbat/cli/station.py
cli_station_list
cli_station_list(
*,
all_events: Annotated[
bool, Parameter(name=all)
] = False,
table_parameters: TableParameters | None = None,
global_parameters: GlobalParameters | None = None
) -> None
Print information on the stations used in the active event.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
all_events
|
Annotated[bool, Parameter(name=all)]
|
Select stations for all events. |
False
|
Source code in src/aimbat/cli/station.py
utils
Utilities for AIMBAT.
Modules:
| Name | Description |
|---|---|
app |
Utilities for AIMBAT. |
sampledata |
Download or delete AIMBAT sample data. |
app
Utilities for AIMBAT.
The utils subcommand contains useful tools that are not strictly part of an AIMBAT workflow.
Functions:
| Name | Description |
|---|---|
cli_checkdata |
Check if there are any problems with SAC files before adding them to a project. |
cli_checkdata
cli_checkdata(
sacfiles: Annotated[
list[Path],
Parameter(name=data, consume_multiple=True),
],
*,
common: GlobalParameters | None = None
) -> None
Check if there are any problems with SAC files before adding them to a project.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sacfiles
|
Annotated[list[Path], Parameter(name=data, consume_multiple=True)]
|
One or more SAC files. |
required |
Source code in src/aimbat/cli/utils/app.py
sampledata
Download or delete AIMBAT sample data.
The sampledata subcommand manages an example dataset that can be used for testing or learning how to use AIMBAT.
The sample data source url can be viewed or changed via aimbat default
<list/set> sampledata_src. Likewise the sample data destination folder
be viewed or changed via aimbat default <list/set> sampledata_dir.
Functions:
| Name | Description |
|---|---|
sampledata_cli_delete |
Recursively delete sample data directory. |
sampledata_cli_download |
Download AIMBAT sample data. |
sampledata_cli_delete
sampledata_cli_delete(
*, global_parameters: GlobalParameters | None = None
) -> None
Recursively delete sample data directory.
Source code in src/aimbat/cli/utils/sampledata.py
sampledata_cli_download
sampledata_cli_download(
*,
force: bool = False,
global_parameters: GlobalParameters | None = None
) -> None
Download AIMBAT sample data.
Downloads an example dataset to the directory specified in the
sampledata_dir AIMBAT default variable.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
force
|
bool
|
Delete the download directory and re-download." |
False
|
Source code in src/aimbat/cli/utils/sampledata.py
core
Functions:
| Name | Description |
|---|---|
add_files_to_project |
Add files to the AIMBAT database. |
create_iccs_instance |
Create an ICCS instance for the active event. |
create_project |
Create a new AIMBAT project. |
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 |
Dump the table data to json. |
dump_event_table |
Dump the table data to json. |
dump_seismogram_table |
Dump the table data to json. |
dump_station_table |
Dump the table data to json. |
get_active_event |
Return the currently active event (i.e. the one being processed). |
get_completed_events |
Get the events marked as completed. |
get_data_for_active_event |
Returns the AimbatFiles belonging to the active event. |
get_event_parameter |
Get event parameter value for the active 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 active avent. |
get_snapshots |
Get the snapshots for the active avent. |
get_stations_in_event |
Get the stations for a particular event. |
plot_all_seismograms |
Plot all seismograms for a particular event ordered by great circle distance. |
plot_seismograms |
Plot the ICCS seismograms as an image. |
plot_stack |
Plot the ICCS stack. |
print_data_table |
Print a pretty table with AIMBAT data. |
print_event_table |
Print a pretty table with AIMBAT events. |
print_project_info |
Show AIMBAT project information. |
print_seismogram_table |
Prints a pretty table with AIMBAT seismograms. |
print_snapshot_table |
Print a pretty table with AIMBAT snapshots. |
print_station_table |
Prints a pretty table with AIMBAT stations. |
rollback_to_snapshot |
Rollback to an AIMBAT parameters snapshot. |
rollback_to_snapshot_by_id |
Rollback to an AIMBAT parameters snapshot. |
run_iccs |
Run ICCS algorithm. |
set_active_event |
Set the active event (i.e. the one being processed). |
set_active_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 active event. |
set_seismogram_parameter |
Set parameter value for an AimbatSeismogram instance. |
set_seismogram_parameter_by_id |
Set parameter value for an AimbatSeismogram by ID. |
update_min_ccnorm |
Update the minimum cross correlation coefficient for the active event. |
update_pick |
Update the pick for the active event. |
update_timewindow |
Update the time window for the active event. |
add_files_to_project
add_files_to_project(
session: Session,
datasources: Sequence[str | PathLike],
datatype: DataType,
disable_progress_bar: bool = True,
) -> None
Add files to the AIMBAT database.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
datasources
|
Sequence[str | PathLike]
|
List of data sources to add. |
required |
datatype
|
DataType
|
Type of data. |
required |
disable_progress_bar
|
bool
|
Do not display progress bar. |
True
|
Source code in src/aimbat/core/_data.py
create_iccs_instance
create_iccs_instance(session: Session) -> ICCS
Create an ICCS instance for the active event.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session
|
Session
|
Database session. |
required |
Returns:
| Type | Description |
|---|---|
ICCS
|
ICCS instance. |
Source code in src/aimbat/core/_iccs.py
create_project
Create a new AIMBAT project.
Source code in src/aimbat/core/_project.py
create_snapshot
create_snapshot(
session: Session, comment: str | None = None
) -> None
Create a snapshot of the AIMBAT processing parameters.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session
|
Session
|
Database session. |
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
Dump the table data to json.
Source code in src/aimbat/core/_data.py
dump_event_table
Dump the table data to json.
dump_seismogram_table
Dump the table data to json.
Source code in src/aimbat/core/_seismogram.py
dump_station_table
Dump the table data to json.
get_active_event
get_active_event(session: Session) -> AimbatEvent
Return the currently active event (i.e. the one being processed).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session
|
Session
|
SQL session. |
required |
Returns:
| Type | Description |
|---|---|
AimbatEvent
|
Active Event |
Raises NoResultFound: When no event is active.
Source code in src/aimbat/utils/_active_event.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_active_event
get_data_for_active_event(
session: Session,
) -> Sequence[AimbatDataSource]
Returns the AimbatFiles belonging to the active event.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session
|
Session
|
Database session. |
required |
Returns:
| Type | Description |
|---|---|
Sequence[AimbatDataSource]
|
List of AimbatFiles. |
Source code in src/aimbat/core/_data.py
get_event_parameter
get_event_parameter(
session: Session, name: EventParameter
) -> Timedelta | bool | float
Get event parameter value for the active event.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session
|
Session
|
Database session. |
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, all_events: bool = False
) -> Sequence[AimbatSeismogram]
Get the selected seismograms for the active avent.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session
|
Session
|
Database session. |
required |
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, all_events: bool = False
) -> Sequence[AimbatSnapshot]
Get the snapshots for the active avent.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session
|
Session
|
Database session. |
required |
all_events
|
bool
|
Get the selected 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
) -> Sequence[AimbatStation]
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 |
Returns: Stations in event.
Source code in src/aimbat/core/_station.py
plot_all_seismograms
Plot all seismograms for a particular event ordered by great circle distance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
use_qt
|
bool
|
Plot with pqtgraph instead of pyplot |
False
|
Source code in src/aimbat/core/_seismogram.py
plot_seismograms
Plot the ICCS seismograms as an image.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
iccs
|
ICCS
|
ICCS instance. |
required |
context
|
bool
|
Whether to use seismograms with extra context. |
required |
all
|
bool
|
Whether to plot all seismograms. |
required |
Source code in src/aimbat/core/_iccs.py
plot_stack
print_data_table
Print a pretty table with AIMBAT data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
short
|
bool
|
Shorten UUIDs and format data. |
required |
all_events
|
bool
|
Print all files instead of limiting to the active event. |
False
|
Source code in src/aimbat/core/_data.py
print_event_table
print_event_table(
session: Session, short: bool = True
) -> None
Print a pretty table with AIMBAT events.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
short
|
bool
|
Shorten and format the output to be more human-readable. |
True
|
Source code in src/aimbat/core/_event.py
print_project_info
Show AIMBAT project information.
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If no project found. |
Source code in src/aimbat/core/_project.py
print_seismogram_table
Prints a pretty table with AIMBAT seismograms.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
short
|
bool
|
Shorten and format the output to be more human-readable. |
required |
all_events
|
bool
|
Print seismograms for all events. |
False
|
Source code in src/aimbat/core/_seismogram.py
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 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 | |
print_snapshot_table
Print a pretty table with AIMBAT snapshots.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
short
|
bool
|
Shorten and format the output to be more human-readable. |
required |
all_events
|
bool
|
Print all snapshots instead of limiting to the active event. |
required |
Source code in src/aimbat/core/_snapshot.py
print_station_table
Prints a pretty table with AIMBAT stations.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session
|
Session
|
Database session. |
required |
short
|
bool
|
Shorten and format the output to be more human-readable. |
required |
all_events
|
bool
|
Print stations for all events. |
False
|
Source code in src/aimbat/core/_station.py
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 | |
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 ICCS algorithm.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session
|
Session
|
Database session. |
required |
iccs
|
ICCS
|
ICCS instance. |
required |
autoflip
|
bool
|
Whether to automatically flip seismograms. |
required |
autoselect
|
bool
|
Whether to automatically select seismograms. |
required |
Source code in src/aimbat/core/_iccs.py
set_active_event
set_active_event(
session: Session, event: AimbatEvent
) -> None
Set the active event (i.e. the one being processed).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session
|
Session
|
SQL session. |
required |
event
|
AimbatEvent
|
AIMBAT Event to set as active. |
required |
Source code in src/aimbat/core/_event.py
set_active_event_by_id
set_active_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 active one. |
required |
Raises:
| Type | Description |
|---|---|
ValueError
|
If no event with the given ID is found. |
Source code in src/aimbat/core/_event.py
set_event_parameter
set_event_parameter(
session: Session,
name: EventParameter,
value: Timedelta | bool | float | str,
) -> None
Set event parameter value for the active event.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session
|
Session
|
Database session. |
required |
name
|
EventParameter
|
Name of the parameter. |
required |
value
|
Timedelta | bool | float | str
|
Value to set. |
required |
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
update_min_ccnorm
Update the minimum cross correlation coefficient for the active event.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
iccs
|
ICCS
|
ICCS instance. |
required |
context
|
bool
|
Whether to use seismograms with extra context. |
required |
all
|
bool
|
Whether to plot all seismograms. |
required |
Source code in src/aimbat/core/_iccs.py
update_pick
update_pick(
session: Session,
iccs: ICCS,
context: bool,
all: bool,
use_seismogram_image: bool,
) -> None
Update the pick for the active event.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
iccs
|
ICCS
|
ICCS instance. |
required |
context
|
bool
|
Whether to use seismograms with extra context. |
required |
all
|
bool
|
Whether to plot all seismograms. |
required |
use_seismogram_image
|
bool
|
Whether to use the seismogram image to update pick. |
required |
Source code in src/aimbat/core/_iccs.py
update_timewindow
update_timewindow(
session: Session,
iccs: ICCS,
context: bool,
all: bool,
use_seismogram_image: bool,
) -> None
Update the time window for the active event.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
iccs
|
ICCS
|
ICCS instance. |
required |
context
|
bool
|
Whether to use seismograms with extra context. |
required |
all
|
bool
|
Whether to plot all seismograms. |
required |
use_seismogram_image
|
bool
|
Whether to use the seismogram image to update pick. |
required |
Source code in src/aimbat/core/_iccs.py
db
Module to define the AIMBAT project file and create the database engine.
Attributes:
| Name | Type | Description |
|---|---|---|
engine |
AIMBAT database engine. |
io
Functions to read and write data files used with AIMBAT
Functions:
| Name | Description |
|---|---|
create_event |
Read event data from a data source and create an AimbatEvent. |
create_seismogram |
Read seismogram data from a data source and create an AimbatSeismogram. |
create_station |
Read station data from a data source and create an AimbatStation. |
read_seismogram_data |
Read seismogram data from a data source. |
write_seismogram_data |
Write seismogram data to a data source. |
create_event
create_event(
datasource: str | PathLike, datatype: DataType
) -> AimbatEvent
Read event data from a data source and create an AimbatEvent.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
datasource
|
str | PathLike
|
Name of the data source. |
required |
datatype
|
DataType
|
AIMBAT compatible datatype. |
required |
Returns:
| Type | Description |
|---|---|
AimbatEvent
|
AimbatEvent instance. |
Raises:
| Type | Description |
|---|---|
NotImplementedError
|
If the datatype is not supported. |
Source code in src/aimbat/io/_base.py
create_seismogram
create_seismogram(
datasource: str | PathLike, datatype: DataType
) -> AimbatSeismogram
Read seismogram data from a data source and create an AimbatSeismogram.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
datasource
|
str | PathLike
|
Name of the data source. |
required |
datatype
|
DataType
|
AIMBAT compatible datatype. |
required |
Returns:
| Type | Description |
|---|---|
AimbatSeismogram
|
AimbatSeismogram instance. |
Raises:
| Type | Description |
|---|---|
NotImplementedError
|
If the datatype is not supported. |
Source code in src/aimbat/io/_base.py
create_station
create_station(
datasource: str | PathLike, datatype: DataType
) -> AimbatStation
Read station data from a data source and create an AimbatStation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
datasource
|
str | PathLike
|
Name of the data source. |
required |
datatype
|
DataType
|
AIMBAT compatible datatype. |
required |
Returns:
| Type | Description |
|---|---|
AimbatStation
|
AimbatStation instance. |
Raises:
| Type | Description |
|---|---|
NotImplementedError
|
If the datatype is not supported. |
Source code in src/aimbat/io/_base.py
read_seismogram_data
Read seismogram data from a data source.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
datasource
|
str | PathLike
|
Name of the data source. |
required |
datatype
|
DataType
|
AIMBAT compatible filetype. |
required |
Returns:
| Type | Description |
|---|---|
NDArray[float64]
|
Seismogram data. |
Raises:
| Type | Description |
|---|---|
NotImplementedError
|
If the datatype is not supported. |
Source code in src/aimbat/io/_base.py
write_seismogram_data
write_seismogram_data(
datasource: str | PathLike,
datatype: DataType,
data: NDArray[float64],
) -> None
Write seismogram data to a data source.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
datasource
|
str | PathLike
|
Name of the data source. |
required |
datatype
|
DataType
|
AIMBAT compatible filetype. |
required |
data
|
NDArray[float64]
|
Seismogram data |
required |
Raises:
| Type | Description |
|---|---|
NotImplementedError
|
If the datatype is not supported. |
Source code in src/aimbat/io/_base.py
logger
Logging setup.
Functions:
| Name | Description |
|---|---|
configure_logging |
Reconfigure loguru sinks based on current settings. |
configure_logging
models
Models used in AIMBAT.
Type Aliases:
| Name | Description |
|---|---|
AimbatTypes |
Union of all AIMBAT models that exist in the database. |
Classes:
| Name | Description |
|---|---|
AimbatDataSource |
Class to store data source information. |
AimbatDataSourceCreate |
Class to store data source information. |
AimbatEvent |
Store event information. |
AimbatEventParameters |
Processing parameters common to all seismograms of a particular event. |
AimbatEventParametersBase |
Base class that defines the event parameters used in AIMBAT. |
AimbatEventParametersSnapshot |
Event parameter snapshot. |
AimbatSeismogram |
Class to store seismogram data |
AimbatSeismogramParameters |
Class to store ICCS processing parameters of a single seismogram. |
AimbatSeismogramParametersBase |
Base class that defines the seismogram parameters used in AIMBAT. |
AimbatSeismogramParametersSnapshot |
Class to store a snapshot of ICCS processing parameters of a single seismogram. |
AimbatSnapshot |
Class to store AIMBAT snapshots. |
AimbatStation |
Class to store station information. |
AimbatTypes
AimbatTypes = (
AimbatDataSource
| AimbatStation
| AimbatEvent
| AimbatEventParameters
| AimbatSeismogram
| AimbatSeismogramParameters
| AimbatSnapshot
| AimbatEventParametersSnapshot
| AimbatSeismogramParametersSnapshot
)
Union of all AIMBAT models that exist in the database.
AimbatDataSource
Bases: SQLModel
Class to store data source information.
Source code in src/aimbat/models/_models.py
AimbatDataSourceCreate
AimbatEvent
Bases: SQLModel
Store event information.
Attributes:
| Name | Type | Description |
|---|---|---|
active |
bool | None
|
Indicates if an event is the active event. |
depth |
float | None
|
Event depth. |
id |
UUID
|
Unique ID. |
latitude |
float
|
Event latitude. |
longitude |
float
|
Event longitude. |
parameters |
AimbatEventParameters
|
Event parameters. |
seismograms |
list[AimbatSeismogram]
|
List of seismograms of this event. |
snapshots |
list[AimbatSnapshot]
|
List of snapshots. |
time |
PydanticTimestamp
|
Event time. |
Source code in src/aimbat/models/_models.py
active
class-attribute
instance-attribute
active: bool | None = Field(default=None, unique=True)
Indicates if an event is the active event.
id
class-attribute
instance-attribute
Unique ID.
parameters
class-attribute
instance-attribute
parameters: AimbatEventParameters = Relationship(
back_populates="event", cascade_delete=True
)
Event parameters.
seismograms
class-attribute
instance-attribute
seismograms: list[AimbatSeismogram] = Relationship(
back_populates="event", cascade_delete=True
)
List of seismograms of this event.
snapshots
class-attribute
instance-attribute
snapshots: list[AimbatSnapshot] = Relationship(
back_populates="event", cascade_delete=True
)
List of snapshots.
AimbatEventParameters
Bases: AimbatEventParametersBase, EventParametersValidatorMixin
Processing parameters common to all seismograms of a particular event.
Attributes:
| Name | Type | Description |
|---|---|---|
bandpass_apply |
bool
|
Whether to apply bandpass filter to seismograms. |
bandpass_fmax |
float
|
Maximum frequency for bandpass filter (ignored if |
bandpass_fmin |
float
|
Minimum frequency for bandpass filter (ignored if |
completed |
bool
|
Mark an event as completed. |
event |
AimbatEvent
|
Event these parameters are associated with. |
event_id |
UUID
|
Event ID these parameters are associated with. |
id |
UUID
|
Unique ID. |
min_ccnorm |
float
|
Minimum cross-correlation used when automatically de-selecting seismograms. |
snapshots |
list[AimbatEventParametersSnapshot]
|
Snapshots these parameters are associated with. |
window_post |
PydanticPositiveTimedelta
|
Post-pick window length. |
window_pre |
PydanticNegativeTimedelta
|
Pre-pick window length. |
Source code in src/aimbat/models/_models.py
bandpass_apply
class-attribute
instance-attribute
bandpass_apply: bool = Field(
default_factory=lambda: bandpass_apply
)
Whether to apply bandpass filter to seismograms.
bandpass_fmax
class-attribute
instance-attribute
bandpass_fmax: float = Field(
default_factory=lambda: bandpass_fmax, gt=0
)
Maximum frequency for bandpass filter (ignored if bandpass_apply is False).
bandpass_fmin
class-attribute
instance-attribute
bandpass_fmin: float = Field(
default_factory=lambda: bandpass_fmin, ge=0
)
Minimum frequency for bandpass filter (ignored if bandpass_apply is False).
event
class-attribute
instance-attribute
event: AimbatEvent = Relationship(
back_populates="parameters"
)
Event these parameters are associated with.
event_id
class-attribute
instance-attribute
event_id: UUID = Field(
default=None,
foreign_key="aimbatevent.id",
ondelete="CASCADE",
)
Event ID these parameters are associated with.
id
class-attribute
instance-attribute
Unique ID.
min_ccnorm
class-attribute
instance-attribute
min_ccnorm: float = Field(
ge=0.0, le=1.0, default_factory=lambda: min_ccnorm
)
Minimum cross-correlation used when automatically de-selecting seismograms.
snapshots
class-attribute
instance-attribute
snapshots: list[AimbatEventParametersSnapshot] = (
Relationship(
back_populates="parameters", cascade_delete=True
)
)
Snapshots these parameters are associated with.
AimbatEventParametersBase
Bases: SQLModel
Base class that defines the event parameters used in AIMBAT.
This class serves as a base that is inherited by the actual classes that create the database tables. The attributes in this class correspond exactl to the AIMBAT event parameters.
Attributes:
| Name | Type | Description |
|---|---|---|
bandpass_apply |
bool
|
Whether to apply bandpass filter to seismograms. |
bandpass_fmax |
float
|
Maximum frequency for bandpass filter (ignored if |
bandpass_fmin |
float
|
Minimum frequency for bandpass filter (ignored if |
completed |
bool
|
Mark an event as completed. |
min_ccnorm |
float
|
Minimum cross-correlation used when automatically de-selecting seismograms. |
window_post |
PydanticPositiveTimedelta
|
Post-pick window length. |
window_pre |
PydanticNegativeTimedelta
|
Pre-pick window length. |
Source code in src/aimbat/models/_models.py
bandpass_apply
class-attribute
instance-attribute
bandpass_apply: bool = Field(
default_factory=lambda: bandpass_apply
)
Whether to apply bandpass filter to seismograms.
bandpass_fmax
class-attribute
instance-attribute
bandpass_fmax: float = Field(
default_factory=lambda: bandpass_fmax, gt=0
)
Maximum frequency for bandpass filter (ignored if bandpass_apply is False).
bandpass_fmin
class-attribute
instance-attribute
bandpass_fmin: float = Field(
default_factory=lambda: bandpass_fmin, ge=0
)
Minimum frequency for bandpass filter (ignored if bandpass_apply is False).
min_ccnorm
class-attribute
instance-attribute
min_ccnorm: float = Field(
ge=0.0, le=1.0, default_factory=lambda: min_ccnorm
)
Minimum cross-correlation used when automatically de-selecting seismograms.
AimbatEventParametersSnapshot
Bases: AimbatEventParametersBase
Event parameter snapshot.
Attributes:
| Name | Type | Description |
|---|---|---|
bandpass_apply |
bool
|
Whether to apply bandpass filter to seismograms. |
bandpass_fmax |
float
|
Maximum frequency for bandpass filter (ignored if |
bandpass_fmin |
float
|
Minimum frequency for bandpass filter (ignored if |
completed |
bool
|
Mark an event as completed. |
min_ccnorm |
float
|
Minimum cross-correlation used when automatically de-selecting seismograms. |
window_post |
PydanticPositiveTimedelta
|
Post-pick window length. |
window_pre |
PydanticNegativeTimedelta
|
Pre-pick window length. |
Source code in src/aimbat/models/_models.py
bandpass_apply
class-attribute
instance-attribute
bandpass_apply: bool = Field(
default_factory=lambda: bandpass_apply
)
Whether to apply bandpass filter to seismograms.
bandpass_fmax
class-attribute
instance-attribute
bandpass_fmax: float = Field(
default_factory=lambda: bandpass_fmax, gt=0
)
Maximum frequency for bandpass filter (ignored if bandpass_apply is False).
bandpass_fmin
class-attribute
instance-attribute
bandpass_fmin: float = Field(
default_factory=lambda: bandpass_fmin, ge=0
)
Minimum frequency for bandpass filter (ignored if bandpass_apply is False).
min_ccnorm
class-attribute
instance-attribute
min_ccnorm: float = Field(
ge=0.0, le=1.0, default_factory=lambda: min_ccnorm
)
Minimum cross-correlation used when automatically de-selecting seismograms.
AimbatSeismogram
Bases: SQLModel
Class to store seismogram data
Attributes:
| Name | Type | Description |
|---|---|---|
begin_time |
PydanticTimestamp
|
Begin time of seismogram. |
delta |
PydanticPositiveTimedelta
|
Sampling interval. |
id |
UUID
|
Unique ID. |
t0 |
PydanticTimestamp
|
Initial pick. |
Source code in src/aimbat/models/_models.py
207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 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 | |
begin_time
class-attribute
instance-attribute
Begin time of seismogram.
delta
class-attribute
instance-attribute
Sampling interval.
id
class-attribute
instance-attribute
Unique ID.
AimbatSeismogramParameters
Bases: AimbatSeismogramParametersBase
Class to store ICCS processing parameters of a single seismogram.
Attributes:
| Name | Type | Description |
|---|---|---|
flip |
bool
|
Whether or not the seismogram should be flipped. |
select |
bool
|
Whether or not this seismogram should be used for processing. |
t1 |
PydanticTimestamp | None
|
Working pick. |
Source code in src/aimbat/models/_models.py
AimbatSeismogramParametersBase
Bases: SQLModel
Base class that defines the seismogram parameters used in AIMBAT.
Attributes:
| Name | Type | Description |
|---|---|---|
flip |
bool
|
Whether or not the seismogram should be flipped. |
select |
bool
|
Whether or not this seismogram should be used for processing. |
t1 |
PydanticTimestamp | None
|
Working pick. |
Source code in src/aimbat/models/_models.py
AimbatSeismogramParametersSnapshot
Bases: AimbatSeismogramParametersBase
Class to store a snapshot of ICCS processing parameters of a single seismogram.
Attributes:
| Name | Type | Description |
|---|---|---|
flip |
bool
|
Whether or not the seismogram should be flipped. |
select |
bool
|
Whether or not this seismogram should be used for processing. |
t1 |
PydanticTimestamp | None
|
Working pick. |
Source code in src/aimbat/models/_models.py
AimbatSnapshot
Bases: SQLModel
Class to store AIMBAT snapshots.
The AimbatSnapshot class does not actually save any parameter data. It is used to keep track of the AimbatEventParametersSnapshot and AimbatSeismogramParametersSnapshot instances.
Attributes:
| Name | Type | Description |
|---|---|---|
event |
AimbatEvent
|
Event this snapshot is associated with. |
event_id |
UUID
|
Event ID this snapshot is associated with. |
Source code in src/aimbat/models/_models.py
event
class-attribute
instance-attribute
event: AimbatEvent = Relationship(
back_populates="snapshots"
)
Event this snapshot is associated with.
event_id
class-attribute
instance-attribute
event_id: UUID = Field(
default=None,
foreign_key="aimbatevent.id",
ondelete="CASCADE",
)
Event ID this snapshot is associated with.
AimbatStation
Bases: SQLModel
Class to store station information.
Attributes:
| Name | Type | Description |
|---|---|---|
channel |
str
|
Channel code. |
elevation |
float | None
|
Station elevation. |
id |
UUID
|
Unique ID. |
latitude |
float
|
Station latitude |
location |
str
|
Location ID. |
longitude |
float
|
Station longitude |
name |
str
|
Station name. |
network |
str
|
Network name. |
seismograms |
list[AimbatSeismogram]
|
Seismograms recorded at this station. |
Source code in src/aimbat/models/_models.py
id
class-attribute
instance-attribute
Unique ID.
location
class-attribute
instance-attribute
location: str = Field(allow_mutation=False)
Location ID.
seismograms
class-attribute
instance-attribute
seismograms: list[AimbatSeismogram] = Relationship(
back_populates="station", cascade_delete=True
)
Seismograms recorded at this station.
utils
Utils used in AIMBAT.
Classes:
| Name | Description |
|---|---|
TableStyling |
This class is to set the colour of the table columns and elements. |
Functions:
| Name | Description |
|---|---|
delete_sampledata |
Delete sample data. |
download_sampledata |
Download sample data. |
dump_to_json |
Dump a sequence of AimbatTypes to a JSON string and print it. |
get_active_event |
Return the currently active event (i.e. the one being processed). |
run_checks |
Run all checks on one or more SAC files. |
string_to_uuid |
Determine a UUID from a string containing the first few characters. |
TableStyling
dataclass
This class is to set the colour of the table columns and elements.
Source code in src/aimbat/utils/_style.py
delete_sampledata
download_sampledata
download_sampledata(force: bool = False) -> None
Download sample data.
Source code in src/aimbat/utils/_sampledata.py
dump_to_json
dump_to_json(aimbat_data: Sequence[AimbatTypes]) -> None
Dump a sequence of AimbatTypes to a JSON string and print it.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
aimbat_data
|
Sequence[AimbatTypes]
|
A sequence of AimbatTypes to dump to JSON. |
required |
Source code in src/aimbat/utils/_json.py
get_active_event
get_active_event(session: Session) -> AimbatEvent
Return the currently active event (i.e. the one being processed).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session
|
Session
|
SQL session. |
required |
Returns:
| Type | Description |
|---|---|
AimbatEvent
|
Active Event |
Raises NoResultFound: When no event is active.
Source code in src/aimbat/utils/_active_event.py
run_checks
Run all checks on one or more SAC files.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sacfiles
|
list[Path]
|
SAC files to test. |
required |
Source code in src/aimbat/utils/_checkdata.py
string_to_uuid
string_to_uuid(
session: Session,
id: str,
aimbat_class: type[AimbatTypes],
custom_error: str | None = None,
) -> UUID
Determine a UUID from a string containing the first few characters.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session
|
Session
|
Database session. |
required |
id
|
str
|
Input string to find UUID for. |
required |
aimbat_class
|
type[AimbatTypes]
|
Aimbat class to use to find UUID. |
required |
custom_error
|
str | None
|
Overrides the default error message. |
None
|
Returns:
| Type | Description |
|---|---|
UUID
|
The full UUID. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the UUID could not be determined. |