Closed capitanevs closed 4 years ago
With menu open:
The back-end function gets called like this:
I have modified the function, so it accepts two additional parameters, FileFormat
and SkipRows
. I don't have any example files or know what is the difference between height and slopes, so it would be best if you can modify the FigureErrorLoad
to accept the two formats, the latest version is in the repository.
This is the function to wire. It is a member of Optics.py => Mirror class.
def FigureErrorLoadFromFile(PathFile : str,
FileType = [enum value, see below],
Step = 1e-3,
Delimiter = '\t',
SkipLines = 0,
XScaling = 1,
YScaling = 1,
**kwargs):
return Height, Step
"FileType" distinguishes the different case we have to handle These are the different cases (with labels to use).
in Optics.py
class FIGURE_ERROR_FILE_FORMAT(Enum):
HEIGHT_ONLY = 0 # label: "Height (Y)"
POSITION_AND_HEIGHT = 2**1 # label: "Position, Height (X,Y)"
SLOPE_ONLY = 2**2 # label: "Slope (dY)"
ELETTRA_LTP_JAVA1 = 2**3 # label: "ELETTRA LTP-JAVA1"
ELETTRA_LTP_DOS = 2**4 # label: "ELETTRA LTP"
Here there is a short list of how the mask should appear. I did it quickly, so I hope it is clear. The first entries mark the required fields. XScaling and YScaling tell how the computation must be performed (they are not fields, and shall not be displayed).
HEIGHT_ONLY "Step [oasys units]", default = 1mm "Height unit" as string, default to "mm". Use LibWiser.Units.GetPrefixFactor to convert to float. E.g. GetPrefixFactor('mm') = 0.001. Here you can also use a listbox with S.I. prefixes rather than a free string box. Prefixes are stored in LibWiser.Units.SiPrefixes as a dictionary. Choose the most effective solution. "Custom Height scaling (Y)", default = 1 "Delimiter" = '\t' or empty "Lines to skip" = 0
XScaling = 1
YScaling = "Custom Height scaling (Y)" * "Height unit"
POSITION_AND_HEIGHT "Step" show somewhere if possible, it is returned by FigureErrorLoadFromFile "Step unit" as string, default to "mm". "Height unit" as string, default to "mm". "Custom Height scaling (Y)", default = 1 "Delimiter" = '\t' "Lines to skip" = 0
XScaling = "Step unit"
YScaling = "Custom Height scaling (Y)" * "Height unit"
SLOPE_ONLY the same as HEIGHT_ONLY, but with "Slope unit" as label.
ELETTRA_LTP_JAVA1 everything is hardwired except "Custom Height scaling (Y)", default = 1
XScaling = 1
YScaling = "Custom Height scaling (Y)"
ELETTRA_LTP_DOS everything is hardwired, except "Custom Height scaling (Y)", default = 1
XScaling = 1
YScaling = "Custom Height scaling (Y)"
I have tested it for the most common cases and it simplify things a lot. For instance with "JAVA1" code looks like this
ReadYFile
is missing and is crucial for this...
Inviato da myMail per Android Giovedì, 30 Luglio 2020, 03:16PM +02:00 da aljosahafner notifications@github.com :
ReadYFile is missing and is crucial for this... — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub , or unsubscribe .
It was in ToolLib yes, I corrected the bug from ReadYFile
to tl.ReadYFile
Allright, thank you.
I must have had littered workspace.
If something else is wrong, I am in right now.
M
Il 30/07/2020 18:06, aljosahafner ha scritto:
It was in ToolLib yes, I corrected the bug from |ReadYFile| to |tl.ReadYFile|
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/oasys-elettra-kit/OasysWiser/issues/20#issuecomment-666491810, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADGPG3GFU6JMUWX6WWXIS5LR6GLBDANCNFSM4NOLQPFQ.
-- Michele Manfredda, PhD Scientist Photon Transport Group Elettra - Sincrotrone Trieste (IT)
"The release date is just one day, but the record is forever." Bruce Springsteen
etc.
Functionality has to be tested, as there are two ReadYFile
functions, one in must
and another one in ToolLib.FileIO
. I don't have the corresponding profile files to test this. Delimiter functionality is a bit unknown for now (disconnected from the code), as the string which is passed gets converted to the corresponding ASCII sign.
You are right: the one in must.py
was probably the first version, which I then migrated into ToolLib.FileIO
I have never removed it because I was afraid of back-compatibility issues.
String: when does it happen the conversion? If you pass '\t' to LibWiser function it should be ok (i.e. you are not converting \t into "tab"). Do you think it is happening before? Maybe when you get the text value from the textbox? If yes, does it change something if you input "\t" raher than "\t"?
For Michele:
-For Aljosa and Michele: Discuss the following format (we have already talked about that, I am just putting it to written form). Discuss which function to use and where (I guess something in wofrywiser).