aimbat.lib
#
Modules:
| Name | Description |
|---|---|
common |
Common functions for AIMBAT. |
data |
|
db |
Module to define the AIMBAT project file and create the database engine. |
event |
Module to manage and view events in AIMBAT. |
iccs |
Processing of data for AIMBAT. |
io |
Functions to read and write data files used with AIMBAT |
models |
This module defines the "Aimbat" classes. |
project |
|
seismogram |
|
snapshot |
|
station |
|
typing |
Custom types used in AIMBAT. |
utils |
|
common
#
Common functions for AIMBAT.
Classes:
| Name | Description |
|---|---|
CliHints |
Hints for error messages. |
TableStyling |
This class is to set the colour of the table columns and elements. |
Functions:
| Name | Description |
|---|---|
check_for_notebook |
Check if we ware running inside a jupyter notebook. |
string_to_uuid |
Determine a UUID from a string containing the first few characters. |
CliHints
dataclass
#
Hints for error messages.
Source code in src/aimbat/lib/common.py
101 102 103 104 105 106 | |
TableStyling
dataclass
#
This class is to set the colour of the table columns and elements.
Source code in src/aimbat/lib/common.py
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 | |
check_for_notebook
#
check_for_notebook() -> bool
Check if we ware running inside a jupyter notebook.
Source code in src/aimbat/lib/common.py
80 81 82 83 84 85 86 87 88 89 90 91 92 93 | |
string_to_uuid
#
string_to_uuid(
session: Session,
id: str,
aimbat_class: type[
AimbatDataSource
| AimbatStation
| AimbatEvent
| AimbatEventParameters
| AimbatSeismogram
| AimbatSeismogramParameters
| AimbatSnapshot
| AimbatEventParametersSnapshot
| AimbatSeismogramParametersSnapshot
],
custom_error: str | None = None,
) -> UUID
Determine a UUID from a string containing the first few characters.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
Session
|
Database session. |
required |
|
str
|
Input string to find UUID for. |
required |
|
type[AimbatDataSource | AimbatStation | AimbatEvent | AimbatEventParameters | AimbatSeismogram | AimbatSeismogramParameters | AimbatSnapshot | AimbatEventParametersSnapshot | AimbatSeismogramParametersSnapshot]
|
Aimbat class to use to find UUID. |
required |
|
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. |
Source code in src/aimbat/lib/common.py
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | |
data
#
Functions:
| Name | Description |
|---|---|
add_files_to_project |
Add files to the AIMBAT database. |
dump_data_table |
Dump the table data to json. |
get_data_for_active_event |
Returns the AimbatFiles belonging to the active event. |
print_data_table |
Print a pretty table with AIMBAT data. |
add_files_to_project
#
add_files_to_project(
datasources: Sequence[str | PathLike],
datatype: DataType,
disable_progress_bar: bool = True,
) -> None
Add files to the AIMBAT database.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
Sequence[str | PathLike]
|
List of data sources to add. |
required |
|
DataType
|
Type of data. |
required |
|
bool
|
Do not display progress bar. |
True
|
Source code in src/aimbat/lib/data.py
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 | |
dump_data_table
#
dump_data_table() -> None
Dump the table data to json.
Source code in src/aimbat/lib/data.py
241 242 243 244 245 246 247 248 | |
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
|
Database session. |
required |
Returns:
| Type | Description |
|---|---|
Sequence[AimbatDataSource]
|
List of AimbatFiles. |
Source code in src/aimbat/lib/data.py
156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 | |
print_data_table
#
print_data_table(
short: bool, all_events: bool = False
) -> None
Print a pretty table with AIMBAT data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
bool
|
Shorten UUIDs and format data. |
required |
|
bool
|
Print all files instead of limiting to the active event. |
False
|
Source code in src/aimbat/lib/data.py
177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 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 | |
db
#
event
#
Module to manage and view events in AIMBAT.
Functions:
| Name | Description |
|---|---|
delete_event |
Delete an AimbatEvent from the database. |
delete_event_by_id |
Delete an AimbatEvent from the database by ID. |
dump_event_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_event_parameter |
Get event parameter value for the active event. |
get_events_using_station |
Get all events that use a particular station. |
print_event_table |
Print a pretty table with AIMBAT events. |
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. |
delete_event
#
delete_event(session: Session, event: AimbatEvent) -> None
Delete an AimbatEvent from the database.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
Session
|
Database session. |
required |
|
AimbatEvent
|
Event to delete. |
required |
Source code in src/aimbat/lib/event.py
52 53 54 55 56 57 58 59 60 61 62 63 | |
delete_event_by_id
#
Delete an AimbatEvent from the database by ID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
Session
|
Database session. |
required |
|
UUID
|
Event ID. |
required |
Raises:
| Type | Description |
|---|---|
NoResultFound
|
If no AimbatEvent is found with the given ID. |
Source code in src/aimbat/lib/event.py
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | |
dump_event_table
#
dump_event_table() -> None
Dump the table data to json.
Source code in src/aimbat/lib/event.py
311 312 313 314 315 316 317 318 | |
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
|
SQL session. |
required |
Returns:
| Type | Description |
|---|---|
AimbatEvent
|
Active Event |
Raises NoResultFound: When no event is active.
Source code in src/aimbat/lib/event.py
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 | |
get_completed_events
#
get_completed_events(
session: Session,
) -> Sequence[AimbatEvent]
Get the events marked as completed.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
Session
|
SQL session. |
required |
Source code in src/aimbat/lib/event.py
137 138 139 140 141 142 143 144 145 146 147 148 149 150 | |
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
|
Database session. |
required |
|
EventParameter
|
Name of the parameter. |
required |
Source code in src/aimbat/lib/event.py
201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 | |
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
|
Database session. |
required |
|
AimbatStation
|
Station to return events for. |
required |
Returns: Events that use the station.
Source code in src/aimbat/lib/event.py
153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 | |
print_event_table
#
print_event_table(short: bool = True) -> None
Print a pretty table with AIMBAT events.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
bool
|
Shorten and format the output to be more human-readable. |
True
|
Source code in src/aimbat/lib/event.py
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 | |
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
|
SQL session. |
required |
|
AimbatEvent
|
AIMBAT Event to set as active. |
required |
Source code in src/aimbat/lib/event.py
121 122 123 124 125 126 127 128 129 130 131 132 133 134 | |
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
|
SQL session. |
required |
|
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/lib/event.py
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 | |
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
|
Database session. |
required |
|
EventParameter
|
Name of the parameter. |
required |
|
timedelta | bool | float | str
|
Value to set. |
required |
Source code in src/aimbat/lib/event.py
242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 | |
iccs
#
Processing of data for AIMBAT.
Functions:
| Name | Description |
|---|---|
create_iccs_instance |
Create an ICCS instance for the active event. |
plot_seismograms |
Plot the ICCS seismograms as an image. |
plot_stack |
Plot the ICCS stack. |
run_iccs |
Run ICCS algorithm. |
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. |
create_iccs_instance
#
create_iccs_instance(session: Session) -> ICCS
Create an ICCS instance for the active event.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
Session
|
Database session. |
required |
Returns:
| Type | Description |
|---|---|
ICCS
|
ICCS instance. |
Source code in src/aimbat/lib/iccs.py
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | |
plot_seismograms
#
Plot the ICCS seismograms as an image.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
ICCS
|
ICCS instance. |
required |
|
bool
|
Whether to use seismograms with extra context. |
required |
|
bool
|
Whether to plot all seismograms. |
required |
Source code in src/aimbat/lib/iccs.py
70 71 72 73 74 75 76 77 78 79 80 81 | |
plot_stack
#
Plot the ICCS stack.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
ICCS
|
ICCS instance. |
required |
|
bool
|
Whether to use seismograms with extra context. |
required |
|
bool
|
Whether to plot all seismograms. |
required |
Source code in src/aimbat/lib/iccs.py
57 58 59 60 61 62 63 64 65 66 67 | |
run_iccs
#
run_iccs(
session: Session,
iccs: ICCS,
autoflip: bool,
autoselect: bool,
) -> None
Run ICCS algorithm.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
Session
|
Database session. |
required |
|
ICCS
|
ICCS instance. |
required |
|
bool
|
Whether to automatically flip seismograms. |
required |
|
bool
|
Whether to automatically select seismograms. |
required |
Source code in src/aimbat/lib/iccs.py
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | |
update_min_ccnorm
#
Update the minimum cross correlation coefficient for the active event.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
ICCS
|
ICCS instance. |
required |
|
bool
|
Whether to use seismograms with extra context. |
required |
|
bool
|
Whether to plot all seismograms. |
required |
Source code in src/aimbat/lib/iccs.py
126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 | |
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 instance. |
required |
|
bool
|
Whether to use seismograms with extra context. |
required |
|
bool
|
Whether to plot all seismograms. |
required |
|
bool
|
Whether to use the seismogram image to update pick. |
required |
Source code in src/aimbat/lib/iccs.py
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 | |
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 instance. |
required |
|
bool
|
Whether to use seismograms with extra context. |
required |
|
bool
|
Whether to plot all seismograms. |
required |
|
bool
|
Whether to use the seismogram image to update pick. |
required |
Source code in src/aimbat/lib/iccs.py
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 | |
io
#
Functions to read and write data files used with AIMBAT
Classes:
| Name | Description |
|---|---|
DataType |
Valid AIMBAT data types. |
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. |
DataType
#
Bases: StrEnum
flowchart TD
aimbat.lib.io.DataType[DataType]
click aimbat.lib.io.DataType href "" "aimbat.lib.io.DataType"
Valid AIMBAT data types.
Source code in src/aimbat/lib/io/_io.py
18 19 20 21 | |
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 |
|---|---|---|---|
|
str | PathLike
|
Name of the data source. |
required |
|
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/lib/io/_io.py
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | |
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 |
|---|---|---|---|
|
str | PathLike
|
Name of the data source. |
required |
|
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/lib/io/_io.py
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 | |
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 |
|---|---|---|---|
|
str | PathLike
|
Name of the data source. |
required |
|
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/lib/io/_io.py
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | |
read_seismogram_data
#
read_seismogram_data(
datasource: str | PathLike, datatype: DataType
) -> NDArray[float64]
Read seismogram data from a data source.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str | PathLike
|
Name of the data source. |
required |
|
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/lib/io/_io.py
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 | |
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 |
|---|---|---|---|
|
str | PathLike
|
Name of the data source. |
required |
|
DataType
|
AIMBAT compatible filetype. |
required |
|
NDArray[float64]
|
Seismogram data |
required |
Raises:
| Type | Description |
|---|---|
NotImplementedError
|
If the datatype is not supported. |
Source code in src/aimbat/lib/io/_io.py
129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 | |
models
#
This module defines the "Aimbat" classes.
These classes are ORMs that present data stored in a database as classes to use with python in AIMBAT.
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. |
Attributes:
| Name | Type | Description |
|---|---|---|
AimbatTypes |
Union of all AIMBAT models that exist in the database. |
AimbatTypes
module-attribute
#
AimbatTypes = (
AimbatDataSource
| AimbatStation
| AimbatEvent
| AimbatEventParameters
| AimbatSeismogram
| AimbatSeismogramParameters
| AimbatSnapshot
| AimbatEventParametersSnapshot
| AimbatSeismogramParametersSnapshot
)
Union of all AIMBAT models that exist in the database.
AimbatDataSource
#
Bases: SQLModel
flowchart TD
aimbat.lib.models.AimbatDataSource[AimbatDataSource]
click aimbat.lib.models.AimbatDataSource href "" "aimbat.lib.models.AimbatDataSource"
Class to store data source information.
Source code in src/aimbat/lib/models.py
37 38 39 40 41 42 43 44 45 46 | |
AimbatDataSourceCreate
#
Bases: SQLModel
flowchart TD
aimbat.lib.models.AimbatDataSourceCreate[AimbatDataSourceCreate]
click aimbat.lib.models.AimbatDataSourceCreate href "" "aimbat.lib.models.AimbatDataSourceCreate"
Class to store data source information.
Source code in src/aimbat/lib/models.py
30 31 32 33 34 | |
AimbatEvent
#
Bases: SQLModel
flowchart TD
aimbat.lib.models.AimbatEvent[AimbatEvent]
click aimbat.lib.models.AimbatEvent href "" "aimbat.lib.models.AimbatEvent"
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 |
datetime
|
Event time. |
Source code in src/aimbat/lib/models.py
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 | |
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
#
id: UUID = Field(default_factory=uuid4, primary_key=True)
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.
time
class-attribute
instance-attribute
#
time: datetime = Field(
unique=True, sa_type=_DateTimeUTC, allow_mutation=False
)
Event time.
AimbatEventParameters
#
Bases: AimbatEventParametersBase
flowchart TD
aimbat.lib.models.AimbatEventParameters[AimbatEventParameters]
aimbat.lib.models.AimbatEventParametersBase[AimbatEventParametersBase]
aimbat.lib.models.AimbatEventParametersBase --> aimbat.lib.models.AimbatEventParameters
click aimbat.lib.models.AimbatEventParameters href "" "aimbat.lib.models.AimbatEventParameters"
click aimbat.lib.models.AimbatEventParametersBase href "" "aimbat.lib.models.AimbatEventParametersBase"
Processing parameters common to all seismograms of a particular event.
Attributes:
| Name | Type | Description |
|---|---|---|
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 |
timedelta
|
Post-pick window length. |
window_pre |
timedelta
|
Pre-pick window length. |
Source code in src/aimbat/lib/models.py
107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 | |
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
#
id: UUID = Field(default_factory=uuid4, primary_key=True)
Unique ID.
min_ccnorm
class-attribute
instance-attribute
#
min_ccnorm: float = Field(
ge=0.0, le=1.0, default=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.
window_post
class-attribute
instance-attribute
#
window_post: timedelta = Field(gt=0, default=window_post)
Post-pick window length.
window_pre
class-attribute
instance-attribute
#
window_pre: timedelta = Field(lt=0, default=window_pre)
Pre-pick window length.
AimbatEventParametersBase
#
Bases: SQLModel
flowchart TD
aimbat.lib.models.AimbatEventParametersBase[AimbatEventParametersBase]
click aimbat.lib.models.AimbatEventParametersBase href "" "aimbat.lib.models.AimbatEventParametersBase"
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.
- First Steps Data Parameters Event Parameters
Attributes:
| Name | Type | Description |
|---|---|---|
completed |
bool
|
Mark an event as completed. |
min_ccnorm |
float
|
Minimum cross-correlation used when automatically de-selecting seismograms. |
window_post |
timedelta
|
Post-pick window length. |
window_pre |
timedelta
|
Pre-pick window length. |
Source code in src/aimbat/lib/models.py
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 | |
min_ccnorm
class-attribute
instance-attribute
#
min_ccnorm: float = Field(
ge=0.0, le=1.0, default=min_ccnorm
)
Minimum cross-correlation used when automatically de-selecting seismograms.
window_post
class-attribute
instance-attribute
#
window_post: timedelta = Field(gt=0, default=window_post)
Post-pick window length.
window_pre
class-attribute
instance-attribute
#
window_pre: timedelta = Field(lt=0, default=window_pre)
Pre-pick window length.
AimbatEventParametersSnapshot
#
Bases: AimbatEventParametersBase
flowchart TD
aimbat.lib.models.AimbatEventParametersSnapshot[AimbatEventParametersSnapshot]
aimbat.lib.models.AimbatEventParametersBase[AimbatEventParametersBase]
aimbat.lib.models.AimbatEventParametersBase --> aimbat.lib.models.AimbatEventParametersSnapshot
click aimbat.lib.models.AimbatEventParametersSnapshot href "" "aimbat.lib.models.AimbatEventParametersSnapshot"
click aimbat.lib.models.AimbatEventParametersBase href "" "aimbat.lib.models.AimbatEventParametersBase"
Event parameter snapshot.
Attributes:
| Name | Type | Description |
|---|---|---|
completed |
bool
|
Mark an event as completed. |
min_ccnorm |
float
|
Minimum cross-correlation used when automatically de-selecting seismograms. |
window_post |
timedelta
|
Post-pick window length. |
window_pre |
timedelta
|
Pre-pick window length. |
Source code in src/aimbat/lib/models.py
127 128 129 130 131 132 133 134 135 136 137 138 139 140 | |
min_ccnorm
class-attribute
instance-attribute
#
min_ccnorm: float = Field(
ge=0.0, le=1.0, default=min_ccnorm
)
Minimum cross-correlation used when automatically de-selecting seismograms.
window_post
class-attribute
instance-attribute
#
window_post: timedelta = Field(gt=0, default=window_post)
Post-pick window length.
window_pre
class-attribute
instance-attribute
#
window_pre: timedelta = Field(lt=0, default=window_pre)
Pre-pick window length.
AimbatSeismogram
#
Bases: SQLModel
flowchart TD
aimbat.lib.models.AimbatSeismogram[AimbatSeismogram]
click aimbat.lib.models.AimbatSeismogram href "" "aimbat.lib.models.AimbatSeismogram"
Class to store seismogram data
Attributes:
| Name | Type | Description |
|---|---|---|
begin_time |
datetime
|
Begin time of seismogram. |
delta |
timedelta
|
Sampling interval. |
id |
UUID
|
Unique ID. |
t0 |
datetime
|
Initial pick. |
Source code in src/aimbat/lib/models.py
176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 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 | |
AimbatSeismogramParameters
#
Bases: AimbatSeismogramParametersBase
flowchart TD
aimbat.lib.models.AimbatSeismogramParameters[AimbatSeismogramParameters]
aimbat.lib.models.AimbatSeismogramParametersBase[AimbatSeismogramParametersBase]
aimbat.lib.models.AimbatSeismogramParametersBase --> aimbat.lib.models.AimbatSeismogramParameters
click aimbat.lib.models.AimbatSeismogramParameters href "" "aimbat.lib.models.AimbatSeismogramParameters"
click aimbat.lib.models.AimbatSeismogramParametersBase href "" "aimbat.lib.models.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 |
datetime | None
|
Working pick. |
Source code in src/aimbat/lib/models.py
277 278 279 280 281 282 283 284 285 286 287 | |
flip
class-attribute
instance-attribute
#
flip: bool = False
Whether or not the seismogram should be flipped.
select
class-attribute
instance-attribute
#
select: bool = True
Whether or not this seismogram should be used for processing.
t1
class-attribute
instance-attribute
#
t1: datetime | None = Field(
default=None, sa_type=_DateTimeUTC
)
Working pick.
This pick serves as working as well as output pick. It is changed by:
- Picking the phase arrival in the stack.
- Running ICCS.
- Running MCCC.
AimbatSeismogramParametersBase
#
Bases: SQLModel
flowchart TD
aimbat.lib.models.AimbatSeismogramParametersBase[AimbatSeismogramParametersBase]
click aimbat.lib.models.AimbatSeismogramParametersBase href "" "aimbat.lib.models.AimbatSeismogramParametersBase"
Base class that defines the seismogram parameters used in AIMBAT.
- First Steps Data Parameters Seismogram Parameters
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 |
datetime | None
|
Working pick. |
Source code in src/aimbat/lib/models.py
257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 | |
flip
class-attribute
instance-attribute
#
flip: bool = False
Whether or not the seismogram should be flipped.
select
class-attribute
instance-attribute
#
select: bool = True
Whether or not this seismogram should be used for processing.
t1
class-attribute
instance-attribute
#
t1: datetime | None = Field(
default=None, sa_type=_DateTimeUTC
)
Working pick.
This pick serves as working as well as output pick. It is changed by:
- Picking the phase arrival in the stack.
- Running ICCS.
- Running MCCC.
AimbatSeismogramParametersSnapshot
#
Bases: AimbatSeismogramParametersBase
flowchart TD
aimbat.lib.models.AimbatSeismogramParametersSnapshot[AimbatSeismogramParametersSnapshot]
aimbat.lib.models.AimbatSeismogramParametersBase[AimbatSeismogramParametersBase]
aimbat.lib.models.AimbatSeismogramParametersBase --> aimbat.lib.models.AimbatSeismogramParametersSnapshot
click aimbat.lib.models.AimbatSeismogramParametersSnapshot href "" "aimbat.lib.models.AimbatSeismogramParametersSnapshot"
click aimbat.lib.models.AimbatSeismogramParametersBase href "" "aimbat.lib.models.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 |
datetime | None
|
Working pick. |
Source code in src/aimbat/lib/models.py
290 291 292 293 294 295 296 297 298 299 300 301 302 303 | |
flip
class-attribute
instance-attribute
#
flip: bool = False
Whether or not the seismogram should be flipped.
select
class-attribute
instance-attribute
#
select: bool = True
Whether or not this seismogram should be used for processing.
t1
class-attribute
instance-attribute
#
t1: datetime | None = Field(
default=None, sa_type=_DateTimeUTC
)
Working pick.
This pick serves as working as well as output pick. It is changed by:
- Picking the phase arrival in the stack.
- Running ICCS.
- Running MCCC.
AimbatSnapshot
#
Bases: SQLModel
flowchart TD
aimbat.lib.models.AimbatSnapshot[AimbatSnapshot]
click aimbat.lib.models.AimbatSnapshot href "" "aimbat.lib.models.AimbatSnapshot"
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/lib/models.py
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 | |
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
flowchart TD
aimbat.lib.models.AimbatStation[AimbatStation]
click aimbat.lib.models.AimbatStation href "" "aimbat.lib.models.AimbatStation"
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/lib/models.py
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 | |
channel
class-attribute
instance-attribute
#
channel: str = Field(allow_mutation=False)
Channel code.
id
class-attribute
instance-attribute
#
id: UUID = Field(default_factory=uuid4, primary_key=True)
Unique ID.
location
class-attribute
instance-attribute
#
location: str = Field(allow_mutation=False)
Location ID.
network
class-attribute
instance-attribute
#
network: str = Field(allow_mutation=False)
Network name.
seismograms
class-attribute
instance-attribute
#
seismograms: list[AimbatSeismogram] = Relationship(
back_populates="station", cascade_delete=True
)
Seismograms recorded at this station.
project
#
Functions:
| Name | Description |
|---|---|
create_project |
Create a new AIMBAT project. |
delete_project |
Delete the AIMBAT project. |
print_project_info |
Show AIMBAT project information. |
create_project
#
create_project() -> None
Create a new AIMBAT project.
Source code in src/aimbat/lib/project.py
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | |
delete_project
#
delete_project() -> None
Delete the AIMBAT project.
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If unable to delete project. |
Source code in src/aimbat/lib/project.py
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 | |
print_project_info
#
print_project_info() -> None
Show AIMBAT project information.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
Database engine. |
required |
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If no project found. |
Source code in src/aimbat/lib/project.py
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 | |
seismogram
#
Functions:
| Name | Description |
|---|---|
delete_seismogram |
Delete an AimbatSeismogram from the database. |
delete_seismogram_by_id |
Delete an AimbatSeismogram from the database by ID. |
dump_seismogram_table |
Dump the table data to json. |
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. |
plot_seismograms |
Plot all seismograms for a particular event ordered by great circle distance. |
print_seismogram_table |
Prints a pretty table with AIMBAT seismograms. |
set_seismogram_parameter |
Set parameter value for an AimbatSeismogram instance. |
set_seismogram_parameter_by_id |
Set parameter value for an AimbatSeismogram by ID. |
delete_seismogram
#
delete_seismogram(
session: Session, seismogram: AimbatSeismogram
) -> None
Delete an AimbatSeismogram from the database.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
Session
|
Database session. |
required |
|
AimbatSeismogram
|
Seismogram to delete. |
required |
Source code in src/aimbat/lib/seismogram.py
59 60 61 62 63 64 65 66 67 68 69 70 | |
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
|
Database session. |
required |
|
UUID
|
Seismogram ID. |
required |
Raises:
| Type | Description |
|---|---|
NoResultFound
|
If no AimbatSeismogram is found with the given ID. |
Source code in src/aimbat/lib/seismogram.py
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | |
dump_seismogram_table
#
dump_seismogram_table() -> None
Dump the table data to json.
Source code in src/aimbat/lib/seismogram.py
341 342 343 344 345 346 347 348 | |
get_seismogram_parameter
#
get_seismogram_parameter(
seismogram: AimbatSeismogram, name: SeismogramParameter
) -> bool | datetime
Get parameter value from an AimbatSeismogram instance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
AimbatSeismogram
|
Seismogram. |
required |
|
SeismogramParameter
|
Name of the parameter value to return. |
required |
Returns:
| Type | Description |
|---|---|
bool | datetime
|
Seismogram parameter value. |
Source code in src/aimbat/lib/seismogram.py
118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 | |
get_seismogram_parameter_by_id
#
get_seismogram_parameter_by_id(
session: Session,
seismogram_id: UUID,
name: SeismogramParameter,
) -> bool | datetime
Get parameter value from an AimbatSeismogram by ID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
Session
|
Database session. |
required |
|
UUID
|
Seismogram ID. |
required |
|
SeismogramParameter
|
Name of the parameter value to return. |
required |
Returns:
| Type | Description |
|---|---|
bool | datetime
|
Seismogram parameter value. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If no AimbatSeismogram is found with the given ID. |
Source code in src/aimbat/lib/seismogram.py
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 | |
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
|
Database session. |
required |
|
bool
|
Get the selected seismograms for all events. |
False
|
Returns: Selected seismograms.
Source code in src/aimbat/lib/seismogram.py
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 | |
plot_seismograms
#
plot_seismograms(
use_qt: bool = False,
) -> Figure | PlotWidget
Plot all seismograms for a particular event ordered by great circle distance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
bool
|
Plot with pqtgraph instead of pyplot |
False
|
Source code in src/aimbat/lib/seismogram.py
357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 | |
print_seismogram_table
#
print_seismogram_table(
short: bool, all_events: bool = False
) -> None
Prints a pretty table with AIMBAT seismograms.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
bool
|
Shorten and format the output to be more human-readable. |
required |
|
bool
|
Print seismograms for all events. |
False
|
Source code in src/aimbat/lib/seismogram.py
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 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 | |
set_seismogram_parameter
#
set_seismogram_parameter(
session: Session,
seismogram: AimbatSeismogram,
name: SeismogramParameter,
value: datetime | bool | str,
) -> None
Set parameter value for an AimbatSeismogram instance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
Session
|
Database session |
required |
|
AimbatSeismogram
|
Seismogram to set parameter for. |
required |
|
SeismogramParameter
|
Name of the parameter. |
required |
|
datetime | bool | str
|
Value to set parameter to. |
required |
Source code in src/aimbat/lib/seismogram.py
193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 | |
set_seismogram_parameter_by_id
#
set_seismogram_parameter_by_id(
session: Session,
seismogram_id: UUID,
name: SeismogramParameter,
value: datetime | bool | str,
) -> None
Set parameter value for an AimbatSeismogram by ID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
Session
|
Database session |
required |
|
UUID
|
Seismogram id. |
required |
|
SeismogramParameter
|
Name of the parameter. |
required |
|
datetime | bool | str
|
Value to set. |
required |
Raises:
| Type | Description |
|---|---|
ValueError
|
If no AimbatSeismogram is found with the given ID. |
Source code in src/aimbat/lib/seismogram.py
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 | |
snapshot
#
Functions:
| Name | Description |
|---|---|
create_snapshot |
Create a snapshot of the AIMBAT processing parameters. |
delete_snapshot |
Delete an AIMBAT parameter snapshot. |
delete_snapshot_by_id |
Delete an AIMBAT parameter snapshot. |
get_snapshots |
Get the snapshots for the active avent. |
print_snapshot_table |
Print a pretty table with AIMBAT snapshots. |
rollback_to_snapshot |
Rollback to an AIMBAT parameters snapshot. |
rollback_to_snapshot_by_id |
Rollback to an AIMBAT parameters snapshot. |
create_snapshot
#
Create a snapshot of the AIMBAT processing parameters.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
Session
|
Database session. |
required |
|
str | None
|
Optional comment. |
None
|
Source code in src/aimbat/lib/snapshot.py
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | |
delete_snapshot
#
delete_snapshot(
session: Session, snapshot: AimbatSnapshot
) -> None
Delete an AIMBAT parameter snapshot.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
Session
|
Database session. |
required |
|
AimbatSnapshot
|
Snapshot. |
required |
Source code in src/aimbat/lib/snapshot.py
148 149 150 151 152 153 154 155 156 157 158 159 | |
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
|
Database session. |
required |
|
UUID
|
Snapshot id. |
required |
Source code in src/aimbat/lib/snapshot.py
128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 | |
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
|
Database session. |
required |
|
bool
|
Get the selected snapshots for all events. |
False
|
Returns: Snapshots.
Source code in src/aimbat/lib/snapshot.py
162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 | |
print_snapshot_table
#
print_snapshot_table(short: bool, all_events: bool) -> None
Print a pretty table with AIMBAT snapshots.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
bool
|
Shorten and format the output to be more human-readable. |
required |
|
bool
|
Print all snapshots instead of limiting to the active event. |
required |
Source code in src/aimbat/lib/snapshot.py
191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 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 | |
rollback_to_snapshot
#
rollback_to_snapshot(
session: Session, snapshot: AimbatSnapshot
) -> None
Rollback to an AIMBAT parameters snapshot.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
AimbatSnapshot
|
Snapshot. |
required |
Source code in src/aimbat/lib/snapshot.py
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 | |
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
|
Database session. |
required |
|
UUID
|
Snapshot id. |
required |
Source code in src/aimbat/lib/snapshot.py
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 | |
station
#
Functions:
| Name | Description |
|---|---|
delete_station |
Delete an AimbatStation from the database. |
delete_station_by_id |
Delete an AimbatStation from the database by ID. |
dump_station_table |
Dump the table data to json. |
get_stations_in_event |
Get the stations for a particular event. |
print_station_table |
Prints a pretty table with AIMBAT stations. |
delete_station
#
delete_station(
session: Session, station: AimbatStation
) -> None
Delete an AimbatStation from the database.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
Session
|
Database session. |
required |
|
AimbatStation
|
Station to delete. |
required |
Source code in src/aimbat/lib/station.py
33 34 35 36 37 38 39 40 41 42 43 44 | |
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
|
Database session. |
required |
|
UUID
|
Station ID. |
required |
Raises:
| Type | Description |
|---|---|
NoResultFound
|
If no AimbatStation is found with the given ID. |
Source code in src/aimbat/lib/station.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | |
dump_station_table
#
dump_station_table() -> None
Dump the table data to json.
Source code in src/aimbat/lib/station.py
164 165 166 167 168 169 170 171 | |
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
|
Database session. |
required |
|
AimbatEvent
|
Event to return stations for. |
required |
Returns: Stations in event.
Source code in src/aimbat/lib/station.py
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | |
print_station_table
#
print_station_table(
short: bool, all_events: bool = False
) -> None
Prints a pretty table with AIMBAT stations.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
bool
|
Shorten and format the output to be more human-readable. |
required |
|
bool
|
Print stations for all events. |
False
|
Source code in src/aimbat/lib/station.py
75 76 77 78 79 80 81 82 83 84 85 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 | |
typing
#
Custom types used in AIMBAT.
Classes:
| Name | Description |
|---|---|
EventParameter |
|
SeismogramParameter |
|
Attributes:
| Name | Type | Description |
|---|---|---|
EventParameterBool |
TypeAlias
|
[ |
EventParameterFloat |
TypeAlias
|
[ |
EventParameterTimedelta |
TypeAlias
|
[ |
EventParameterBool
module-attribute
#
EventParameterBool: TypeAlias = Literal[COMPLETED]
[TypeAlias][typing.TypeAlias] for AimbatEvent attributes with [bool][] values.
EventParameterFloat
module-attribute
#
EventParameterFloat: TypeAlias = Literal[MIN_CCNORM]
[TypeAlias][typing.TypeAlias] for AimbatEvent attributes with [float][] values.
EventParameterTimedelta
module-attribute
#
EventParameterTimedelta: TypeAlias = Literal[
WINDOW_PRE, WINDOW_POST
]
[TypeAlias][typing.TypeAlias] for AimbatEvent attributes with [timedelta][datetime.timedelta] values.
EventParameter
#
Bases: StrEnum
flowchart TD
aimbat.lib.typing.EventParameter[EventParameter]
click aimbat.lib.typing.EventParameter href "" "aimbat.lib.typing.EventParameter"
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 model.
Source code in src/aimbat/lib/typing.py
7 8 9 10 11 12 13 14 15 16 17 | |
SeismogramParameter
#
Bases: StrEnum
flowchart TD
aimbat.lib.typing.SeismogramParameter[SeismogramParameter]
click aimbat.lib.typing.SeismogramParameter href "" "aimbat.lib.typing.SeismogramParameter"
AimbatSeismograParameters 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/lib/typing.py
32 33 34 35 36 37 38 39 40 41 | |
utils
#
Modules:
| Name | Description |
|---|---|
checkdata |
|
sampledata |
|
checkdata
#
Functions:
| Name | Description |
|---|---|
checkdata_event |
Check if event information is complete. |
checkdata_seismogram |
Check if seismogram information is complete. |
checkdata_station |
Check if station information is complete. |
run_checks |
Run all checks on one or more SAC files. |
checkdata_event
#
checkdata_event(event: Event) -> list[str]
Check if event information is complete.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
Event
|
event object to test. |
required |
Source code in src/aimbat/lib/utils/checkdata.py
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | |
checkdata_seismogram
#
checkdata_seismogram(seismogram: Seismogram) -> list[str]
Check if seismogram information is complete.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
Seismogram
|
seismogram object to test. |
required |
Source code in src/aimbat/lib/utils/checkdata.py
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 | |
checkdata_station
#
checkdata_station(station: Station) -> list[str]
Check if station information is complete.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
Station
|
station object to test. |
required |
Source code in src/aimbat/lib/utils/checkdata.py
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | |
run_checks
#
run_checks(sacfiles: list[Path]) -> None
Run all checks on one or more SAC files.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
list[Path]
|
SAC files to test. |
required |
Source code in src/aimbat/lib/utils/checkdata.py
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 | |
sampledata
#
Functions:
| Name | Description |
|---|---|
delete_sampledata |
Delete sample data. |
download_sampledata |
Download sample data. |
delete_sampledata
#
delete_sampledata() -> None
Delete sample data.
Source code in src/aimbat/lib/utils/sampledata.py
10 11 12 13 14 15 | |
download_sampledata
#
download_sampledata(force: bool = False) -> None
Download sample data.
Source code in src/aimbat/lib/utils/sampledata.py
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | |