From 10c0764d35b0179c234b4e95719b49d5cd69eb23 Mon Sep 17 00:00:00 2001
From: pcain-usgs <pcain@usgs.gov>
Date: Thu, 4 Jun 2020 09:35:21 -0600
Subject: [PATCH] Fix comments, imports, and spacing. Add diagnostics to
 testing

---
 Calculation_test.py                           | 27 +++++++++++++++++++
 geomagio/residual/Diagnostics.py              |  7 +----
 .../residual/SpreadsheetAbsolutesFactory.py   |  5 ++--
 3 files changed, 30 insertions(+), 9 deletions(-)

diff --git a/Calculation_test.py b/Calculation_test.py
index b62c7a303..013e2949d 100644
--- a/Calculation_test.py
+++ b/Calculation_test.py
@@ -43,3 +43,30 @@ for filename in os.listdir("etc/residual"):
             err_msg="Baselines not within 4 decimals",
             verbose=True,
         )
+    # gather original and resulting diagnostics
+    o_diagnostics = original.diagnostics
+    r_diagnostics = original.diagnostics
+    # test mean mark values
+    assert_almost_equal(
+        o_diagnostics.mean_mark,
+        r_diagnostics.mean_mark,
+        decimal=2,
+        err_msg="Baselines not within 4 decimals",
+        verbose=True,
+    )
+    # test magnetic azimuth values
+    assert_almost_equal(
+        o_diagnostics.magnetic_azimuth,
+        r_diagnostics.magnetic_azimuth,
+        decimal=2,
+        err_msg="Baselines not within 4 decimals",
+        verbose=True,
+    )
+    # test meridian values
+    assert_almost_equal(
+        o_diagnostics.meridian,
+        r_diagnostics.meridian,
+        decimal=2,
+        err_msg="Baselines not within 4 decimals",
+        verbose=True,
+    )
diff --git a/geomagio/residual/Diagnostics.py b/geomagio/residual/Diagnostics.py
index 8e5f2c940..32d773c1f 100644
--- a/geomagio/residual/Diagnostics.py
+++ b/geomagio/residual/Diagnostics.py
@@ -8,14 +8,9 @@ class Diagnostics(BaseModel):
 
     Attributes
     ----------
-    meridian: claculated from declination measurements
+    meridian: calculated from declination measurements
     mean_mark: average mark angles from measurements
     magnetic_azimuh: after adjustment
-    mark_azimuth: from metadata
-    declination: from declination measurements
-    inclination: from inclination measurements
-    h_component: H baseline from calculations
-    z_component: Z baseline from calculations
     """
 
     meridian: float = None
diff --git a/geomagio/residual/SpreadsheetAbsolutesFactory.py b/geomagio/residual/SpreadsheetAbsolutesFactory.py
index 024e27839..63abcb20b 100644
--- a/geomagio/residual/SpreadsheetAbsolutesFactory.py
+++ b/geomagio/residual/SpreadsheetAbsolutesFactory.py
@@ -6,11 +6,11 @@ from obspy.core import UTCDateTime
 import openpyxl
 
 from .Absolute import Absolute
+from .Calculation import DECLINATION_TYPES, MARK_TYPES, average_measurement
+from .Diagnostics import Diagnostics
 from .Measurement import Measurement
 from .MeasurementType import MeasurementType as mt
 from .Reading import Reading
-from .Diagnostics import Diagnostics
-from .Calculation import DECLINATION_TYPES, MARK_TYPES, average_measurement
 from . import Angle
 
 
@@ -414,7 +414,6 @@ class SpreadsheetAbsolutesFactory(object):
         meridian = average_measurement(measurements, DECLINATION_TYPES).angle
 
         magnetic_azimuth = mean_mark - meridian
-
         if meridian > 180:
             magnetic_azimuth = mean_mark - (meridian - 90)
         if mean_mark > 180:
-- 
GitLab