mrtommyb / ktransit

A simple exoplanet transit modeling tool in python
GNU General Public License v3.0
53 stars 20 forks source link

LCModel.add_data() causes crash depending on when it's called. #4

Open fergalm opened 10 years ago

fergalm commented 10 years ago

I'm getting the following error

/home/fmullall/.local/lib/python2.7/site-packages/ktransit/ktransit.pyc in transitmodel(self) 183 self._transitmodel = transitmodel(self.nplanets, 184 sol,time,itime,self.ntt, --> 185 self.tobs,self.omc,datatype) 186 self._rvmodel = None 187

error: failed in converting 6th argument `tobs' of _tmodtom.transitmodel to C/Fortran array

With this code.

mod = ktransit.LCModel()
mod.add_data( time=data[:,tCol], \
              itime= np.ones_like(data[:,tCol])*const.keplerLongCadence_days)
mod.add_star()
mod.add_planet( T0=epoch_bkjd, \
                period=period_days, \
                rprs=.2075, \
                ecosw=0, \
                esinw=1, \
                occ=0, \
              )

If I delay calling add_data() until after add_planet the error goes away. That doesn't seem like it's the expected behaviour.

mrtommyb commented 10 years ago

The way the code is currently written it require the number of planets included in the model to be known before the add_data method is called. I could spend some effort changing this or I could let it fail more gracefully.