Skip to content

Commit

Permalink
Merge pull request #1225 from rzellem/develop
Browse files Browse the repository at this point in the history
Release EXOTIC 3.2.3
  • Loading branch information
rzellem authored Sep 4, 2023
2 parents 2a5b09c + 44ee032 commit 3d60cd2
Show file tree
Hide file tree
Showing 4 changed files with 282 additions and 246 deletions.
21 changes: 11 additions & 10 deletions exotic/api/elca.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,14 @@
# Fit an exoplanet transit model to time series data.
# ########################################################################### #

from astropy.time import Time
import copy
import numpy as np
from itertools import cycle
import matplotlib.pyplot as plt
import numpy as np
from scipy import spatial
from scipy.optimize import least_squares
from scipy.signal import savgol_filter
from scipy import spatial

try:
from ultranest import ReactiveNestedSampler
Expand Down Expand Up @@ -168,6 +169,7 @@ def __init__(self, time, data, dataerr, airmass, prior, bounds, neighbors=200, m
self.verbose = verbose
self.mode = mode
self.neighbors = neighbors
self.results = None
if self.mode == "lm":
self.fit_LM()
elif self.mode == "ns":
Expand Down Expand Up @@ -322,12 +324,10 @@ def prior_transform(upars):
self.results['posterior']['errup'][i]]
except NameError:
self.ns_type = 'dynesty'
dsampler = dynesty.DynamicNestedSampler(loglike, prior_transform,
ndim=len(freekeys), bound='multi', sample='unif'
)
dsampler = dynesty.DynamicNestedSampler(loglike, prior_transform, ndim=len(freekeys),
bound='multi', sample='unif')
dsampler.run_nested(maxcall=int(1e5), dlogz_init=0.05,
maxbatch=10, nlive_batch=100
)
maxbatch=10, nlive_batch=100, print_progressbool=self.verbose)
self.results = dsampler.results

tests = [copy.deepcopy(self.prior) for i in range(5)]
Expand Down Expand Up @@ -558,7 +558,7 @@ def __init__(self, input_data, global_bounds, local_bounds, individual_fit=False
self.individual_fit = individual_fit
self.stdev_cutoff = stdev_cutoff
self.verbose = verbose

self.results = None
self.fit_nested()

def fit_nested(self):
Expand Down Expand Up @@ -680,10 +680,11 @@ def loglike(pars):
#clean_name = self.lc_data[n].get('name', n).replace(' ','_').replace('(','').replace(')','').replace('[','').replace(']','').replace('-','_').split('-')[0]
freekeys.append(f"local_{k}_{n}")

noop = lambda *args, **kwargs: None
if self.verbose:
self.results = ReactiveNestedSampler(freekeys, loglike, prior_transform).run(max_ncalls=1e6)
self.results = ReactiveNestedSampler(freekeys, loglike, prior_transform).run(max_ncalls=1e6, show_status=True)
else:
self.results = ReactiveNestedSampler(freekeys, loglike, prior_transform).run(max_ncalls=1e6, show_status=self.verbose, viz_callback=self.verbose)
self.results = ReactiveNestedSampler(freekeys, loglike, prior_transform).run(max_ncalls=1e6, show_status=False, viz_callback=noop)

self.quantiles = {}
self.errors = {}
Expand Down
Loading

0 comments on commit 3d60cd2

Please sign in to comment.