Skip to content

Commit c285812

Browse files
committed
Add saveCalib()
1 parent e7cdfcf commit c285812

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

src/emagpy/Problem.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1893,6 +1893,21 @@ def saveSlice(self, fname, index=0, islice=0, nx=100, ny=100, method='linear',
18931893
width=Z.shape[1], count=1, dtype=Z.dtype,
18941894
crs=self.projection, transform=tt) as dst:
18951895
dst.write(Z, 1)
1896+
1897+
def saveCalib(self, fname):
1898+
"""Save files for ERT calibration. Three files will be saved:
1899+
- _ec.csv: contains the EC profiles (from inverted ERT)
1900+
- _eca_obs.csv: observed ECa from EMI
1901+
- _eca_sim.csv: simulated ECa from EC readings
1902+
1903+
Parameters
1904+
----------
1905+
fname : str
1906+
Path with .csv extension where the .csv files will be saved.
1907+
"""
1908+
self.calibEC.to_csv(fname.replace('.csv', '_ec.csv'), index=False)
1909+
self.calibECaObs.to_csv(fname.replace('.csv', '_eca_obs.csv'), index=False)
1910+
self.calibECaSim.to_csv(fname.replace('.csv', '_eca_sim.csv'), index=False)
18961911

18971912
def saveData(self, outputdir):
18981913
"""Save processed data and inverted data (if available)

src/ui.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1026,9 +1026,7 @@ def exportCalibBtnFunc():
10261026
if '.csv' not in fname:
10271027
fname = fname + '.csv'
10281028
self.lastdir = os.path.dirname(fname)
1029-
self.problem.calibEC.to_csv(fname.replace('.csv', '_ec.csv'), index=False)
1030-
self.problem.calibECaObs.to_csv(fname.replace('.csv', '_eca_obs.csv'), index=False)
1031-
self.problem.calibECaSim.to_csv(fname.replace('.csv', '_eca_sim.csv'), index=False)
1029+
self.problem.saveCalib(fname)
10321030
self.exportCalibBtn = QPushButton('Export')
10331031
self.exportCalibBtn.clicked.connect(exportCalibBtnFunc)
10341032

0 commit comments

Comments
 (0)