beacon-biosignals / DataFrameIntervals.jl

Utilities for working with DataFrames of `Intervals.jl` or `TimeSpans.jl` objects.
MIT License
6 stars 1 forks source link

Mention AlignedSpans workaround in README #20

Closed haberdashPI closed 1 year ago

haberdashPI commented 2 years ago

To let folks know there's a way to do this via pirating.

codecov[bot] commented 2 years ago

Codecov Report

Merging #20 (55feaff) into main (d22c243) will increase coverage by 0.06%. The diff coverage is n/a.

@@            Coverage Diff             @@
##             main      #20      +/-   ##
==========================================
+ Coverage   89.50%   89.57%   +0.06%     
==========================================
  Files           1        1              
  Lines         162      163       +1     
==========================================
+ Hits          145      146       +1     
  Misses         17       17              
Impacted Files Coverage Δ
src/DataFrameIntervals.jl 89.57% <0.00%> (+0.06%) :arrow_up:

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more

ericphanson commented 1 year ago

my preferred workaround is to just do

timespanify = :span => ByRow(TimeSpan) => :span
interval_join(transform(df1, timespanify), transform(df2, timespanify); on=:span)

I.e. to match by mapping to TimeSpan's. I feel like that's the most explicit way to say: ignore sample rate etc, just map to Nanosecond timespans and match that way. Whereas an alternate approach would be to map to check all sample rates are equal and then map to Int-valued intervals of indices.