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

Move arrays holding measurement types to top of module

parent 97b18fa3
No related branches found
No related tags found
No related merge requests found
...@@ -6,6 +6,18 @@ from .MeasurementType import MeasurementType as mt ...@@ -6,6 +6,18 @@ from .MeasurementType import MeasurementType as mt
from pydantic import BaseModel from pydantic import BaseModel
# specify mark measurement types
MARK_TYPES = [
mt.FIRST_MARK_DOWN,
mt.FIRST_MARK_UP,
mt.SECOND_MARK_DOWN,
mt.SECOND_MARK_UP,
]
# define measurement types used to calculate inclination
INCLINATION_TYPES = [mt.NORTH_DOWN, mt.NORTH_UP, mt.SOUTH_DOWN, mt.SOUTH_UP]
class Calculate(BaseModel): class Calculate(BaseModel):
""" """
Class object for performing calculations. Class object for performing calculations.
...@@ -40,11 +52,9 @@ def calculate(reading): ...@@ -40,11 +52,9 @@ def calculate(reading):
ordinate_index = reading.ordinate_index() ordinate_index = reading.ordinate_index()
measurements = reading.measurements measurements = reading.measurements
measurement_index = reading.measurement_index() measurement_index = reading.measurement_index()
# define measurement types used to calculate inclination
inclination_types = [mt.NORTH_DOWN, mt.NORTH_UP, mt.SOUTH_DOWN, mt.SOUTH_UP]
# get ordinate values across h, e, z, and f for inclination measurement types # get ordinate values across h, e, z, and f for inclination measurement types
inclination_ordinates = [ inclination_ordinates = [
o for o in ordinates if o.measurement_type in inclination_types o for o in ordinates if o.measurement_type in INCLINATION_TYPES
] ]
# get average ordinate values across h, e, z, and f # get average ordinate values across h, e, z, and f
mean = average_ordinate(inclination_ordinates, None) mean = average_ordinate(inclination_ordinates, None)
...@@ -157,20 +167,14 @@ def calculate_D(ordinates_index, measurements, measurements_index, azimuth, h_b) ...@@ -157,20 +167,14 @@ def calculate_D(ordinates_index, measurements, measurements_index, azimuth, h_b)
ordinates, measurements, measurement_index(dictionary), azimuth and H baseline ordinates, measurements, measurement_index(dictionary), azimuth and H baseline
Returns absolute and baseline for declination. Returns absolute and baseline for declination.
""" """
# specify mark measurement types
mark_types = [
mt.FIRST_MARK_DOWN,
mt.FIRST_MARK_UP,
mt.SECOND_MARK_DOWN,
mt.SECOND_MARK_UP,
]
# average mark angles # average mark angles
# note that angles are being converted to geon # note that angles are being converted to geon
average_mark = np.average( average_mark = np.average(
[ [
convert_to_geon(m.angle) convert_to_geon(m.angle)
for m in measurements for m in measurements
if m.measurement_type in mark_types if m.measurement_type in MARK_TYPES
] ]
) )
# add 100 if mark up is greater than mark down # add 100 if mark up is greater than mark down
......
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