oasys-elettra-kit / OASYS1-Wiser

The implementation of WISER into OASYS
MIT License
0 stars 1 forks source link

FIGURE ERROR GUI #77

Closed capitanevs closed 2 years ago

capitanevs commented 2 years ago

What does Scaling do? immagine

I expect in the previous image to change the Y on the chart, but it does not.

Similarly for "Height Unit"

aljosahafner commented 2 years ago

I see, you're right, this has to be fixed.

capitanevs commented 2 years ago

Keep in mind immagine

aljosahafner commented 2 years ago

Of course!

capitanevs commented 2 years ago

YEah yeah, it was for "personal" notice:) I mean, always get confused on what the meaning of X/YScaling is supposed to be (if the scaling of the written data, or if the factor I have to multiply once I have read them to make them in the SI system; apparently it is the first one. :)

aljosahafner commented 2 years ago

Bug fixed in 0.3.19. Please close when tested.

capitanevs commented 2 years ago

immagine

capitanevs commented 2 years ago

The figure error is read correctly (x>mm, y>nm)

However the intensity on the element has changed?

No figure error immagine

With figure error

immagine

For sure before the update (if the good numbers were given) this was not happening.

aljosahafner commented 2 years ago

Ok, weird, let's discuss today.

capitanevs commented 2 years ago

A Problem could still be that the x and y are not returned properly (because of the scaling factor)

if the figure error is too high,then we are deformating the mirror a lot, and we do not know what is happening to the scattered light.

i messed on a similar problem my as well:) maybe it is the same.

capitanevs commented 2 years ago

This error is still persistent and it has nothing to do with the issue related to "ignore" function.

Do we have any clue?

LDM simple.ows.txt ldmkbh(mm,nm).txt

aljosahafner commented 2 years ago

Ok, I haven't been to this issue yet. I need to do a bit more thorough inspection, as at the moment everything seems fine (lines 548 to 579 in ow_optical_element.py).

if self.use_figure_error == 1:
            libWiserOE.CoreOptics.ComputationSettings.UseFigureError = True

            if ((self.figure_error_select_file_format == FIGURE_ERROR_FILE_FORMAT.HEIGHT_ONLY) or
                    (self.figure_error_select_file_format == FIGURE_ERROR_FILE_FORMAT.SLOPE_ONLY)):
                figure_error_step_final = self.figure_error_step
                figure_error_xscaling_final = 1.
                figure_error_yscaling_final = self.figure_error_YScaling * figure_error_units[self.figure_error_height_unit]

            elif self.figure_error_select_file_format == FIGURE_ERROR_FILE_FORMAT.POSITION_AND_HEIGHT:
                figure_error_step_final = None
                figure_error_xscaling_final = figure_error_units[self.figure_error_step_unit]
                figure_error_yscaling_final = self.figure_error_YScaling * figure_error_units[self.figure_error_height_unit]

            elif self.figure_error_select_file_format == FIGURE_ERROR_FILE_FORMAT.ELETTRA_LTP_JAVA1:
                figure_error_step_final = None
                figure_error_xscaling_final = 1.
                figure_error_yscaling_final = self.figure_error_YScaling

            elif self.figure_error_select_file_format == FIGURE_ERROR_FILE_FORMAT.ELETTRA_LTP_DOS:
                figure_error_step_final = None
                figure_error_xscaling_final = 1.
                figure_error_yscaling_final = self.figure_error_YScaling

            libWiserOE.CoreOptics.FigureErrorLoadFromFile(PathFile=self.figure_error_file,
                                                          FileType=self.figure_error_select_file_format,
                                                          Step=figure_error_step_final,
                                                          #Delimiter=self.figure_error_delimiter,
                                                          SkipLines=int(self.figure_error_skip_rows),
                                                          XScaling=figure_error_xscaling_final,
                                                          YScaling=figure_error_yscaling_final
                                                          )

But the plot is also not updating upon change of units, which gives me no confidence in my answer :)

aljosahafner commented 2 years ago

Hey, I solved the "bug".

            libWiserOE.CoreOptics.FigureErrorLoadFromFile(PathFile=self.figure_error_file,
                                                          FileType=self.figure_error_select_file_format,
                                                          Step=figure_error_step_final,
                                                          #Delimiter=self.figure_error_delimiter,
                                                          SkipLines=int(self.figure_error_skip_rows),
                                                          XScaleFactor=figure_error_xscaling_final,
                                                          YScaleFactor=figure_error_yscaling_final
                                                          )

The underlying code in LibWiser changed, before it was called XScaling and YScaling, now it has another name YScaleFactor and XScaleFactor.

capitanevs commented 2 years ago

Sorry for the inconvenience. Now it works and it works nicely!

immagine immagine immagine