Skip to content

ZEISSDataReader wrongly produces 64-bit data #2256

@JeppeKlitgaard

Description

@JeppeKlitgaard

Using ZEISSDataReader on data gathered from a ZEISS X-Ray system at my university incorrectly produces arrays with float64 dtypes, which leads to a whole host of issues when the AcquisitionData is processed using ASTRA-based optimisers.

A stop-gap measure is to recast the data as 32-bit floats:

data = ZEISSDataReader(file_name=...).read()
data.array = data.array.astype('float32')
data.geometry.dtype = 'float32'

Note that the geometry dtype is overridden by the data dtype as indicated by warning UserWarning: Over-riding geometry.dtype with data.dtype

I believe this is an upstream issue, but thought it would be useful to track here as well. The stop-gap could potentially be implemented directly in ZEISSDataReader.

Upstream bug

In https://github.com/data-exchange/dxchange/blob/10c9d870bd403f1ea5fbba4c8194b9c8d9295aca/dxchange/reader.py#L529C8-L540C73, the data is clearly read as 32-bit floats as given by the f in the format string, but when the array is initalised in https://github.com/data-exchange/dxchange/blob/10c9d870bd403f1ea5fbba4c8194b9c8d9295aca/dxchange/reader.py#L1149-L1156 no dtype is given and thus the default float64 dtype is used.

I would be happy to report the bug in dxchange and submit a PR either there or here in ZEISSDataReader, but would appreciate input as to whether my diagnosis is sensible first.

Progress

  • Submit PR fix to dxchange: PR
  • PR Merged
  • dxchange release cut
  • Optional: Update dxchange dependency in CIL

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Status

    In Progress

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions