Skip to content

Commit

Permalink
chore: style
Browse files Browse the repository at this point in the history
  • Loading branch information
MyPyDavid committed Jan 14, 2024
1 parent 99dd668 commit e0041c8
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 17 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

In batch processing mode this package will index the raman data files in a chosen folder.
First, it will try to extract a sample ID and position number from the filenames and create an index of the files in a dataframe. Over this index a preprocessing, fitting and exporting loop will start.
There are several models, each with a different combination of typical peaks, used for fitting. Each individual typical peak is defined as a class in the deconvolution/default_peaks folder with some added literature reference in the docstring. Here, the individual peak parameter settings can also be easily adjusted for initial values, limits, shape (eg. Lorentzian, Gaussian and Voigt) or be fixed at certain initial values.
There are several models, each with a different combination of typical peaks, used for fitting. Each individual typical peak is defined as a class in the deconvolution/default_models folder with some added literature reference in the docstring. Here, the individual peak parameter settings can also be easily adjusted for initial values, limits, shape (eg. Lorentzian, Gaussian and Voigt) or be fixed at certain initial values.
Export is done with plots and excel files for the spectral data and fitting parameters for further analysis.


Expand Down
14 changes: 6 additions & 8 deletions src/raman_fitting/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,18 +95,16 @@
from raman_fitting.delegating.main_delegator import MainDelegator, make_examples

# Indexer
from raman_fitting.imports.indexer import MakeRamanFilesIndex as make_index
from raman_fitting.imports.files.file_indexer import MakeRamanFilesIndex as make_index

# Processing
from raman_fitting.processing.spectrum_template import SpectrumTemplate
from raman_fitting.processing.spectrum_constructor import (
SpectrumDataLoader,
SpectrumDataCollection,
)
from raman_fitting.imports.spectrum.spectrum_constructor import SpectrumDataLoader
from raman_fitting.imports.spectrum.spectra_collection import SpectrumDataCollection


# Modelling / fitting
from raman_fitting.deconvolution_models.init_models import InitializeModels
from raman_fitting.deconvolution_models.fit_models import Fitter
from raman_fitting.models.deconvolution.init_models import InitializeModels
from raman_fitting.models.fit_models import Fitter


# Exporting / Plotting
Expand Down
18 changes: 11 additions & 7 deletions src/raman_fitting/exports/exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ class Exporter:
"""

def __init__(self, arg, raw_out=True, plot=True, model_names_prefix=["1st", "2nd"]):
def __init__(
self, arg, raw_out=True, plot=True, model_names_prefix=["first", "second"]
):
self.raw_out = raw_out
self.plot = plot
try:
Expand Down Expand Up @@ -87,17 +89,19 @@ def raw_export(self):
def export_fitting_plotting_models(self):
pars1, pars2 = [], []

_1st = {
k: val for k, val in self.fitter.FitResults.items() if k.startswith("1st")
_first = {
k: val for k, val in self.fitter.FitResults.items() if k.startswith("first")
}
_2nd = {
k: val for k, val in self.fitter.FitResults.items() if k.startswith("2nd")
_second = {
k: val
for k, val in self.fitter.FitResults.items()
if k.startswith("second")
}

for modname_2, fitres_2 in _2nd.items():
for modname_2, fitres_2 in _second.items():
self.export_xls_from_spec(fitres_2)
pars2.append(fitres_2.FitParameters)
for modname_1, fitres_1 in _1st.items():
for modname_1, fitres_1 in _first.items():
self.export_xls_from_spec(fitres_1)
try:
fit_spectrum_plot(
Expand Down
2 changes: 1 addition & 1 deletion tests/exporting/test_plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import pytest
from lmfit import Model

from raman_fitting.deconvolution_models.init_models import InitializeModels
from raman_fitting.models.deconvolution.init_models import InitializeModels
from raman_fitting.exports.plot_formatting import (
get_cmap_list,
assign_colors_to_peaks,
Expand Down

0 comments on commit e0041c8

Please sign in to comment.