Skip to content

Commit

Permalink
Merge pull request #67 from leofang/fix_get_images
Browse files Browse the repository at this point in the history
Make get_fastccd_images() work again
  • Loading branch information
danielballan committed Oct 17, 2019
2 parents eb3ab7f + 23d6e6a commit 02686ed
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions csxtools/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,15 @@ def get_images_to_3D(images, dtype=None):
def _get_images(header, tag, roi=None):
t = ttime.time()
if isinstance(header, (list, tuple)):
images = [img for h in header for img in h.data(tag)]
# assumes all headers are coming from the same db
db = header[0].db
for h in header:
if h.db is not db:
raise ValueError("All headers need to come from the same "
"Broker instance.")
images = db.get_images(header, tag)
else:
images = header.data(tag)
images = header.db.get_images(header, tag)
t = ttime.time() - t
logger.info("Took %.3f seconds to read data using get_images", t)

Expand Down

4 comments on commit 02686ed

@ambarb
Copy link
Contributor

@ambarb ambarb commented on 02686ed Mar 4, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@leofang sorry to bother you. Thank you for fixing this. I see you switched from the generator method. Back to a previous method. Did you do any investigation or just quickly did something that would get things working again?

@tacaswell
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

get_images() is on it's way to be deprecated but it did a bit of extra logic to sticky-tape together mulitple runs.

@leofang
Copy link
Contributor

@leofang leofang commented on 02686ed Mar 4, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No worries, Andi! Tom is right. This is just a hot-fix to make things work. When get_images() is fully deprecated, csxtools will need to be updated accordingly. It will require some effort (more than patching) I imagine.

@ambarb
Copy link
Contributor

@ambarb ambarb commented on 02686ed Mar 4, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is good to know. I tried to use .data() method in my notebook (as per the bluesky software documentation) and it doesn't work - which is why the hot-fix was required. Are we ultimately moving away from .data() as well (all catalogues)? Or do we need to think about some very low level changes. Recommendations on how to proceed are welcome.

Please sign in to comment.