Skip to content
Snippets Groups Projects

[ePix100][Correct] Correcting one train for epix100 and storing a list of one pulseId

Merged Karim Ahmed requested to merge fix/one_pulse_in_list into master
1 unresolved thread

Description

A few weeks ago a bug was identified in ePix100 correction notebook when correcting a sequence file of 1 train.

This is a fix for the following error when converting an array of one pulseId to a list:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-44-b0dfb1190f77> in <module>
----> 1 list(seq_dc[instrument_src]['data.pulseId'].ndarray().squeeze())

TypeError: iteration over a 0-d array

How Has This Been Tested?

Unit tests and attached the correction result for the run which exposed the bug in the first place

Relevant Documents (optional)

The failed run after correcting it with this MR

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

Reviewers

@duarten @schmidtp

Edited by Karim Ahmed

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
635 635 " \"data.trainId\", data=seq_dc.train_ids, chunks=min(50, len(seq_dc.train_ids)))\n",
636 636 " \n",
637 637 " if np.isin('data.pulseId', list(seq_dc[instrument_src].keys())): # some runs are missing 'data.pulseId'\n",
638 " pulseid = seq_dc[instrument_src]['data.pulseId'].ndarray().squeeze()\n",
  • I'm not sure this is the right fix - isn't the .squeeze() the cause for this issue in the first place? In the case of a single train, you're unintentionally squeezing away the train axis. Instead, you could explicitly remove the axis you don't want to have, I suspect it's some (N_TRAINS, 1, x, y) shape?

  • Author Owner

    So the shape is (n_trains, 1)

  • Of course sorry, we're looking at data.pulseId here. Still the point stands, instead of squeezing (and turning a single train into a scalar), you could simply remove the second axis:

    .ndarray()[:, 0]

    We intentionally tried to make sure that the dimensionality of data accessor methods in EXtra-data does not change when inspecting a single train.

  • changed this line in version 3 of the diff

  • Author Owner

    Thank you. Yes, this is differently better. While writing the fix I also felt that I was complicating things more than I should.

  • Please register or sign in to reply
  • Karim Ahmed added 32 commits

    added 32 commits

    • 6e67150f...6f3f34e7 - 29 commits from branch master
    • cdbdc0ef - Correcting one train for epix100 and storing a list of one pulseId
    • 03ff42d9 - preserve pulseid dtype
    • 75f4e499 - Improve fix by just discarding the axis instead of squeezing

    Compare with previous version

  • Author Owner

    Thanks @schmidtp for the review!

  • merged

  • Karim Ahmed mentioned in commit 017f4bdc

    mentioned in commit 017f4bdc

  • Karim Ahmed changed milestone to %3.13.0

    changed milestone to %3.13.0

  • Please register or sign in to reply
    Loading