Skip to content

Commit 1ea909c

Browse files
authored
Merge pull request #23 from MyPyDavid/fix/make-example-run
Fix/make example run
2 parents 7131f8e + ff8368e commit 1ea909c

25 files changed

+83
-1061
lines changed

.github/workflows/tox_actions.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
- python-version: 3.9
2828
toxenv: "py39-cover,report" #,codecov"
2929
exclude:
30-
# TODO py39 on windows has errors so we exclude it for now
30+
# IDEA py39 on windows has errors so we exclude it for now
3131
- os: windows-latest
3232
python-version: 3.9
3333

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ venv.bak/
109109
.mypy_cache/
110110

111111
# pycharm
112-
.idea/
112+
.todo/
113113

114114
# datafiles and results
115115
**/results/*

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ repos:
4949
name: nbqa-black - consistent Python code formatting (notebooks; auto-fixes)
5050
args: [ --nbqa-mutate ]
5151
additional_dependencies: [ black==21.5b2 ]
52-
# TODO: Disabled for now until it's clear how to add noqa to specific cells of a Jupyter notebook
52+
# IDEA: Disabled for now until it's clear how to add noqa to specific cells of a Jupyter notebook
5353
#- id: nbqa-flake8
5454
# name: nbqa-flake8 - Python linting (notebooks)
5555
# additional_dependencies: [ flake8==3.9.2 ]

src/raman_fitting/__init__.py

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
# VERSION_PATH = config.PACKAGE_ROOT / 'VERSION.txt'
2525
# with open(VERSION_PATH, 'r') as version_file:
26-
# TODO change version definitino
26+
# IDEA change version definitino
2727
# __version__ = version_file.read().strip()
2828

2929
import logging
@@ -93,15 +93,3 @@
9393
# Other user-facing functions
9494
from .api import *
9595

96-
# TODO list:
97-
# added setup.cfg
98-
# added unittests
99-
# added README.md
100-
# add project.toml only for
101-
# improved logger, each module needs a getlogger(name)
102-
# TODO future daemonize the fitting process for using the package and dropping files in the datafiles folder
103-
# TODO add docs with Sphinx, readthedocs
104-
# TODO improve AsyncIO into main delegator processes
105-
# TODO fix plotting because of DeprecationWarning in savefig
106-
# TODO add database for spectrum data storage
107-
# TODO future GUI webinterface

src/raman_fitting/config/filepath_helper.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ def create_dataset_dir(DATASET_DIR): # pragma: no cover
117117
"""
118118
)
119119
sys.exit()
120-
# TODO build in daemon version with folder watcher....
120+
# IDEA build in daemon version with folder watcher....
121121
except Exception as exc:
122122
logger.warning(
123123
f"""The datafiles directory could not be created at:

src/raman_fitting/config/filepath_settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060

6161
# ADAPT to your own configurations
6262
if 0: # pragma: no cover
63-
# TODO implement config file handling
63+
# IDEA implement config file handling
6464
# LOCAL_CONFIG_FILE.is_file():
6565
try:
6666
# PACKAGE_ROOT, MODEL_DIR are not locally configurated

src/raman_fitting/deconvolution_models/base_model.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ class BaseModel:
111111
_SEP = "+"
112112
_SUFFIX = "_"
113113

114-
# TODO change include substrate to has substrate and remove from init
114+
# IDEA change include substrate to has substrate and remove from init
115115
def __init__(
116116
self,
117117
model_name: str = "",
@@ -220,14 +220,14 @@ def add_substrate(self):
220220

221221
def validate_model_name_input(self, value):
222222
"""checks if given input name is valid"""
223-
if not type(value) == str:
223+
if type(value) != str:
224224
raise TypeError(
225225
f'Given name "{value}" for model_name should be a string insteady of type({type(value).__name__})'
226226
)
227227
elif not value:
228228
warn(f'\n\tThis name "{value}" is an empty string', BaseModelWarning)
229229
return value
230-
elif not "+" in value:
230+
elif "+" not in value:
231231
warn(
232232
f'\n\tThis name "{value}" does not contain the separator "+". (could be just 1 Peak)',
233233
BaseModelWarning,

src/raman_fitting/deconvolution_models/default_peaks/first_order_peaks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,5 +139,5 @@ def __init__(self):
139139

140140
def test_for_Si_substrate(
141141
model,
142-
): # TODO test fit on spectrum to decide wether Si substrate is required or not
142+
): # IDEA test fit on spectrum to decide wether Si substrate is required or not
143143
"""make test fit for only slice 900-1000"""

src/raman_fitting/deconvolution_models/fit_models.py

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class Fitter:
1414
"""
1515
Fitter class for executing the fitting functions and optimizations
1616
17-
# TODO implement sensing of spectrum for Si samples
17+
IDEA: implement sensing of spectrum for Si samples
1818
"""
1919

2020
fit_windows = ["1st_order", "2nd_order"]
@@ -48,7 +48,7 @@ def spectra(self, value):
4848
_fit_lbl = "int"
4949
elif isinstance(value, pd.DataFrame):
5050
raise AttributeError
51-
# TODO implement self.sense_windowname(value)
51+
# IDEA implement self.sense_windowname(value)
5252
else:
5353
raise ValueError(_errtxt)
5454

@@ -112,7 +112,7 @@ def fit_models(self, model_selection):
112112
self.FitResults.update(**_fittings)
113113

114114
def run_fit(self, model, _data, method="leastsq", **kws):
115-
# TODO improve fitting loop so that starting parameters from modelX and modelX+Si are shared, faster...
115+
# ideas: improve fitting loop so that starting parameters from modelX and modelX+Si are shared, faster...
116116
_fit_res, _param_res = {}, {}
117117
init_params = model.make_params()
118118
x, y = _data.ramanshift, _data[kws.get("_int_lbl")]
@@ -131,7 +131,7 @@ def run_fit(self, model, _data, method="leastsq", **kws):
131131
def get_int_label(self, value):
132132
_lbl = ""
133133
if isinstance(value, pd.DataFrame):
134-
cols = [i for i in value.columns if not "ramanshift" in i]
134+
cols = [i for i in value.columns if "ramanshift" not in i]
135135
if len(cols) == 0:
136136
_lbl = ""
137137
if len(cols) == 1:
@@ -206,15 +206,10 @@ def model_result(self, value):
206206
_mod_lbl = f'Model_{getattr(value,"_modelname")}'
207207
self.model_name_lbl = _mod_lbl
208208

209-
# TODO remove
210-
# from pprint import pprint
211-
# print('===== /n',value._int_lbl,'/n')
212-
213209
self.raw_data_lbl = value._int_lbl
214210

215211
self._model_result = value
216212

217-
# TODO rewrite class and attirbuter setter
218213
self.make_result()
219214

220215
def make_result(self):
@@ -335,7 +330,7 @@ def prep_components(self):
335330
_fit_comps_data = OrderedDict({"RamanShift": self.model_result.userkws["x"]})
336331
_fit_comps_data.update(self.model_result.eval_components())
337332

338-
# TODO take out
333+
# IDEA take out
339334
# print('===/n',self.model_result, '/n')
340335
# print('===/n',self.model_result.__dict__.keys(), '/n')
341336

@@ -344,7 +339,6 @@ def prep_components(self):
344339
{
345340
self.model_name_lbl: self.model_result.best_fit,
346341
"residuals": self.model_result.residual,
347-
# TODO check attributes of model_result
348342
self.model_result._int_lbl: self.model_result.data,
349343
}
350344
)
@@ -353,7 +347,7 @@ def prep_components(self):
353347

354348

355349
def NormalizeFit(norm_cleaner, plotprint=False): # pragma: no cover
356-
# TODO optional add normalization seperately to Fitter
350+
# IDEA: optional add normalization seperately to Fitter
357351
x, y = norm_cleaner.spec.ramanshift, norm_cleaner.blcorr_desp_intensity
358352
Model = InitializeModels("2peaks normalization Lorentzian")
359353
params = Model.make_params()

src/raman_fitting/deconvolution_models/peak_validation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ def __getattr__(self, name):
342342
# raise AttributeError(f'Chosen name "{name}" not in in options: "{", ".join(self.options)}".')
343343

344344
def normalization_model(self):
345-
pass # TODO separate peaks in groups
345+
pass # IDEA separate peaks in groups
346346

347347
def __iter__(self):
348348
for mod_inst in self.lmfit_models:

0 commit comments

Comments
 (0)