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. Only one event can be active at a time, enforced by a database constraint on theactivecolumn.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.
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 |
Class to store seismic event information. |
AimbatEventParameters |
Processing parameters common to all seismograms of a particular event. |
AimbatEventParametersSnapshot |
Snapshot of processing parameters for a particular event. |
AimbatSeismogram |
Class to store seismogram metadata. |
AimbatSeismogramParameters |
Processing parameters for a single seismogram. |
AimbatSeismogramParametersSnapshot |
Snapshot of processing parameters for a single seismogram. |
AimbatSnapshot |
Container for a point-in-time snapshot of event and seismogram parameters. |
AimbatStation |
Class to store station information. |
AimbatTypes
AimbatTypes = (
AimbatDataSource
| AimbatStation
| AimbatEvent
| AimbatEventParameters
| AimbatSeismogram
| AimbatSeismogramParameters
| AimbatSnapshot
| AimbatEventParametersSnapshot
| AimbatSeismogramParametersSnapshot
)
Union of all AIMBAT models that exist in the database.
AimbatDataSource
Bases: SQLModel
Class to store data source information.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
UUID
|
Unique ID. |
UUID('9a9b1640-3e9e-4624-ab5b-91e24025a8f8')
|
sourcename
|
str
|
Path or name of the data source. |
required |
datatype
|
DataType
|
Data type of the data source. |
required |
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
Class to store seismic event information.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
UUID
|
Unique ID. |
UUID('403e6264-a9ef-43bc-9c56-f560705aa1e0')
|
active
|
bool | None
|
Indicates if an event is the active event. |
None
|
time
|
PydanticTimestamp
|
Event time. |
required |
latitude
|
float
|
Event latitude. |
required |
longitude
|
float
|
Event longitude. |
required |
depth
|
float | None
|
Event depth. |
None
|
Attributes:
| Name | Type | Description |
|---|---|---|
parameters |
AimbatEventParameters
|
Event parameters. |
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.
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
|
min_ccnorm
|
float
|
Minimum cross-correlation used when automatically de-selecting seismograms. |
0.5
|
window_pre
|
PydanticNegativeTimedelta
|
Pre-pick window length. |
Timedelta('-1 days +23:59:45')
|
window_post
|
PydanticPositiveTimedelta
|
Post-pick window length. |
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 (ignored if |
0.05
|
bandpass_fmax
|
float
|
Maximum frequency for bandpass filter (ignored if |
2.0
|
mccc_damp
|
float
|
Damping factor for MCCC algorithm. |
0.1
|
mccc_min_ccnorm
|
float
|
Minimum correlation coefficient required to include a pair in the MCCC inversion. |
0.5
|
id
|
UUID
|
Unique ID. |
UUID('0132c627-81ea-4ab6-91c0-cbfbfa96c863')
|
event_id
|
UUID
|
Foreign key referencing the parent event. |
None
|
Methods:
| Name | Description |
|---|---|
check_freq_range |
Validate that |
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
AimbatEventParametersSnapshot
Bases: AimbatEventParametersBase
Snapshot of processing parameters for a particular event.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
completed
|
bool
|
Mark an event as completed. |
False
|
min_ccnorm
|
float
|
Minimum cross-correlation used when automatically de-selecting seismograms. |
0.5
|
window_pre
|
PydanticNegativeTimedelta
|
Pre-pick window length. |
Timedelta('-1 days +23:59:45')
|
window_post
|
PydanticPositiveTimedelta
|
Post-pick window length. |
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 (ignored if |
0.05
|
bandpass_fmax
|
float
|
Maximum frequency for bandpass filter (ignored if |
2.0
|
mccc_damp
|
float
|
Damping factor for MCCC algorithm. |
0.1
|
mccc_min_ccnorm
|
float
|
Minimum correlation coefficient required to include a pair in the MCCC inversion. |
0.5
|
id
|
UUID
|
Unique ID. |
UUID('7dee5868-91bc-4830-8109-bfaeb9ffd93e')
|
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 |
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
AimbatSeismogram
Bases: SQLModel
Class to store seismogram metadata.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
UUID
|
Unique ID. |
UUID('9299aaed-6be7-4165-be7d-7ae388f72b96')
|
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
|
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. |
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
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 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 | |
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.
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('e28e8f03-dd40-4787-97d1-c1f95ac91b14')
|
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.
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('a5449322-eca9-49bd-b83a-5f568408d603')
|
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.
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('fa3c002c-aec4-49de-8e81-002005763a6c')
|
date
|
PydanticTimestamp
|
Timestamp when the snapshot was created. |
Timestamp('2026-02-27 03:09:06.575884+0000', tz='UTC')
|
comment
|
str | None
|
Optional comment for the snapshot. |
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. |
seismogram_parameters_snapshots |
list[AimbatSeismogramParametersSnapshot]
|
Seismogram parameter 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.
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.
AimbatStation
Bases: SQLModel
Class to store station information.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
UUID
|
Unique ID. |
UUID('8059d721-b3c8-48db-a632-afc2e25e7c53')
|
name
|
str
|
Station name. |
required |
network
|
str
|
Network name. |
required |
location
|
str
|
Location ID. |
required |
channel
|
str
|
Channel code. |
required |
latitude
|
float
|
Station latitude. |
required |
longitude
|
float
|
Station longitude. |
required |
elevation
|
float | None
|
Station elevation. |
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.