Skip to content

Update vamas.py for floating coordinate in MAP file#2

Merged
matkrin merged 1 commit into
matkrin:mainfrom
StephaneGuilet:patch-1
Sep 20, 2023
Merged

Update vamas.py for floating coordinate in MAP file#2
matkrin merged 1 commit into
matkrin:mainfrom
StephaneGuilet:patch-1

Conversation

@StephaneGuilet
Copy link
Copy Markdown
Contributor

Some MAP VAMAS file in XPS give coordinate in a floating format (example: -2.156) when you read the file you get a string like '-2.156\n' which cause a fault when using int() I propose to use int(float('-2.156\n')) to get the int value of the coordinate

Some MAP VAMAS file in XPS give coordinate in a floating format (example: -2.156) 
when you read the file you get a string like '-2.156\n' which cause a fault when using int()
I propose to use int(float('-2.156\n')) to get the int value of the coordinate
@matkrin
Copy link
Copy Markdown
Owner

matkrin commented Sep 15, 2023

Thanks for reporting this. Unfortunately, I could never test MAP files.
Do you know if there are cases in which the value is closer to the next higher integer?
E.g. int(float(2.9) would give a value of 2. Is that the bahavior we want or does 3 make more sense?

@matkrin matkrin merged commit 13c98b7 into matkrin:main Sep 20, 2023
@StephaneGuilet
Copy link
Copy Markdown
Contributor Author

Thanks for reporting this. Unfortunately, I could never test MAP files. Do you know if there are cases in which the value is closer to the next higher integer? E.g. int(float(2.9) would give a value of 2. Is that the behavior we want or does 3 make more sense?

Sorry, didn't see you question. Back to use this library, I don't know exactly what to answer. My case was a user with a MAP file with only one spectra. Maybe I should ask for an image to test the result of the data extraction on real MAP file.

@matkrin
Copy link
Copy Markdown
Owner

matkrin commented Jun 12, 2024

In general, it would be nice if we would have a bit more files, ideally from different machines of which we know the parameters that were set. Then we could write more tests to catch edge cases like this one. Personally, I just have access to one AES and one XPS.
Let me know if you want to share some files (can be meaningless data, as it gets added to this repo) or even write some tests. It would help a lot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants