aimbat.models
ORM classes mapping to AIMBAT database tables.
Each class in this module corresponds to a table in the SQLite project database and is built on SQLModel, which combines SQLAlchemy (for database access) with Pydantic (for validation).
The main classes and their relationships are:
AimbatEvent— a seismic event.AimbatStation— a seismic recording station.AimbatSeismogram— links anAimbatEventto anAimbatStationand holds the timing metadata (begin_time,delta,t0). Waveform data is accessed via the associatedAimbatDataSource.AimbatDataSource— records where the waveform data for a seismogram is stored, along with its type (e.g. SAC).AimbatEventParameters— processing parameters shared across all seismograms of an event (window bounds, bandpass filter settings, MCCC settings, etc.).AimbatSeismogramParameters— per-seismogram processing parameters (flip,select, working pickt1).AimbatSnapshot— captures a point-in-time copy of event and seismogram parameters viaAimbatEventParametersSnapshotandAimbatSeismogramParametersSnapshot, enabling rollback and comparison.AimbatEventQuality/AimbatSeismogramQuality— live quality metrics updated during processing;AimbatSeismogramQualitystores the ICCS cross-correlation coefficienticcs_ccand MCCC per-seismogram metrics;AimbatEventQualitystores the MCCC global RMSE.AimbatEventQualitySnapshot/AimbatSeismogramQualitySnapshot— point-in-time copies of quality metrics captured alongside parameter snapshots.
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. |
AimbatEvent |
Seismic event with origin time, location, and depth. |
AimbatEventParameters |
Processing parameters common to all seismograms of a particular event. |
AimbatEventParametersBase |
Base class defining event-level processing parameters for AIMBAT. |
AimbatEventParametersSnapshot |
Snapshot of processing parameters for a particular event. |
AimbatEventQuality |
Live quality metrics for a seismic event. |
AimbatEventQualityBase |
Base class defining event-level quality metrics. |
AimbatEventQualitySnapshot |
Snapshot of quality metrics for a seismic event. |
AimbatEventRead |
Read model for AimbatEvent including computed counts. |
AimbatNote |
Free-text Markdown note attached to an event, station, seismogram, or snapshot. |
AimbatSeismogram |
Class to store seismogram metadata. |
AimbatSeismogramParameters |
Processing parameters for a single seismogram. |
AimbatSeismogramParametersBase |
Base class defining seismogram-level processing parameters for AIMBAT. |
AimbatSeismogramParametersSnapshot |
Snapshot of processing parameters for a single seismogram. |
AimbatSeismogramQuality |
Live quality metrics for a single seismogram. |
AimbatSeismogramQualityBase |
Base class defining seismogram-level quality metrics. |
AimbatSeismogramQualitySnapshot |
Snapshot of quality metrics for a single seismogram. |
AimbatSeismogramRead |
Read model for AimbatSeismogram including parameters. |
AimbatSnapshot |
Container for a point-in-time snapshot of event and seismogram parameters. |
AimbatSnapshotRead |
Read model for AimbatSnapshot with a seismogram count. |
AimbatStation |
Recording station with network, location, and channel metadata. |
AimbatStationRead |
Read model for AimbatStation including parameters. |
RichColSpec |
Display metadata for a model field rendered in a Rich table. |
SeismogramQualityStats |
Aggregated seismogram quality statistics for an event or station. |
TuiColSpec |
Display metadata for a model field rendered in the TUI. |
AimbatTypes
AimbatTypes = (
AimbatDataSource
| AimbatNote
| AimbatStation
| AimbatEvent
| AimbatEventParameters
| AimbatEventQuality
| AimbatSeismogram
| AimbatSeismogramParameters
| AimbatSeismogramQuality
| AimbatSnapshot
| AimbatEventParametersSnapshot
| AimbatEventQualitySnapshot
| AimbatSeismogramParametersSnapshot
| AimbatSeismogramQualitySnapshot
)
Union of all AIMBAT models that exist in the database.
AimbatDataSource
Bases: SQLModel
Class to store data source information.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
UUID
|
Unique data source ID. |
UUID('5c4dbee0-1b05-472f-a8c3-4405147515f5')
|
sourcename
|
str
|
Path or name of the data source. |
required |
datatype
|
DataType
|
Data type of the data source. |
<DataType.SAC: 'sac'>
|
seismogram_id
|
UUID
|
Foreign key referencing the parent seismogram. |
None
|
Attributes:
| Name | Type | Description |
|---|---|---|
seismogram |
AimbatSeismogram
|
The seismogram this data source belongs to. |
Source code in src/aimbat/models/_models.py
seismogram
class-attribute
instance-attribute
seismogram: AimbatSeismogram = Relationship(
back_populates="datasource"
)
The seismogram this data source belongs to.
AimbatEvent
Bases: SQLModel
Seismic event with origin time, location, and depth.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
UUID
|
Unique event ID. |
UUID('cf40ac72-f000-41f1-968b-a7b847f252c2')
|
time
|
PydanticTimestamp
|
Event origin time (UTC). |
required |
latitude
|
float
|
Event latitude in degrees. |
required |
longitude
|
float
|
Event longitude in degrees. |
required |
depth
|
float | None
|
Event depth in metres. |
None
|
last_modified
|
PydanticTimestamp | None
|
Timestamp of the last parameter modification. |
None
|
Attributes:
| Name | Type | Description |
|---|---|---|
parameters |
AimbatEventParameters
|
Event parameters. |
quality |
AimbatEventQuality | None
|
Live quality metrics for this event. |
seismograms |
list[AimbatSeismogram]
|
List of seismograms of this event. |
snapshots |
list[AimbatSnapshot]
|
List of snapshots. |
Source code in src/aimbat/models/_models.py
parameters
class-attribute
instance-attribute
parameters: AimbatEventParameters = Relationship(
back_populates="event", cascade_delete=True
)
Event parameters.
quality
class-attribute
instance-attribute
quality: AimbatEventQuality | None = Relationship(
back_populates="event", cascade_delete=True
)
Live quality metrics for this event.
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
Processing parameters common to all seismograms of a particular event.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
completed
|
bool
|
Mark an event as completed. |
False
|
ramp_width
|
float
|
Width of taper ramp up and down as a fraction of the window length. |
0.1
|
window_pre
|
PydanticNegativeTimedelta
|
Pre-pick window length in seconds. |
Timedelta('-1 days +23:59:45')
|
window_post
|
PydanticPositiveTimedelta
|
Post-pick window length in seconds. |
Timedelta('0 days 00:00:15')
|
bandpass_apply
|
bool
|
Whether to apply bandpass filter to seismograms. |
False
|
bandpass_fmin
|
float
|
Minimum frequency for bandpass filter in Hz (ignored if |
0.05
|
bandpass_fmax
|
float
|
Maximum frequency for bandpass filter in Hz (ignored if |
2.0
|
min_cc
|
float
|
Minimum cross-correlation used when automatically de-selecting seismograms. |
0.5
|
mccc_damp
|
float
|
Damping factor for MCCC algorithm. |
0.1
|
mccc_min_cc
|
float
|
Minimum correlation coefficient required to include a pair in the MCCC inversion. |
0.5
|
id
|
UUID
|
Unique ID. |
UUID('518e532c-dc2d-4449-9a44-1030f72b3d3e')
|
event_id
|
UUID
|
Foreign key referencing the parent event. |
None
|
Methods:
| Name | Description |
|---|---|
check_freq_range |
Validate that |
validate_iccs_context |
Attempt ICCS construction with these parameters if requested. |
Attributes:
| Name | Type | Description |
|---|---|---|
event |
AimbatEvent
|
The event these parameters belong to. |
snapshots |
list[AimbatEventParametersSnapshot]
|
Parameter snapshots for this event. |
Source code in src/aimbat/models/_models.py
event
class-attribute
instance-attribute
event: AimbatEvent = Relationship(
back_populates="parameters"
)
The event these parameters belong to.
snapshots
class-attribute
instance-attribute
snapshots: list[AimbatEventParametersSnapshot] = (
Relationship(
back_populates="parameters", cascade_delete=True
)
)
Parameter snapshots for this event.
check_freq_range
check_freq_range() -> Self
Validate that bandpass_fmax is strictly greater than bandpass_fmin.
Source code in src/aimbat/models/_parameters.py
validate_iccs_context
validate_iccs_context(info: ValidationInfo) -> Self
Attempt ICCS construction with these parameters if requested.
Requires validate_iccs=True and an event instance in the validation
context.
Source code in src/aimbat/models/_parameters.py
AimbatEventParametersBase
Bases: SQLModel
Base class defining event-level processing parameters for AIMBAT.
This class serves as a base that is inherited by the actual classes that create the database tables. The attributes correspond exactly to the AIMBAT event parameters.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
completed
|
bool
|
Mark an event as completed. |
False
|
ramp_width
|
float
|
Width of taper ramp up and down as a fraction of the window length. |
0.1
|
window_pre
|
PydanticNegativeTimedelta
|
Pre-pick window length in seconds. |
Timedelta('-1 days +23:59:45')
|
window_post
|
PydanticPositiveTimedelta
|
Post-pick window length in seconds. |
Timedelta('0 days 00:00:15')
|
bandpass_apply
|
bool
|
Whether to apply bandpass filter to seismograms. |
False
|
bandpass_fmin
|
float
|
Minimum frequency for bandpass filter in Hz (ignored if |
0.05
|
bandpass_fmax
|
float
|
Maximum frequency for bandpass filter in Hz (ignored if |
2.0
|
min_cc
|
float
|
Minimum cross-correlation used when automatically de-selecting seismograms. |
0.5
|
mccc_damp
|
float
|
Damping factor for MCCC algorithm. |
0.1
|
mccc_min_cc
|
float
|
Minimum correlation coefficient required to include a pair in the MCCC inversion. |
0.5
|
Methods:
| Name | Description |
|---|---|
check_freq_range |
Validate that |
validate_iccs_context |
Attempt ICCS construction with these parameters if requested. |
Source code in src/aimbat/models/_parameters.py
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 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 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 | |
check_freq_range
check_freq_range() -> Self
Validate that bandpass_fmax is strictly greater than bandpass_fmin.
Source code in src/aimbat/models/_parameters.py
validate_iccs_context
validate_iccs_context(info: ValidationInfo) -> Self
Attempt ICCS construction with these parameters if requested.
Requires validate_iccs=True and an event instance in the validation
context.
Source code in src/aimbat/models/_parameters.py
AimbatEventParametersSnapshot
Bases: AimbatEventParametersBase
Snapshot of processing parameters for a particular event.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
completed
|
bool
|
Mark an event as completed. |
False
|
ramp_width
|
float
|
Width of taper ramp up and down as a fraction of the window length. |
0.1
|
window_pre
|
PydanticNegativeTimedelta
|
Pre-pick window length in seconds. |
Timedelta('-1 days +23:59:45')
|
window_post
|
PydanticPositiveTimedelta
|
Post-pick window length in seconds. |
Timedelta('0 days 00:00:15')
|
bandpass_apply
|
bool
|
Whether to apply bandpass filter to seismograms. |
False
|
bandpass_fmin
|
float
|
Minimum frequency for bandpass filter in Hz (ignored if |
0.05
|
bandpass_fmax
|
float
|
Maximum frequency for bandpass filter in Hz (ignored if |
2.0
|
min_cc
|
float
|
Minimum cross-correlation used when automatically de-selecting seismograms. |
0.5
|
mccc_damp
|
float
|
Damping factor for MCCC algorithm. |
0.1
|
mccc_min_cc
|
float
|
Minimum correlation coefficient required to include a pair in the MCCC inversion. |
0.5
|
id
|
UUID
|
Unique ID. |
UUID('cb44d60e-3654-4480-a951-7c868833e10a')
|
snapshot_id
|
UUID
|
Foreign key referencing the parent snapshot. |
None
|
parameters_id
|
UUID
|
Foreign key referencing the source event parameters. |
None
|
Methods:
| Name | Description |
|---|---|
check_freq_range |
Validate that |
validate_iccs_context |
Attempt ICCS construction with these parameters if requested. |
Attributes:
| Name | Type | Description |
|---|---|---|
parameters |
AimbatEventParameters
|
The event parameters this snapshot was taken from. |
snapshot |
AimbatSnapshot
|
The snapshot this record belongs to. |
Source code in src/aimbat/models/_models.py
parameters
class-attribute
instance-attribute
parameters: AimbatEventParameters = Relationship(
back_populates="snapshots"
)
The event parameters this snapshot was taken from.
snapshot
class-attribute
instance-attribute
snapshot: AimbatSnapshot = Relationship(
back_populates="event_parameters_snapshot"
)
The snapshot this record belongs to.
check_freq_range
check_freq_range() -> Self
Validate that bandpass_fmax is strictly greater than bandpass_fmin.
Source code in src/aimbat/models/_parameters.py
validate_iccs_context
validate_iccs_context(info: ValidationInfo) -> Self
Attempt ICCS construction with these parameters if requested.
Requires validate_iccs=True and an event instance in the validation
context.
Source code in src/aimbat/models/_parameters.py
AimbatEventQuality
Bases: AimbatEventQualityBase
Live quality metrics for a seismic event.
One row per event. Updated in place whenever MCCC runs.
Fields are None until MCCC has been executed.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mccc_rmse
|
PydanticPositiveTimedelta | None
|
Root-mean-square error of the MCCC inversion fit across the whole array. |
None
|
id
|
UUID
|
Unique ID. |
UUID('ee121e56-06e3-4e95-ab1f-a6bf61ee6434')
|
event_id
|
UUID
|
Foreign key referencing the parent event. |
None
|
Attributes:
| Name | Type | Description |
|---|---|---|
event |
AimbatEvent
|
The event these quality metrics belong to. |
snapshots |
list[AimbatEventQualitySnapshot]
|
Quality snapshots taken from this live record. |
Source code in src/aimbat/models/_models.py
event
class-attribute
instance-attribute
event: AimbatEvent = Relationship(back_populates='quality')
The event these quality metrics belong to.
snapshots
class-attribute
instance-attribute
snapshots: list[AimbatEventQualitySnapshot] = Relationship(
back_populates="quality", cascade_delete=True
)
Quality snapshots taken from this live record.
AimbatEventQualityBase
Bases: SQLModel
Base class defining event-level quality metrics.
Fields are None when the corresponding algorithm has not been run yet.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mccc_rmse
|
PydanticPositiveTimedelta | None
|
Root-mean-square error of the MCCC inversion fit across the whole array. |
None
|
Source code in src/aimbat/models/_quality.py
AimbatEventQualitySnapshot
Bases: AimbatEventQualityBase
Snapshot of quality metrics for a seismic event.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mccc_rmse
|
PydanticPositiveTimedelta | None
|
Root-mean-square error of the MCCC inversion fit across the whole array. |
None
|
id
|
UUID
|
Unique ID. |
UUID('9a312876-6b9a-42ef-bd79-d21f6764e681')
|
event_quality_id
|
UUID
|
Foreign key referencing the source event quality. |
None
|
snapshot_id
|
UUID
|
Foreign key referencing the parent snapshot. |
None
|
Attributes:
| Name | Type | Description |
|---|---|---|
quality |
AimbatEventQuality
|
The event quality this snapshot was taken from. |
snapshot |
AimbatSnapshot
|
The snapshot this record belongs to. |
Source code in src/aimbat/models/_models.py
quality
class-attribute
instance-attribute
quality: AimbatEventQuality = Relationship(
back_populates="snapshots"
)
The event quality this snapshot was taken from.
snapshot
class-attribute
instance-attribute
snapshot: AimbatSnapshot = Relationship(
back_populates="event_quality_snapshot"
)
The snapshot this record belongs to.
AimbatEventRead
Bases: BaseModel
Read model for AimbatEvent including computed counts.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
UUID
|
Unique identifier for the event |
required |
short_id
|
str | None
|
Shortened unique identifier |
None
|
completed
|
bool
|
Indicates if the event's parameters are marked as completed |
required |
time
|
PydanticTimestamp
|
Origin time of the event |
required |
latitude
|
float
|
Latitude of the event |
required |
longitude
|
float
|
Longitude of the event |
required |
depth
|
float | None
|
Depth of the event |
required |
seismogram_count
|
int
|
Number of seismograms associated with this event |
required |
station_count
|
int
|
Number of stations associated with this event |
required |
snapshot_count
|
int
|
Number of snapshots associated with this event |
required |
last_modified
|
PydanticTimestamp | None
|
Timestamp of the last modification of this event's parameters |
None
|
Methods:
| Name | Description |
|---|---|
from_event |
Create an AimbatEventRead from an AimbatEvent ORM instance. |
Source code in src/aimbat/models/_readers.py
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 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 | |
from_event
classmethod
from_event(
event: "AimbatEvent", session: "Session | None" = None
) -> Self
Create an AimbatEventRead from an AimbatEvent ORM instance.
Source code in src/aimbat/models/_readers.py
AimbatNote
Bases: SQLModel
Free-text Markdown note attached to an event, station, seismogram, or snapshot.
At most one of the four FK fields is set per row. Deletion of the parent record cascades to delete the note via the DB-level foreign key constraint.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
UUID
|
Unique note ID. |
UUID('f696058c-dd29-4968-b94a-eebd4e7bac13')
|
content
|
str
|
Note content in Markdown format. |
''
|
event_id
|
UUID | None
|
Foreign key referencing the parent event. |
None
|
station_id
|
UUID | None
|
Foreign key referencing the parent station. |
None
|
seismogram_id
|
UUID | None
|
Foreign key referencing the parent seismogram. |
None
|
snapshot_id
|
UUID | None
|
Foreign key referencing the parent snapshot. |
None
|
Source code in src/aimbat/models/_models.py
AimbatSeismogram
Bases: SQLModel
Class to store seismogram metadata.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
UUID
|
Unique seismogram ID. |
UUID('30504b86-88bf-4565-92f9-fa3f6e0191bf')
|
begin_time
|
PydanticTimestamp
|
Start time of the seismogram. |
required |
delta
|
PydanticPositiveTimedelta
|
Sampling interval. |
required |
t0
|
PydanticTimestamp
|
Initial phase arrival pick. |
required |
station_id
|
UUID
|
Foreign key referencing the recording station. |
None
|
event_id
|
UUID
|
Foreign key referencing the parent event. |
None
|
extra
|
dict[Hashable, Any]
|
Dictionary to store any additional metadata for the seismogram. |
<class 'dict'>
|
Methods:
| Name | Description |
|---|---|
end_time |
End time of the seismogram, derived from begin_time, delta, and data length. |
Attributes:
| Name | Type | Description |
|---|---|---|
data |
NDArray[float64]
|
Seismogram waveform data array. |
datasource |
AimbatDataSource
|
Data source for the seismogram waveform. |
event |
AimbatEvent
|
The event this seismogram belongs to. |
flip |
bool
|
Whether the seismogram should be flipped. |
parameters |
AimbatSeismogramParameters
|
Processing parameters for this seismogram. |
quality |
AimbatSeismogramQuality | None
|
Live quality metrics for this seismogram. |
select |
bool
|
Whether this seismogram should be used for processing. |
station |
AimbatStation
|
The station that recorded this seismogram. |
t1 |
Timestamp | None
|
Working phase arrival pick. |
Source code in src/aimbat/models/_models.py
421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 | |
datasource
class-attribute
instance-attribute
datasource: AimbatDataSource = Relationship(
back_populates="seismogram", cascade_delete=True
)
Data source for the seismogram waveform.
event
class-attribute
instance-attribute
event: AimbatEvent = Relationship(
back_populates="seismograms"
)
The event this seismogram belongs to.
parameters
class-attribute
instance-attribute
parameters: AimbatSeismogramParameters = Relationship(
back_populates="seismogram", cascade_delete=True
)
Processing parameters for this seismogram.
quality
class-attribute
instance-attribute
quality: AimbatSeismogramQuality | None = Relationship(
back_populates="seismogram", cascade_delete=True
)
Live quality metrics for this seismogram.
station
class-attribute
instance-attribute
station: AimbatStation = Relationship(
back_populates="seismograms"
)
The station that recorded this seismogram.
end_time
End time of the seismogram, derived from begin_time, delta, and data length.
Source code in src/aimbat/models/_models.py
AimbatSeismogramParameters
Bases: AimbatSeismogramParametersBase
Processing parameters for a single seismogram.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
flip
|
bool
|
Whether or not the seismogram should be flipped. |
False
|
select
|
bool
|
Whether or not this seismogram should be used for processing. |
True
|
t1
|
PydanticTimestamp | None
|
Working pick. This pick serves as working as well as output pick. It is changed by: 1. Picking the phase arrival in the stack, 2. Running ICCS, 3. Running MCCC. |
None
|
id
|
UUID
|
Unique ID. |
UUID('2ee96b79-bc62-4897-be98-2742a6fbcc72')
|
seismogram_id
|
UUID
|
Foreign key referencing the parent seismogram. |
None
|
Attributes:
| Name | Type | Description |
|---|---|---|
seismogram |
AimbatSeismogram
|
The seismogram these parameters belong to. |
snapshots |
list[AimbatSeismogramParametersSnapshot]
|
Parameter snapshots for this seismogram. |
Source code in src/aimbat/models/_models.py
seismogram
class-attribute
instance-attribute
seismogram: AimbatSeismogram = Relationship(
back_populates="parameters"
)
The seismogram these parameters belong to.
snapshots
class-attribute
instance-attribute
snapshots: list[AimbatSeismogramParametersSnapshot] = (
Relationship(
back_populates="parameters", cascade_delete=True
)
)
Parameter snapshots for this seismogram.
AimbatSeismogramParametersBase
Bases: SQLModel
Base class defining seismogram-level processing parameters for AIMBAT.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
flip
|
bool
|
Whether or not the seismogram should be flipped. |
False
|
select
|
bool
|
Whether or not this seismogram should be used for processing. |
True
|
t1
|
PydanticTimestamp | None
|
Working pick. This pick serves as working as well as output pick. It is changed by: 1. Picking the phase arrival in the stack, 2. Running ICCS, 3. Running MCCC. |
None
|
Source code in src/aimbat/models/_parameters.py
AimbatSeismogramParametersSnapshot
Bases: AimbatSeismogramParametersBase
Snapshot of processing parameters for a single seismogram.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
flip
|
bool
|
Whether or not the seismogram should be flipped. |
False
|
select
|
bool
|
Whether or not this seismogram should be used for processing. |
True
|
t1
|
PydanticTimestamp | None
|
Working pick. This pick serves as working as well as output pick. It is changed by: 1. Picking the phase arrival in the stack, 2. Running ICCS, 3. Running MCCC. |
None
|
id
|
UUID
|
Unique ID. |
UUID('1e449615-9e14-4bd4-ac70-038b808ce4af')
|
seismogram_parameters_id
|
UUID
|
Foreign key referencing the source seismogram parameters. |
required |
snapshot_id
|
UUID
|
Foreign key referencing the parent snapshot. |
None
|
Attributes:
| Name | Type | Description |
|---|---|---|
parameters |
AimbatSeismogramParameters
|
The seismogram parameters this snapshot was taken from. |
snapshot |
AimbatSnapshot
|
The snapshot this record belongs to. |
Source code in src/aimbat/models/_models.py
parameters
class-attribute
instance-attribute
parameters: AimbatSeismogramParameters = Relationship(
back_populates="snapshots"
)
The seismogram parameters this snapshot was taken from.
snapshot
class-attribute
instance-attribute
snapshot: AimbatSnapshot = Relationship(
back_populates="seismogram_parameters_snapshots"
)
The snapshot this record belongs to.
AimbatSeismogramQuality
Bases: AimbatSeismogramQualityBase
Live quality metrics for a single seismogram.
One row per seismogram. Updated in place whenever ICCS or MCCC runs.
Fields are None until the corresponding algorithm has been executed.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
iccs_cc
|
float | None
|
Pearson cross-correlation coefficient of this seismogram with the ICCS stack. |
None
|
mccc_cc_mean
|
float | None
|
Mean cross-correlation coefficient from the MCCC run (waveform quality). |
None
|
mccc_cc_std
|
float | None
|
Standard deviation of cross-correlation coefficients from the MCCC run (waveform consistency). |
None
|
mccc_error
|
PydanticPositiveTimedelta | None
|
Timing precision (standard error from covariance matrix) from the MCCC run. |
None
|
id
|
UUID
|
Unique ID. |
UUID('7c92d5c7-4154-4629-b874-544d671fd69d')
|
seismogram_id
|
UUID
|
Foreign key referencing the parent seismogram. |
None
|
Attributes:
| Name | Type | Description |
|---|---|---|
seismogram |
AimbatSeismogram
|
The seismogram these quality metrics belong to. |
snapshots |
list[AimbatSeismogramQualitySnapshot]
|
Quality snapshots taken from this live record. |
Source code in src/aimbat/models/_models.py
seismogram
class-attribute
instance-attribute
seismogram: AimbatSeismogram = Relationship(
back_populates="quality"
)
The seismogram these quality metrics belong to.
snapshots
class-attribute
instance-attribute
snapshots: list[AimbatSeismogramQualitySnapshot] = (
Relationship(
back_populates="quality", cascade_delete=True
)
)
Quality snapshots taken from this live record.
AimbatSeismogramQualityBase
Bases: SQLModel
Base class defining seismogram-level quality metrics.
Fields are None when the corresponding algorithm has not been run for
this seismogram.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
iccs_cc
|
float | None
|
Pearson cross-correlation coefficient of this seismogram with the ICCS stack. |
None
|
mccc_cc_mean
|
float | None
|
Mean cross-correlation coefficient from the MCCC run (waveform quality). |
None
|
mccc_cc_std
|
float | None
|
Standard deviation of cross-correlation coefficients from the MCCC run (waveform consistency). |
None
|
mccc_error
|
PydanticPositiveTimedelta | None
|
Timing precision (standard error from covariance matrix) from the MCCC run. |
None
|
Source code in src/aimbat/models/_quality.py
AimbatSeismogramQualitySnapshot
Bases: AimbatSeismogramQualityBase
Snapshot of quality metrics for a single seismogram.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
iccs_cc
|
float | None
|
Pearson cross-correlation coefficient of this seismogram with the ICCS stack. |
None
|
mccc_cc_mean
|
float | None
|
Mean cross-correlation coefficient from the MCCC run (waveform quality). |
None
|
mccc_cc_std
|
float | None
|
Standard deviation of cross-correlation coefficients from the MCCC run (waveform consistency). |
None
|
mccc_error
|
PydanticPositiveTimedelta | None
|
Timing precision (standard error from covariance matrix) from the MCCC run. |
None
|
id
|
UUID
|
Unique ID. |
UUID('159c30fb-85de-4c17-adf9-9bfd37846823')
|
seismogram_quality_id
|
UUID
|
Foreign key referencing the source seismogram quality. |
None
|
snapshot_id
|
UUID
|
Foreign key referencing the parent snapshot. |
None
|
Attributes:
| Name | Type | Description |
|---|---|---|
quality |
AimbatSeismogramQuality
|
The seismogram quality this snapshot was taken from. |
snapshot |
AimbatSnapshot
|
The snapshot this record belongs to. |
Source code in src/aimbat/models/_models.py
quality
class-attribute
instance-attribute
quality: AimbatSeismogramQuality = Relationship(
back_populates="snapshots"
)
The seismogram quality this snapshot was taken from.
snapshot
class-attribute
instance-attribute
snapshot: AimbatSnapshot = Relationship(
back_populates="seismogram_quality_snapshots"
)
The snapshot this record belongs to.
AimbatSeismogramRead
Bases: BaseModel
Read model for AimbatSeismogram including parameters.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
UUID
|
Unique identifier for the seismogram |
required |
short_id
|
str | None
|
Shortened unique identifier |
None
|
name
|
str
|
Name of the seismogram. |
required |
channel
|
str
|
Seismogram channel. |
required |
select
|
bool
|
Whether the seismogram is selected for processing. |
required |
flip
|
bool
|
Whether the seismogram is flipped for processing. |
required |
delta_t
|
PydanticTimedelta | None
|
Arrival time residual (observed - predicted) in seconds. |
required |
mccc_error
|
PydanticTimedelta | None
|
Uncertainty in the MCCC arrival time residual (observed - predicted) in seconds. |
required |
iccs_cc
|
float | None
|
Cross-correlation coefficient with ICCS stack. |
required |
mccc_cc_mean
|
float | None
|
Mean cross-correlation coefficient of MCCC cluster. |
required |
mccc_cc_std
|
float | None
|
Standard deviation of cross-correlation coefficients in MCCC cluster. |
required |
event_id
|
UUID
|
ID of the associated event. |
required |
short_event_id
|
str | None
|
Shortened unique identifier for the associated event. |
required |
Source code in src/aimbat/models/_readers.py
407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 | |
AimbatSnapshot
Bases: SQLModel
Container for a point-in-time snapshot of event and seismogram parameters.
The AimbatSnapshot class does not actually save any parameter data. It is used to keep track of the AimbatEventParametersSnapshot and AimbatSeismogramParametersSnapshot instances.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
UUID
|
Unique ID. |
UUID('2cf15c70-5a39-47ae-ad2f-a12cf2cb8475')
|
time
|
PydanticTimestamp
|
Timestamp when the snapshot was created. |
Timestamp('2026-03-20 16:54:52.583201+0000', tz='UTC')
|
comment
|
str | None
|
Optional comment for the snapshot. |
None
|
parameters_hash
|
str | None
|
SHA-256 hash of event and seismogram parameters at creation time. |
None
|
event_id
|
UUID
|
Foreign key referencing the parent event. |
None
|
Attributes:
| Name | Type | Description |
|---|---|---|
event |
AimbatEvent
|
The event this snapshot belongs to. |
event_parameters_snapshot |
AimbatEventParametersSnapshot
|
Event parameter snapshot associated with this snapshot. |
event_quality_snapshot |
AimbatEventQualitySnapshot | None
|
Event quality metric snapshot associated with this snapshot. |
seismogram_parameters_snapshots |
list[AimbatSeismogramParametersSnapshot]
|
Seismogram parameter snapshots associated with this snapshot. |
seismogram_quality_snapshots |
list[AimbatSeismogramQualitySnapshot]
|
Seismogram quality metric snapshots associated with this snapshot. |
Source code in src/aimbat/models/_models.py
event
class-attribute
instance-attribute
event: AimbatEvent = Relationship(
back_populates="snapshots"
)
The event this snapshot belongs to.
event_parameters_snapshot
class-attribute
instance-attribute
event_parameters_snapshot: AimbatEventParametersSnapshot = (
Relationship(
back_populates="snapshot", cascade_delete=True
)
)
Event parameter snapshot associated with this snapshot.
event_quality_snapshot
class-attribute
instance-attribute
event_quality_snapshot: (
AimbatEventQualitySnapshot | None
) = Relationship(
back_populates="snapshot", cascade_delete=True
)
Event quality metric snapshot associated with this snapshot.
seismogram_parameters_snapshots
class-attribute
instance-attribute
seismogram_parameters_snapshots: list[
AimbatSeismogramParametersSnapshot
] = Relationship(
back_populates="snapshot", cascade_delete=True
)
Seismogram parameter snapshots associated with this snapshot.
seismogram_quality_snapshots
class-attribute
instance-attribute
seismogram_quality_snapshots: list[
AimbatSeismogramQualitySnapshot
] = Relationship(
back_populates="snapshot", cascade_delete=True
)
Seismogram quality metric snapshots associated with this snapshot.
AimbatSnapshotRead
Bases: BaseModel
Read model for AimbatSnapshot with a seismogram count.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
UUID
|
Unique identifier for the snapshot |
required |
short_id
|
str | None
|
Shortened unique identifier |
None
|
time
|
PydanticTimestamp
|
Timestamp of the snapshot |
required |
comment
|
str | None
|
Optional comment for the snapshot |
required |
seismogram_count
|
int
|
Total number of seismograms in the snapshot |
required |
selected_seismogram_count
|
int
|
Number of selected seismograms in the snapshot |
required |
flipped_seismogram_count
|
int
|
Number of flipped seismograms in the snapshot |
required |
cc_mean
|
float | None
|
Mean cross-correlation coefficient for this snapshot |
None
|
cc_sem
|
float | None
|
Standard error of the mean of cross-correlation coefficients for this snapshot |
None
|
mccc
|
bool | None
|
Whether MCCC parameters are included in this snapshot |
None
|
event_id
|
UUID
|
ID of the associated event |
required |
short_event_id
|
str | None
|
Shortened unique identifier for the associated event |
required |
Methods:
| Name | Description |
|---|---|
from_snapshot |
Create an AimbatSnapshotRead from an AimbatSnapshot ORM instance. |
Source code in src/aimbat/models/_readers.py
535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 | |
from_snapshot
classmethod
from_snapshot(
snapshot: AimbatSnapshot, session: Session | None = None
) -> Self
Create an AimbatSnapshotRead from an AimbatSnapshot ORM instance.
Source code in src/aimbat/models/_readers.py
AimbatStation
Bases: SQLModel
Recording station with network, location, and channel metadata.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
UUID
|
Unique station ID. |
UUID('b36c4b94-888e-46ff-95ec-c56b33542158')
|
name
|
str
|
Station name (SEED station code). |
required |
network
|
str
|
Network code. |
required |
location
|
str
|
Location code. |
required |
channel
|
str
|
Channel code (e.g. BHZ). |
required |
latitude
|
float
|
Station latitude in degrees. |
required |
longitude
|
float
|
Station longitude in degrees. |
required |
elevation
|
float | None
|
Station elevation in metres. |
None
|
Attributes:
| Name | Type | Description |
|---|---|---|
seismograms |
list[AimbatSeismogram]
|
Seismograms recorded at this station. |
Source code in src/aimbat/models/_models.py
seismograms
class-attribute
instance-attribute
seismograms: list[AimbatSeismogram] = Relationship(
back_populates="station", cascade_delete=True
)
Seismograms recorded at this station.
AimbatStationRead
Bases: BaseModel
Read model for AimbatStation including parameters.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
UUID
|
Unique identifier for the station |
required |
short_id
|
str | None
|
Shortened unique identifier |
None
|
network
|
str
|
Station network code |
required |
name
|
str
|
Station name |
required |
location
|
str | None
|
Station location code |
required |
channel
|
str
|
Station channel code |
required |
latitude
|
float
|
Station latitude |
required |
longitude
|
float
|
Station longitude |
required |
elevation
|
float | None
|
Station elevation |
None
|
cc_mean
|
float | None
|
Mean cross-correlation coefficient at this station |
None
|
cc_sem
|
float | None
|
Standard error of the mean of cross-correlation coefficients at this station |
None
|
seismogram_count
|
int
|
Number of seismograms associated with this station |
required |
event_count
|
int
|
Number of unique events recorded at this station |
required |
Source code in src/aimbat/models/_readers.py
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 347 348 349 350 351 352 353 354 355 356 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 | |
RichColSpec
Bases: BaseModel
Display metadata for a model field rendered in a Rich table.
Attach to a field via json_schema_extra={"rich": RichColSpec(...)}.
Only attributes that differ from the field's defaults need to be set.
Attributes:
| Name | Type | Description |
|---|
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
display_title
|
str | None
|
|
None
|
justify
|
Literal['left', 'center', 'right'] | None
|
|
None
|
style
|
str | None
|
|
None
|
no_wrap
|
bool | None
|
|
None
|
highlight
|
bool | None
|
|
True
|
formatter
|
Callable[list, str] | None
|
|
None
|
Source code in src/aimbat/models/_format.py
SeismogramQualityStats
Bases: BaseModel
Aggregated seismogram quality statistics for an event or station.
Built from live quality records. All mean fields are None when no
seismograms in the group have quality data. SEM fields are None when
fewer than two values are available. mccc_rmse is only populated by
from_event and from_snapshot; it is always None for from_station.
event_id is populated by from_event and from_snapshot; it is always
None for from_station.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
event_id
|
UUID | None
|
|
None
|
snapshot_id
|
UUID | None
|
|
None
|
station_id
|
UUID | None
|
|
None
|
count
|
int
|
|
required |
cc_mean
|
float | None
|
|
None
|
cc_mean_sem
|
float | None
|
|
None
|
mccc_cc_mean
|
float | None
|
|
None
|
mccc_cc_mean_sem
|
float | None
|
|
None
|
mccc_cc_std
|
float | None
|
|
None
|
mccc_cc_std_sem
|
float | None
|
|
None
|
mccc_error
|
PydanticTimedelta | None
|
|
None
|
mccc_error_sem
|
PydanticTimedelta | None
|
|
None
|
mccc_rmse
|
PydanticTimedelta | None
|
|
None
|
Methods:
| Name | Description |
|---|---|
from_event |
Build quality stats from live quality records for an event. |
from_snapshot |
Build quality stats from the frozen quality records in a snapshot. |
from_station |
Build quality stats from live quality records for a station. |
Source code in src/aimbat/models/_readers.py
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 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 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 175 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 | |
from_event
classmethod
from_event(event: AimbatEvent) -> Self
Build quality stats from live quality records for an event.
Aggregates iccs_cc and MCCC metrics across all seismograms that
have live quality records. mccc_rmse is taken from the event-level
quality record.
Warning
This method may trigger lazy-loading of event.seismograms and
each seis.quality relationship. For performance, query event
with selectinload for seismograms and their nested quality
relationships before calling.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
event
|
AimbatEvent
|
The event whose seismograms' live quality to aggregate. |
required |
Returns:
| Type | Description |
|---|---|
Self
|
Aggregated quality statistics. |
Source code in src/aimbat/models/_readers.py
from_snapshot
classmethod
from_snapshot(snapshot: AimbatSnapshot) -> Self
Build quality stats from the frozen quality records in a snapshot.
Aggregates from AimbatSeismogramQualitySnapshot records rather than
live quality, so the result reflects the state at snapshot time.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
snapshot
|
AimbatSnapshot
|
The snapshot to aggregate quality from. |
required |
Returns:
| Type | Description |
|---|---|
Self
|
Aggregated quality statistics. |
Source code in src/aimbat/models/_readers.py
from_station
classmethod
from_station(station: AimbatStation) -> Self
Build quality stats from live quality records for a station.
Aggregates iccs_cc and MCCC metrics across all seismograms at the
station that have live quality records.
Warning
This method may trigger lazy-loading of station.seismograms and
each seis.quality relationship. For performance, query station
with selectinload for seismograms and their nested quality
relationships before calling.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
station
|
AimbatStation
|
The station whose seismograms' live quality to aggregate. |
required |
Returns:
| Type | Description |
|---|---|
Self
|
Aggregated quality statistics. |
Source code in src/aimbat/models/_readers.py
TuiColSpec
dataclass
Display metadata for a model field rendered in the TUI.
Attach to a field via json_schema_extra={"tui": TuiColSpec(...)}.
Only attributes that differ from the field's defaults need to be set.
Attributes:
| Name | Type | Description |
|---|
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
display_title
|
str | None
|
|
None
|
text_align
|
Literal['left', 'center', 'right'] | None
|
|
None
|
formatter
|
Formatter[Any] | None
|
|
None
|