Open caplinje-NOAA opened 5 months ago
Hello! This should be fixed in the new branch feature/gridded_data I am running some extra testing and will merge the pull request as soon as I am happy with it. If you want to test that branch already that would be helpful!
ps. sorry for the delay in fixing this, I was taking a long break after my phd
Thank you and no worry about the delay. I will test this out and compare it to my fix.
Yeah I changed more things than that, I hope that is not a problem. It was a long time that I wanted to offer support for "gridded" data (each bin starts at second 0). But there was indeed a mistake in the code for non-zero windows. Now the _n_blocks _bins function have been changed, and should be correct. If you could check it I would really appreciate!
I have committed my solution to a clean fork of your project here. I realize that you are addressing this in a different way (and entirely refactoring the _bins method), so I thought I would ask before I submitted a pull request. Also, apologies for not testing that branch yet, I am in the middle of some analysis and want to stick with what is working.
The fix is small but mostly is just replacing bin_overlap with noverlap in the sf.blocks call, but also corrects the time keeping.
I've run into an issue using bin overlaps in file class methods which call _bins, for example if attempting to do this:
In this case (i.e. using float bin_overlaps between 0 and 1), soundfile.blocks throws a type error:
TypeError: slice indices must be integers or None or have an __index__ method
I believe that maybe in the sf.blocks call in the _bins method (below), overlap should be set to 'noverlap', rather than 'bin_overlap', as the latter is the integer/sample representation of the fractional overlap.
Doing this solves the error (or at least the file.rms call doesn't error), however, the resulting dataset does not appear to show start_sample and end_sample values which I would expect, if there were some overlap. This is the resulting dataset if I replace bin_overlap with noverlap:
I appreciate any help here, and have really been enjoying learning this package.