Giter Club home page Giter Club logo

Comments (11)

ericagol avatar ericagol commented on May 17, 2024 1

I would recommend starting with the documentation. There is an example given on how to mask the transits, which is necessary for detrending (since you don't want the transits to affect the pixel-level decorelation). An alternative to masking is to do an initial fit to the transits, and then subtract the fit, and carry out the PLD on the residuals.

https://rodluger.github.io/everest/using_everest.html

from everest.

mirsakhawathossain avatar mirsakhawathossain commented on May 17, 2024 1

Everest pipeline runs good in Linux but when I try it to my Windows laptop it shows this problem. Could you please help me @rodluger and @ericagol?

Everest.zip

from everest.

mirsakhawathossain avatar mirsakhawathossain commented on May 17, 2024 1

I am studying exoplanet candidates to confirm them. Now please help me @rodluger @ericagol

from everest.

ericagol avatar ericagol commented on May 17, 2024

I haven't used EVEREST on Windows, so I can't help. @rodluger ?

from everest.

mirsakhawathossain avatar mirsakhawathossain commented on May 17, 2024

It shows when run in Windows Machine. Can anyone please help me? @ericagol @rodluger
import everest
`=================

RESTART: C:/Users/User/Desktop/everesr.py =================
Traceback (most recent call last):
File "C:/Users/User/Desktop/everesr.py", line 1, in
import everest
File "C:/Users/User/Desktop\everest_init_.py", line 23, in
from . import transit
File "C:/Users/User/Desktop\everest\transit.py", line 19, in
import pysyzygy as ps
File "E:\WPy-3662\python-3.6.6.amd64\lib\site-packages\pysyzygy_init_.py", line 16, in
subprocess.call(["make"], cwd = cwd)
File "E:\WPy-3662\python-3.6.6.amd64\lib\subprocess.py", line 267, in call
with Popen(*popenargs, **kwargs) as p:
File "E:\WPy-3662\python-3.6.6.amd64\lib\subprocess.py", line 709, in init
restore_signals, start_new_session)
File "E:\WPy-3662\python-3.6.6.amd64\lib\subprocess.py", line 997, in _execute_child
startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified`

from everest.

rodluger avatar rodluger commented on May 17, 2024

Hi @sakhawat18 the problem is in installing the pysyzygy package, which I coded up years ago before I knew what I was doing! Looks like the install script fails on Windows. But you shouldn't need pysyzygy to run most of the stuff in everest, so I pushed a quick workaround to master. Can you try to re-install everest from the master branch and let me know if that fixes the issue?

from everest.

mirsakhawathossain avatar mirsakhawathossain commented on May 17, 2024

Hello @rodluger I followed your way but when I tried your mcmc code following
`"""MCMC example for transit fitting."""

import matplotlib.pyplot as pl
from everest import Everest, TransitModel
import numpy as np
import emcee
from tqdm import tqdm
from corner import corner

def lnprior(x):
"""Return the log prior given parameter vector x."""
per, t0, b = x
if b < -1 or b > 1:
return -np.inf
elif per < 7 or per > 10:
return -np.inf
elif t0 < 1978 or t0 > 1979:
return -np.inf
else:
return 0.

def lnlike(x, star):
"""Return the log likelihood given parameter vector x."""
ll = lnprior(x)
if np.isinf(ll):
return ll, (np.nan, np.nan)
per, t0, b = x
model = TransitModel('b', per=per, t0=t0, b=b, rhos=10.)(star.time)
like, d, vard = star.lnlike(model, full_output=True)
ll += like
return ll, (d,)

Initialize the everest model

star = Everest(201635569)

Set up the MCMC sampler

params = ['Period (days)', r't$_0$ (BJD - 2456811)', 'Impact parameter']
blobs = ['Depth (%)']
nsteps = 1000
nburn = 300
nwalk = 10
ndim = len(params)
nblobs = len(blobs)
sampler = emcee.EnsembleSampler(nwalk, ndim, lnlike, args=[star])
x0 = [[8.368 + 0.01 * np.random.randn(),
1978.4513 + 0.01 * np.random.randn(),
0. + 0.1 * np.random.randn()] for k in range(nwalk)]
blobs0 = [[0.] for k in range(nwalk)]

Run!

for i in tqdm(sampler.sample(x0, iterations=nsteps, blobs0=blobs0),
total=nsteps):
pass

Add the blobs to the chain for plotting

chain = np.concatenate((sampler.chain,
np.array(sampler.blobs).swapaxes(0, 1)), axis=2)

Re-scale the transit time for prettier axes labels

chain[:, :, 1] -= 1978.

Take the absolute value of the impact parameter for plotting

chain[:, :, 2] = np.abs(chain[:, :, 2])

Re-scale the transit depth as a percentage

chain[:, :, 3] *= 100.

Plot the chains

fig1, ax = pl.subplots(ndim + nblobs, figsize=(6, 7))
fig1.suptitle("K2-14b", fontsize=16, fontweight='bold')
ax[-1].set_xlabel("Iteration", fontsize=14)
for n in range(ndim + nblobs):
for k in range(nwalk):
ax[n].plot(chain[k, :, n], alpha=0.3, lw=1)
ax[n].set_ylabel((params + blobs)[n], fontsize=9)
ax[n].margins(0, None)
ax[n].axvline(nburn, color='b', alpha=0.5, lw=1, ls='--')
fig1.savefig("k2-14b_chains.png", bbox_inches='tight')

Plot the posterior distributions

samples = chain[:, nburn:, :].reshape(-1, ndim + nblobs)
fig2 = corner(samples, labels=params + blobs)
fig2.suptitle("K2-14b", fontsize=16, fontweight='bold')
fig2.set_size_inches(6, 6)
for ax in fig2.axes:
for tick in ax.get_xticklabels() + ax.get_yticklabels():
tick.set_fontsize(7)
fig2.savefig("k2-14b_corner.png", bbox_inches='tight')
`
It raised exception following
=================== RESTART: C:\Users\User\Desktop\mcmc.py ===================
INFO [everest.user.DownloadFile()]: Found cached file.
INFO [everest.user.load_fits()]: Loading FITS file for 201635569.

0%| | 0/1000 [00:00<?, ?it/s]emcee: Exception while calling your likelihood function:
params: [ 8.37136581e+00 1.97846054e+03 -2.77124129e-02]
args: [<everest.Everest(201635569)>]
kwargs: {}
exception:
Traceback (most recent call last):
File "E:\WPy-3662\python-3.6.6.amd64\lib\site-packages\emcee\ensemble.py", line 519, in call
return self.f(x, *self.args, **self.kwargs)
File "C:\Users\User\Desktop\mcmc.py", line 30, in lnlike
model = TransitModel('b', per=per, t0=t0, b=b, rhos=10.)(star.time)
File "E:\WPy-3662\python-3.6.6.amd64\lib\site-packages\everest\transit.py", line 107, in call
raise Exception("Unable to import pysyzygy.")
Exception: Unable to import pysyzygy.
Traceback (most recent call last):
File "C:\Users\User\Desktop\mcmc.py", line 55, in
total=nsteps):
File "E:\WPy-3662\python-3.6.6.amd64\lib\site-packages\tqdm_tqdm.py", line 933, in iter
for obj in iterable:
File "E:\WPy-3662\python-3.6.6.amd64\lib\site-packages\emcee\ensemble.py", line 198, in sample
lnprob, blobs = self._get_lnprob(p)
File "E:\WPy-3662\python-3.6.6.amd64\lib\site-packages\emcee\ensemble.py", line 382, in _get_lnprob
results = list(M(self.lnprobfn, [p[i] for i in range(len(p))]))
File "E:\WPy-3662\python-3.6.6.amd64\lib\site-packages\emcee\ensemble.py", line 519, in call
return self.f(x, *self.args, **self.kwargs)
File "C:\Users\User\Desktop\mcmc.py", line 30, in lnlike
model = TransitModel('b', per=per, t0=t0, b=b, rhos=10.)(star.time)
File "E:\WPy-3662\python-3.6.6.amd64\lib\site-packages\everest\transit.py", line 107, in call
raise Exception("Unable to import pysyzygy.")
Exception: Unable to import pysyzygy.

from everest.

mirsakhawathossain avatar mirsakhawathossain commented on May 17, 2024

In mcmc.py code how can I set up following line
x0 = [[8.368 + 0.01 * np.random.randn(), 1978.4513 + 0.01 * np.random.randn(), 0. + 0.1 * np.random.randn()] for k in range(nwalk)]
How can I find out transit time and period? Please help me. @rodluger @ericagol

from everest.

ericagol avatar ericagol commented on May 17, 2024

That depends on which system you are studying - this is only useful if you have a known transiting exoplanet; if the planet is not known, then the transits cannot be masked.

from everest.

ericagol avatar ericagol commented on May 17, 2024

Well, for each candidate you will have to look up the period and time of first transit.

from everest.

mirsakhawathossain avatar mirsakhawathossain commented on May 17, 2024

It is easy to find out time of transit using Lightkurve Python package but the period search it is not easy because using different algorithm it varies. Could you please help me? @rodluger @ericagol

from everest.

Related Issues (10)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.