Skip to content

number of valid reflection needs to be np.sum(idx) #853

@dnaragan

Description

@dnaragan

Describe the bug

In def determine_valid_reflections @ https://github.com/HEXRD/hexrd/blob/master/hexrd/hedm/fitgrains.py#L342

num_refl_valid is calculated as:
num_refl_valid += sum(valid_refl_ids)

where valid_refl_ids is calculated after pullspots only, and does not account for spots removed in subsequent operations: which are saturated and overlap. In edge cases, where 1) so many spots are removed or 2) so few spots exist that removing saturated spots drops the number of available spots in culled spots below 12, this will create an error for the optimizer.

Option, to avoid this error:
num_refl_valid += sum(idx)

It mirrors the calculation of num_refl_valid after we kick out spots in refit. (num_refl_valid += sum(idx_new))
This will alter the calculation of completeness though, so maybe calculating num_refl_valid again towards the end is preferred. Although I would not be opposed to discussing whether completeness should account for those spots.

Thanks!

Impact

Will eventually cause someone a problem

Reproduction

See description above.

Version

Affected Workflows

  • core
  • EDD
  • HEDM
  • Powder
  • Laue

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