Skip to content
Snippets Groups Projects
Commit a9388364 authored by Erin (Josh) Rigler's avatar Erin (Josh) Rigler Committed by Wilbur, Spencer Franklin
Browse files

Set proper timestamps in residual calculated absolutes

Fixes #75

When geomagio.residual.calculate() is called with adjust_reference set equal
to True, the start/end timestamps now both reflect the time of the first absolute
measurement (i.e., West Down). This is consistent with the residual absolute
spreadsheet calculations.
parent 6f2ed540
No related branches found
No related tags found
2 merge requests!223Attempt StringIO after failed BytesIO file read,!212Draft: Reattempt to merge old Iris-Factory Branch from Swilbur's local repo
...@@ -95,6 +95,12 @@ def calculate_D_absolute( ...@@ -95,6 +95,12 @@ def calculate_D_absolute(
D Absolute D Absolute
""" """
mean = average_measurement(measurements, DECLINATION_TYPES) mean = average_measurement(measurements, DECLINATION_TYPES)
if reference:
starttime = reference.time
endtime = reference.time
else:
starttime = mean.time
endtime = mean.endtime
reference = reference or mean reference = reference or mean
# average mark # average mark
average_mark = average_measurement(measurements, MARK_TYPES) average_mark = average_measurement(measurements, MARK_TYPES)
...@@ -136,8 +142,8 @@ def calculate_D_absolute( ...@@ -136,8 +142,8 @@ def calculate_D_absolute(
absolute=d_abs, absolute=d_abs,
baseline=d_b, baseline=d_b,
shift=shift, shift=shift,
starttime=mean.time, starttime=starttime,
endtime=mean.endtime, endtime=endtime,
), ),
meridian, meridian,
) )
...@@ -173,21 +179,26 @@ def calculate_HZ_absolutes( ...@@ -173,21 +179,26 @@ def calculate_HZ_absolutes(
if reference: if reference:
h_abs = np.sqrt((h_b + reference.h) ** 2 + (reference.e) ** 2) h_abs = np.sqrt((h_b + reference.h) ** 2 + (reference.e) ** 2)
z_abs = z_b + reference.z z_abs = z_b + reference.z
starttime = reference.time
endtime = reference.time
else:
starttime = mean.time
endtime = mean.endtime
# return absolutes # return absolutes
return ( return (
Absolute( Absolute(
element="H", element="H",
baseline=h_b, baseline=h_b,
absolute=h_abs, absolute=h_abs,
starttime=mean.time, starttime=starttime,
endtime=mean.endtime, endtime=endtime,
), ),
Absolute( Absolute(
element="Z", element="Z",
baseline=z_b, baseline=z_b,
absolute=z_abs, absolute=z_abs,
starttime=mean.time, starttime=starttime,
endtime=mean.endtime, endtime=endtime,
), ),
) )
...@@ -279,5 +290,5 @@ def calculate_scale_value( ...@@ -279,5 +290,5 @@ def calculate_scale_value(
/ corrected_f / corrected_f
) + (m2.angle - m1.angle) ) + (m2.angle - m1.angle)
residual_change = m2.residual - m1.residual residual_change = m2.residual - m1.residual
scale_value = corrected_f * field_change / np.abs(residual_change) scale_value = np.radians(corrected_f * field_change / np.abs(residual_change))
return scale_value return scale_value
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