Comments (8)
Thanks for quick answer and thanks a lot for making this code available !!
from tls.
Hey, sorry you are having trouble. This is the first bug report with respect to multiprocessing, and many people use it, so it appears that it's got something to do with your machine.
Can you please:
- Try a run without multiprocessing, i.e. add the parameter
use_threads=1
- Provide your Python version from
python --version
- Give some details on the hardware: Is this a new M1 Mac?
from tls.
I have old MacOs (intel core i7, Catalina) and Python 3.8.12
I am not sure where to specify the use_threads=1. is it in the calling :
model = transitleastsquares(time, flux, use_threads=1) ?
if so then the code crashes :
TypeError: init() got an unexpected keyword argument 'use_threads'
from tls.
Please try:
import numpy
import batman
from transitleastsquares import transitleastsquares
if __name__ == "__main__":
print("Starting test: synthetic...", end="")
numpy.random.seed(seed=0) # reproducibility
# Create test data
start = 48
days = 365.25 * 3
samples_per_day = 12 # 48
samples = int(days * samples_per_day) # 48
t = numpy.linspace(start, start + days, samples)
# Use batman to create transits
ma = batman.TransitParams()
ma.t0 = (
start + 20
) # time of inferior conjunction; first transit is X days after start
ma.per = 365.25 # orbital period
ma.rp = 6371 / 696342 # 6371 planet radius (in units of stellar radii)
ma.a = 217 # semi-major axis (in units of stellar radii)
ma.inc = 90 # orbital inclination (in degrees)
ma.ecc = 0 # eccentricity
ma.w = 90 # longitude of periastron (in degrees)
ma.u = [0.5] # limb darkening coefficients
ma.limb_dark = "linear" # limb darkening model
m = batman.TransitModel(ma, t) # initializes model
original_flux = m.light_curve(ma) # calculates light curve
# Create noise and merge with flux
ppm = 5
stdev = 10 ** -6 * ppm
noise = numpy.random.normal(0, stdev, int(samples))
y = original_flux + noise
y[1] = numpy.nan
model = transitleastsquares(t, y)
results = model.power(
period_min=360,
period_max=370,
transit_depth_min=10 * 10 ** -6,
oversampling_factor=5,
duration_grid_step=1.02,
verbose=True,
use_threads=1
)
numpy.testing.assert_almost_equal(results.chi2_min, 8831.654060613922, decimal=5)
numpy.testing.assert_almost_equal(
results.chi2red_min, 0.6719152511118321, decimal=5
)
numpy.testing.assert_almost_equal(
results.period_uncertainty, 0.216212529678387, decimal=5
)
numpy.testing.assert_equal(results.per_transit_count[0], 7)
numpy.testing.assert_equal(len(results.transit_times), 3)
numpy.testing.assert_almost_equal(results.period, 365.2582192473641, decimal=5)
numpy.testing.assert_almost_equal(
results.transit_times[0], 68.00349264912924, decimal=5
)
from tls.
that works
Starting test: synthetic...Transit Least Squares TLS 1.0.30 (17 Nov 2021)
Creating model cache for 133 durations
Searching 13148 data points, 278 periods from 360.012 to 369.983 days
Using 1 of 4 CPU threads
100%|█████████████████████████████████████████████████████████████████████████████████████████████| 278/278 periods | 00:06<00:00
Searching for best T0 for period 365.25822 days
100%|████████████████████████████████████████████████████████████████████████████████████| 13148/13148 [00:03<00:00, 3954.28it/s]
from tls.
OK great! So at least you can use TLS now. What happens if you just change use_threads=2
in the script?
from tls.
You script given above works with use_threads=1 or 2 or 3 or 4 !
however the script in the tutorial 1 runs only if results = model.power(use_threads=1)
from tls.
ok. I found it. If I add
if name == "main":
at the begging of the code of Tutorial 1, then all the use_treads=1 or 2 or 3 or 4 work.
from tls.
Related Issues (20)
- catalog_info_ returning the errors for radius/mass_min/max instead of the min/max values HOT 1
- Bug
- TLS failing for Kepler prime mission data HOT 5
- Dependency on batman / numpy makes it impossible to install TLS HOT 3
- MultiProcessing Bug with M1 Pro chipped Mac books HOT 2
- Non-integer oversampling factors cause index error in TLS pipeline
- Why TLS use duration from minimum chi2 period instead of maximum power period? HOT 6
- Setting minimum duration limit HOT 2
- maximum orbital frequency formula derivation HOT 4
- Occasional buggy spectrum if array of equal errors given HOT 3
- [Question] How to efficiently find long period signals in data with long gaps? HOT 20
- Period Grid error in stellar mass (maybe radius too?) > 1 HOT 13
- Insert Sort on previous trial period
- Bug: Default Limb Darkening Coefficients overriding input HOT 2
- Smooth the periodograms with log-normal biweight
- Bug: Can't install due to batman-package failure HOT 6
- Relax minimum period HOT 4
- Bug: expected dtype object, got 'numpy.dtype[float64]' with numpy 1.21 HOT 4
- Add `verbose` kwarg to transitleastsquares HOT 6
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 tls.