|
17 | 17 | import pickle |
18 | 18 | import time |
19 | 19 | from lmfit.models import GaussianModel |
| 20 | +from scipy import interpolate |
20 | 21 | import customplotting.mscope as cpm |
21 | 22 | # local modules |
22 | 23 | try: |
@@ -260,8 +261,18 @@ def check_loaded_files(self): |
260 | 261 | def plot(self): |
261 | 262 | try: |
262 | 263 | if self.opened_from_flim: |
263 | | - self.x, self.y = self.sum_data_from_flim |
264 | | - elif self.file is None: |
| 264 | + flim_data = self.sum_data_from_flim.T |
| 265 | + interp = interpolate.interp1d(flim_data[:,0], flim_data[:,1]) |
| 266 | + x_range = [flim_data[:,0][0], flim_data[:,0][-1]] |
| 267 | + xnew = np.linspace(x_range[0], x_range[1], 100 ) |
| 268 | + ynew = interp(xnew) |
| 269 | + self.file = np.zeros((xnew.shape[0], 2)) |
| 270 | + self.file[:,0] = xnew |
| 271 | + self.file[:,1] = ynew |
| 272 | + self.x = xnew |
| 273 | + self.y = ynew |
| 274 | + |
| 275 | + elif self.file is None: #elif |
265 | 276 | self.ui.result_textBrowser.setText("You need to load a data file.") |
266 | 277 | else: |
267 | 278 | self.x = self.file[:,0] |
@@ -310,7 +321,10 @@ def fit_and_plot(self): |
310 | 321 | try: |
311 | 322 | self.plot() |
312 | 323 | if self.opened_from_flim: |
313 | | - self.file = self.sum_data_from_flim.T |
| 324 | + self.file = np.zeros((self.x.shape[0], 2)) |
| 325 | + self.file[:,0] = self.x |
| 326 | + self.file[:,1] = self.y |
| 327 | + |
314 | 328 | if self.ui.plot_without_bck_radioButton.isChecked(): #if plot w/o bck, create dummy bck_file |
315 | 329 | self.bck_file = np.zeros(shape=(self.file.shape[0], 2)) |
316 | 330 | self.bck_file[:,0] = self.file[:,0] |
|
0 commit comments