You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was runing demo script "2d_ptychography_w_position_correction.py" and found some interesting path issues.
ptychography.py line 224 h5py_path = f'{save_path}/demo/cone_256_foam_ptycho' seems to be hard-coded with the '/demo/cone_256_foam_ptycho` after {save_path} and this would break the i/o for other demo scripts
ptychography.py line 397-404 if not os.path.exists('arrsize_{}_{}_{}_ntheta_{}'.format(*this_obj_size, n_theta)) seems to check and make the folder for rotation transformation coordinates at the working directory. For demo purpose I'd assume the working directory to be "adorym/demos", saving demo-specific folders at a common level is probably not ideal because all the demo scripts would be saving their folders here.
With arrsize_256_256_1_ntheta_1 sitting under adorym/demos, it will also cause error in forward_model.py line 235, 451, 541, 657, 881 while they're all looking for the file under {save_path}/demo given coord_ls = read_origin_coords('{}/demo/arrsize_{}_{}_{}_ntheta_{}'.format(self.save_path, *this_obj_size, n_theta), theta_ls[this_i_theta], reverse=False). The save_path is defined as 'cameraman_pos_error' inside the demo script so we'll get NotFoundError.
Lastly, the util.py that defines function save_rotation_lookup at line 492 seems to default the folder 'arrsize_{}{}{}ntheta{}' to be generated at working directiory as well, unless dest_folder is explicitly specified.
I wasn't really sure what'd be the best way to fix the path issues while maintaining the function in both demo and production scenario, but I'd guess we could first fix 1., and just save the 'arrsize' forlder under 'save_path', and then fix all 5 lines in forward_model.py by removing the /'demo', and prefix a {save_path} to the "dest_folder = " when we call save_rotation_lookup. Let me know if this makes sense or if I'm missing anything, thanks!
The text was updated successfully, but these errors were encountered:
Thanks for pointing this out. The hardcoded paths were found in a pull request I merged a few months ago which I didn't realize. The quickest way to fix this is to roll back to the previous commit 31035d35cd016313bd8e80c79bcc9ba4aede9059, where it would follow user-specified working directories. I'll also reset the master branch back to that.
Hi, thanks for sharing the code!
I was runing demo script "2d_ptychography_w_position_correction.py" and found some interesting path issues.
ptychography.py
line 224h5py_path = f'{save_path}/demo/cone_256_foam_ptycho'
seems to be hard-coded with the '/demo/cone_256_foam_ptycho` after {save_path} and this would break the i/o for other demo scriptsptychography.py
line 397-404if not os.path.exists('arrsize_{}_{}_{}_ntheta_{}'.format(*this_obj_size, n_theta))
seems to check and make the folder for rotation transformation coordinates at the working directory. For demo purpose I'd assume the working directory to be "adorym/demos", saving demo-specific folders at a common level is probably not ideal because all the demo scripts would be saving their folders here.arrsize_256_256_1_ntheta_1
sitting underadorym/demos
, it will also cause error inforward_model.py
line 235, 451, 541, 657, 881 while they're all looking for the file under{save_path}/demo
givencoord_ls = read_origin_coords('{}/demo/arrsize_{}_{}_{}_ntheta_{}'.format(self.save_path, *this_obj_size, n_theta), theta_ls[this_i_theta], reverse=False)
. Thesave_path
is defined as 'cameraman_pos_error' inside the demo script so we'll get NotFoundError.util.py
that defines functionsave_rotation_lookup
at line 492 seems to default the folder 'arrsize_{}{}{}ntheta{}' to be generated at working directiory as well, unlessdest_folder
is explicitly specified.I wasn't really sure what'd be the best way to fix the path issues while maintaining the function in both demo and production scenario, but I'd guess we could first fix 1., and just save the 'arrsize' forlder under 'save_path', and then fix all 5 lines in
forward_model.py
by removing the /'demo', and prefix a {save_path} to the "dest_folder = " when we callsave_rotation_lookup
. Let me know if this makes sense or if I'm missing anything, thanks!The text was updated successfully, but these errors were encountered: