Models
qseek.models.location.Location
pydantic-model
Bases: BaseModel
Fields:
-
lat(float) -
lon(float) -
east_shift(float) -
north_shift(float) -
elevation(float) -
depth(float) -
_cached_lat_lon(tuple[float, float] | None) -
_cached_origin(Location | None)
east_shift
pydantic-field
east_shift: float = 0.0
East shift towards geographical reference in meters.
effective_lat_lon
property
Shift-corrected lat/lon pair of the location.
north_shift
pydantic-field
north_shift: float = 0.0
North shift towards geographical reference in meters.
azimuth_to
distance_to
offset_from
origin
origin() -> Location
shift
shifted_origin
Shift the origin of the location to the effective lat/lon.
Returns:
| Name | Type | Description |
|---|---|---|
Self |
Self
|
The shifted location. |
qseek.models.detection.EventDetection
pydantic-model
Bases: Location
Fields:
-
lat(float) -
lon(float) -
east_shift(float) -
north_shift(float) -
elevation(float) -
depth(float) -
_cached_lat_lon(tuple[float, float] | None) -
_cached_origin(Location | None) -
uid(UUID) -
time(AwareDatetime) -
semblance(PositiveFloat) -
n_stations(int) -
distance_border(PositiveFloat) -
in_bounds(bool) -
uncertainty(DetectionUncertainty | None) -
magnitudes(list[EventMagnitudeType]) -
features(list[EventFeaturesType]) -
_receivers(EventReceivers | None) -
_detection_idx(int | None) -
_receiver_cache(ReceiverCache | None)
Validators:
-
migrate_features→features
distance_border
pydantic-field
distance_border: PositiveFloat
Distance to the nearest border in meters. Only distance to NW, SW and bottom border is considered.
east_shift
pydantic-field
east_shift: float = 0.0
East shift towards geographical reference in meters.
effective_lat_lon
property
Shift-corrected lat/lon pair of the location.
in_bounds
pydantic-field
in_bounds: bool = True
Is detection in bounds, and inside the configured border.
magnitude
property
Returns the magnitude of the event.
If there are no magnitudes available, returns None.
north_shift
pydantic-field
north_shift: float = 0.0
North shift towards geographical reference in meters.
receivers
property
Retrieves the event receivers associated with the detection.
Returns:
| Name | Type | Description |
|---|---|---|
EventReceivers |
EventReceivers
|
The event receivers associated with the detection. |
Raises:
| Type | Description |
|---|---|
AttributeError
|
If the receivers cannot be fetched without a set rundir and detection index. |
ValueError
|
If the receivers cannot be fetched due to missing rundir and index, or if there is a UID mismatch between the fetched receivers and the detection. |
add_feature
Add feature to the feature set.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
feature
|
EventFeature
|
Feature to add |
required |
add_magnitude
Add magnitude to detection.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
magnitude
|
EventMagnitudeType
|
magnitude |
required |
as_pyrocko_event
Get detection as Pyrocko event.
Returns:
| Name | Type | Description |
|---|---|---|
Event |
Event
|
Pyrocko event |
azimuth_to
distance_to
export_csv_line
export_pyrocko_event
export_pyrocko_markers
export_pyrocko_markers(filename: Path) -> None
Save detection's Pyrocko markers to file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filename
|
Path
|
path to marker file |
required |
get_azimuthal_coverage
Get azimuthal coverage of the detection.
This is the reverse of the azimuthal gap: 360 - azimuthal_gap.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
observed_only
|
bool
|
Consider only observed azimuths. Defaults to True. |
True
|
get_azimuthal_gap
Get maximum azimuthal gap of the detection.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
observed_only
|
bool
|
Consider only observed azimuths. Defaults to True. |
True
|
get_csv_dict
get_pyrocko_markers
get_pyrocko_markers(modelled: bool = True, observed: bool = True) -> list[EventMarker | PhaseMarker]
Get detections as Pyrocko markers.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
modelled
|
bool
|
Include modelled arrivals. Defaults to True. |
True
|
observed
|
bool
|
Include observed arrivals. Defaults to True. |
True
|
Returns:
| Type | Description |
|---|---|
list[EventMarker | PhaseMarker]
|
list[marker.EventMarker | marker.PhaseMarker]: Pyrocko markers |
get_receiver_azimuths
get_receiver_azimuths(observed_only: bool = True)
Get receiver azimuths.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
observed_only
|
bool
|
Return only observed azimuths. Defaults to False. |
True
|
Returns:
| Type | Description |
|---|---|
|
dict[str, float]: Receiver azimuths |
jitter_location
jitter_location(meters: float) -> Self
Randomize detection location.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
meters
|
float
|
maximum randomization in meters |
required |
Returns:
| Name | Type | Description |
|---|---|---|
EventDetection |
Self
|
spatially jittered detection |
offset_from
origin
origin() -> Location
save
async
Dump the detection data to a file.
After the detection is dumped, the receivers are dumped to a separate file and the receivers cache is cleared.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
rundir
|
Path
|
The path to the rundir. |
required |
update
|
bool
|
Whether to update an existing detection or append a new one. |
False
|
jitter_location
|
float
|
The amount of spatial jitter to apply to the exported detection. Defaults to 0.0. |
0.0
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If the detection index is not set and update is True. |
set_index
set_receiver_cache
set_receiver_cache(rundir: Path) -> None
Set the rundir for the detection model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
rundir
|
Path
|
The path to the rundir. |
required |
set_uncertainty
Set detection uncertainty.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
uncertainty
|
DetectionUncertainty
|
detection uncertainty |
required |
shift
shifted_origin
Shift the origin of the location to the effective lat/lon.
Returns:
| Name | Type | Description |
|---|---|---|
Self |
Self
|
The shifted location. |
snuffle
snuffle(squirrel: Squirrel, restituted: bool | MeasurementUnit = False) -> None
Open snuffler for detection.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
squirrel
|
Squirrel
|
The squirrel, holding the data |
required |
restituted
|
bool
|
Restitude the data. Defaults to False. |
False
|
surface_distance_to
update
async
update(rundir: Path) -> None
Update detection in database.
Doing this often requires a lot of I/O.