pycs.spldiff package

Submodules

pycs.spldiff.multiopt module

Optimization using regdiff

Would be great to have an opt_flux in here !

pycs.spldiff.multiopt.opt_ts(lcs, method='weights', pd=5, plotcolour=None, knotstep=20.0, n=None, stab=True, stabext=300.0, stabgap=20.0, stabstep=5.0, stabmagerr=-2.0, stabrampsize=0, stabrampfact=1.0, bokit=1, bokeps=2.0, boktests=5, bokwindow=None, k=3, verbose=True, magshift=True)

Give me lightcurves (with more or less good initial time shifts) I run a spline regression on them, optimize the difference, and set their delays to the optimal values. I also optimise the magnitude shifts for display purpose, but it does not affect the time shifts at all !

Parameters:pd – the point density of the regularly sampled lightcurves, in points per days.

pycs.spldiff.rslc module

Defines a class that represents a regularly sampled lightcurve

class pycs.spldiff.rslc.rslc(jds, mags, magerrs, pad, pd, timeshift=0.0, name='Name', plotcolour='black')

A regularly sampled lightcurve, typically obtained by regression. To make such a rslc from a usual lightcurve object, look at the factory function below. One idea is that we want to be able to add and subtract those, propagating errors. There is no “microlensing” or similar stuff – only time shifts.

__init__(jds, mags, magerrs, pad, pd, timeshift=0.0, name='Name', plotcolour='black')
__str__()
shifttime(timeshift)
copy()
getjds()
getmags()
getmagerrs()
mask(maxmagerr=0.1, target=20.0)
wtv(method='weights')

Return some weighted average variation WAV. Usuall called on a “difference” lightcurve.

__module__ = 'pycs.spldiff.rslc'
pycs.spldiff.rslc.factory(l, pad=300, pd=2, plotcolour=None, knotstep=20.0, n=None, stab=True, stabext=300.0, stabgap=20.0, stabstep=5.0, stabmagerr=-2.0, stabrampsize=0, stabrampfact=1.0, bokit=1, bokeps=2.0, boktests=5, bokwindow=None, k=3, verbose=True)

Give me a lightcurve, I return a regularly sampled light curve, by performing some spline regression. !!! New: I also return the spline used for the 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 …

pycs.spldiff.rslc.subtract(rs1, rs2)

I subtract rs2 from rs1. This means I keep the jds and timeshift of rs1, and only change the mags and magerrs, interpolating rs2. I return a brand new rslc object, that has no timeshift (as we do not care about a timeshift, for a difference).

Parameters:
  • rs1 (rslc object) –
  • rs2 (rslc object) –
pycs.spldiff.rslc.wtvdiff(rs1, rs2, method)

Returns the wtv (weighted TV) of the difference between 2 curves.

This is symmetric (no change if you invert rs1 and rs2), up to some small numerical errors.

pycs.spldiff.rslc.bruteranges(step, radius, center)

Auxiliary function for brute force exploration. Prepares the “ranges” parameter to be passed to brute force optimizer In other words, we draw a cube … radius is an int saying how many steps to go left and right of center. center is an array of the centers, it can be of any lenght.

You make 2*radius + 1 steps in each direction !, so radius=2 means 5 steps thus 125 calls for 4 curves.

pycs.spldiff.rslc.opt_ts(rslcs, method='weights', verbose=True)

I optimize the timeshifts between the rslcs to minimize the wtv between them. Note that even if the wtvdiff is only about two curves, we cannot split this into optimizing AB AC AD in a row, as this would never calculate BC, and BC is not contained into AB + AC. !!! New : I also return a spline to optimise the magshifts

Parameters:rslcs – a list of rslc objects

pycs.spldiff.splreg module

spline regression module…

pycs.spldiff.splreg.splreg(jds, mags, magerrs, knotstep=20.0, n=None, stab=True, stabext=300.0, stabgap=20.0, stabstep=5.0, stabmagerr=-2.0, stabrampsize=0, stabrampfact=1.0, bokit=1, bokeps=2.0, boktests=5, bokwindow=None, k=3, verbose=True)

Give me datapoints x y, with errorbars on y I return a function : you pass an array of new x, the func returns (newy, newyerr)

I return a spline as well, so I can use it for magshifts later performed with a BOK spline fitting on the datas and the errors. The errors on y take into account the seasons in y

Module contents

Spline difference curve shifting technique, using spline enveloppes.