@@ -110,9 +110,7 @@ def __init__(self, fn=None, impedance_units="mt", **kwargs):
110
110
111
111
self .save_dir = Path .cwd ()
112
112
113
- self ._coordinate_reference_frame_options = (
114
- COORDINATE_REFERENCE_FRAME_OPTIONS
115
- )
113
+ self ._coordinate_reference_frame_options = COORDINATE_REFERENCE_FRAME_OPTIONS
116
114
117
115
self .coordinate_reference_frame = (
118
116
self .station_metadata .transfer_function .sign_convention
@@ -231,9 +229,7 @@ def impedance_units(self, value):
231
229
if not isinstance (value , str ):
232
230
raise TypeError ("Units input must be a string." )
233
231
if value .lower () not in self ._impedance_unit_factors .keys ():
234
- raise ValueError (
235
- f"{ value } is not an acceptable unit for impedance."
236
- )
232
+ raise ValueError (f"{ value } is not an acceptable unit for impedance." )
237
233
238
234
self ._impedance_units = value
239
235
@@ -612,6 +608,17 @@ def interpolate(
612
608
)
613
609
614
610
new_m = self .clone_empty ()
611
+ theta_r = 0
612
+ if isinstance (self ._rotation_angle , (int , float )):
613
+ if self ._rotation_angle != 0 :
614
+ theta_r = float (self ._rotation_angle )
615
+ elif isinstance (self ._rotation_angle , np .ndarray ):
616
+ if self ._rotation_angle .mean () != 0 :
617
+ theta_r = float (self ._rotation_angle .mean ())
618
+ self .logger .warning (
619
+ f"Station { self .station } : Using mean rotation angle of { theta_r :.2f} degrees."
620
+ )
621
+ new_m ._rotation_angle = np .repeat (theta_r , len (new_period ))
615
622
if self .has_impedance ():
616
623
new_m .Z = self .Z .interpolate (new_period , method = method , ** kwargs )
617
624
if new_m .has_impedance ():
@@ -622,9 +629,7 @@ def interpolate(
622
629
"See scipy.interpolate.interp1d for more information."
623
630
)
624
631
if self .has_tipper ():
625
- new_m .Tipper = self .Tipper .interpolate (
626
- new_period , method = method , ** kwargs
627
- )
632
+ new_m .Tipper = self .Tipper .interpolate (new_period , method = method , ** kwargs )
628
633
if new_m .has_tipper ():
629
634
if np .all (np .isnan (new_m .Tipper .tipper )):
630
635
self .logger .warning (
@@ -1109,12 +1114,9 @@ def add_white_noise(self, value, inplace=True):
1109
1114
)
1110
1115
1111
1116
if inplace :
1112
- self ._transfer_function [
1113
- "transfer_function"
1114
- ] = self ._transfer_function .transfer_function .real * (
1115
- noise_real
1116
- ) + (
1117
- 1j * self ._transfer_function .transfer_function .imag * noise_imag
1117
+ self ._transfer_function ["transfer_function" ] = (
1118
+ self ._transfer_function .transfer_function .real * (noise_real )
1119
+ + (1j * self ._transfer_function .transfer_function .imag * noise_imag )
1118
1120
)
1119
1121
1120
1122
self ._transfer_function ["transfer_function_error" ] = (
@@ -1123,12 +1125,9 @@ def add_white_noise(self, value, inplace=True):
1123
1125
1124
1126
else :
1125
1127
new_mt_obj ._transfer_function = self ._transfer_function .copy ()
1126
- new_mt_obj ._transfer_function [
1127
- "transfer_function"
1128
- ] = self ._transfer_function .transfer_function .real * (
1129
- noise_real
1130
- ) + (
1131
- 1j * self ._transfer_function .transfer_function .imag * noise_imag
1128
+ new_mt_obj ._transfer_function ["transfer_function" ] = (
1129
+ self ._transfer_function .transfer_function .real * (noise_real )
1130
+ + (1j * self ._transfer_function .transfer_function .imag * noise_imag )
1132
1131
)
1133
1132
1134
1133
self ._transfer_function ["transfer_function_error" ] = (
0 commit comments