Skip to content

Commit

Permalink
Fixed RV plot
Browse files Browse the repository at this point in the history
  • Loading branch information
kyle committed Aug 20, 2017
1 parent 760aeb6 commit 07d64b3
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 11 deletions.
12 changes: 7 additions & 5 deletions ExoSOFT/tools/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ def __init__(self, epochs_di, epochs_rv, rapa, rapa_err, decsa, decsa_err,
self.data_mode = data_mode
self.pasa = pasa

def ln_posterior(pars, Model):
def ln_posterior(pars, Model, no_range_check=False):
"""
Calculates the likelihood for a given set of inputs.
Then calculate the natural logarithm of the posterior probability.
Expand All @@ -250,16 +250,18 @@ def ln_posterior(pars, Model):
variables necessary for those calculations.
"""
speed_test = False#$$$$$$$$$$$$$$$$$$$$
speed_test = False
if no_range_check:
speed_test = True
## convert params from raw values
Model.Params.direct_pars = pars
Model.Params.make_model_in()

## Range check on proposed params, set ln_post=zero if outside ranges.
ln_post = -np.inf
if speed_test: #$$$$$$$$$$$$$$$$$$$$
in_range=True#$$$$$$$$$$$$$$$$$$$$
else:#$$$$$$$$$$$$$$$$$$$$
if speed_test:
in_range=True
else:
in_range = Model.Params.check_range()
if in_range:
## Call Cython func to calculate orbit. ie. -> predicted x,y,rv values.
Expand Down
9 changes: 6 additions & 3 deletions ExoSOFT/tools/plotTools.py
Original file line number Diff line number Diff line change
Expand Up @@ -1039,7 +1039,7 @@ def orbitPlotter(orbParams,settings,plotFnameBase="",fl_format='png',DIlims=[],R
atot = asConversion*np.sqrt((semiMajorLocs[:,0][0]-semiMajorLocs[:,1][0])**2 + (semiMajorLocs[:,0][0]-semiMajorLocs[:,1][0])**2)
#print('5*paramsDI[10] = '+str(5*paramsDI[10]))
#print('atot/15.0 = '+str(atot/15.0))
starWidth = atot/15.0
starWidth = 2 #atot/15.0
#old width was 5*paramsDI[10]
starPolygon = star(starWidth,0,0,color='yellow',N=6,thin=0.5)
if parSetInt<1:
Expand Down Expand Up @@ -1219,6 +1219,7 @@ def orbitPlotter(orbParams,settings,plotFnameBase="",fl_format='png',DIlims=[],R
for par in orbParams[0][0]:
params.append(par)
params=np.array(params,dtype=np.dtype('d'),order='C')

if settingsRV['data_mode']!='DI':
realDataRV = copy.deepcopy(realData)
realDataRV = realDataRV[np.where(realDataRV[:,6]<1e6)[0],:]
Expand Down Expand Up @@ -1249,7 +1250,9 @@ def orbitPlotter(orbParams,settings,plotFnameBase="",fl_format='png',DIlims=[],R
fakeEpochs[i] = last_epoch
fakeEpochs[-1] = fakeEpochs[-2]#paramsRV[6]+(days_per_year*paramsRV[7]/2.0)
Model.Data.epochs_rv = fakeEpochs
_ = ln_posterior(paramsRVraw, Model)
paramsRVrawZeroed = copy.deepcopy(paramsRVraw)
paramsRVrawZeroed[9:]=0
_ = ln_posterior(paramsRVrawZeroed, Model, no_range_check=True)
fit_epochs = copy.deepcopy(Model.Data.epochs_rv)
fit_rv_model = copy.deepcopy(Model.Data.rv_model)

Expand Down Expand Up @@ -1315,7 +1318,7 @@ def orbitPlotter(orbParams,settings,plotFnameBase="",fl_format='png',DIlims=[],R
## add real data to plots
residualsPlot = addRVdataToPlot(residualsPlot,phasesReal,residualData[:,5]*kmConversion,residualData[:,6]*kmConversion,datasetInts=residualData[:,7],alf=0.1,markersize=15,plotErrorBars=True)
fitPlot = addRVdataToPlot(fitPlot,phasesReal,zeroedRealDataRV[:,5]*kmConversion,zeroedRealDataRV[:,6]*kmConversion,datasetInts=residualData[:,7],alf=0.2,markersize=9,plotErrorBars=True)

## Find and set limits
xLims = (np.min([np.min(phasesFit),np.min(phasesReal)]),np.max([np.max(phasesFit),np.max(phasesReal)]))
xLims = (xLims[0]-(xLims[1]-xLims[0])*.05,xLims[1]+(xLims[1]-xLims[0])*.05)
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,13 @@ The commands in order are:

$ pip uninstall -y scipy

<!-$pip uninstall -y scikit-learn-->
<!--$pip uninstall -y scikit-learn-->

$ pip install numpy --ignore-installed --no-cache-dir --no-binary :all:

$ pip install scipy --ignore-installed --no-cache-dir --no-binary :all:

<!-$pip install scikit-learn --ignore-installed --no-cache-dir --no-binary :all:-->
<!--$pip install scikit-learn --ignore-installed --no-cache-dir --no-binary :all:-->

**Solution to problems with matplotlib**

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def rd(filename):

setup(
name='ExoSOFT',
version="0.2.7",
version="0.2.8",
author='Kyle Mede',
author_email = 'kylemede@gmail.com',
url = 'https://github.com/kylemede/ExoSOFT',
Expand Down

0 comments on commit 07d64b3

Please sign in to comment.