astropy / astropy/astropy

BoxLeastSquares autoperiod memory usage

Open
#14,150 3 comments 0 reactions 0 assignees View on GitHub
Bug Performance timeseries
Dominant language
Python
Stars
5.3k
Forks
2.2k
Avg merge
1d 20h
Merged PRs (30d)
81

Description

The BoxLeastSquares autoperiod() function has impossibly high RAM demands for data with long baselines, even when maximum_period is specified. Perhaps this is naive, but shouldn't the period grid be identical for all data baselines longer than maximum_period?

```python
import numpy as np
from astropy.timeseries import BoxLeastSquares
t = np.random.random(1000) * 100
y = np.ones_like(t)
model = BoxLeastSquares(t, y)
p1 = model.autoperiod(duration=0.05, minimum_period=0.1)
p2 = model.autoperiod(duration=0.05, minimum_period=0.1, maximum_period=10)
p3 = model.autoperiod(duration=0.05, minimum_period=0.1, maximum_period=1)
t *= 10
p4 = model.autoperiod(duration=0.05, minimum_period=0.1, maximum_period=1)
print(len(p1))
print(len(p2))
print(len(p3))
print(len(p4))
```

Output:
1984506
1968610
1789645
178964450

I had expected p1 to be significantly larger than the others, and for p2, p3, p4 to have been identical

Contributor guide

Open the contributing guide

Research direction

Start by running the supplied BoxLeastSquares.autoperiod() example and comparing the lengths of p1 through p4. Read the autoperiod entry point to determine why scaling the baseline changes the period-grid size; done means avoiding the excessive RAM demand and producing the expected matching grids for p2, p3, and p4.

Written by the indexing model from the issue text.

Assessment

Tech stack
numpy, python
Domain
performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.