Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Residual errors are 0 #92

Open
ZvejysMegejas opened this issue Jun 23, 2023 · 9 comments
Open

Residual errors are 0 #92

ZvejysMegejas opened this issue Jun 23, 2023 · 9 comments
Assignees
Labels
bug Something isn't working

Comments

@ZvejysMegejas
Copy link

ZvejysMegejas commented Jun 23, 2023

Hi,

I'm a new user of Rascal. Trying to use it to calibrate the spectrometer. After messing around with custom atlas lines and all other setting I managed to get satisfactory line matches. However I noticed that the Residual error and RMS were shown as zeros in c.plot_fit. I looked in the code of the plot.fit in plotting.py, and I have feeling that the error sits over there. As I'm a new Python user as well, I can not pinpoint where is that exactly as the code for the Residual Error calculations seems complicated for me. A simpler code gives "proper" numbers for Residual error.

peaks_angstr = c.polyval(matched_peaks, fit_coeff1)
diff = []

for i, j in zip(peaks_angstr, matched_atlas):

diff.append(i - j)

print(diff)

# RMS calculations

rms = np.sqrt(np.mean(np.array(diff) ** 2.0))

print(rms)

@jveitchmichaelis jveitchmichaelis added the bug Something isn't working label Jun 24, 2023
@cylammarco
Copy link
Collaborator

Hi @ZvejysMegejas, would you please share the code and the full error message?

@ZvejysMegejas
Copy link
Author

Please find at https://github.com/ZvejysMegejas/rascalcodeexample
Three files: the code, the data, and the result of 'c.plot_fit'

I noticed that if plots are send to a browser (plotly feature?), then the residual error is shown correctly. However, if plotting is done with pyplot (?), the error is flat.

I'll try to write my own code with 'plotly' using your examples.

@cylammarco
Copy link
Collaborator

I noticed that if plots are send to a browser (plotly feature?), then the residual error is shown correctly. However, if plotting is done with pyplot (?), the error is flat.

Thanks, that's a really good place to start!

@cylammarco
Copy link
Collaborator

This is also fixed in the dev-0.3.X branch.

@ZvejysMegejas
Copy link
Author

This is also fixed in the dev-0.3.X branch.

Thus, I downloaded a new file. Now I'm getting a funny result :)

image

Labels and seems positions are used twice now.

@ZvejysMegejas
Copy link
Author

Using
c.use_plotly()

The labels are shown too however the lines are not used in the fitting.

image

@ZvejysMegejas
Copy link
Author

OK, my bad.
In my file, the spectral lines had a missing digit:
435.8335 was used as 35.8335.
[404.6565, 407.7837**, 35.8335,** 491.6068 ...]

With an improved atlas, still the plot does not act properly.
image

@cylammarco
Copy link
Collaborator

Ha! @jveitchmichaelis, is that an old bug creeping back or a wontfix in v0.3?

@jveitchmichaelis
Copy link
Owner

Did we figure out this one @cylammarco ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants