Skip to content

Commit d34fd01

Browse files
committed
FIX: wrong data unit in SIP Fuchs III files
1 parent 5b08bc0 commit d34fd01

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

pygimli/physics/SIP/importData.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,20 @@ def load(fileName, verbose=False, **kwargs):
2525
2626
"""
2727
firstLine = None
28+
factor = kwargs.pop("factor", None)
2829
with codecs.open(fileName, 'r', encoding='iso-8859-15',
2930
errors='replace') as fi:
3031
firstLine = fi.readline()
32+
if fileName.lower().endswith(".res"):
33+
newLine = fi.readline()
34+
while "Current" not in newLine:
35+
newLine = fi.readline()
36+
37+
if "°" in newLine: # convert degrees in mrad
38+
factor = -np.pi/180.
39+
40+
if factor is None:
41+
factor = -1.0
3142

3243
f, amp, phi = None, None, None
3344

@@ -38,26 +49,24 @@ def load(fileName, verbose=False, **kwargs):
3849
pg.info("Reading SIP Fuchs III file")
3950
f, amp, phi, header = readFuchs3File(fileName,
4051
verbose=verbose, **kwargs)
41-
phi *= -np.pi/180.
4252
# print(header) # not used?
4353
elif 'SIP-Quad' in firstLine:
4454
if verbose:
4555
pg.info("Reading SIP Quad file")
4656
f, amp, phi, header = readFuchs3File(fileName, nfr=9, namp=10, nphi=11,
4757
nk=7, verbose=verbose, **kwargs)
48-
phi *= -np.pi/180.
4958
elif 'SIP-Fuchs' in firstLine:
5059
if verbose:
5160
pg.info("Reading SIP Fuchs file")
5261
f, amp, phi, drhoa, dphi = readRadicSIPFuchs(fileName,
5362
verbose=verbose, **kwargs)
54-
phi *= -np.pi/180.
5563
elif fnLow.endswith('.txt') or fnLow.endswith('.csv'):
5664
f, amp, phi = readTXTSpectrum(fileName)
5765
amp *= 1.0 # scale it with k if available
5866
else:
5967
raise NotImplementedError("Don't know how to read data.")
6068

69+
phi *= factor
6170
return f, amp, phi
6271

6372

0 commit comments

Comments
 (0)