Skip to content

two issues with hRIXS

issue with integrate:

print(ds)
h.integrate(ds)
<xarray.Dataset>
Dimensions:           (trainId: 74, x: 2048, y: 2048)
Coordinates:
  * trainId           (trainId) uint64 1475785615 1475785858 ... 1475803365
Dimensions without coordinates: x, y
Data variables:
    hRIXS_det         (trainId, x, y) uint16 557 505 551 560 ... 605 606 596 601
    hRIXS_index       (trainId) int32 6 7 8 9 10 11 12 13 0 ... 2 3 4 5 6 7 8 9
    hRIXS_delay       (trainId) float32 0.17 0.15 0.13 0.1 ... 0.15 0.13 0.1
    hRIXS_delay_corr  (trainId) float64 0.2265 0.2076 0.1878 ... 0.2159 0.1894
Attributes:
    runFolder:  /gpfs/exfel/exp/SCS/202202/p002953/raw/r0507

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-27-6d4e3e601b66> in <module>
      1 print(ds)
----> 2 h.integrate(ds)

/gpfs/exfel/u/scratch/SCS/202202/p002953/checkouts/toolbox_p2953_dev/src/toolbox_scs/detectors/hrixs.py in integrate(self, data)
    490             if self.USE_DARK:
    491                 image = image - dark_image
--> 492             r[:] = np.bincount(quo, weights=(rem * image).ravel())
    493         ret /= np.bincount(quo, weights=rem.ravel())
    494         data.coords["energy"] = (

/gpfs/exfel/sw/software/xfel_anaconda3/1.1.2/lib/python3.7/site-packages/xarray/core/arithmetic.py in __array_ufunc__(self, ufunc, method, *inputs, **kwargs)
     77             dataset_fill_value=np.nan,
     78             kwargs=kwargs,
---> 79             dask="allowed",
     80         )
     81 

/gpfs/exfel/sw/software/xfel_anaconda3/1.1.2/lib/python3.7/site-packages/xarray/core/computation.py in apply_ufunc(func, input_core_dims, output_core_dims, exclude_dims, vectorize, join, dataset_join, dataset_fill_value, keep_attrs, kwargs, dask, output_dtypes, output_sizes, meta, dask_gufunc_kwargs, *args)
   1108             join=join,
   1109             exclude_dims=exclude_dims,
-> 1110             keep_attrs=keep_attrs,
   1111         )
   1112     # feed Variables directly through apply_variable_ufunc

/gpfs/exfel/sw/software/xfel_anaconda3/1.1.2/lib/python3.7/site-packages/xarray/core/computation.py in apply_dataarray_vfunc(func, signature, join, exclude_dims, keep_attrs, *args)
    260 
    261     data_vars = [getattr(a, "variable", a) for a in args]
--> 262     result_var = func(*data_vars)
    263 
    264     if signature.num_outputs > 1:

/gpfs/exfel/sw/software/xfel_anaconda3/1.1.2/lib/python3.7/site-packages/xarray/core/computation.py in apply_variable_ufunc(func, signature, exclude_dims, dask, output_dtypes, vectorize, keep_attrs, dask_gufunc_kwargs, *args)
    718         if data.ndim != len(dims):
    719             raise ValueError(
--> 720                 "applied function returned data with unexpected "
    721                 f"number of dimensions. Received {data.ndim} dimension(s) but "
    722                 f"expected {len(dims)} dimensions with names: {dims!r}"

ValueError: applied function returned data with unexpected number of dimensions. Received 3 dimension(s) but expected 2 dimensions with names: ('x', 'y')

issue with params:

h = hRIXS()
h.get_params()
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-2-a9efe7eafc7d> in <module>
      1 h = hRIXS()
----> 2 h.get_params()

/gpfs/exfel/u/scratch/SCS/202202/p002953/checkouts/toolbox_p2953_dev/src/toolbox_scs/detectors/hrixs.py in get_params(self, *params)
    331                       'factor', 'range', 'bins',
    332                       'method', 'fields')
--> 333         return {param: getattr(self, param.upper()) for param in params}
    334 
    335     def from_run(self, runNB, proposal=None, extra_fields=()):

/gpfs/exfel/u/scratch/SCS/202202/p002953/checkouts/toolbox_p2953_dev/src/toolbox_scs/detectors/hrixs.py in <dictcomp>(.0)
    331                       'factor', 'range', 'bins',
    332                       'method', 'fields')
--> 333         return {param: getattr(self, param.upper()) for param in params}
    334 
    335     def from_run(self, runNB, proposal=None, extra_fields=()):

AttributeError: 'hRIXS' object has no attribute 'RANGE'
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information