Closed ambarb closed 1 year ago
-used with the above code
stack = get_fastccd_images(bgnd1, (None), flat=None)
print(type(stack))
#images = get_images_to_3D(stack)
images = stack[0]
print(images.shape)
-used with the above code
stack = get_fastccd_images(bgnd2, (None), flat=None)
print(type(stack))
#images = get_images_to_3D(stack)
images = stack[0]
print(images.shape)
Processing without dark images
<class 'slicerator.Pipeline'>
/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)
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-240-3226e65c5e69> in <module>()
14 print(type(stack))
15 #images = get_images_to_3D(stack)
---> 16 images = stack[0]
17 print(images.shape)
/opt/conda_envs/analysis-2018-2.1/lib/python3.6/site-packages/slicerator.py in __getitem__(self, i)
431 indices, new_length = key_to_indices(i, len(self))
432 if new_length is None:
--> 433 return self._get(indices)
434 else:
435 return Slicerator(self, indices, new_length, self._propagate_attrs)
/opt/conda_envs/analysis-2018-2.1/lib/python3.6/site-packages/slicerator.py in _get(self, key)
413 # We need to copy here: else any _proc_func that acts inplace would
414 # change the ancestor value.
--> 415 return self._proc_func(copy(self._ancestor[key]))
416
417 def __repr__(self):
/opt/conda_envs/analysis-2018-2.1/lib/python3.6/site-packages/slicerator.py in proc_func(x)
591 or isinstance(obj, Pipeline):
592 def proc_func(x):
--> 593 return func(x, *args, **kwargs)
594
595 return Pipeline(obj, proc_func)
/opt/conda_envs/analysis-2018-2.1/lib/python3.6/site-packages/csxtools/utils.py in _correct_fccd_images(image, bgnd, flat, gain)
191 @pipeline
192 def _correct_fccd_images(image, bgnd, flat, gain):
--> 193 image = correct_images(image, bgnd, flat, gain)
194 image = rotate90(image, 'cw')
195 return image
/opt/conda_envs/analysis-2018-2.1/lib/python3.6/site-packages/csxtools/fastccd/images.py in correct_images(images, dark, flat, gain)
50 flat = np.asarray(flat, dtype=np.float32)
51
---> 52 data = fastccd.correct_images(images, dark, flat, gain)
53 t = ttime.time() - t
54
/opt/conda_envs/analysis-2018-2.1/lib/python3.6/site-packages/slicerator.py in <genexpr>(.0)
224
225 def __iter__(self):
--> 226 return (self._get(i) for i in self.indices)
227
228 def __len__(self):
/opt/conda_envs/analysis-2018-2.1/lib/python3.6/site-packages/slicerator.py in _get(self, key)
204
205 def _get(self, key):
--> 206 return self._ancestor[key]
207
208 def _map_index(self, key):
/opt/conda_envs/analysis-2018-2.1/lib/python3.6/site-packages/slicerator.py in __getitem__(self, i)
185 indices, new_length = key_to_indices(i, len(self))
186 if new_length is None:
--> 187 return self._get(indices)
188 else:
189 return cls(self, indices, new_length, propagate_attrs)
/opt/conda_envs/analysis-2018-2.1/lib/python3.6/site-packages/pims/base_frames.py in __getitem__(self, key)
146 """__getitem__ is handled by Slicerator. In all pims readers, the data
147 returning function is get_frame."""
--> 148 return self.get_frame(key)
149
150 def __iter__(self):
/opt/conda_envs/analysis-2018-2.1/lib/python3.6/site-packages/databroker/assets/handlers.py in get_frame(self, i)
35
36 def get_frame(self, i):
---> 37 return Frame(self._dataset[self._start + i], frame_no=i)
38
39 def __len__(self):
h5py/_objects.pyx in h5py._objects.with_phil.wrapper()
h5py/_objects.pyx in h5py._objects.with_phil.wrapper()
/opt/conda_envs/analysis-2018-2.1/lib/python3.6/site-packages/h5py/_hl/dataset.py in __getitem__(self, args)
474
475 # Perform the dataspace selection.
--> 476 selection = sel.select(self.shape, args, dsid=self.id)
477
478 if selection.nselect == 0:
/opt/conda_envs/analysis-2018-2.1/lib/python3.6/site-packages/h5py/_hl/selections.py in select(shape, args, dsid)
92
93 sel = SimpleSelection(shape)
---> 94 sel[args]
95 return sel
96
/opt/conda_envs/analysis-2018-2.1/lib/python3.6/site-packages/h5py/_hl/selections.py in __getitem__(self, args)
259 return self
260
--> 261 start, count, step, scalar = _handle_simple(self.shape,args)
262
263 self._id.select_hyperslab(start, count, step)
/opt/conda_envs/analysis-2018-2.1/lib/python3.6/site-packages/h5py/_hl/selections.py in _handle_simple(shape, args)
449 else:
450 try:
--> 451 x,y,z = _translate_int(int(arg), length)
452 s = True
453 except TypeError:
/opt/conda_envs/analysis-2018-2.1/lib/python3.6/site-packages/h5py/_hl/selections.py in _translate_int(exp, length)
469
470 if not 0<=exp<length:
--> 471 raise ValueError("Index (%s) out of range (0-%s)" % (exp, length-1))
472
473 return exp, 1, 1
ValueError: Index (1) out of range (0-0)
So need to try to load from file directly not using get_fccd_images()
to understand if something bad happened to this file.
probably bad file or data is missing and databroker refuses to open
Possible corrupt data for gain2??? Using
None
ordb[354022]
works for bgnd2, but the scan that is supposed to be used results in an error (db[135026]
).