Skip to content
Snippets Groups Projects
Commit e2f790cd authored by Cain, Payton David's avatar Cain, Payton David
Browse files

Add mask parameter to 3rd north down measurements

parent a0bacf3d
No related branches found
No related tags found
No related merge requests found
......@@ -270,7 +270,9 @@ def average_angle(measurements, type):
Compute average angle from a dictionary of
measurements and specified measurement type.
"""
return np.average([convert_to_geon(m.angle) for m in measurements[type]])
return np.average(
[convert_to_geon(m.angle) for m in measurements[type] if not m.mask]
)
def average_residual(measurements, type):
......@@ -278,7 +280,7 @@ def average_residual(measurements, type):
Compute average residual from a dictionary
of measurements and specified measurement type.
"""
return np.average([m.residual for m in measurements[type]])
return np.average([m.residual for m in measurements[type] if not m.mask])
def average_ordinate(ordinates, type):
......@@ -288,6 +290,8 @@ def average_ordinate(ordinates, type):
"""
if type is not None:
ordinates = ordinates[type]
if type is mt.NORTH_DOWN:
ordinates = ordinates[0:2]
o = Ordinate(measurement_type=type)
avgs = np.average([[o.h, o.e, o.z, o.f] for o in ordinates], axis=0,)
o.h, o.e, o.z, o.f = avgs
......
......@@ -22,3 +22,4 @@ class Measurement(BaseModel):
angle: float = 0
residual: float = None
time: Optional[UTCDateTime] = None
mask: bool = None
......@@ -179,9 +179,9 @@ SPREADSHEET_MEASUREMENTS = [
},
{
"type": mt.NORTH_DOWN,
"angle": "D43",
"residual": "E43",
"time": "B43",
"angle": "D44",
"residual": "E44",
"time": "B44",
"h": "C57",
"e": "D57",
"z": "E57",
......@@ -189,13 +189,14 @@ SPREADSHEET_MEASUREMENTS = [
},
{
"type": mt.NORTH_DOWN,
"angle": "D44",
"residual": "E44",
"time": "B44",
"angle": "D45",
"residual": "E45",
"time": "B45",
"h": "C58",
"e": "D58",
"z": "E58",
"f": "B58",
"mask": True,
},
# scaling
{
......@@ -355,12 +356,14 @@ class SpreadsheetAbsolutesFactory(object):
and parse_relative_time(base_date, sheet[m["time"]].value)
or None
)
mask = "mask" in m or False
measurements.append(
Measurement(
measurement_type=measurement_type,
angle=angle,
residual=residual,
time=time,
mask=mask,
)
)
return measurements
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment