PtychographyTranslator read_dm3 issue
Created by: kbschliep
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')