Skip to content

Commit

Permalink
LVE Data imported from Excel can be fitted with theories now
Browse files Browse the repository at this point in the history
  • Loading branch information
jorge-ramirez-upm committed Dec 15, 2023
1 parent 3bf8807 commit 22fc20a
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 14 deletions.
3 changes: 1 addition & 2 deletions RepTate/gui/ImportExcelWindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ def get_data(self):
z.append(np.nan)
flag_nan = True

# Sort and clean data? JR
# Sort and clean data
x = np.array(x)
y = np.array(y)
ind = np.argsort(x)
Expand All @@ -380,7 +380,6 @@ def get_data(self):
znotnan = z[~np.isnan(z)]
zznan = np.interp(xznan, xznotnan, znotnan, left=0, right=0)
z[np.isnan(z)] = zznan
# End sort and clean data - JR

res_dic = {
"error": False,
Expand Down
40 changes: 28 additions & 12 deletions RepTate/gui/QTheory.py
Original file line number Diff line number Diff line change
Expand Up @@ -922,12 +922,20 @@ def func_fit(self, x, *param_in):
conditiony = (yexp[:, i] > self.ymin) * (yexp[:, i] < self.ymax)
else:
conditiony = np.ones_like(yexp[:, i], dtype=bool)
conditionnaninf = (
(~np.isnan(xexp)[:, 0])
* (~np.isnan(yexp)[:, 0])
* (~np.isinf(xexp)[:, 0])
* (~np.isinf(yexp)[:, 0])
)
if view.n > 1:
conditionnaninf = (
(np.prod(~np.isnan(xexp), axis=1, dtype=bool))
* (np.prod(~np.isnan(yexp), axis=1, dtype=bool))
* (np.prod(~np.isinf(xexp), axis=1, dtype=bool))
* (np.prod(~np.isinf(yexp), axis=1, dtype=bool))
)
else:
conditionnaninf = (
(~np.isnan(xexp)[:, 0])
* (~np.isnan(yexp)[:, 0])
* (~np.isinf(xexp)[:, 0])
* (~np.isinf(yexp)[:, 0])
)
ycond = np.extract(
conditionx * conditiony * conditionnaninf, yth[:, i]
)
Expand Down Expand Up @@ -989,12 +997,20 @@ def do_fit(self, line):
conditiony = (yexp[:, i] > self.ymin) * (yexp[:, i] < self.ymax)
else:
conditiony = np.ones_like(yexp[:, i], dtype=bool)
conditionnaninf = (
(~np.isnan(xexp)[:, 0])
* (~np.isnan(yexp)[:, 0])
* (~np.isinf(xexp)[:, 0])
* (~np.isinf(yexp)[:, 0])
)
if view.n > 1:
conditionnaninf = (
(np.prod(~np.isnan(xexp), axis=1, dtype=bool))
* (np.prod(~np.isnan(yexp), axis=1, dtype=bool))
* (np.prod(~np.isinf(xexp), axis=1, dtype=bool))
* (np.prod(~np.isinf(yexp), axis=1, dtype=bool))
)
else:
conditionnaninf = (
(~np.isnan(xexp)[:, 0])
* (~np.isnan(yexp)[:, 0])
* (~np.isinf(xexp)[:, 0])
* (~np.isinf(yexp)[:, 0])
)
xcond = np.extract(
conditionx * conditiony * conditionnaninf, xexp[:, i]
)
Expand Down

0 comments on commit 22fc20a

Please sign in to comment.