NSLS-II-CSX / csxtools

Useful python tools for CSX (23-ID)

Home Page:http://nsls-ii-csx.github.io/csxtools

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

swmr says it is enabled but it doesn't seem to work

ambarb opened this issue · comments

This scan is a step scan, mid-way or more through. Using get_fastccd_images()

/opt/conda_envs/analysis-2018-2.1/lib/python3.6/site-packages/csxtools/utils.py:181: UserWarning: Images and get_images are deprecated. Use Header.data('fccd_image') instead.
  images = header.db.get_images(header, tag)

---------------------------------------------------------------------------
OSError                                   Traceback (most recent call last)
<ipython-input-48-9e807f3dbb64> in <module>()
      1 #%%capture
----> 2 images = get_fastccd_images(h, (bgnd8[0], bgnd2, bgnd1), flat=None)
      3 
      4 stack = get_images_to_4D(images)
      5 

/opt/conda_envs/analysis-2018-2.1/lib/python3.6/site-packages/csxtools/utils.py in get_fastccd_images(light_header, dark_headers, flat, gain, tag, roi)
    119         logger.info("Computed dark images in %.3f seconds", ttime.time() - t)
    120 
--> 121     events = _get_images(light_header, tag, roi)
    122 
    123     # Ok, so lets return a pims pipeline which does the image conversion

/opt/conda_envs/analysis-2018-2.1/lib/python3.6/site-packages/csxtools/utils.py in _get_images(header, tag, roi)
    179 def _get_images(header, tag, roi=None):
    180     t = ttime.time()
--> 181     images = header.db.get_images(header, tag)
    182     t = ttime.time() - t
    183     logger.info("Took %.3f seconds to read data using get_images", t)

/opt/conda_envs/analysis-2018-2.1/lib/python3.6/site-packages/databroker/_core.py in get_images(self, headers, name, stream_name, handler_registry)
   1712                       headers=headers,
   1713                       name=name, stream_name=stream_name,
-> 1714                       handler_registry=handler_registry)
   1715 
   1716     def get_resource_uids(self, header):

/opt/conda_envs/analysis-2018-2.1/lib/python3.6/site-packages/databroker/_core.py in __init__(self, mds, reg, es, headers, name, handler_registry, handler_override, stream_name)
    606             self.handler_registry = defaultdict(lambda: handler_override)
    607         with self.reg.handler_context(self.handler_registry) as reg:
--> 608             example_frame = reg.retrieve(first_uid)
    609         # Try to duck-type as a numpy array, but fall back as a general
    610         # Python object.

/opt/conda_envs/analysis-2018-2.1/lib/python3.6/site-packages/databroker/assets/base_registry.py in retrieve(self, datum_id)
    176         return self._api.retrieve(self._datum_col, datum_id,
    177                                   self._datum_cache, self.get_spec_handler,
--> 178                                   logger)
    179 
    180     def get_datum(self, datum_id):

/opt/conda_envs/analysis-2018-2.1/lib/python3.6/site-packages/databroker/assets/core.py in retrieve(col, datum_id, datum_cache, get_spec_handler, logger)
     63 def retrieve(col, datum_id, datum_cache, get_spec_handler, logger):
     64     datum = _get_datum_from_datum_id(col, datum_id, datum_cache, logger)
---> 65     handler = get_spec_handler(datum['resource'])
     66     return handler(**datum['datum_kwargs'])
     67 

/opt/conda_envs/analysis-2018-2.1/lib/python3.6/site-packages/databroker/assets/base_registry.py in get_spec_handler(self, resource)
    260         if root:
    261             rpath = os.path.join(root, rpath)
--> 262         ret = handler(rpath, **kwargs)
    263         h_cache[key] = ret
    264         return ret

/opt/conda_envs/analysis-2018-2.1/lib/python3.6/site-packages/databroker/assets/handlers.py in __init__(self, filename, frame_per_point)
    201         super(AreaDetectorHDF5Handler, self).__init__(
    202             filename=filename, key=hardcoded_key,
--> 203             frame_per_point=frame_per_point)
    204 
    205 

/opt/conda_envs/analysis-2018-2.1/lib/python3.6/site-packages/databroker/assets/handlers.py in __init__(self, filename, key, frame_per_point)
    151         self._dataset = None
    152         self._data_objects = {}
--> 153         self.open()
    154 
    155     def get_file_list(self, datum_kwarg_gen):

/opt/conda_envs/analysis-2018-2.1/lib/python3.6/site-packages/databroker/assets/handlers.py in open(self)
    173             return
    174 
--> 175         self._file = h5py.File(self._filename, 'r')
    176 
    177     def close(self):

/opt/conda_envs/analysis-2018-2.1/lib/python3.6/site-packages/h5py/_hl/files.py in __init__(self, name, mode, driver, libver, userblock_size, swmr, **kwds)
    310             with phil:
    311                 fapl = make_fapl(driver, libver, **kwds)
--> 312                 fid = make_fid(name, mode, userblock_size, fapl, swmr=swmr)
    313 
    314                 if swmr_support:

/opt/conda_envs/analysis-2018-2.1/lib/python3.6/site-packages/h5py/_hl/files.py in make_fid(name, mode, userblock_size, fapl, fcpl, swmr)
    140         if swmr and swmr_support:
    141             flags |= h5f.ACC_SWMR_READ
--> 142         fid = h5f.open(name, flags, fapl=fapl)
    143     elif mode == 'r+':
    144         fid = h5f.open(name, h5f.ACC_RDWR, fapl=fapl)

h5py/_objects.pyx in h5py._objects.with_phil.wrapper()

h5py/_objects.pyx in h5py._objects.with_phil.wrapper()

h5py/h5f.pyx in h5py.h5f.open()

OSError: Unable to open file (file is already open for write (may use <h5clear file> to clear file consistency flags))

This may be some other issue not associated with the profile. I believe there is also a trac issue. If we are changing how we save the data (as per @stuwilkins project for image saving), then perhaps we can close this.

https://controlsweb.nsls2.bnl.gov/trac/ticket/4799