Skip to content
Snippets Groups Projects

Draft: WIP Positive/negative standard deviation refinement

Open Camilla Compton requested to merge camilla.compton/locklost:pos_neg_std into master

I have changed the function find_transition in refine.py look at threshold crossings above and below the channel's mean by a given standard deviation. This makes the refinement more accurate by around 25ms in some cases (see images below) and does not effect the refinement in others. The tuple returned by find_transition is threshold, refined_gps from the first threshold crossing (or only threshold crossing or None if no crossings exist).

The number of standard deviations is still taken from config.py but now the sign doesn't matter, only the magnitude. Signs have been removed and comments added too config.py to indicate that.

find_transition now creates a list dictionary containing a list of first ind where threshold crosses and threshold, sorts that list so the first ind (crossing) comes first and then outputs ind and threshold from the beginning of the list. This list only contains entries if the ind exists.

eg: thresh_crossing_list = [[ind_that_comes_first, associated_threshold],[ind_that_comes_second, associated_threshold]]

eg: thresh_crossing_dict = {'thresh': {'lower': lower_threshold, 'upper': upper_threshold}, 'ind': {'lower': lower_ind, 'upper': upper_ind} }

The key of the minimum ind is retuned as first_crossing and will be upper, lower or None if no crossings exist. The threshold and refined_gps is then retuned using the first_crossing key.

I have removed the logic that was: if no threshold crossing exists, choose the max/min channel value for use in plotting the threshold. Do we think that is okay to do?

Closes #158

Old version, refined gps = .0688 Screen_Shot_2020-05-15_at_12.01.35_PM

New version, refined gps = .0429 (i.e. 25.9ms sooner) Screen_Shot_2020-05-15_at_12.03.27_PM

Additionally, I have changed to input params of plot_indicators from taking the dictionary params to just taking channel. Previously the plotting looked at whether the upper or lower threshold was used in order to place the annotation "threshold" above or below the plotted line. This seemed tricky to do with the variable thresholds so I removed the dependence and put the annotation always below. This doesn't always look as smart if anyone can think of a better way of doing this Plotting will still look at whether threshold is above or below mean and plot "threshold" annotation in the correct place.

Edited by Camilla Compton

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
  • added 1 commit

    • 35f4b9ac - add thresh=lower_t if no threshold crossings found for clearer graphs

    Compare with previous version

  • added 1 commit

    • 328f6316 - assign threshold=None in find_transition so no error when channel < min

    Compare with previous version

  • added 1 commit

    • 26e4fef9 - add threshold for graphs if refinment fails and edit annotate location

    Compare with previous version

  • added 1 commit

    • 36ae78a7 - change postion of threshold annotation to keep it on right side of graph

    Compare with previous version

  • added 1 commit

    • df15b0dc - add logic to decide side of threshold annotation and clarify 'if threshold is None'

    Compare with previous version

  • added 1 commit

    • 2f1bffb5 - change from list to dictionary in refine.py refine_transistion

    Compare with previous version

  • added 1 commit

    Compare with previous version

  • Camilla Compton changed the description

    changed the description

  • added 1 commit

    • 083c4e33 - refine.py plot_indicators to use mean not y_ind[0] to place thresh label

    Compare with previous version

  • added 1 commit

    • 069e037f - fix error: use y_ind sample rate for refine.py plot_indicators mean

    Compare with previous version

  • added 1 commit

    • ab93ba1f - fix error: agaain use bufs for sample_rate in refine.py plot_indicators

    Compare with previous version

  • added 1 commit

    • 07e19d1e - fix error: typo in refine.py plot_indicators bufs[1][0] swaps with y_ind

    Compare with previous version

  • added 1 commit

    • a6dd91d3 - fix error: change bufs indexing to get sample rate for plot_indicators

    Compare with previous version

  • Camilla Compton resolved all threads

    resolved all threads

  • Camilla Compton unmarked as a Work In Progress

    unmarked as a Work In Progress

  • @jameson.rollins this merge request is now ready to be looked at.

  • Jameson Rollins marked as a Work In Progress

    marked as a Work In Progress

  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Please register or sign in to reply
    Loading