Thread: [PyMca] ROI Imaging Tool: Stack Simple Fitting
Brought to you by:
vasole
From: PyMca g. p. m. list. <pym...@li...> - 2020-10-09 16:56:15
|
Dear all, I am currently using the ROI Imaging Tool to visualise various .edf mapping. I am trying to use the Stack Simple Fitting plugin to fit various curves to my signal. When I click the "ADD" button (to add function I suppose), the error message "Function not imported" occures. I am using this wrong? I went into the code and it seems that a dialog box should pop up (module SimpleFitGui.py, in PyMca5.PyMcaGui.math.fitting, line 219) in order to pick a file (maybe I am totally wrong though). Does anyone ever used this, and if yes could you help me ? Thanks in advance for you time and have a nice week-end. Best regards, Raphaël |
From: PyMca g. p. m. list. <pym...@li...> - 2020-11-19 15:36:31
|
Dear all, I am currently using the ROI Imaging Tool to visualise various .edf mapping. I am trying to use the Stack Simple Fitting plugin to fit various curves to my signal. Regarding this, I would like to raise two points. First when I try to add a fuction using the ADD button and selecting a python file everything goes okay, the function appears on the list, but when I estimate and start fit, it raises: : You should reconsider how to write your function. The python script I am using is the following one: from numpy import * def gauss(param, t): param = float(param) dummy = 2.35482 * (t - param[3])/param[4] return param[0] + param[1] * t + param[2] * exp(-0.5*dummy*dummy) FUNCTION = [gauss] PARAMETERS = [["Constant", "Linear", "Height", "Position", "FWHM"]] THEORY = ["My Gaussian"] ESTIMATE =[None] CONFIGURE = [None] I guess this is not the right format for describing the function? The second point I'd like to underline is more related to the capabilities of the Stack Simple Fitting module. I would like to know if it is possible to implement non-analytical functions for the fit: I have a 1-D array representing an certain spectrum (the excitation source) that I'd like to use to fit my signal, on which appears this certain spectrum. Is it possible to fit a 1D array, with maybe two parameters that would be a scale for the values and maybe a shift along x axis for exemple ? I guess it would raises other questions (if my 1D array is not the same lenght of my signal, a resize might be necessary). Thanks for any help provided, Best regards Raphael |
From: PyMca g. p. m. list. <pym...@li...> - 2020-11-19 15:57:25
|
Dear Raphael, I have unsuscribed myself from the mailing list, but I keep getting the emails here. Could you put me out of the list please? Thanks! Kind regards Yavuz O. Uca ________________________________ From: PyMca general purpose mailing list. [pym...@li...] Sent: Thursday, November 19, 2020 4:36 PM To: pym...@li... Subject: [ext] [PyMca] ROI Imaging Tool: Stack Simple Fitting Dear all, I am currently using the ROI Imaging Tool to visualise various .edf mapping. I am trying to use the Stack Simple Fitting plugin to fit various curves to my signal. Regarding this, I would like to raise two points. First when I try to add a fuction using the ADD button and selecting a python file everything goes okay, the function appears on the list, but when I estimate and start fit, it raises: <class 'TypeError'>: You should reconsider how to write your function. The python script I am using is the following one: from numpy import * def gauss(param, t): param = float(param) dummy = 2.35482 * (t - param[3])/param[4] return param[0] + param[1] * t + param[2] * exp(-0.5*dummy*dummy) FUNCTION = [gauss] PARAMETERS = [["Constant", "Linear", "Height", "Position", "FWHM"]] THEORY = ["My Gaussian"] ESTIMATE =[None] CONFIGURE = [None] I guess this is not the right format for describing the function? The second point I'd like to underline is more related to the capabilities of the Stack Simple Fitting module. I would like to know if it is possible to implement non-analytical functions for the fit: I have a 1-D array representing an certain spectrum (the excitation source) that I'd like to use to fit my signal, on which appears this certain spectrum. Is it possible to fit a 1D array, with maybe two parameters that would be a scale for the values and maybe a shift along x axis for exemple ? I guess it would raises other questions (if my 1D array is not the same lenght of my signal, a resize might be necessary). Thanks for any help provided, Best regards Raphael |
From: PyMca g. p. m. list. <pym...@li...> - 2020-11-19 16:28:55
|
Dear Raphael, It seems python does not any longer support numpy.float([1, 2, 3]) Replacing your param = float(param) by param = array(param, dtype=float) should be enough. The code below works for me: |
From: PyMca g. p. m. list. <pym...@li...> - 2020-10-09 17:58:20
Attachments:
SimpleFitGui.py
|
Dear Raphaël, Thank you for your feedback. The attached file should solve that problem. It will be in next release. Best regards, Armando |