Re: [PyMca] Baseline calculation using SNIPModule.py
Brought to you by:
vasole
From: PyMca g. p. m. list. <pym...@li...> - 2025-01-27 19:17:10
|
Dear Ana Júlia, The PyMca5.PyMca importing approach is there for backwards compatibility but sometimes it does not properly work with relative imports. Please use the full import: from PyMca5.PyMcaMath import SNIPModule It should work. Best regards, Armando On 27/01/2025 17:35, PyMca general purpose mailing list. wrote: > Dear PyMca community, > I am attempting to calculate the XRF spectrum baseline itself (without > the fit) using the PyMca module, specifically using the SNIP > algorithm. While searching on GitHub, I found the SNIP|Module.py| and > tried to import it to use the function > |getSpectrumBackground(spectrum, width, roi_min=None, roi_max=None, > smoothing=1)|. However, when importing the module, I encountered the > following error: > ImportError: cannot import name 'SpecfitFuns' from > 'PyMca5.PyMca.fitting' > (/opt/micromamba/envs/pymca_env/lib/python3.8/site-packages/PyMca5/PyMcaGui/math/fitting/__init__.py) > > It seems that I already have the compiled version of |SpecfitFuns|, > but I am unsure what went wrong. I am attaching an image of the > terminal for your review. > > Additionally, I would like to confirm if this is the proper way to > calculate the baseline using the SNIP algorithm without any graphical > interface. I have already created a script to perform the fit using > the methods |ClassMcaTheory().estimate()| and |startfit()|, along with > a configuration file specifying the parameters. If I’m not mistaken, > the "continuum" key in the result of |startfit()| represents the > baseline, correct? Is there a way to obtain the baseline without > having to perform the fit first? > > I would greatly appreciate any advice or guidance on how to resolve > this issue. > Best regards, > > Ana Júlia > Intern at Sirius - The Brazilian Synchrotron Light Laboratory (LNLS) > > > > Aviso Legal: Esta mensagem e seus anexos podem conter informações > confidenciais e/ou de uso restrito. Observe atentamente seu conteúdo e > considere eventual consulta ao remetente antes de copiá-la, divulgá-la > ou distribuí-la. Se você recebeu esta mensagem por engano, por favor > avise o remetente e apague-a imediatamente. > > Disclaimer: This email and its attachments may contain confidential > and/or privileged information. Observe its content carefully and > consider possible querying to the sender before copying, disclosing or > distributing it. If you have received this email by mistake, please > notify the sender and delete it immediately. > > > > _______________________________________________ > PyMca-users mailing list > PyM...@li... > https://lists.sourceforge.net/lists/listinfo/pymca-users |