From 92254a3ba659f3ecc855501ce55e5d34dda9ea6d Mon Sep 17 00:00:00 2001 From: Jeremy Fee <jmfee@usgs.gov> Date: Fri, 18 Mar 2022 15:27:46 -0600 Subject: [PATCH] Black formatting updates for ** operation, remove typing_extensions now that python3.8+ --- geomagio/algorithm/SqDistAlgorithm.py | 4 ++-- geomagio/geomag_types.py | 2 +- geomagio/residual/Calculation.py | 7 +++---- geomagio/residual/Reading.py | 5 ++--- 4 files changed, 8 insertions(+), 10 deletions(-) diff --git a/geomagio/algorithm/SqDistAlgorithm.py b/geomagio/algorithm/SqDistAlgorithm.py index 4dc5087a2..e2106c0fa 100644 --- a/geomagio/algorithm/SqDistAlgorithm.py +++ b/geomagio/algorithm/SqDistAlgorithm.py @@ -461,7 +461,7 @@ class SqDistAlgorithm(Algorithm): # to White et al. (USGS SIR 2014-5045). fom = 10 ** (-3 / 20.0) # halve power at corner frequency omg = np.pi / np.float64(smooth) # corner angular frequency - sig = np.sqrt(-2 * np.log(fom) / omg ** 2) + np.finfo(float).eps # sig>0 + sig = np.sqrt(-2 * np.log(fom) / omg**2) + np.finfo(float).eps # sig>0 ts = np.linspace( np.max((-m, -3 * np.round(sig))), np.min((m, 3 * np.round(sig))), @@ -536,7 +536,7 @@ class SqDistAlgorithm(Algorithm): # when forecasting, grow sigma=sqrt(var) like a prediction # interval; sumc2 and jstep will be reset with the next # valid observation - phiJminus1 = phiJminus1 + phi ** jstep + phiJminus1 = phiJminus1 + phi**jstep jstep = jstep + 1 sumc2 = ( sumc2 diff --git a/geomagio/geomag_types.py b/geomagio/geomag_types.py index a50e2804e..9a181bcd2 100644 --- a/geomagio/geomag_types.py +++ b/geomagio/geomag_types.py @@ -1,4 +1,4 @@ -from typing_extensions import Literal +from typing import Literal DataInterval = Literal["tenhertz", "second", "minute", "hour", "day", "month"] DataType = Literal[ diff --git a/geomagio/residual/Calculation.py b/geomagio/residual/Calculation.py index fe1ab1c1e..d6d820446 100644 --- a/geomagio/residual/Calculation.py +++ b/geomagio/residual/Calculation.py @@ -1,5 +1,4 @@ -from typing import List, Tuple -from typing_extensions import Literal +from typing import List, Literal, Tuple import numpy as np @@ -116,7 +115,7 @@ def calculate_D_absolute( m.angle + np.degrees( m.measurement_type.meridian - * (np.arcsin(m.residual / np.sqrt((m.h + h_baseline) ** 2 + m.e ** 2))) + * (np.arcsin(m.residual / np.sqrt((m.h + h_baseline) ** 2 + m.e**2))) ) - np.degrees(np.arctan(m.e / (m.h + h_baseline))) for m in declination_measurements @@ -168,7 +167,7 @@ def calculate_HZ_absolutes( inclination_radians = np.radians(inclination) h_abs = corrected_f * np.cos(inclination_radians) z_abs = corrected_f * np.sin(inclination_radians) - h_b = np.sqrt(h_abs ** 2 - mean.e ** 2) - mean.h + h_b = np.sqrt(h_abs**2 - mean.e**2) - mean.h z_b = z_abs - mean.z # adjust absolutes to reference measurement if reference: diff --git a/geomagio/residual/Reading.py b/geomagio/residual/Reading.py index 437da4992..101ba4b4b 100644 --- a/geomagio/residual/Reading.py +++ b/geomagio/residual/Reading.py @@ -1,5 +1,4 @@ -from typing import Dict, List, Optional, Tuple -from typing_extensions import Literal +from typing import Dict, List, Literal, Optional, Tuple import numpy as np from obspy import Stream, UTCDateTime @@ -187,7 +186,7 @@ def get_ordinates( d_ord = d_abs - d_bas z_ord = z_abs - z_bas e_ord = h_abs * np.radians(d_ord) - h_ord = np.sqrt(h_ord ** 2 - e_ord ** 2) + h_ord = np.sqrt(h_ord**2 - e_ord**2) return (h_ord, e_ord, z_ord) -- GitLab