Esempio n. 1
0
	def regression(self):
	
		# Prior on mean function :
		mean_mag = np.mean(self.mags)
		def meanprior(query):
			return (0.0 * query + mean_mag)
		
		# Ok we try this, but with a spline
		#def meanprior(jds):
		#	inshape = jds.shape
		#	return spline.eval(jds=jds.reshape(inshape[0])).reshape(inshape)
	
		self.regfct = pymcgp.regression(self.jds, self.mags, self.magerrs, meanprior)
		
		#npts = (gpr.jds[-1] - gpr.jds[0])*2.0
		#		xs = np.linspace(gpr.jds[0], gpr.jds[-1], npts)
		#		(ys, yerrs) = gpr.regfct(xs)
Esempio n. 2
0
    def regression(self):

        # Prior on mean function :
        mean_mag = np.mean(self.mags)

        def meanprior(query):
            return (0.0 * query + mean_mag)

        # Ok we try this, but with a spline
        #def meanprior(jds):
        #	inshape = jds.shape
        #	return spline.eval(jds=jds.reshape(inshape[0])).reshape(inshape)

        self.regfct = pymcgp.regression(self.jds, self.mags, self.magerrs,
                                        meanprior)

        #npts = (gpr.jds[-1] - gpr.jds[0])*2.0
        #		xs = np.linspace(gpr.jds[0], gpr.jds[-1], npts)
        #		(ys, yerrs) = gpr.regfct(xs)
Esempio n. 3
0
def factory(l, pad=300, pd=2, plotcolour=None, covkernel="matern", pow=1.5, amp=2.0, scale=200.0, errscale=5.0):
	"""
	Give me a lightcurve, I return a regularly sampled light curve, by performing some regression.
	
	:param pad: the padding, in days
	:param pd: the point density, in points per days.
	
	The points live on a regular grid in julian days, 0.0, 0.1, 0.2, 0.3 ...
	
	The parameters pow, amp, scale, errscale are passed to the GPR, see its doc.
	
	"""

	if plotcolour == None:
		plotcolour = l.plotcolour
	
	name = l.object
	
	jds = l.jds.copy()
	timeshift = l.timeshift
	
	mags = l.getmags(noml=True)
	magerrs = l.getmagerrs()
	
	minjd = np.round(jds[0] - pad)
	maxjd = np.round(jds[-1] + pad)
		
	npts = int(maxjd - minjd)*pd
		
	rsjds = np.linspace(minjd, maxjd, npts) # rs for regularly sampled
		
	# The regression itself
	
	mean_mag = np.mean(mags)
	def meanprior(query):
		return (0.0 * query + mean_mag)
		
	regfct = pymcgp.regression(jds, mags, magerrs, meanprior, covkernel=covkernel, pow=pow, amp=amp, scale=scale, errscale=errscale)

	(rsmags, rsmagerrs) = regfct(rsjds) # that f****r does not want to be executed in a multiprocessing loop. Why ?

	return rslc(rsjds, rsmags, rsmagerrs, pad, pd, timeshift=timeshift, name=name, plotcolour=plotcolour)
Esempio n. 4
0
def factory(l, pad=300, pd=2, plotcolour=None, pow=1.5, amp=2.0, scale=200.0, errscale=5.0):
	"""
	Give me a lightcurve, I return a regularly sampled light curve, by performing some regression.
	
	:param pad: the padding, in days
	:param pd: the point density, in points per days.
	
	The points live on a regular grid in julian days, 0.0, 0.1, 0.2, 0.3 ...
	
	The parameters pow, amp, scale, errscale are passed to the GPR, see its doc.
	
	"""
	
	if plotcolour == None:
		plotcolour = l.plotcolour
	
	name = l.object
	
	jds = l.jds.copy()
	timeshift = l.timeshift
	
	mags = l.getmags(noml=True)
	magerrs = l.getmagerrs()
	
	minjd = np.round(jds[0] - pad)
	maxjd = np.round(jds[-1] + pad)
		
	npts = int(maxjd - minjd)*pd
		
	rsjds = np.linspace(minjd, maxjd, npts) # rs for regularly sampled
		
	# The regression itself
	
	mean_mag = np.mean(mags)
	def meanprior(query):
		return (0.0 * query + mean_mag)
		
	regfct = pymcgp.regression(jds, mags, magerrs, meanprior, pow=pow, amp=amp, scale=scale, errscale=errscale)
	(rsmags, rsmagerrs) = regfct(rsjds)
	
	return rslc(rsjds, rsmags, rsmagerrs, pad, pd, timeshift=timeshift, name=name, plotcolour=plotcolour)
Esempio n. 5
0
def factory(l, pad=300, pd=2, plotcolour=None):
	"""
	Give me a lightcurve, I return a regularly sampled light curve, by performing some regression.
	
	:param pad: the padding, in days
	:param pd: the point density, in points per days.
	
	The points live on a regular grid in julian days, 0.0, 0.1, 0.2, 0.3 ...
	"""
	
	if plotcolour == None:
		plotcolour = l.plotcolour
	
	name = l.object
	
	jds = l.jds.copy()
	timeshift = l.timeshift
	
	mags = l.getmags(noml=True)
	magerrs = l.getmagerrs()
	
	minjd = np.round(jds[0] - pad)
	maxjd = np.round(jds[-1] + pad)
		
	npts = int(maxjd - minjd)*pd
		
	rsjds = np.linspace(minjd, maxjd, npts) # rs for regularly sampled
		
	# The regression itself
	
	mean_mag = np.mean(mags)
	def meanprior(query):
		return (0.0 * query + mean_mag)
		
	regfct = pymcgp.regression(jds, mags, magerrs, meanprior)
	(rsmags, rsmagerrs) = regfct(rsjds)
	
	return rslc(rsjds, rsmags, rsmagerrs, pad, pd, timeshift=timeshift, name=name, plotcolour=plotcolour)