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

PtychographyTranslator read_dm3 issue #196

Open
kbschliep opened this issue Nov 20, 2018 · 0 comments
Open

PtychographyTranslator read_dm3 issue #196

kbschliep opened this issue Nov 20, 2018 · 0 comments

Comments

@kbschliep
Copy link

kbschliep commented Nov 20, 2018

Having an issue using PtychographyTranslate.
In translate definition, within the Ptychography.py, the image_path is listed as [Absolute path to folder holding image files yet when image_type == '.dm3' it calls upon read_dm3(image_path).[1] In read_dm3,[2] the image_path is a path to the image file so some issues occur. I've copy pasted the relevant code I'm citing below.
1 - translate() -code
Parameters
----------------
image_path : str
Absolute path to folder holding the image files

2 - read_dm3() code
def read_dm3(image_path, get_parms=True):
"""
Read an image from a dm3 file into a numpy array
image_path : str
Path to the image file

In the end I'm just trying to use the PtychographyTranslation to convert a folder of .dm3 to an hdf5.
This is how I am currently using it (let me know if I'm missing something)

Example

root = Tk() # Tk() is a function in tkinter that opens a window
root.directory = filedialog.askdirectory() # opens explorer window so you can find the folder of choice
Data_path=root.directory # Returns folder location 'C:\Users\kbs1\Documents\Test'
hdf5_filename = 'Test.hdf5'
hdf5_path = Data_path + '/'+hdf5_filename # Returns 'C:\Users\kbs1\Documents\Test\Test.hdf5'

tran=PtychographyTranslator()
test_data= tran.translate(hdf5_path, Data_path, image_type='.dm3')

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

1 participant