Mercurial > repos > rv43 > tomo
comparison fit.py @ 71:1cf15b61cd83 draft
planemo upload for repository https://github.com/rolfverberg/galaxytools commit 366e516aef0735af2998c6ff3af037181c8d5213
| author | rv43 |
|---|---|
| date | Mon, 20 Mar 2023 13:56:57 +0000 |
| parents | fba792d5f83b |
| children | d5e1d4ea2b7e |
comparison
equal
deleted
inserted
replaced
| 70:97c4e2cbbad9 | 71:1cf15b61cd83 |
|---|---|
| 18 LorentzianModel | 18 LorentzianModel |
| 19 import numpy as np | 19 import numpy as np |
| 20 from os import cpu_count, getpid, listdir, mkdir, path | 20 from os import cpu_count, getpid, listdir, mkdir, path |
| 21 from re import compile, sub | 21 from re import compile, sub |
| 22 from shutil import rmtree | 22 from shutil import rmtree |
| 23 from sympy import diff, simplify | 23 try: |
| 24 from sympy import diff, simplify | |
| 25 except: | |
| 26 pass | |
| 24 try: | 27 try: |
| 25 from joblib import Parallel, delayed | 28 from joblib import Parallel, delayed |
| 26 have_joblib = True | 29 have_joblib = True |
| 27 except: | 30 except: |
| 28 have_joblib = False | 31 have_joblib = False |
| 30 import xarray as xr | 33 import xarray as xr |
| 31 have_xarray = True | 34 have_xarray = True |
| 32 except: | 35 except: |
| 33 have_xarray = False | 36 have_xarray = False |
| 34 | 37 |
| 35 from .general import illegal_value, is_int, is_dict_series, is_index, index_nearest, \ | 38 #try: |
| 39 # from .general import illegal_value, is_int, is_dict_series, is_index, index_nearest, \ | |
| 40 # almost_equal, quick_plot #, eval_expr | |
| 41 #except: | |
| 42 # try: | |
| 43 # from sys import path as syspath | |
| 44 # syspath.append(f'/nfs/chess/user/rv43/msnctools/msnctools') | |
| 45 # from general import illegal_value, is_int, is_dict_series, is_index, index_nearest, \ | |
| 46 # almost_equal, quick_plot #, eval_expr | |
| 47 # except: | |
| 48 # from general import illegal_value, is_int, is_dict_series, is_index, index_nearest, \ | |
| 49 # almost_equal, quick_plot #, eval_expr | |
| 50 from general import illegal_value, is_int, is_dict_series, is_index, index_nearest, \ | |
| 36 almost_equal, quick_plot #, eval_expr | 51 almost_equal, quick_plot #, eval_expr |
| 37 #from sys import path as syspath | |
| 38 #syspath.append(f'/nfs/chess/user/rv43/msnctools/msnctools') | |
| 39 #from general import illegal_value, is_int, is_dict_series, is_index, index_nearest, \ | |
| 40 # almost_equal, quick_plot #, eval_expr | |
| 41 | 52 |
| 42 from sys import float_info | 53 from sys import float_info |
| 43 float_min = float_info.min | 54 float_min = float_info.min |
| 44 float_max = float_info.max | 55 float_max = float_info.max |
| 45 | 56 |
| 1808 for model in models: | 1819 for model in models: |
| 1809 kwargs = self.add_model(model, **kwargs) | 1820 kwargs = self.add_model(model, **kwargs) |
| 1810 self.fit(**kwargs) | 1821 self.fit(**kwargs) |
| 1811 | 1822 |
| 1812 @classmethod | 1823 @classmethod |
| 1813 def fit_map(cls, x, ymap, models, normalize=True, **kwargs): | 1824 def fit_map(cls, ymap, models, x=None, normalize=True, **kwargs): |
| 1814 return(cls(x, ymap, models, normalize=normalize, **kwargs)) | 1825 return(cls(ymap, x=x, models=models, normalize=normalize, **kwargs)) |
| 1815 | 1826 |
| 1816 @property | 1827 @property |
| 1817 def best_errors(self): | 1828 def best_errors(self): |
| 1818 return(self._best_errors) | 1829 return(self._best_errors) |
| 1819 | 1830 |
