Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HDF5 counting #259

Open
ercius opened this issue Jul 29, 2022 · 4 comments
Open

HDF5 counting #259

ercius opened this issue Jul 29, 2022 · 4 comments

Comments

@ercius
Copy link
Collaborator

ercius commented Jul 29, 2022

In v3.1.0 I get this warning using an H5 file to count:

DeprecationWarning: Using a reader in electron_count() that is not a SectorThreadedReader or a SectorThreadedMultiPassReader is deprecated in stempy==1.1 and will be removed in stempy==1.2

Here is the code:

with h5py.File('filename.h5','r') as f0:
    sReader = stio.reader(f0)
    ee = stim.electron_count(sReader,dark0,number_of_samples=1200,
                                            xray_threshold_n_sigma=175,
                                            background_threshold_n_sigma=4.5)

Is there a reason to deprecate this function? Its useful to create an H5 file, process the frames, and then compare the counting. I.e. for #258 and #233

@psavery
Copy link
Collaborator

psavery commented Jul 29, 2022

@cjh1 FYI, it looks like Peter's reader would be a PyReader in this case.

@psavery
Copy link
Collaborator

psavery commented Jul 29, 2022

If I'm not mistaken, this is calling the older electronCount() function that was designed with different logic and assumes there is only one frame per scan (see here). So if your data has more than one frame per scan, it might not work properly.

We should look into fixing this (maybe getting it to call the new electron counting function? or adjusting the old function to allow multiple frames per scan). The HDF5 case would definitely be one we would want to support.

@ercius
Copy link
Collaborator Author

ercius commented Jul 30, 2022

So if your data has more than one frame per scan, it might not work properly.

I dont think we have any way to indicate in the HDF5 format multiple frames per position. I think we can ignore that possibility since making HDF5's of raw data is not an important or common use case anymore.

We should look into fixing this (maybe getting it to call the new electron counting function? or adjusting the old function to allow multiple frames per scan). The HDF5 case would definitely be one we would want to support.

I think we should support HDF5 counting, but its not worth a lot of work to implement multiple frames per position. That is only applicable to the 4D Camera which normally uses the other sector reader.

@psavery
Copy link
Collaborator

psavery commented Jul 31, 2022

I dont think we have any way to indicate in the HDF5 format multiple frames per position. I think we can ignore that possibility since making HDF5's of raw data is not an important or common use case anymore.

Looks like you are right. I even see in the docs "frames - If present, the raw diffractogram data, where the first index is the scan position index for the 2D diffractogram.". So it must only support one frame per scan.

I think we should support HDF5 counting, but its not worth a lot of work to implement multiple frames per position. That is only applicable to the 4D Camera which normally uses the other sector reader.

Sounds good.

@cjh1 now we know that the other electronCount() method is still in use. We should thus either continue to make sure it works well or start using the new function for the PyReader (which may not be a huge amount of work to switch over).

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

No branches or pull requests

2 participants