Skip to content

Fix api in erna.hdf_utils #47

@jebuss

Description

@jebuss

HI, erna gather_fits is not working with the current version:

erna_gather_fits std_analysis 0.17.2 /gpfs0/fact/processing/erna/datasets/Crab1516_no_data_check_std_analysis_0.17.2.hdf5 --start=2015-8-31 --end=2016-3-19 --source="Crab" --datacheck=/gpfs0/fact/processing/erna/no_datacheck.txt
Found 3761 runs with a total ontime of 260.42 h
Outputfile exists! Overwrite? [y, N]: y
  0%|                                                                      | 0/3761 [00:00<?, ?it/s]
Traceback (most recent call last):
  File "/swdev_nfs/anaconda3/bin/erna_gather_fits", line 11, in <module>
    load_entry_point('erna==0.5.0', 'console_scripts', 'erna_gather_fits')()
  File "/swdev_nfs/anaconda3/lib/python3.6/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/swdev_nfs/anaconda3/lib/python3.6/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/swdev_nfs/anaconda3/lib/python3.6/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/swdev_nfs/anaconda3/lib/python3.6/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/swdev_nfs/anaconda3/lib/python3.6/site-packages/erna/scripts/gather_fits.py", line 185, in main
    write_fits_to_hdf5(outputfile, successful_jobs.result_file, mode='a')
  File "/swdev_nfs/anaconda3/lib/python3.6/site-packages/erna/hdf_utils.py", line 88, in write_fits_to_hdf5
    compression=compression,
  File "/swdev_nfs/anaconda3/lib/python3.6/site-packages/fact/io.py", line 318, in initialize_h5py
    dtypes = array.dtype
AttributeError: 'numpy.dtype' object has no attribute 'dtype'Ah

The problem is in erna.hdf_utils line 86

if len(names) > 0:
                    array = recfunctions.append_fields(
                        array,
                        names=names,
                        data=arrays,
                        usemask=False,
                    )

                if not initialized:
                    initialize_h5py(
                        hdf_file,
                        array.dtype,
                        key=key,
                        compression=compression,
                    )

Line 86 should be without .dtype

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions