Comments (8)
Right now I opt for putting it in a try block. The time tag for a simple series has been pretty much my main focus in the past: in situ heating experiments with time dependent processes.
According to the SER spec the tags seem mandatory and would need to have at least the time information. Could you provide me that test file? I would like to make sure that I did not screw up that version dependent length of things to read in. Apart from that I guess its best to put it in a try block and assign nan if the tag information is missing.
from openncem.
Inserted a try block in fileSER.getTag() to return a tag full with nans, if something goes wrong (branch iss4).
Could you test this fix or send me the file?
from openncem.
Sorry for the late reply on this. I answered your other questions and forgot about this one. I think the try block is a good idea. Its nice to have the time tags available if the exist.
Ill test this when I get a chance and send you the file I had trouble with by email for future testing. We probably need to add a few test files of different types (1 image, multi-image, spectra, etc.)
from openncem.
I uploaded a test data set which triggers the try: block you added. You will receive an email from Google Drive. Let me know if there is a better way to share this data.
I still get an error when trying to read the non-existent tags (im1.getTag(0)) or run writeEMD(). See below:
TypeError: list indices must be integers or slices, not str
The problem is tag creation should be a dict tag{}
not a list tag[]
. I pushed a fix and now this tests properly on my series file. We can merge this once you try it @fniekiel.
from openncem.
I also had to add try/except blocks to all other instances of getTag in the file. Otherwise, writeEMD() did not work properly. I made the except use time[x,y] = 0 in each case. Im not sure if this is how this should be done. Maybe we should make a "fake" time tag of increasing integers.
from openncem.
Thanks for the help. I have merged the fixes from #3 and #4 to keep working on a single branch. For me it is working with the test file you provided.
I decided to remove the try-except blocks around calls to getTag, as I prefer to handle everything inside getTag. Now getTag will return a tag in either case, but its empty if the TagOffsetArray is bad.
In my initial fix (except for the tag{} problem) I did not consider that some of the entries in TagOffsetArray are zero, such that they do not raise an exception during file reading. It is now checking the TagTypeID and compares it to the one in the file header.
Could you try once more with your test? If it runs ok, I would like to merge iss3+4 to development and release them as version 1.1.2.
from openncem.
I just tested iss3+4. It works for me on the 01_Si110_5images_1.ser. I think we can merge this.
from openncem.
merged to development
from openncem.
Related Issues (20)
- Matlab Code Location HOT 1
- ser.py and import ncempy.io.emd HOT 1
- SER array size backwards HOT 3
- ser tab complete infinite loop HOT 1
- Submodule name io clobbers built in python3 module io HOT 1
- 4D-STEM data reads incorrectly HOT 1
- Could not build ncempy. Cannot load backend 'Qt5Agg' which requires the 'qt5' HOT 34
- Change genfire import line HOT 1
- dm data not accessible after file closed using on_memory option HOT 2
- RingDiff tool and PyQT HOT 1
- module 'ncempy' has no attribute 'io' HOT 4
- EMD `memmap`s can lose their file handles prematurely HOT 1
- DM import can't read newest-version files HOT 1
- DM reader fails in `__del__` on current Python 3.9 HOT 1
- `BufferError` caused by eager closing of DM file handles HOT 3
- emd import does not support default dim attributes HOT 3
- Unsupported tag breaks DM reading
- IMG and SMV not recognized
- SMV and IMG reader errors HOT 1
- Numpy 2.0 compatibility HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from openncem.