hippke / tls

Transit Least Squares: An optimized transit-fitting algorithm to search for periodic transits of small planets
MIT License
48 stars 24 forks source link

Enhance APIs to provide time series models for visualization purposes #85

Closed sriramsrao closed 2 years ago

sriramsrao commented 4 years ago

Is your feature request related to a problem? Please describe. A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Describe the solution you'd like A call to transitleastsquares.power() returns the period information along with models for visualization purposes. It would be nice if the APIs could be enhanced to return the models for visualization purposes. For instance, the following APIs

could return the time series corresponding to the phase folded model and the model that TLS computes.

Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.

Additional context Add any other context or screenshots about the feature request here.

hippke commented 4 years ago

The model in normal time and in folded form is already available, see the documentation. The keywords are

sriramsrao commented 4 years ago

The above solution requires me to build the model by calling power(). The APIs I am asking for are to reuse computed values for T0, period, and duration and generate the visualization curves.

hippke commented 4 years ago

First you must build (=calculate) the model. Afterwards, it becomes available and you can use it.

sriramsrao commented 4 years ago

Agreed. In my use case, I build the model once and have all the params. I just want the visualization curves later (perhaps in a different program) and I don't want to rebuild the model each time.

sriramsrao commented 4 years ago

I am bit puzzled why this is closed. If you look at the lightkurve APIs, they have APIs such as fold(), where you pass in T0, duration, etc. Are you closing the issue because this is an API/use case that you don't intend to support? Given that this is an open source project, would be good if you comment on this aspect. We are actively using TLS and having this API would be useful. Hence, all my comments.

hippke commented 4 years ago

I was under the impression that my explanation had solved your issue. I have used both TLS and lightkurve extensively and don't understand your issue. Please explain. Can you provide some sample code which doesn't work? Or sketch a use-case step by step?

sriramsrao commented 4 years ago

Our use case is the following:

  1. Run TLS to compute period/T0 information. (Program 1).
  2. Use an ML model to classify curves and generate probabilities of possible planet candidates (PCs). (Program 2).
  3. Take the top few PC's and then visualize the curves. (Program 3).

With Program 3, I have to recompute the model with TLS to get the visualization information. The model calculation is expensive (and is redundant), since I already have T0/period/epoch from Program 1. The ask here is that, if I can APIs that take the previously computed T0/period/epoch and just get me back the visualization without having to recompute the whole model, that'd speed up the visualization step (Program 3) considerably.

Hope this clarifies. Thanks.

hippke commented 4 years ago

You can do this without any changes to the code. Why would you re-compute the TLS model? The model is just a numpy array which you can store, save, etc. as you wish.

sriramsrao commented 4 years ago

Had tried that. Was running into disk space issues (even though I had compressed the data) :).

hippke commented 4 years ago

The model arrays will be the same size as your input data. That can only be a few MB.