anss-formats 0.1.0__tar.gz → 0.1.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,24 @@
1
+ Metadata-Version: 2.4
2
+ Name: anss-formats
3
+ Version: 0.1.1
4
+ Summary: Python implementation of the library used to communicate seismic event detection information between systems
5
+ License: CC0-1.0
6
+ Keywords: anss,earthquakes,formats,detection
7
+ Author: John Patton
8
+ Author-email: jpatton@usgs.gov
9
+ Requires-Python: >3.9.1,<3.12
10
+ Classifier: License :: CC0 1.0 Universal (CC0 1.0) Public Domain Dedication
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Programming Language :: Python :: 3.10
13
+ Classifier: Programming Language :: Python :: 3.11
14
+ Provides-Extra: pycurl
15
+ Requires-Dist: certifi (>=2024.07.04,<2025.0.0)
16
+ Requires-Dist: cryptography (>=42.0.5)
17
+ Requires-Dist: docutils (!=0.21.post1)
18
+ Requires-Dist: dparse (>=0.6.2,<0.7.0)
19
+ Requires-Dist: pydantic (>=2.6.0,<3.0.0)
20
+ Requires-Dist: requests (>=2.32.2,<3.0.0)
21
+ Requires-Dist: twine (>=5.1.1,<6.0.0)
22
+ Requires-Dist: urllib3 (>=2.6.0,<3.0.0)
23
+ Project-URL: Homepage, https://gitlab.com/anss-netops/anss-data-formats
24
+ Project-URL: Repository, https://gitlab.com/anss-netops/anss-data-formats
@@ -0,0 +1,26 @@
1
+ from anssformats.pick import Pick
2
+ from anssformats.source import Source
3
+ from anssformats.amplitude import Amplitude
4
+ from anssformats.analytics import Analytics, Prediction
5
+ from anssformats.association import Association
6
+ from anssformats.detection import Detection
7
+ from anssformats.hypocenter import Hypocenter
8
+ from anssformats.magnitude import Magnitude
9
+ from anssformats.channel import Channel
10
+ from anssformats.filter import Filter
11
+ from anssformats.eventType import EventType
12
+
13
+ __all__ = [
14
+ "Pick",
15
+ "Source",
16
+ "Amplitude",
17
+ "Analytics",
18
+ "Prediction",
19
+ "Association",
20
+ "Detection",
21
+ "Hypocenter",
22
+ "Magnitude",
23
+ "Channel",
24
+ "Filter",
25
+ "EventType",
26
+ ]
@@ -0,0 +1,82 @@
1
+ from typing import Optional, Union, List
2
+
3
+ from pydantic import Field
4
+
5
+ from anssformats.formatbasemodel import FormatBaseModel
6
+ from anssformats.source import Source as SourceFormat
7
+
8
+
9
+ class Prediction(FormatBaseModel):
10
+ """A generic prediction from an analytical model (AI/ML, statistical, rule-based, etc.)
11
+
12
+ This class provides a flexible structure for representing any type of prediction
13
+ with associated metrics and model provenance.
14
+
15
+ Attributes
16
+ ----------
17
+ label: string identifying what is being predicted (e.g., "phase", "magnitude",
18
+ "eventType", "custom_attribute")
19
+
20
+ value: the predicted value - can be string, number, or structured object
21
+
22
+ probability: optional float [0.0-1.0] containing the probability of this prediction
23
+
24
+ metrics: optional dict containing additional prediction metrics such as confidence,
25
+ uncertainty quantification (std, ranges, credible intervals), entropy, etc.
26
+ Structure is flexible to support any model-specific metrics.
27
+
28
+ modelID: optional string identifying which model made this prediction
29
+
30
+ modelVersion: optional string containing the version of the model
31
+
32
+ source: optional Source object containing the source/author of the
33
+ """
34
+
35
+ label: str = Field(
36
+ ...,
37
+ description="What is being predicted (e.g., phase, magnitude, eventType, distance)",
38
+ )
39
+ value: Union[str, float, int, list, dict] = Field(
40
+ ..., description="The predicted value"
41
+ )
42
+ probability: Optional[float] = Field(
43
+ None, ge=0.0, le=1.0, description="Probability of this prediction [0.0-1.0]"
44
+ )
45
+ metrics: Optional[dict] = Field(
46
+ None,
47
+ description="Additional prediction metrics (confidence, uncertainty, entropy, etc.)",
48
+ )
49
+ modelID: Optional[str] = Field(
50
+ None, description="Identifier for the model that made this prediction"
51
+ )
52
+ modelVersion: Optional[str] = Field(None, description="Version of the model")
53
+ source: Optional[SourceFormat] = Field(
54
+ None, description="Source/author of the model"
55
+ )
56
+
57
+
58
+ class Analytics(FormatBaseModel):
59
+ """A conversion class used to create, parse, and validate analytical information
60
+ from models such as pickers, analytical models, AI/ML, etc.
61
+
62
+ This class provides an extensible structure supporting multiple models, arbitrary
63
+ prediction labels, and custom extensions.
64
+
65
+ Attributes
66
+ ----------
67
+
68
+ predictions: optional list of Prediction objects containing predictions from one
69
+ or more models. Each prediction can represent any type of analytical output
70
+ with associated confidence metrics and model provenance.
71
+
72
+ extensions: optional dict containing custom key-value pairs for experimental code and debugging.
73
+
74
+ """
75
+
76
+ predictions: Optional[List[Prediction]] = Field(
77
+ None, description="Array of predictions from one or more analytical models"
78
+ )
79
+
80
+ extensions: Optional[dict] = Field(
81
+ None, description="Custom key-value pairs for experimental or debuging data"
82
+ )
@@ -9,6 +9,7 @@ from anssformats.hypocenter import Hypocenter, HypocenterProperties
9
9
  from anssformats.source import Source
10
10
  from anssformats.pick import Pick
11
11
  from anssformats.magnitude import Magnitude
12
+ from anssformats.analytics import Analytics
12
13
 
13
14
 
14
15
  class Detection(FormatBaseModel):
@@ -41,7 +42,7 @@ class Detection(FormatBaseModel):
41
42
  pickData: optional list of either Pick objects used to generate
42
43
  this detection
43
44
 
44
-
45
+ analyticsInfo: optional analytics object containing model output attached to this detection
45
46
  """
46
47
 
47
48
  type: Literal["Detection"]
@@ -64,3 +65,5 @@ class Detection(FormatBaseModel):
64
65
  pickData: Optional[List[Pick]] = None
65
66
 
66
67
  magnitudeData: Optional[List[Magnitude]] = None
68
+
69
+ analyticsInfo: Optional[Analytics] = None
@@ -4,12 +4,11 @@ from pydantic import Field
4
4
 
5
5
  from anssformats.amplitude import Amplitude
6
6
  from anssformats.association import Association
7
- from anssformats.machineLearning import MachineLearning
7
+ from anssformats.analytics import Analytics
8
8
  from anssformats.filter import Filter
9
9
  from anssformats.formatbasemodel import CustomDT, FormatBaseModel
10
10
  from anssformats.channel import Channel, ChannelProperties
11
11
  from anssformats.source import Source
12
- from anssformats.quality import Quality
13
12
 
14
13
 
15
14
  class Pick(FormatBaseModel):
@@ -39,17 +38,12 @@ class Pick(FormatBaseModel):
39
38
  filterInfo: optional list of Filter objects containing the filter frequencies when the
40
39
  pick was made
41
40
 
42
- amplitude: optional Amplitude object containing the amplitude associated with the
43
- pick
41
+ amplitude: optional Amplitude object containing the amplitude associated with the pick
44
42
 
45
43
  associationInfo: optional Association object containing the association information
46
44
  if this pick is used as data in a Detection
47
45
 
48
- machineLearningInfo: optional machineLearning object containing the machineLearning
49
- information of this pick
50
-
51
- qualityInfo: optional quality object containing the quality
52
- information of this pick
46
+ AnalyticsInfo: optional analytics object containing model output attached to this pick
53
47
  """
54
48
 
55
49
  type: Literal["Pick"]
@@ -70,5 +64,4 @@ class Pick(FormatBaseModel):
70
64
  amplitudeInfo: Optional[Amplitude] = None
71
65
 
72
66
  associationInfo: Optional[Association] = None
73
- machineLearningInfo: Optional[MachineLearning] = None
74
- qualityInfo: Optional[List[Quality]] = None
67
+ analyticsInfo: Optional[Analytics] = None
@@ -1,39 +1,39 @@
1
- [tool.poetry]
2
- name = "anss-formats"
3
- version = "0.1.0"
4
- description = "Python implementation of the library used to communicate seismic event detection information between systems"
5
- authors = ["John Patton <jpatton@usgs.gov>"]
6
- readme = "README_purpose.md"
7
- license = "CC0-1.0"
8
- homepage ="https://gitlab.com/anss-netops/anss-data-formats"
9
- include = [
10
- "LICENSE.md"
11
- ]
12
- repository="https://gitlab.com/anss-netops/anss-data-formats"
13
- keywords = ["anss", "earthquakes", "formats", "detection"]
14
- packages = [
15
- {include = "anssformats" }
16
- ]
17
-
18
- [tool.poetry.dependencies]
19
- python = ">3.9.1,<3.12"
20
- twine = "^5.1.1"
21
- dparse = "^0.6.2"
22
- certifi = "^2024.07.04"
23
- cryptography = "^44.0.1"
24
- pydantic = "^2.6.0"
25
- docutils = "!=0.21.post1"
26
- requests = "^2.32.2"
27
-
28
- [tool.poetry.group.dev.dependencies]
29
- black = "^24.10.0"
30
- safety = "^2.2.0"
31
- pytest = "^7.3.1"
32
- pytest-cov = "^4.1.0"
33
-
34
- [tool.poetry.extras]
35
- pycurl = ["pycurl"]
36
-
37
- [build-system]
38
- requires = ["poetry-core>=1.0.0"]
39
- build-backend = "poetry.core.masonry.api"
1
+ [tool.poetry]
2
+ name = "anss-formats"
3
+ version = "0.1.1"
4
+ description = "Python implementation of the library used to communicate seismic event detection information between systems"
5
+ authors = ["John Patton <jpatton@usgs.gov>"]
6
+ license = "CC0-1.0"
7
+ homepage ="https://gitlab.com/anss-netops/anss-data-formats"
8
+ include = [
9
+ "LICENSE.md"
10
+ ]
11
+ repository="https://gitlab.com/anss-netops/anss-data-formats"
12
+ keywords = ["anss", "earthquakes", "formats", "detection"]
13
+ packages = [
14
+ {include = "anssformats" }
15
+ ]
16
+
17
+ [tool.poetry.dependencies]
18
+ python = ">3.9.1,<3.12"
19
+ twine = "^5.1.1"
20
+ dparse = "^0.6.2"
21
+ certifi = "^2024.07.04"
22
+ cryptography = ">=42.0.5"
23
+ pydantic = "^2.6.0"
24
+ docutils = "!=0.21.post1"
25
+ requests = "^2.32.2"
26
+ urllib3 = "^2.6.0"
27
+
28
+ [tool.poetry.group.dev.dependencies]
29
+ black = "^24.10.0"
30
+ safety = "^2.2.0"
31
+ pytest = "^7.3.1"
32
+ pytest-cov = "^4.1.0"
33
+
34
+ [tool.poetry.extras]
35
+ pycurl = ["pycurl"]
36
+
37
+ [build-system]
38
+ requires = ["poetry-core>=1.0.0"]
39
+ build-backend = "poetry.core.masonry.api"