pmb399 / H5Analysis

This is a library to analyse, plot, and export HDF5 data
https://h5analysis.readthedocs.io/latest/index.html
MIT License
1 stars 0 forks source link

XASLoader.add TypeError #55

Open josephzsombor opened 5 hours ago

josephzsombor commented 5 hours ago

I'm having an issue where XASLoader.add always gives me a type error. XASLoader.load doesn't give me the same error.

TypeError: h5analysis.LoadData.Load1d.load() got multiple values for keyword argument 'grid_x'

Could it be that I've done something wrong in setup?

pmb399 commented 5 hours ago

@josephzsombor I don't think there are any problems with your installation. Would you be able to share the couple lines of code that you used to instantiate the XASLoader object and the subsequent .add call? I assume you are specifying the grid_x argument which relies on the base class Load1d. However, in XASLoader this functionality is overwritten and you would specify a key-word grid instead. The only thing that seems slightly strange is that it works with .load - if you are using the exact same code, this should not work either.

@boykocls We might want to consider checking whether grid_x is in the kwargs dictionary prior to passing it on to the Load1d call to avoid this TypeError. See here: https://github.com/pmb399/H5Analysis/blob/f4d58963fa029ba5b8d3a2f557a663aa41b63254/src/h5analysis/beamlines/REIXS.py#L1102C1-L1112C86

josephzsombor commented 5 hours ago

Hi @pmb399 !

Actually, you're 100% correct. It works with neither. When I noticed that it worked with XASLoader.load I had been accidentally using a different conda env, which must've had an older version of h5analysis and/or python installed. I created a new env with python3.13.0 and h5analysis installed as per the instructions on your docs page and in that env neither XASLoader.load nor XASLoader.add work.

I am actually just trying to re-run some of the blocks from the jupyter file from my beamtime. For example, these are the lines I tried to run:

XAS_Cu = XASLoader()
XAS_Cu.add(RSXS, 'Se_samples.h5', '(SDDX_N[745:1075]*11.5-0.03)',64,66,67,68,69,70,71,72,73,norm = True)
XAS_Cu.plot()