-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
flux_percentile_ratio Index off by one error for small time series #8
Comments
mfff. @stevenstetzler i just started the next version of feets (to deliver it arround april) can you help me with this bug? |
Yeah, I can help with this. I think the two solutions I proposed are all that can be done:
The problem with (2) is that making this change might make all results produced by |
mmm i'am little confused with this bug. mostly because the second proposal. So lets try to figure out this issue.
import feets
fs = feets.FeatureSpace(only=[
'FluxPercentileRatioMid20',
'FluxPercentileRatioMid35',
'FluxPercentileRatioMid50',,
'FluxPercentileRatioMid65',
'FluxPercentileRatioMid80'])
features, values = fs.extract(*ts) Can you provide the correct Also, maybe we can use np.percentile |
If you pass in a time series with just a single value, it will break: import feets
fs = feets.FeatureSpace(only=[
'FluxPercentileRatioMid20',
'FluxPercentileRatioMid35',
'FluxPercentileRatioMid50',
'FluxPercentileRatioMid65',
'FluxPercentileRatioMid80'])
ts = [[0], [1]]
features, values = fs.extract(*ts) produces
It breaks when you have < 20 points in the time series: import feets
fs = feets.FeatureSpace(only=[
'FluxPercentileRatioMid20',
'FluxPercentileRatioMid35',
'FluxPercentileRatioMid50',
'FluxPercentileRatioMid65',
'FluxPercentileRatioMid80'])
for n in range(1, 30):
# Make time series of size n
ts = [[i for i in range(n)], [i for i in range(n)]]
try:
features, values = fs.extract(*ts)
except Exception as e:
print(e) produces
This test was done using a fresh install of feets with conda with only
The change in this commit fixes the error stevenstetzler@5480427. |
sorry the delay i gona check this in a week (phd thesis next 25) |
I back i gonna create a branch for this bug and add this test to the suite. Are you still want to help me with the code? |
I am running a full feature extraction on a time series with 14 measurements (using something like):
and I receive the following error:
This is due to the fact that
ext_flux_percentile_ratio.py
calculates the location of the flux percentiles as:For my example,
lc_length = 14
thus:but 14 is not a valid index for
sorted_data[F_95_index]
sincesorted_data
is of length 14.Note that this is also an issue in
ext_flux_percentile_ratio.py
.I am fixing this right now but just decrementing
F_95_index
by 1 if it is the same aslc_length
, but it would probably be better to do bounds checking on allF_X_index
variables or even just redefininglc_length
to belc_length - 1
to make it an index and not a length might work.The text was updated successfully, but these errors were encountered: