Comments (2)
The problem is similar to #1422 . While the specific code paths are different, the nature of underlying issue is the same: implementation assumes lc.time
is Time
/ TimeDelta
, but for normalized FoldedLightCurve, lc.time
is Quantity
with unit u.dimensionless_unscaled
(conceptually floats).
from lightkurve.
I've been looking into this, and it's a bit tricky as the astropy functions require 'time' to be Time or TimeDelta objects. One possible workaround is to re-define all of the functions that fail in the FoldedLightCurve object so that if they have been normalized, the are temporarily reverted back to the regular phase, the operation is performed, and then time is reassigned to the normalized value again at the end. For example:
class FoldedLightCurve(LightCurve):
def bin(
self,
time_bin_size=None,
time_bin_start=None,
time_bin_end=None,
n_bins=None,
aggregate_func=None,
bins=None,
binsize=None,
):
if (hasattr(self, 'normalize_phase')) & (self.normalize_phase == True):
with self._delay_required_column_checks():
normalized_phase = self.time.copy()
phase = TimeDelta(normalized_phase * self.period)
self.remove_column("time")
self.add_column(phase, name="time", index=0)
*Regular bin operation from LightCurve*
# Reset at the end of the function
if (hasattr(self, 'normalize_phase')) & (self.normalize_phase == True):
# Reset the 'time' column of the folded object to be the normalized value
with self._delay_required_column_checks():
phase = self.time.copy()
normalized_phase = phase / self.period
self.remove_column("time")
self.add_column(normalized_phase, name="time", index=0)
self.sort("time")
# Reset the 'time' column of the folded and binned object to be the normalized value
with returned_object._delay_required_column_checks():
phase = returned_object.time.copy()
normalized_phase = phase / self.period #returned_object.normalized_phase.copy()
returned_object.remove_column("time")
returned_object.add_column(normalized_phase, name="time", index=0)
returned_object.sort("time")
It's an ugly solution, but it works. I'd be happy to develop other suggestions, as this requires over-writing all of the broken functions in FoldedLightCurve.
from lightkurve.
Related Issues (20)
- Slow looping when plotting the aperture over the TPF of saturated stars HOT 2
- `interact_sky()`: support querying ZTF data
- Reading files wtih io.tess.read_tess_lightcurve(url) is filling astropy's cache directory HOT 4
- Crash in "How to estimate a starβs mass and radius using asteroseismology" tutorial web page. HOT 1
- search_lightcurve() and download_all() return different author HOT 1
- compatibility with numpy v2.0 HOT 9
- Downloading certain K2 is not working HOT 5
- EROR: Searching for Transiting Planets in Light Curves with interact_bls() #1
- Convenience function to read and stitch multiple light curves based on a list of cloud URIs HOT 1
- Document existence of read_generic_lightcurve HOT 2
- Generic-icize `to_fits` HOT 1
- Users should be able to download products from STScI's cloud
- EROR:This file may be corrupt due to an interrupted download. Please remove it from your disk and try again.
- read TIMESYS from fits header for time_format=`mjd`
- `to_fits` adds units to dimensionless fluxes
- Pixel to world coordinate transform consistency HOT 1
- pos_corr usage
- pip release for v2.5.0 HOT 1
- We need a way to read in fits files from memory
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lightkurve.