oasys-elettra-kit / OASYS1-Wiser

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

Save/Load, again => Defaulting values #61

Open capitanevs opened 3 years ago

capitanevs commented 3 years ago

We still have the Save/Load issue.

Because of its persistence, I will promote it to the nastiest bug ever, and the one with the highest priority.

What doest it happen At a certain point, the values stored in *.ows file are defaulted.

How do I see it? I have created a test workspace long time ago (Margot_3), which I marked as READONLY, (an which is read only on my laptop). This ensure that I have never overwritten the values since the file creation. The "right" values are written in ows file as comment.

What shall we do?

aljosahafner commented 3 years ago

I suggest a mail to Luca. He probably knows ...

capitanevs commented 3 years ago

Ok. Before doing that, I would try as follows:

I'll post an old answer of Luca here, just as common starting point.


-------- Messaggio Inoltrato -------- Oggetto: | Re: OASYS/ORANGE load/save -- | -- Wed, 17 Mar 2021 15:52:12 +0000 Rebuffi, Luca Michele Manfredda Aljosa Hafner

Dear All,

The load/save is based on the "pickle" package, that belongs to the kernel of python. We have experienced issues in the past, especially with some releases of Anaconda.
Sometimes, the pickle load failed when the file was saved in miniconda and opened in standard python or with a different version on miniconda. The result is the appearance of all default values in the input fields of the widgets.
This is the main reason why we froze the miniconda version in the installation script. When a problem like this happens, you should not save the ows again, in order to not loose the original content, and try to open it with a different installation of OASYS.
Anyway, this is the website of Orange: https://orangedatamining.com

Be aware that OASYS is relying on a special release of Orange, dated 2013. I did several modifications and upgrades, but it is no more aligned to the "original" one.
The manpower needed to realign to the "original" version (several weeks...) is not justified, especially considering the risks related to rewriting the kernel of a software.

In case you need my help, I need far more detailed information. I hope you can identify the cause soon or find a reproducible pattern that shows the error.

Best,

Luca Rebuffi, Ph.D.
capitanevs commented 3 years ago

Note: on MM laptopt, the recent update of OASYS was not installed (and the problem still persisted) immagine

capitanevs commented 3 years ago

MARGOT TEST OWS attached here

Rename from .MOV to .OWS to make it work :-)**

test_margot_03_READONLY.LOG

aljosahafner commented 3 years ago

image It works in my installation, file: test_wiser_margot_correct2_READONLY.ows

capitanevs commented 3 years ago

image It works in my installation, file: test_wiser_margot_correct2_READONLY.ows

please be sure that we all use the same file. The correct one is test_margot_03_READONLY.ows

aljosahafner commented 3 years ago

You're right, that one gets reset. Maybe there is some problem with Positioning directives, saving with a different one to the default?

capitanevs commented 3 years ago

TEST BY MARCO ZANGRANDO

file: test_margot_03_READONLY.ows OS: (macOS) Catalina

RESULT: BAD :-(, values are defaulted (e.g. elliptical mirror F1=98)

capitanevs commented 3 years ago

You're right, that one gets reset. Maybe there is some problem with Positioning directives, saving with a different one to the default?

I do not understand exactly what you mean:-)

WISER has no default values, but oasys widget have. In addition, this is not a matter of PositioningDirectives only, but of all the attributes (F1 and F2 are sent to init, not to PositionindDirectives). So the problem is somewhere in OASYS, I would say.

If you have some idea for a test for this involving LibWiser, I can do a counterproof.

In the meanwhile, since we have the issue an all the platforms, we need to roll back OASYS-Wiser (of 1,2,3 versions?) and see whether we can get the right values back.

Can you possibly handle this?

aljosahafner commented 3 years ago

There is a problem with the pickle module for this specific file, that's why it happens. It's not a problem of LibWiser, but ows files of course. You can always revert the version by doing: pip install oasys1-oasyswiser==version_no

aljosahafner commented 3 years ago

So, I have tried LOTS of combination and couldn't manage to run the file: OASYS Tests/Test Margot/test_margot_03_READONLY.ows The following combinations don't work (don't open the file with correct numbers)

image

Maybe we need to try some other strategy...

aljosahafner commented 3 years ago

My OS File browser says the file test_margot_03_READONLY.ows was last modified on 26. 8. 2021, there haven't been that many versions of OASYS1-oasyswiser and LibWiser since then, so at least the last one should be able to open it.

capitanevs commented 3 years ago

That's VERY interesting.

Premise: I clearly made some mistake in the process. test_margot_03_READONLY.ows is not really "read only" on my laptopt (wtf?). I sweared it was, but it is not. This means that there might have been a wrong saving operation on 26.8.2021, of which we still do not understand the causes (for sure I have never put the default values, for all the widgets, manually). But there is some partially good news:

I have a backup file in my "\old\" folder

test_margot_correct3_READONLY.ows => is still readonly, and it was last modified on 18.03.2021.

test_margot_03_READONLY.ows => wrong numbers Itest_margot_correct3_READONLY.ows => right numbers

Conclusion: Reading "seems" to work. Still do not know why in "margot_03" values are defaulted.

What to do now? All this is quite frustrating, We could: change the default values of the elliptical mirror focals F1, F2 to 0. Then cast an error message

If F1==0 or F2==0 then
   errorMessage("Focal lengths of the elliptical mirror can not be 0. Please check them"

This is just a different strategy to monitor the behavior of this thing: if it occurs, you will realize it as easily as me (4 eyes are better than 2).

The other thing we can do is write an email to Janes&co and say: "Hey, sometimes our values are defaulted, but we do not know when and why. There is something we can do, like adding a warning somewhere in OASys"?

What you think of all this?

aljosahafner commented 3 years ago

Ok, I can read the one in old fine with the latest versions, values are not defaulted.

capitanevs commented 3 years ago

Ok, good. This is what I see in my \old\ folder immagine

What do you think about setting F2 of the elliptic mirror to 0 and then cast the error message?

aljosahafner commented 3 years ago

That means that always when you add an optical element you get this error?

capitanevs commented 3 years ago

Sorry, I was unclear.

The idea is: " if a certain value is 0 when you launch the computation, then cast the error message", not "when you drop an optical element" :-)

capitanevs commented 3 years ago

This is new...

-I create a new file ("untitled.ows"), i use gaussian source + elliptical mirror + detector. -I change "Displacement" in the source (and see nothing, which is another issue). "Longitudinal" is set to -15 -I close the ows, without saving. -I open another workspace (Wiser Snippets.ows) -I open the source and the "Longitudinal" displacement is still at -15...Also the values of the mirror are the same of the "untitled.ows"

This stuff is quite unpredictable

capitanevs commented 3 years ago

Note: I DID NOT close oasys, I just opened "wiser Snippets.ows" in the same session

capitanevs commented 3 years ago

TO DO

immagine

Then everything should gear up automatically.

capitanevs commented 3 years ago

Did new test: on new default falues F1 and F2 of elliptical mirror:

case 1 -open oasys -deploy an elliptical mirror widget -double click -F1 = 0, F2 = 0 => As (I) expected

case 1b) -the same as 1)

we still have to check what is gonna happen when defaulting occurs because "load ows" fails