timothydmorton / VESPA

Validation of Exoplanet Signals using a Probabilistic Algorithm--- calculating false positive probabilities for transit signals
MIT License
36 stars 20 forks source link

Adding a POSS contraint #20

Closed jxcbecker closed 6 years ago

jxcbecker commented 6 years ago

I am trying to add a POSS constraint (that there are no background stars to 5 mag within 10 arcsec of the target). I created a .cc file:

0 5
10 5

I have successfully loaded my FFP:

from vespa import FPPCalculation
f = FPPCalculation.load('Example')
f.FPP()

but when I try to load the contrast 'curve':

from vespa.stars.contrastcurve import ContrastCurveFromFile
cc = ContrastCurveFromFile('Data/POSS_sample.cc', 'k') # include waveband of constraint

I get the following error:

---------------------------------------------------------------------------
error                                     Traceback (most recent call last)
<ipython-input-29-1f927e906ba6> in <module>()
      1 from vespa.stars.contrastcurve import ContrastCurveFromFile
----> 2 cc = ContrastCurveFromFile('Data/POSS_sample.cc', 'k') # include waveband of constraint
      3 bebs = f['beb']
      4 bebs.apply_cc(cc)

~/anaconda2/envs/vespa/lib/python3.6/site-packages/vespa/stars/contrastcurve.py in __init__(self, filename, band, mag, mas, **kwargs)
    142         if mas: #convert from milliarcsec
    143             rs /= 1000.
--> 144         ContrastCurve.__init__(self,rs,dmags,band,mag, **kwargs)
    145         self.filename = filename
    146 

~/anaconda2/envs/vespa/lib/python3.6/site-packages/vespa/stars/contrastcurve.py in __init__(self, rs, dmags, band, mag, name)
     56         self.band = band
     57         self.mag = mag
---> 58         self.contrastfn = interpolate(rs,dmags,s=0)
     59         self.rmax = rs.max()
     60         self.rmin = rs.min()

~/anaconda2/envs/vespa/lib/python3.6/site-packages/scipy/interpolate/fitpack2.py in __init__(self, x, y, w, bbox, k, s, ext, check_finite)
    183 
    184         data = dfitpack.fpcurf0(x,y,k,w=w,
--> 185                                 xb=bbox[0],xe=bbox[1],s=s)
    186         if data[-1] == 1:
    187             # nest too small, setting to maximum bound

error: (m>k) failed for hidden m: fpcurf0:m=2
jxcbecker commented 6 years ago

Solution: Add four rows (or more), with the contrast constraint, so that your file contains several points on the flat line instead of just the upper and lower limits to allow the line fit routine to succeed. i.e., instead of:

0 5 10 5

use as your constraint file:

0 5 1 5 3 5 6 5 10 5