SainsburyWellcomeCentre / aeon_mecha

Project Aeon's main library for interfacing with acquired data. Contains modules for raw data file io, data querying, data processing, data qc, database ingestion, and building computational data pipelines.
BSD 3-Clause "New" or "Revised" License
3 stars 5 forks source link

Add threshold-specific pellet delivery timestamps as dj table #382

Open jkbhagatio opened 1 month ago

jkbhagatio commented 1 month ago

This should have the timestamp a pellet was delivered (from beambreak ideally) and the corresponding threshold value

ttngu207 commented 2 weeks ago

Add here the latest logic discussed and finalized for this procedure

  1. Get all patch state update timestamps: let's call these events "A"
  2. Remove all "A" events near manual pellet delivery events (so we don't include manual pellet delivery events in downstream analysis)
  3. For the remaining "A" events, find the nearest delivery event within 1s: for this delivery event, check if there are any repeat delivery events within 0.5 seconds - take the last of these as the pellet delivery timestamp (discard all "A" events that don't have such a corresponding delivery event)
  4. Now for these 'clean' "A" events, go back in time to the SECOND preceding pellet threshold value: this is the threshold value for this pellet delivery (as seen in this image we discussed before) MicrosoftTeams-image