Skip to content
New issue

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

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

Already on GitHub? # to your account

datetime's not supported in loaders as indices #27

Closed
pbeaucage opened this issue Apr 7, 2022 · 0 comments · Fixed by #79
Closed

datetime's not supported in loaders as indices #27

pbeaucage opened this issue Apr 7, 2022 · 0 comments · Fixed by #79

Comments

@pbeaucage
Copy link
Collaborator

Loading with a dimension of, e.g., meas_time in SST1RSoXSDB causes errors because it's a date time and a list trick is used.

OBJECT CACHE: Will use up to 121_499_070_873 bytes (15% of total physical RAM)
INFO:tiled.server.object_cache:Will use up to 121_499_070_873 bytes (15% of total physical RAM)
OBJECT CACHE: Will use up to 121_499_070_873 bytes (15% of total physical RAM)
INFO:tiled.server.object_cache:Will use up to 121_499_070_873 bytes (15% of total physical RAM)
/nsls2/users/pbeaucage/PyHyperScattering-devel/src/PyHyperScattering/SST1RSoXSDB.py:102: UserWarning: While loading en_energy_setpoint to infill metadata entry for energy, found beginning and end values unequal: <xarray.DataArray 'en_energy_setpoint' (time: 2)>
array([403.5962788, 404.088584 ])
Coordinates:

  • time (time) float64 1.649e+09 1.649e+09
    Attributes:
    object: en. It is possible something is messed up.
    md = self.loadMd(run)
    /nsls2/users/pbeaucage/PyHyperScattering-devel/src/PyHyperScattering/SST1RSoXSDB.py:126: FutureWarning: Using a non-tuple sequence for multidimensional indexing is deprecated; use arr[tuple(seq)] instead of arr[seq]. In the future this will be interpreted as an array index, arr[np.array(seq)], which will result either in an error or a different result.
    darkframe[(data.time - time)>0]=int(n)
    /srv/conda/envs/notebook/lib/python3.7/site-packages/ipykernel_launcher.py:3: UserWarning: corrections other than none are not supported at the moment
    This is separate from the ipykernel package so we can avoid doing imports until

TypeError Traceback (most recent call last)
~/PyHyperScattering-devel/src/PyHyperScattering/SST1RSoXSDB.py in loadRun(self, run, dims, coords)
140 try:
--> 141 test = len(md[dim])
142 dims_to_join.append(md[dim])

TypeError: object of type 'datetime.datetime' has no len()

During handling of the above exception, another exception occurred:

TypeError Traceback (most recent call last)
in
1 rsoxsload = PyHyperScattering.load.SST1RSoXSDB(corr_mode='i0')
2 c = from_profile('rsoxs')
----> 3 itp = rsoxsload.loadRun(c[-1])#,dims=['energy'])
4 itp.attrs['start']['plan_name']
5 #%time write_run_artifacts(-7,loader=rsoxsload,catalog=c)

~/PyHyperScattering-devel/src/PyHyperScattering/SST1RSoXSDB.py in loadRun(self, run, dims, coords)
143 dim_names_to_join.append(dim)
144 except TypeError:
--> 145 dims_to_join.append(np.ones(run.start['num_points'])*md[dim])
146 dim_names_to_join.append(dim)
147

TypeError: unsupported operand type(s) for *: 'float' and 'datetime.datetime'

BijalBPatel added a commit that referenced this issue Aug 3, 2023
…oaders-as-indices

Fixes #27 by creating non-varying params in a more reasonable way
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant