mt-metadata 0.3.3__py2.py3-none-any.whl → 0.3.5__py2.py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of mt-metadata might be problematic. Click here for more details.
- mt_metadata/__init__.py +12 -10
- mt_metadata/base/metadata.py +24 -13
- mt_metadata/data/transfer_functions/tf_zmm.zmm +1 -1
- mt_metadata/timeseries/channel.py +8 -3
- mt_metadata/timeseries/filters/__init__.py +2 -2
- mt_metadata/timeseries/filters/{channel_response_filter.py → channel_response.py} +62 -29
- mt_metadata/timeseries/filters/coefficient_filter.py +1 -3
- mt_metadata/timeseries/filters/filter_base.py +70 -37
- mt_metadata/timeseries/filters/filtered.py +32 -22
- mt_metadata/timeseries/filters/fir_filter.py +10 -11
- mt_metadata/timeseries/filters/frequency_response_table_filter.py +9 -8
- mt_metadata/timeseries/filters/helper_functions.py +112 -3
- mt_metadata/timeseries/filters/pole_zero_filter.py +9 -8
- mt_metadata/timeseries/filters/standards/filter_base.json +2 -2
- mt_metadata/timeseries/filters/time_delay_filter.py +9 -8
- mt_metadata/timeseries/stationxml/fdsn_tools.py +8 -7
- mt_metadata/timeseries/stationxml/xml_channel_mt_channel.py +1 -1
- mt_metadata/timeseries/stationxml/xml_inventory_mt_experiment.py +4 -1
- mt_metadata/timeseries/tools/from_many_mt_files.py +15 -3
- mt_metadata/transfer_functions/__init__.py +1 -1
- mt_metadata/transfer_functions/core.py +89 -49
- mt_metadata/transfer_functions/io/edi/edi.py +9 -5
- mt_metadata/transfer_functions/io/edi/metadata/define_measurement.py +7 -3
- mt_metadata/transfer_functions/io/emtfxml/emtfxml.py +1 -4
- mt_metadata/transfer_functions/io/jfiles/jfile.py +2 -1
- mt_metadata/transfer_functions/io/zfiles/zmm.py +108 -62
- mt_metadata/transfer_functions/io/zonge/zonge.py +2 -2
- mt_metadata/transfer_functions/processing/aurora/band.py +16 -0
- mt_metadata/transfer_functions/processing/aurora/channel_nomenclature.py +34 -31
- mt_metadata/transfer_functions/processing/aurora/processing.py +12 -5
- mt_metadata/transfer_functions/processing/aurora/stations.py +11 -2
- mt_metadata/transfer_functions/processing/fourier_coefficients/decimation.py +1 -1
- mt_metadata/transfer_functions/processing/fourier_coefficients/standards/decimation.json +1 -1
- mt_metadata/transfer_functions/processing/fourier_coefficients/standards/fc_channel.json +23 -1
- mt_metadata/transfer_functions/tf/transfer_function.py +93 -1
- {mt_metadata-0.3.3.dist-info → mt_metadata-0.3.5.dist-info}/METADATA +379 -379
- {mt_metadata-0.3.3.dist-info → mt_metadata-0.3.5.dist-info}/RECORD +41 -41
- {mt_metadata-0.3.3.dist-info → mt_metadata-0.3.5.dist-info}/WHEEL +1 -1
- {mt_metadata-0.3.3.dist-info → mt_metadata-0.3.5.dist-info}/AUTHORS.rst +0 -0
- {mt_metadata-0.3.3.dist-info → mt_metadata-0.3.5.dist-info}/LICENSE +0 -0
- {mt_metadata-0.3.3.dist-info → mt_metadata-0.3.5.dist-info}/top_level.txt +0 -0
|
@@ -36,14 +36,8 @@ from mt_metadata.transfer_functions.io.zfiles.metadata import (
|
|
|
36
36
|
)
|
|
37
37
|
from mt_metadata.base.helpers import validate_name
|
|
38
38
|
from mt_metadata.utils.list_dict import ListDict
|
|
39
|
+
from mt_metadata import DEFAULT_CHANNEL_NOMENCLATURE
|
|
39
40
|
|
|
40
|
-
DEFAULT_CHANNEL_NOMENCLATURE = {
|
|
41
|
-
"hx": "hx",
|
|
42
|
-
"hy": "hy",
|
|
43
|
-
"hz": "hz",
|
|
44
|
-
"ex": "ex",
|
|
45
|
-
"ey": "ey",
|
|
46
|
-
}
|
|
47
41
|
# =============================================================================
|
|
48
42
|
|
|
49
43
|
|
|
@@ -102,10 +96,29 @@ class TF:
|
|
|
102
96
|
"avg": {"write": self.to_avg, "read": self.from_avg},
|
|
103
97
|
}
|
|
104
98
|
|
|
99
|
+
tf_set = False
|
|
100
|
+
try:
|
|
101
|
+
period = kwargs.pop("period")
|
|
102
|
+
self._transfer_function = self._initialize_transfer_function(
|
|
103
|
+
periods=period
|
|
104
|
+
)
|
|
105
|
+
tf_set = True
|
|
106
|
+
except KeyError:
|
|
107
|
+
try:
|
|
108
|
+
period = 1.0 / kwargs.pop("frequency")
|
|
109
|
+
self._transfer_function = self._initialize_transfer_function(
|
|
110
|
+
periods=period
|
|
111
|
+
)
|
|
112
|
+
tf_set = True
|
|
113
|
+
except KeyError:
|
|
114
|
+
pass
|
|
115
|
+
pass
|
|
116
|
+
|
|
105
117
|
for key, value in kwargs.items():
|
|
106
118
|
setattr(self, key, value)
|
|
107
119
|
|
|
108
|
-
|
|
120
|
+
if not tf_set:
|
|
121
|
+
self._transfer_function = self._initialize_transfer_function()
|
|
109
122
|
|
|
110
123
|
self.fn = fn
|
|
111
124
|
|
|
@@ -178,10 +191,7 @@ class TF:
|
|
|
178
191
|
self.logger.info("Survey Metadata is not equal")
|
|
179
192
|
is_equal = False
|
|
180
193
|
if self.has_transfer_function() and other.has_transfer_function():
|
|
181
|
-
if (
|
|
182
|
-
self.transfer_function.fillna(0)
|
|
183
|
-
!= other.transfer_function.fillna(0)
|
|
184
|
-
).any():
|
|
194
|
+
if not self.transfer_function.equals(other.transfer_function):
|
|
185
195
|
self.logger.info("TF is not equal")
|
|
186
196
|
is_equal = False
|
|
187
197
|
elif (
|
|
@@ -204,6 +214,7 @@ class TF:
|
|
|
204
214
|
continue
|
|
205
215
|
|
|
206
216
|
setattr(result, k, deepcopy(v, memo))
|
|
217
|
+
result.logger = logger
|
|
207
218
|
return result
|
|
208
219
|
|
|
209
220
|
def copy(self):
|
|
@@ -434,56 +445,56 @@ class TF:
|
|
|
434
445
|
"""
|
|
435
446
|
# create an empty array for the transfer function
|
|
436
447
|
tf = xr.DataArray(
|
|
437
|
-
data=0 + 0j,
|
|
448
|
+
data=0.0 + 0j,
|
|
438
449
|
dims=["period", "output", "input"],
|
|
439
450
|
coords={
|
|
440
451
|
"period": periods,
|
|
441
|
-
"output": self._ch_output_dict["
|
|
442
|
-
"input": self._ch_input_dict["
|
|
452
|
+
"output": self._ch_output_dict["all"],
|
|
453
|
+
"input": self._ch_input_dict["all"],
|
|
443
454
|
},
|
|
444
455
|
name="transfer_function",
|
|
445
456
|
)
|
|
446
457
|
|
|
447
458
|
tf_err = xr.DataArray(
|
|
448
|
-
data=0,
|
|
459
|
+
data=0.0,
|
|
449
460
|
dims=["period", "output", "input"],
|
|
450
461
|
coords={
|
|
451
462
|
"period": periods,
|
|
452
|
-
"output": self._ch_output_dict["
|
|
453
|
-
"input": self._ch_input_dict["
|
|
463
|
+
"output": self._ch_output_dict["all"],
|
|
464
|
+
"input": self._ch_input_dict["all"],
|
|
454
465
|
},
|
|
455
466
|
name="transfer_function_error",
|
|
456
467
|
)
|
|
457
468
|
|
|
458
469
|
tf_model_err = xr.DataArray(
|
|
459
|
-
data=0,
|
|
470
|
+
data=0.0,
|
|
460
471
|
dims=["period", "output", "input"],
|
|
461
472
|
coords={
|
|
462
473
|
"period": periods,
|
|
463
|
-
"output": self._ch_output_dict["
|
|
464
|
-
"input": self._ch_input_dict["
|
|
474
|
+
"output": self._ch_output_dict["all"],
|
|
475
|
+
"input": self._ch_input_dict["all"],
|
|
465
476
|
},
|
|
466
477
|
name="transfer_function_model_error",
|
|
467
478
|
)
|
|
468
479
|
|
|
469
480
|
inv_signal_power = xr.DataArray(
|
|
470
|
-
data=0 + 0j,
|
|
481
|
+
data=0.0 + 0j,
|
|
471
482
|
dims=["period", "output", "input"],
|
|
472
483
|
coords={
|
|
473
484
|
"period": periods,
|
|
474
|
-
"output": self._ch_output_dict["
|
|
475
|
-
"input": self._ch_input_dict["
|
|
485
|
+
"output": self._ch_output_dict["all"],
|
|
486
|
+
"input": self._ch_input_dict["all"],
|
|
476
487
|
},
|
|
477
488
|
name="inverse_signal_power",
|
|
478
489
|
)
|
|
479
490
|
|
|
480
491
|
residual_covariance = xr.DataArray(
|
|
481
|
-
data=0 + 0j,
|
|
492
|
+
data=0.0 + 0j,
|
|
482
493
|
dims=["period", "output", "input"],
|
|
483
494
|
coords={
|
|
484
495
|
"period": periods,
|
|
485
|
-
"output": self._ch_output_dict["
|
|
486
|
-
"input": self._ch_input_dict["
|
|
496
|
+
"output": self._ch_output_dict["all"],
|
|
497
|
+
"input": self._ch_input_dict["all"],
|
|
487
498
|
},
|
|
488
499
|
name="residual_covariance",
|
|
489
500
|
)
|
|
@@ -496,7 +507,12 @@ class TF:
|
|
|
496
507
|
tf_model_err.name: tf_model_err,
|
|
497
508
|
inv_signal_power.name: inv_signal_power,
|
|
498
509
|
residual_covariance.name: residual_covariance,
|
|
499
|
-
}
|
|
510
|
+
},
|
|
511
|
+
coords={
|
|
512
|
+
"period": periods,
|
|
513
|
+
"output": self._ch_output_dict["all"],
|
|
514
|
+
"input": self._ch_input_dict["all"],
|
|
515
|
+
},
|
|
500
516
|
)
|
|
501
517
|
|
|
502
518
|
# ==========================================================================
|
|
@@ -531,7 +547,6 @@ class TF:
|
|
|
531
547
|
|
|
532
548
|
@property
|
|
533
549
|
def _ch_input_dict(self):
|
|
534
|
-
|
|
535
550
|
return {
|
|
536
551
|
"impedance": self.hx_hy,
|
|
537
552
|
"tipper": self.hx_hy,
|
|
@@ -543,6 +558,7 @@ class TF:
|
|
|
543
558
|
"res": self.ex_ey_hz,
|
|
544
559
|
"tf": self.hx_hy,
|
|
545
560
|
"tf_error": self.hx_hy,
|
|
561
|
+
"all": [self.ex, self.ey, self.hz, self.hx, self.hy],
|
|
546
562
|
}
|
|
547
563
|
|
|
548
564
|
@property
|
|
@@ -558,8 +574,33 @@ class TF:
|
|
|
558
574
|
"res": self.ex_ey_hz,
|
|
559
575
|
"tf": self.ex_ey_hz,
|
|
560
576
|
"tf_error": self.ex_ey_hz,
|
|
577
|
+
"all": [self.ex, self.ey, self.hz, self.hx, self.hy],
|
|
561
578
|
}
|
|
562
579
|
|
|
580
|
+
@property
|
|
581
|
+
def index_zxx(self):
|
|
582
|
+
return {"input": self.hx, "output": self.ex}
|
|
583
|
+
|
|
584
|
+
@property
|
|
585
|
+
def index_zxy(self):
|
|
586
|
+
return {"input": self.hy, "output": self.ex}
|
|
587
|
+
|
|
588
|
+
@property
|
|
589
|
+
def index_zyx(self):
|
|
590
|
+
return {"input": self.hx, "output": self.ey}
|
|
591
|
+
|
|
592
|
+
@property
|
|
593
|
+
def index_zyy(self):
|
|
594
|
+
return {"input": self.hy, "output": self.ey}
|
|
595
|
+
|
|
596
|
+
@property
|
|
597
|
+
def index_tzx(self):
|
|
598
|
+
return {"input": self.hx, "output": self.hz}
|
|
599
|
+
|
|
600
|
+
@property
|
|
601
|
+
def index_tzy(self):
|
|
602
|
+
return {"input": self.hy, "output": self.hz}
|
|
603
|
+
|
|
563
604
|
@property
|
|
564
605
|
def fn(self):
|
|
565
606
|
"""reference to original data file"""
|
|
@@ -1278,25 +1319,25 @@ class TF:
|
|
|
1278
1319
|
]
|
|
1279
1320
|
|
|
1280
1321
|
z_err = np.zeros((self.period.size, 2, 2), dtype=float)
|
|
1281
|
-
z_err[:, 0, 0] = np.
|
|
1322
|
+
z_err[:, 0, 0] = np.abs(
|
|
1282
1323
|
sigma_e.loc[dict(input=[self.ex], output=[self.ex])].data.flatten()
|
|
1283
1324
|
* sigma_s.loc[
|
|
1284
1325
|
dict(input=[self.hx], output=[self.hx])
|
|
1285
1326
|
].data.flatten()
|
|
1286
1327
|
)
|
|
1287
|
-
z_err[:, 0, 1] = np.
|
|
1328
|
+
z_err[:, 0, 1] = np.abs(
|
|
1288
1329
|
sigma_e.loc[dict(input=[self.ex], output=[self.ex])].data.flatten()
|
|
1289
1330
|
* sigma_s.loc[
|
|
1290
1331
|
dict(input=[self.hy], output=[self.hy])
|
|
1291
1332
|
].data.flatten()
|
|
1292
1333
|
)
|
|
1293
|
-
z_err[:, 1, 0] = np.
|
|
1334
|
+
z_err[:, 1, 0] = np.abs(
|
|
1294
1335
|
sigma_e.loc[dict(input=[self.ey], output=[self.ey])].data.flatten()
|
|
1295
1336
|
* sigma_s.loc[
|
|
1296
1337
|
dict(input=[self.hx], output=[self.hx])
|
|
1297
1338
|
].data.flatten()
|
|
1298
1339
|
)
|
|
1299
|
-
z_err[:, 1, 1] = np.
|
|
1340
|
+
z_err[:, 1, 1] = np.abs(
|
|
1300
1341
|
sigma_e.loc[dict(input=[self.ey], output=[self.ey])].data.flatten()
|
|
1301
1342
|
* sigma_s.loc[
|
|
1302
1343
|
dict(input=[self.hy], output=[self.hy])
|
|
@@ -1329,13 +1370,13 @@ class TF:
|
|
|
1329
1370
|
]
|
|
1330
1371
|
|
|
1331
1372
|
t_err = np.zeros((self.period.size, 1, 2), dtype=float)
|
|
1332
|
-
t_err[:, 0, 0] = np.
|
|
1373
|
+
t_err[:, 0, 0] = np.abs(
|
|
1333
1374
|
sigma_e.loc[dict(input=[self.hz], output=[self.hz])].data.flatten()
|
|
1334
1375
|
* sigma_s.loc[
|
|
1335
1376
|
dict(input=[self.hx], output=[self.hx])
|
|
1336
1377
|
].data.flatten()
|
|
1337
1378
|
)
|
|
1338
|
-
t_err[:, 0, 1] = np.
|
|
1379
|
+
t_err[:, 0, 1] = np.abs(
|
|
1339
1380
|
sigma_e.loc[dict(input=[self.hz], output=[self.hz])].data.flatten()
|
|
1340
1381
|
* sigma_s.loc[
|
|
1341
1382
|
dict(input=[self.hy], output=[self.hy])
|
|
@@ -1366,11 +1407,11 @@ class TF:
|
|
|
1366
1407
|
@period.setter
|
|
1367
1408
|
def period(self, value):
|
|
1368
1409
|
if self.period is not None:
|
|
1369
|
-
if len(self.period) == 1 and self.period == np.array([1]):
|
|
1410
|
+
if len(self.period) == 1 and (self.period == np.array([1])).all():
|
|
1370
1411
|
self._transfer_function = self._initialize_transfer_function(
|
|
1371
1412
|
periods=value
|
|
1372
1413
|
)
|
|
1373
|
-
|
|
1414
|
+
elif len(value) != len(self.period):
|
|
1374
1415
|
msg = (
|
|
1375
1416
|
f"New period size {value.size} is not the same size as "
|
|
1376
1417
|
f"old ones {self.period.size}, suggest creating a new "
|
|
@@ -1378,7 +1419,7 @@ class TF:
|
|
|
1378
1419
|
)
|
|
1379
1420
|
self.logger.error(msg)
|
|
1380
1421
|
raise TFError(msg)
|
|
1381
|
-
|
|
1422
|
+
elif not (self.period == value).all():
|
|
1382
1423
|
self.dataset["period"] = value
|
|
1383
1424
|
else:
|
|
1384
1425
|
self._transfer_function = self._initialize_transfer_function(
|
|
@@ -1596,7 +1637,6 @@ class TF:
|
|
|
1596
1637
|
period_slice["period"].start is not None
|
|
1597
1638
|
and period_slice["period"].stop is not None
|
|
1598
1639
|
):
|
|
1599
|
-
|
|
1600
1640
|
return tf._transfer_function.where(
|
|
1601
1641
|
(
|
|
1602
1642
|
tf._transfer_function.period
|
|
@@ -1734,7 +1774,7 @@ class TF:
|
|
|
1734
1774
|
def read_tf_file(self, **kwargs):
|
|
1735
1775
|
self.logger.error("'read_tf_file' has been deprecated use 'read()'")
|
|
1736
1776
|
|
|
1737
|
-
def read(self, fn=None, file_type=None, get_elevation=
|
|
1777
|
+
def read(self, fn=None, file_type=None, get_elevation=False, **kwargs):
|
|
1738
1778
|
"""
|
|
1739
1779
|
|
|
1740
1780
|
Read an TF response file.
|
|
@@ -1840,7 +1880,7 @@ class TF:
|
|
|
1840
1880
|
|
|
1841
1881
|
return edi_obj
|
|
1842
1882
|
|
|
1843
|
-
def from_edi(self, edi_obj, get_elevation=
|
|
1883
|
+
def from_edi(self, edi_obj, get_elevation=False, **kwargs):
|
|
1844
1884
|
"""
|
|
1845
1885
|
Read in an EDI file or a
|
|
1846
1886
|
:class:`mt_metadata.transfer_functions.io.edi.EDI` ojbect
|
|
@@ -1863,14 +1903,14 @@ class TF:
|
|
|
1863
1903
|
edi_obj.read(self._fn, get_elevation=get_elevation)
|
|
1864
1904
|
if not isinstance(edi_obj, EDI):
|
|
1865
1905
|
raise TypeError(f"Input must be a EDI object not {type(edi_obj)}")
|
|
1866
|
-
if edi_obj.tf is not None:
|
|
1906
|
+
if edi_obj.tf is not None and edi_obj.tf.shape[1:] == (3, 2):
|
|
1867
1907
|
k_dict = OrderedDict(
|
|
1868
1908
|
{
|
|
1869
1909
|
"period": "period",
|
|
1870
1910
|
"transfer_function": "tf",
|
|
1871
|
-
"transfer_function_error": "tf_err",
|
|
1872
1911
|
"inverse_signal_power": "signal_inverse_power",
|
|
1873
1912
|
"residual_covariance": "residual_covariance",
|
|
1913
|
+
"transfer_function_error": "tf_err",
|
|
1874
1914
|
"survey_metadata": "survey_metadata",
|
|
1875
1915
|
"station_metadata": "station_metadata",
|
|
1876
1916
|
}
|
|
@@ -1958,7 +1998,7 @@ class TF:
|
|
|
1958
1998
|
|
|
1959
1999
|
return emtf
|
|
1960
2000
|
|
|
1961
|
-
def from_emtfxml(self, emtfxml_obj, get_elevation=
|
|
2001
|
+
def from_emtfxml(self, emtfxml_obj, get_elevation=False, **kwargs):
|
|
1962
2002
|
"""
|
|
1963
2003
|
|
|
1964
2004
|
:param emtfxml_object: path to emtf xml file or EMTFXML object
|
|
@@ -2016,7 +2056,7 @@ class TF:
|
|
|
2016
2056
|
|
|
2017
2057
|
raise IOError("to_jfile not implemented yet.")
|
|
2018
2058
|
|
|
2019
|
-
def from_jfile(self, j_obj, get_elevation=
|
|
2059
|
+
def from_jfile(self, j_obj, get_elevation=False, **kwargs):
|
|
2020
2060
|
"""
|
|
2021
2061
|
|
|
2022
2062
|
:param jfile_obj: path ot .j file or JFile object
|
|
@@ -2149,7 +2189,7 @@ class TF:
|
|
|
2149
2189
|
|
|
2150
2190
|
return zmm_obj
|
|
2151
2191
|
|
|
2152
|
-
def from_zmm(self, zmm_obj, get_elevation=
|
|
2192
|
+
def from_zmm(self, zmm_obj, get_elevation=False, **kwargs):
|
|
2153
2193
|
"""
|
|
2154
2194
|
|
|
2155
2195
|
:param zmm_obj: path ot .zmm file or ZMM object
|
|
@@ -2218,7 +2258,7 @@ class TF:
|
|
|
2218
2258
|
"""
|
|
2219
2259
|
return self.to_zmm()
|
|
2220
2260
|
|
|
2221
|
-
def from_zrr(self, zrr_obj, get_elevation=
|
|
2261
|
+
def from_zrr(self, zrr_obj, get_elevation=False, **kwargs):
|
|
2222
2262
|
"""
|
|
2223
2263
|
|
|
2224
2264
|
:param zmm_obj: path ot .zmm file or ZMM object
|
|
@@ -2253,7 +2293,7 @@ class TF:
|
|
|
2253
2293
|
"""
|
|
2254
2294
|
return self.to_zmm()
|
|
2255
2295
|
|
|
2256
|
-
def from_zss(self, zss_obj, get_elevation=
|
|
2296
|
+
def from_zss(self, zss_obj, get_elevation=False, **kwargs):
|
|
2257
2297
|
"""
|
|
2258
2298
|
|
|
2259
2299
|
:param zmm_obj: path to .zmm file or ZMM object
|
|
@@ -2284,7 +2324,7 @@ class TF:
|
|
|
2284
2324
|
|
|
2285
2325
|
raise AttributeError("to_avg does not exist yet.")
|
|
2286
2326
|
|
|
2287
|
-
def from_avg(self, avg_obj, get_elevation=
|
|
2327
|
+
def from_avg(self, avg_obj, get_elevation=False, **kwargs):
|
|
2288
2328
|
"""
|
|
2289
2329
|
|
|
2290
2330
|
:param avg_obj: path to .avg file or ZongeMTAvg object
|
|
@@ -35,6 +35,7 @@ from mt_metadata.transfer_functions.io.tools import (
|
|
|
35
35
|
|
|
36
36
|
from mt_metadata import __version__
|
|
37
37
|
|
|
38
|
+
|
|
38
39
|
# ==============================================================================
|
|
39
40
|
# EDI Class
|
|
40
41
|
# ==============================================================================
|
|
@@ -251,7 +252,7 @@ class EDI(object):
|
|
|
251
252
|
return 1.0 / self.frequency
|
|
252
253
|
return None
|
|
253
254
|
|
|
254
|
-
def read(self, fn=None, get_elevation=
|
|
255
|
+
def read(self, fn=None, get_elevation=False):
|
|
255
256
|
"""
|
|
256
257
|
Read in an edi file and fill attributes of each section's classes.
|
|
257
258
|
Including:
|
|
@@ -672,10 +673,13 @@ class EDI(object):
|
|
|
672
673
|
+ np.matmul(tf, np.matmul(hh, tfh))
|
|
673
674
|
) / avgt_dict[key]
|
|
674
675
|
|
|
676
|
+
# variance = abs(np.dot(res[0 : cc.n_inputs, :].T, sig))
|
|
675
677
|
variance = np.zeros((cc.n_outputs, cc.n_inputs), dtype=complex)
|
|
676
678
|
for nn in range(cc.n_outputs):
|
|
677
679
|
for mm in range(cc.n_inputs):
|
|
678
680
|
variance[nn, mm] = res[nn, nn] * sig[mm, mm]
|
|
681
|
+
|
|
682
|
+
tf_err = np.sqrt(np.abs(variance))
|
|
679
683
|
self.tf[kk, :, :] = tf
|
|
680
684
|
self.tf_err[kk, :, :] = np.sqrt(np.abs(variance))
|
|
681
685
|
self.signal_inverse_power[kk, :, :] = sig
|
|
@@ -683,18 +687,18 @@ class EDI(object):
|
|
|
683
687
|
|
|
684
688
|
if cc.has_tipper and cc.has_electric:
|
|
685
689
|
self.z[kk, :, :] = tf[0:2, :]
|
|
686
|
-
self.z_err[kk, :, :] =
|
|
690
|
+
self.z_err[kk, :, :] = tf_err[0:2, :]
|
|
687
691
|
self.t[kk, :, :] = tf[2, :]
|
|
688
|
-
self.t_err[kk, :, :] =
|
|
692
|
+
self.t_err[kk, :, :] = tf_err[2, :]
|
|
689
693
|
self.z_err[np.where(np.nan_to_num(self.z_err) == 0.0)] = 1.0
|
|
690
694
|
self.t_err[np.nan_to_num(self.t_err) == 0.0] = 1.0
|
|
691
695
|
elif not cc.has_tipper and cc.has_electric:
|
|
692
696
|
self.z[kk, :, :] = tf[:, :]
|
|
693
|
-
self.z_err[kk, :, :] =
|
|
697
|
+
self.z_err[kk, :, :] = tf_err[:, :]
|
|
694
698
|
self.z_err[np.where(np.nan_to_num(self.z_err) == 0.0)] = 1.0
|
|
695
699
|
elif cc.has_tipper and not cc.has_electric:
|
|
696
700
|
self.t[kk, :, :] = tf[:, :]
|
|
697
|
-
self.t_err[kk, :, :] =
|
|
701
|
+
self.t_err[kk, :, :] = tf_err[:, :]
|
|
698
702
|
self.t_err[np.nan_to_num(self.t_err) == 0.0] = 1.0
|
|
699
703
|
|
|
700
704
|
def write(
|
|
@@ -192,7 +192,7 @@ class DefineMeasurement(Base):
|
|
|
192
192
|
meas_find = True
|
|
193
193
|
elif ">=" in line:
|
|
194
194
|
if meas_find is True:
|
|
195
|
-
|
|
195
|
+
return
|
|
196
196
|
elif meas_find is True and ">" not in line:
|
|
197
197
|
line = line.strip()
|
|
198
198
|
if len(line) > 2:
|
|
@@ -210,7 +210,7 @@ class DefineMeasurement(Base):
|
|
|
210
210
|
elif ">" in line and meas_find:
|
|
211
211
|
if line.find("!") > 0:
|
|
212
212
|
pass
|
|
213
|
-
|
|
213
|
+
elif "meas" in line.lower():
|
|
214
214
|
count += 1
|
|
215
215
|
line_list = _validate_str_with_equals(line)
|
|
216
216
|
m_dict = {}
|
|
@@ -220,6 +220,8 @@ class DefineMeasurement(Base):
|
|
|
220
220
|
value = ll_list[1]
|
|
221
221
|
m_dict[key] = value
|
|
222
222
|
self.measurement_list.append(m_dict)
|
|
223
|
+
else:
|
|
224
|
+
return
|
|
223
225
|
|
|
224
226
|
def read_measurement(self, edi_lines):
|
|
225
227
|
"""
|
|
@@ -292,7 +294,9 @@ class DefineMeasurement(Base):
|
|
|
292
294
|
value.azm = value.azimuth
|
|
293
295
|
if hasattr(self, key):
|
|
294
296
|
existing_ch = getattr(self, key)
|
|
295
|
-
|
|
297
|
+
existing_line = existing_ch.write_meas_line()
|
|
298
|
+
value_line = value.write_meas_line()
|
|
299
|
+
if existing_line != value_line:
|
|
296
300
|
value.chtype = f"rr{ch_type}".upper()
|
|
297
301
|
key = f"meas_rr{ch_type}"
|
|
298
302
|
else:
|
|
@@ -273,7 +273,7 @@ class EMTFXML(emtf_xml.EMTF):
|
|
|
273
273
|
return self.fn.parent
|
|
274
274
|
return None
|
|
275
275
|
|
|
276
|
-
def read(self, fn=None, get_elevation=
|
|
276
|
+
def read(self, fn=None, get_elevation=False):
|
|
277
277
|
"""
|
|
278
278
|
Read xml file
|
|
279
279
|
|
|
@@ -377,7 +377,6 @@ class EMTFXML(emtf_xml.EMTF):
|
|
|
377
377
|
emtf_helpers._convert_tag_to_capwords(element)
|
|
378
378
|
)
|
|
379
379
|
else:
|
|
380
|
-
|
|
381
380
|
emtf_helpers._write_single(
|
|
382
381
|
emtf_element, key, getattr(self, key)
|
|
383
382
|
)
|
|
@@ -654,7 +653,6 @@ class EMTFXML(emtf_xml.EMTF):
|
|
|
654
653
|
value,
|
|
655
654
|
)
|
|
656
655
|
elif fkey in ["x", "y", "z"]:
|
|
657
|
-
|
|
658
656
|
if comp in ["hx", "hy"]:
|
|
659
657
|
if len(self.site_layout.output_channels) == 0:
|
|
660
658
|
self.site_layout.input_channels.append(
|
|
@@ -1231,7 +1229,6 @@ class EMTFXML(emtf_xml.EMTF):
|
|
|
1231
1229
|
)
|
|
1232
1230
|
self.logger.exception(error)
|
|
1233
1231
|
else:
|
|
1234
|
-
|
|
1235
1232
|
try:
|
|
1236
1233
|
run.set_attr_from_name(key, value)
|
|
1237
1234
|
except Exception as error:
|
|
@@ -23,6 +23,7 @@ from mt_metadata.utils.mttime import MTime
|
|
|
23
23
|
from .metadata import Header
|
|
24
24
|
from mt_metadata.transfer_functions.io.tools import get_nm_elev
|
|
25
25
|
|
|
26
|
+
|
|
26
27
|
# ==============================================================================
|
|
27
28
|
# Class to read j_file
|
|
28
29
|
# ==============================================================================
|
|
@@ -161,7 +162,7 @@ class JFile:
|
|
|
161
162
|
|
|
162
163
|
return j_lines
|
|
163
164
|
|
|
164
|
-
def read(self, fn=None, get_elevation=
|
|
165
|
+
def read(self, fn=None, get_elevation=False):
|
|
165
166
|
"""
|
|
166
167
|
Read data from a j file
|
|
167
168
|
|