id int32 0 252k | repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 75 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 |
|---|---|---|---|---|---|---|---|---|---|---|---|
47,300 | timothydmorton/VESPA | vespa/stars/utils.py | semimajor | def semimajor(P,mstar=1):
"""Returns semimajor axis in AU given P in days, mstar in solar masses.
"""
return ((P*DAY/2/np.pi)**2*G*mstar*MSUN)**(1./3)/AU | python | def semimajor(P,mstar=1):
"""Returns semimajor axis in AU given P in days, mstar in solar masses.
"""
return ((P*DAY/2/np.pi)**2*G*mstar*MSUN)**(1./3)/AU | [
"def",
"semimajor",
"(",
"P",
",",
"mstar",
"=",
"1",
")",
":",
"return",
"(",
"(",
"P",
"*",
"DAY",
"/",
"2",
"/",
"np",
".",
"pi",
")",
"**",
"2",
"*",
"G",
"*",
"mstar",
"*",
"MSUN",
")",
"**",
"(",
"1.",
"/",
"3",
")",
"/",
"AU"
] | Returns semimajor axis in AU given P in days, mstar in solar masses. | [
"Returns",
"semimajor",
"axis",
"in",
"AU",
"given",
"P",
"in",
"days",
"mstar",
"in",
"solar",
"masses",
"."
] | 0446b54d48009f3655cfd1a3957ceea21d3adcaa | https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/stars/utils.py#L159-L162 |
47,301 | timothydmorton/VESPA | vespa/stars/utils.py | fluxfrac | def fluxfrac(*mags):
"""Returns fraction of total flux in first argument, assuming all are magnitudes.
"""
Ftot = 0
for mag in mags:
Ftot += 10**(-0.4*mag)
F1 = 10**(-0.4*mags[0])
return F1/Ftot | python | def fluxfrac(*mags):
"""Returns fraction of total flux in first argument, assuming all are magnitudes.
"""
Ftot = 0
for mag in mags:
Ftot += 10**(-0.4*mag)
F1 = 10**(-0.4*mags[0])
return F1/Ftot | [
"def",
"fluxfrac",
"(",
"*",
"mags",
")",
":",
"Ftot",
"=",
"0",
"for",
"mag",
"in",
"mags",
":",
"Ftot",
"+=",
"10",
"**",
"(",
"-",
"0.4",
"*",
"mag",
")",
"F1",
"=",
"10",
"**",
"(",
"-",
"0.4",
"*",
"mags",
"[",
"0",
"]",
")",
"return",... | Returns fraction of total flux in first argument, assuming all are magnitudes. | [
"Returns",
"fraction",
"of",
"total",
"flux",
"in",
"first",
"argument",
"assuming",
"all",
"are",
"magnitudes",
"."
] | 0446b54d48009f3655cfd1a3957ceea21d3adcaa | https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/stars/utils.py#L176-L183 |
47,302 | timothydmorton/VESPA | vespa/stars/utils.py | dfromdm | def dfromdm(dm):
"""Returns distance given distance modulus.
"""
if np.size(dm)>1:
dm = np.atleast_1d(dm)
return 10**(1+dm/5) | python | def dfromdm(dm):
"""Returns distance given distance modulus.
"""
if np.size(dm)>1:
dm = np.atleast_1d(dm)
return 10**(1+dm/5) | [
"def",
"dfromdm",
"(",
"dm",
")",
":",
"if",
"np",
".",
"size",
"(",
"dm",
")",
">",
"1",
":",
"dm",
"=",
"np",
".",
"atleast_1d",
"(",
"dm",
")",
"return",
"10",
"**",
"(",
"1",
"+",
"dm",
"/",
"5",
")"
] | Returns distance given distance modulus. | [
"Returns",
"distance",
"given",
"distance",
"modulus",
"."
] | 0446b54d48009f3655cfd1a3957ceea21d3adcaa | https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/stars/utils.py#L185-L190 |
47,303 | timothydmorton/VESPA | vespa/stars/utils.py | distancemodulus | def distancemodulus(d):
"""Returns distance modulus given d in parsec.
"""
if type(d)==Quantity:
x = d.to('pc').value
else:
x = d #assumed to be pc
if np.size(x)>1:
d = np.atleast_1d(x)
return 5*np.log10(x/10) | python | def distancemodulus(d):
"""Returns distance modulus given d in parsec.
"""
if type(d)==Quantity:
x = d.to('pc').value
else:
x = d #assumed to be pc
if np.size(x)>1:
d = np.atleast_1d(x)
return 5*np.log10(x/10) | [
"def",
"distancemodulus",
"(",
"d",
")",
":",
"if",
"type",
"(",
"d",
")",
"==",
"Quantity",
":",
"x",
"=",
"d",
".",
"to",
"(",
"'pc'",
")",
".",
"value",
"else",
":",
"x",
"=",
"d",
"#assumed to be pc",
"if",
"np",
".",
"size",
"(",
"x",
")",... | Returns distance modulus given d in parsec. | [
"Returns",
"distance",
"modulus",
"given",
"d",
"in",
"parsec",
"."
] | 0446b54d48009f3655cfd1a3957ceea21d3adcaa | https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/stars/utils.py#L192-L202 |
47,304 | dellis23/ansible-toolkit | ansible_toolkit/utils.py | get_files | def get_files(path):
"""
Returns a recursive list of all non-hidden files in and below the current
directory.
"""
return_files = []
for root, dirs, files in os.walk(path):
# Skip hidden files
files = [f for f in files if not f[0] == '.']
dirs[:] = [d for d in dirs if not... | python | def get_files(path):
"""
Returns a recursive list of all non-hidden files in and below the current
directory.
"""
return_files = []
for root, dirs, files in os.walk(path):
# Skip hidden files
files = [f for f in files if not f[0] == '.']
dirs[:] = [d for d in dirs if not... | [
"def",
"get_files",
"(",
"path",
")",
":",
"return_files",
"=",
"[",
"]",
"for",
"root",
",",
"dirs",
",",
"files",
"in",
"os",
".",
"walk",
"(",
"path",
")",
":",
"# Skip hidden files",
"files",
"=",
"[",
"f",
"for",
"f",
"in",
"files",
"if",
"not... | Returns a recursive list of all non-hidden files in and below the current
directory. | [
"Returns",
"a",
"recursive",
"list",
"of",
"all",
"non",
"-",
"hidden",
"files",
"in",
"and",
"below",
"the",
"current",
"directory",
"."
] | 7eb5198e1f68c9a3ca1d129d9e2a52fb3f0e65c5 | https://github.com/dellis23/ansible-toolkit/blob/7eb5198e1f68c9a3ca1d129d9e2a52fb3f0e65c5/ansible_toolkit/utils.py#L99-L113 |
47,305 | timothydmorton/VESPA | vespa/transitsignal.py | TransitSignal.save_pkl | def save_pkl(self, filename):
"""
Pickles TransitSignal.
"""
with open(filename, 'wb') as fout:
pickle.dump(self, fout) | python | def save_pkl(self, filename):
"""
Pickles TransitSignal.
"""
with open(filename, 'wb') as fout:
pickle.dump(self, fout) | [
"def",
"save_pkl",
"(",
"self",
",",
"filename",
")",
":",
"with",
"open",
"(",
"filename",
",",
"'wb'",
")",
"as",
"fout",
":",
"pickle",
".",
"dump",
"(",
"self",
",",
"fout",
")"
] | Pickles TransitSignal. | [
"Pickles",
"TransitSignal",
"."
] | 0446b54d48009f3655cfd1a3957ceea21d3adcaa | https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/transitsignal.py#L138-L143 |
47,306 | timothydmorton/VESPA | vespa/transitsignal.py | TransitSignal.plot | def plot(self, fig=None, plot_trap=False, name=False, trap_color='g',
trap_kwargs=None, **kwargs):
"""
Makes a simple plot of signal
:param fig: (optional)
Argument for :func:`plotutils.setfig`.
:param plot_trap: (optional)
Whether to plot the (best... | python | def plot(self, fig=None, plot_trap=False, name=False, trap_color='g',
trap_kwargs=None, **kwargs):
"""
Makes a simple plot of signal
:param fig: (optional)
Argument for :func:`plotutils.setfig`.
:param plot_trap: (optional)
Whether to plot the (best... | [
"def",
"plot",
"(",
"self",
",",
"fig",
"=",
"None",
",",
"plot_trap",
"=",
"False",
",",
"name",
"=",
"False",
",",
"trap_color",
"=",
"'g'",
",",
"trap_kwargs",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"setfig",
"(",
"fig",
")",
"plt",
"... | Makes a simple plot of signal
:param fig: (optional)
Argument for :func:`plotutils.setfig`.
:param plot_trap: (optional)
Whether to plot the (best-fit least-sq) trapezoid fit.
:param name: (optional)
Whether to annotate plot with the name of the signal;
... | [
"Makes",
"a",
"simple",
"plot",
"of",
"signal"
] | 0446b54d48009f3655cfd1a3957ceea21d3adcaa | https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/transitsignal.py#L166-L224 |
47,307 | timothydmorton/VESPA | vespa/statutils.py | kdeconf | def kdeconf(kde,conf=0.683,xmin=None,xmax=None,npts=500,
shortest=True,conftol=0.001,return_max=False):
"""
Returns desired confidence interval for provided KDE object
"""
if xmin is None:
xmin = kde.dataset.min()
if xmax is None:
xmax = kde.dataset.max()
x = np.linsp... | python | def kdeconf(kde,conf=0.683,xmin=None,xmax=None,npts=500,
shortest=True,conftol=0.001,return_max=False):
"""
Returns desired confidence interval for provided KDE object
"""
if xmin is None:
xmin = kde.dataset.min()
if xmax is None:
xmax = kde.dataset.max()
x = np.linsp... | [
"def",
"kdeconf",
"(",
"kde",
",",
"conf",
"=",
"0.683",
",",
"xmin",
"=",
"None",
",",
"xmax",
"=",
"None",
",",
"npts",
"=",
"500",
",",
"shortest",
"=",
"True",
",",
"conftol",
"=",
"0.001",
",",
"return_max",
"=",
"False",
")",
":",
"if",
"xm... | Returns desired confidence interval for provided KDE object | [
"Returns",
"desired",
"confidence",
"interval",
"for",
"provided",
"KDE",
"object"
] | 0446b54d48009f3655cfd1a3957ceea21d3adcaa | https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/statutils.py#L8-L19 |
47,308 | timothydmorton/VESPA | vespa/statutils.py | qstd | def qstd(x,quant=0.05,top=False,bottom=False):
"""returns std, ignoring outer 'quant' pctiles
"""
s = np.sort(x)
n = np.size(x)
lo = s[int(n*quant)]
hi = s[int(n*(1-quant))]
if top:
w = np.where(x>=lo)
elif bottom:
w = np.where(x<=hi)
else:
w = np.where((x>=lo... | python | def qstd(x,quant=0.05,top=False,bottom=False):
"""returns std, ignoring outer 'quant' pctiles
"""
s = np.sort(x)
n = np.size(x)
lo = s[int(n*quant)]
hi = s[int(n*(1-quant))]
if top:
w = np.where(x>=lo)
elif bottom:
w = np.where(x<=hi)
else:
w = np.where((x>=lo... | [
"def",
"qstd",
"(",
"x",
",",
"quant",
"=",
"0.05",
",",
"top",
"=",
"False",
",",
"bottom",
"=",
"False",
")",
":",
"s",
"=",
"np",
".",
"sort",
"(",
"x",
")",
"n",
"=",
"np",
".",
"size",
"(",
"x",
")",
"lo",
"=",
"s",
"[",
"int",
"(",
... | returns std, ignoring outer 'quant' pctiles | [
"returns",
"std",
"ignoring",
"outer",
"quant",
"pctiles"
] | 0446b54d48009f3655cfd1a3957ceea21d3adcaa | https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/statutils.py#L22-L35 |
47,309 | timothydmorton/VESPA | vespa/plotutils.py | plot2dhist | def plot2dhist(xdata,ydata,cmap='binary',interpolation='nearest',
fig=None,logscale=True,xbins=None,ybins=None,
nbins=50,pts_only=False,**kwargs):
"""Plots a 2d density histogram of provided data
:param xdata,ydata: (array-like)
Data to plot.
:param cmap: (optional)
... | python | def plot2dhist(xdata,ydata,cmap='binary',interpolation='nearest',
fig=None,logscale=True,xbins=None,ybins=None,
nbins=50,pts_only=False,**kwargs):
"""Plots a 2d density histogram of provided data
:param xdata,ydata: (array-like)
Data to plot.
:param cmap: (optional)
... | [
"def",
"plot2dhist",
"(",
"xdata",
",",
"ydata",
",",
"cmap",
"=",
"'binary'",
",",
"interpolation",
"=",
"'nearest'",
",",
"fig",
"=",
"None",
",",
"logscale",
"=",
"True",
",",
"xbins",
"=",
"None",
",",
"ybins",
"=",
"None",
",",
"nbins",
"=",
"50... | Plots a 2d density histogram of provided data
:param xdata,ydata: (array-like)
Data to plot.
:param cmap: (optional)
Colormap to use for density plot.
:param interpolation: (optional)
Interpolation scheme for display (passed to ``plt.imshow``).
:param fig: (optional)
... | [
"Plots",
"a",
"2d",
"density",
"histogram",
"of",
"provided",
"data"
] | 0446b54d48009f3655cfd1a3957ceea21d3adcaa | https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/plotutils.py#L37-L100 |
47,310 | timothydmorton/VESPA | vespa/transit_basic.py | ldcoeffs | def ldcoeffs(teff,logg=4.5,feh=0):
"""
Returns limb-darkening coefficients in Kepler band.
"""
teffs = np.atleast_1d(teff)
loggs = np.atleast_1d(logg)
Tmin,Tmax = (LDPOINTS[:,0].min(),LDPOINTS[:,0].max())
gmin,gmax = (LDPOINTS[:,1].min(),LDPOINTS[:,1].max())
teffs[(teffs < Tmin)] = Tmi... | python | def ldcoeffs(teff,logg=4.5,feh=0):
"""
Returns limb-darkening coefficients in Kepler band.
"""
teffs = np.atleast_1d(teff)
loggs = np.atleast_1d(logg)
Tmin,Tmax = (LDPOINTS[:,0].min(),LDPOINTS[:,0].max())
gmin,gmax = (LDPOINTS[:,1].min(),LDPOINTS[:,1].max())
teffs[(teffs < Tmin)] = Tmi... | [
"def",
"ldcoeffs",
"(",
"teff",
",",
"logg",
"=",
"4.5",
",",
"feh",
"=",
"0",
")",
":",
"teffs",
"=",
"np",
".",
"atleast_1d",
"(",
"teff",
")",
"loggs",
"=",
"np",
".",
"atleast_1d",
"(",
"logg",
")",
"Tmin",
",",
"Tmax",
"=",
"(",
"LDPOINTS",
... | Returns limb-darkening coefficients in Kepler band. | [
"Returns",
"limb",
"-",
"darkening",
"coefficients",
"in",
"Kepler",
"band",
"."
] | 0446b54d48009f3655cfd1a3957ceea21d3adcaa | https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/transit_basic.py#L81-L97 |
47,311 | timothydmorton/VESPA | vespa/transit_basic.py | impact_parameter | def impact_parameter(a, R, inc, ecc=0, w=0, return_occ=False):
"""a in AU, R in Rsun, inc & w in radians
"""
b_tra = a*AU*np.cos(inc)/(R*RSUN) * (1-ecc**2)/(1 + ecc*np.sin(w))
if return_occ:
b_tra = a*AU*np.cos(inc)/(R*RSUN) * (1-ecc**2)/(1 - ecc*np.sin(w))
return b_tra, b_occ
else:... | python | def impact_parameter(a, R, inc, ecc=0, w=0, return_occ=False):
"""a in AU, R in Rsun, inc & w in radians
"""
b_tra = a*AU*np.cos(inc)/(R*RSUN) * (1-ecc**2)/(1 + ecc*np.sin(w))
if return_occ:
b_tra = a*AU*np.cos(inc)/(R*RSUN) * (1-ecc**2)/(1 - ecc*np.sin(w))
return b_tra, b_occ
else:... | [
"def",
"impact_parameter",
"(",
"a",
",",
"R",
",",
"inc",
",",
"ecc",
"=",
"0",
",",
"w",
"=",
"0",
",",
"return_occ",
"=",
"False",
")",
":",
"b_tra",
"=",
"a",
"*",
"AU",
"*",
"np",
".",
"cos",
"(",
"inc",
")",
"/",
"(",
"R",
"*",
"RSUN"... | a in AU, R in Rsun, inc & w in radians | [
"a",
"in",
"AU",
"R",
"in",
"Rsun",
"inc",
"&",
"w",
"in",
"radians"
] | 0446b54d48009f3655cfd1a3957ceea21d3adcaa | https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/transit_basic.py#L239-L248 |
47,312 | timothydmorton/VESPA | vespa/transit_basic.py | minimum_inclination | def minimum_inclination(P,M1,M2,R1,R2):
"""
Returns the minimum inclination at which two bodies from two given sets eclipse
Only counts systems not within each other's Roche radius
:param P:
Orbital periods.
:param M1,M2,R1,R2:
Masses and radii of primary and secondary stars. ... | python | def minimum_inclination(P,M1,M2,R1,R2):
"""
Returns the minimum inclination at which two bodies from two given sets eclipse
Only counts systems not within each other's Roche radius
:param P:
Orbital periods.
:param M1,M2,R1,R2:
Masses and radii of primary and secondary stars. ... | [
"def",
"minimum_inclination",
"(",
"P",
",",
"M1",
",",
"M2",
",",
"R1",
",",
"R2",
")",
":",
"P",
",",
"M1",
",",
"M2",
",",
"R1",
",",
"R2",
"=",
"(",
"np",
".",
"atleast_1d",
"(",
"P",
")",
",",
"np",
".",
"atleast_1d",
"(",
"M1",
")",
"... | Returns the minimum inclination at which two bodies from two given sets eclipse
Only counts systems not within each other's Roche radius
:param P:
Orbital periods.
:param M1,M2,R1,R2:
Masses and radii of primary and secondary stars. | [
"Returns",
"the",
"minimum",
"inclination",
"at",
"which",
"two",
"bodies",
"from",
"two",
"given",
"sets",
"eclipse"
] | 0446b54d48009f3655cfd1a3957ceea21d3adcaa | https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/transit_basic.py#L297-L328 |
47,313 | timothydmorton/VESPA | vespa/transit_basic.py | eclipse_pars | def eclipse_pars(P,M1,M2,R1,R2,ecc=0,inc=90,w=0,sec=False):
"""retuns p,b,aR from P,M1,M2,R1,R2,ecc,inc,w"""
a = semimajor(P,M1+M2)
if sec:
b = a*AU*np.cos(inc*np.pi/180)/(R1*RSUN) * (1-ecc**2)/(1 - ecc*np.sin(w*np.pi/180))
#aR = a*AU/(R2*RSUN) #I feel like this was to correct a bug, but thi... | python | def eclipse_pars(P,M1,M2,R1,R2,ecc=0,inc=90,w=0,sec=False):
"""retuns p,b,aR from P,M1,M2,R1,R2,ecc,inc,w"""
a = semimajor(P,M1+M2)
if sec:
b = a*AU*np.cos(inc*np.pi/180)/(R1*RSUN) * (1-ecc**2)/(1 - ecc*np.sin(w*np.pi/180))
#aR = a*AU/(R2*RSUN) #I feel like this was to correct a bug, but thi... | [
"def",
"eclipse_pars",
"(",
"P",
",",
"M1",
",",
"M2",
",",
"R1",
",",
"R2",
",",
"ecc",
"=",
"0",
",",
"inc",
"=",
"90",
",",
"w",
"=",
"0",
",",
"sec",
"=",
"False",
")",
":",
"a",
"=",
"semimajor",
"(",
"P",
",",
"M1",
"+",
"M2",
")",
... | retuns p,b,aR from P,M1,M2,R1,R2,ecc,inc,w | [
"retuns",
"p",
"b",
"aR",
"from",
"P",
"M1",
"M2",
"R1",
"R2",
"ecc",
"inc",
"w"
] | 0446b54d48009f3655cfd1a3957ceea21d3adcaa | https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/transit_basic.py#L389-L402 |
47,314 | timothydmorton/VESPA | vespa/transit_basic.py | fit_traptransit | def fit_traptransit(ts,fs,p0):
"""
Fits trapezoid model to provided ts,fs
"""
pfit,success = leastsq(traptransit_resid,p0,args=(ts,fs))
if success not in [1,2,3,4]:
raise NoFitError
#logging.debug('success = {}'.format(success))
return pfit | python | def fit_traptransit(ts,fs,p0):
"""
Fits trapezoid model to provided ts,fs
"""
pfit,success = leastsq(traptransit_resid,p0,args=(ts,fs))
if success not in [1,2,3,4]:
raise NoFitError
#logging.debug('success = {}'.format(success))
return pfit | [
"def",
"fit_traptransit",
"(",
"ts",
",",
"fs",
",",
"p0",
")",
":",
"pfit",
",",
"success",
"=",
"leastsq",
"(",
"traptransit_resid",
",",
"p0",
",",
"args",
"=",
"(",
"ts",
",",
"fs",
")",
")",
"if",
"success",
"not",
"in",
"[",
"1",
",",
"2",
... | Fits trapezoid model to provided ts,fs | [
"Fits",
"trapezoid",
"model",
"to",
"provided",
"ts",
"fs"
] | 0446b54d48009f3655cfd1a3957ceea21d3adcaa | https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/transit_basic.py#L745-L753 |
47,315 | dellis23/ansible-toolkit | ansible_toolkit/vault.py | backup | def backup(path, password_file=None):
"""
Replaces the contents of a file with its decrypted counterpart, storing the
original encrypted version and a hash of the file contents for later
retrieval.
"""
vault = VaultLib(get_vault_password(password_file))
with open(path, 'r') as f:
enc... | python | def backup(path, password_file=None):
"""
Replaces the contents of a file with its decrypted counterpart, storing the
original encrypted version and a hash of the file contents for later
retrieval.
"""
vault = VaultLib(get_vault_password(password_file))
with open(path, 'r') as f:
enc... | [
"def",
"backup",
"(",
"path",
",",
"password_file",
"=",
"None",
")",
":",
"vault",
"=",
"VaultLib",
"(",
"get_vault_password",
"(",
"password_file",
")",
")",
"with",
"open",
"(",
"path",
",",
"'r'",
")",
"as",
"f",
":",
"encrypted_data",
"=",
"f",
".... | Replaces the contents of a file with its decrypted counterpart, storing the
original encrypted version and a hash of the file contents for later
retrieval. | [
"Replaces",
"the",
"contents",
"of",
"a",
"file",
"with",
"its",
"decrypted",
"counterpart",
"storing",
"the",
"original",
"encrypted",
"version",
"and",
"a",
"hash",
"of",
"the",
"file",
"contents",
"for",
"later",
"retrieval",
"."
] | 7eb5198e1f68c9a3ca1d129d9e2a52fb3f0e65c5 | https://github.com/dellis23/ansible-toolkit/blob/7eb5198e1f68c9a3ca1d129d9e2a52fb3f0e65c5/ansible_toolkit/vault.py#L15-L44 |
47,316 | dellis23/ansible-toolkit | ansible_toolkit/vault.py | restore | def restore(path, password_file=None):
"""
Retrieves a file from the atk vault and restores it to its original
location, re-encrypting it if it has changed.
:param path: path to original file
"""
vault = VaultLib(get_vault_password(password_file))
atk_path = os.path.join(ATK_VAULT, path)
... | python | def restore(path, password_file=None):
"""
Retrieves a file from the atk vault and restores it to its original
location, re-encrypting it if it has changed.
:param path: path to original file
"""
vault = VaultLib(get_vault_password(password_file))
atk_path = os.path.join(ATK_VAULT, path)
... | [
"def",
"restore",
"(",
"path",
",",
"password_file",
"=",
"None",
")",
":",
"vault",
"=",
"VaultLib",
"(",
"get_vault_password",
"(",
"password_file",
")",
")",
"atk_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"ATK_VAULT",
",",
"path",
")",
"# Load ... | Retrieves a file from the atk vault and restores it to its original
location, re-encrypting it if it has changed.
:param path: path to original file | [
"Retrieves",
"a",
"file",
"from",
"the",
"atk",
"vault",
"and",
"restores",
"it",
"to",
"its",
"original",
"location",
"re",
"-",
"encrypting",
"it",
"if",
"it",
"has",
"changed",
"."
] | 7eb5198e1f68c9a3ca1d129d9e2a52fb3f0e65c5 | https://github.com/dellis23/ansible-toolkit/blob/7eb5198e1f68c9a3ca1d129d9e2a52fb3f0e65c5/ansible_toolkit/vault.py#L52-L85 |
47,317 | timothydmorton/VESPA | vespa/stars/populations.py | StarPopulation.append | def append(self, other):
"""Appends stars from another StarPopulations, in place.
:param other:
Another :class:`StarPopulation`; must have same columns as ``self``.
"""
if not isinstance(other,StarPopulation):
raise TypeError('Only StarPopulation objects can be ... | python | def append(self, other):
"""Appends stars from another StarPopulations, in place.
:param other:
Another :class:`StarPopulation`; must have same columns as ``self``.
"""
if not isinstance(other,StarPopulation):
raise TypeError('Only StarPopulation objects can be ... | [
"def",
"append",
"(",
"self",
",",
"other",
")",
":",
"if",
"not",
"isinstance",
"(",
"other",
",",
"StarPopulation",
")",
":",
"raise",
"TypeError",
"(",
"'Only StarPopulation objects can be appended to a StarPopulation.'",
")",
"if",
"not",
"np",
".",
"all",
"... | Appends stars from another StarPopulations, in place.
:param other:
Another :class:`StarPopulation`; must have same columns as ``self``. | [
"Appends",
"stars",
"from",
"another",
"StarPopulations",
"in",
"place",
"."
] | 0446b54d48009f3655cfd1a3957ceea21d3adcaa | https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/stars/populations.py#L249-L267 |
47,318 | timothydmorton/VESPA | vespa/stars/populations.py | StarPopulation.bands | def bands(self):
"""
Bandpasses for which StarPopulation has magnitude data
"""
bands = []
for c in self.stars.columns:
if re.search('_mag',c):
bands.append(c)
return bands | python | def bands(self):
"""
Bandpasses for which StarPopulation has magnitude data
"""
bands = []
for c in self.stars.columns:
if re.search('_mag',c):
bands.append(c)
return bands | [
"def",
"bands",
"(",
"self",
")",
":",
"bands",
"=",
"[",
"]",
"for",
"c",
"in",
"self",
".",
"stars",
".",
"columns",
":",
"if",
"re",
".",
"search",
"(",
"'_mag'",
",",
"c",
")",
":",
"bands",
".",
"append",
"(",
"c",
")",
"return",
"bands"
] | Bandpasses for which StarPopulation has magnitude data | [
"Bandpasses",
"for",
"which",
"StarPopulation",
"has",
"magnitude",
"data"
] | 0446b54d48009f3655cfd1a3957ceea21d3adcaa | https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/stars/populations.py#L297-L305 |
47,319 | timothydmorton/VESPA | vespa/stars/populations.py | StarPopulation.distance | def distance(self,value):
"""New distance value must be a ``Quantity`` object
"""
self.stars['distance'] = value.to('pc').value
old_distmod = self.stars['distmod'].copy()
new_distmod = distancemodulus(self.stars['distance'])
for m in self.bands:
self.stars[m... | python | def distance(self,value):
"""New distance value must be a ``Quantity`` object
"""
self.stars['distance'] = value.to('pc').value
old_distmod = self.stars['distmod'].copy()
new_distmod = distancemodulus(self.stars['distance'])
for m in self.bands:
self.stars[m... | [
"def",
"distance",
"(",
"self",
",",
"value",
")",
":",
"self",
".",
"stars",
"[",
"'distance'",
"]",
"=",
"value",
".",
"to",
"(",
"'pc'",
")",
".",
"value",
"old_distmod",
"=",
"self",
".",
"stars",
"[",
"'distmod'",
"]",
".",
"copy",
"(",
")",
... | New distance value must be a ``Quantity`` object | [
"New",
"distance",
"value",
"must",
"be",
"a",
"Quantity",
"object"
] | 0446b54d48009f3655cfd1a3957ceea21d3adcaa | https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/stars/populations.py#L315-L328 |
47,320 | timothydmorton/VESPA | vespa/stars/populations.py | StarPopulation.distok | def distok(self):
"""
Boolean array showing which stars pass all distribution constraints.
A "distribution constraint" is a constraint that affects the
distribution of stars, rather than just the number.
"""
ok = np.ones(len(self.stars)).astype(bool)
for name in ... | python | def distok(self):
"""
Boolean array showing which stars pass all distribution constraints.
A "distribution constraint" is a constraint that affects the
distribution of stars, rather than just the number.
"""
ok = np.ones(len(self.stars)).astype(bool)
for name in ... | [
"def",
"distok",
"(",
"self",
")",
":",
"ok",
"=",
"np",
".",
"ones",
"(",
"len",
"(",
"self",
".",
"stars",
")",
")",
".",
"astype",
"(",
"bool",
")",
"for",
"name",
"in",
"self",
".",
"constraints",
":",
"c",
"=",
"self",
".",
"constraints",
... | Boolean array showing which stars pass all distribution constraints.
A "distribution constraint" is a constraint that affects the
distribution of stars, rather than just the number. | [
"Boolean",
"array",
"showing",
"which",
"stars",
"pass",
"all",
"distribution",
"constraints",
"."
] | 0446b54d48009f3655cfd1a3957ceea21d3adcaa | https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/stars/populations.py#L333-L345 |
47,321 | timothydmorton/VESPA | vespa/stars/populations.py | StarPopulation.countok | def countok(self):
"""
Boolean array showing which stars pass all count constraints.
A "count constraint" is a constraint that affects the number of stars.
"""
ok = np.ones(len(self.stars)).astype(bool)
for name in self.constraints:
c = self.constraints[name]... | python | def countok(self):
"""
Boolean array showing which stars pass all count constraints.
A "count constraint" is a constraint that affects the number of stars.
"""
ok = np.ones(len(self.stars)).astype(bool)
for name in self.constraints:
c = self.constraints[name]... | [
"def",
"countok",
"(",
"self",
")",
":",
"ok",
"=",
"np",
".",
"ones",
"(",
"len",
"(",
"self",
".",
"stars",
")",
")",
".",
"astype",
"(",
"bool",
")",
"for",
"name",
"in",
"self",
".",
"constraints",
":",
"c",
"=",
"self",
".",
"constraints",
... | Boolean array showing which stars pass all count constraints.
A "count constraint" is a constraint that affects the number of stars. | [
"Boolean",
"array",
"showing",
"which",
"stars",
"pass",
"all",
"count",
"constraints",
"."
] | 0446b54d48009f3655cfd1a3957ceea21d3adcaa | https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/stars/populations.py#L348-L359 |
47,322 | timothydmorton/VESPA | vespa/stars/populations.py | StarPopulation.prophist2d | def prophist2d(self,propx,propy, mask=None,
logx=False,logy=False,
fig=None,selected=False,**kwargs):
"""Makes a 2d density histogram of two given properties
:param propx,propy:
Names of properties to histogram. Must be names of columns
in ... | python | def prophist2d(self,propx,propy, mask=None,
logx=False,logy=False,
fig=None,selected=False,**kwargs):
"""Makes a 2d density histogram of two given properties
:param propx,propy:
Names of properties to histogram. Must be names of columns
in ... | [
"def",
"prophist2d",
"(",
"self",
",",
"propx",
",",
"propy",
",",
"mask",
"=",
"None",
",",
"logx",
"=",
"False",
",",
"logy",
"=",
"False",
",",
"fig",
"=",
"None",
",",
"selected",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"mask",... | Makes a 2d density histogram of two given properties
:param propx,propy:
Names of properties to histogram. Must be names of columns
in ``self.stars`` table.
:param mask: (optional)
Boolean mask (``True`` is good) to say which indices to plot.
Must be sa... | [
"Makes",
"a",
"2d",
"density",
"histogram",
"of",
"two",
"given",
"properties"
] | 0446b54d48009f3655cfd1a3957ceea21d3adcaa | https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/stars/populations.py#L376-L436 |
47,323 | timothydmorton/VESPA | vespa/stars/populations.py | StarPopulation.prophist | def prophist(self,prop,fig=None,log=False, mask=None,
selected=False,**kwargs):
"""Plots a 1-d histogram of desired property.
:param prop:
Name of property to plot. Must be column of ``self.stars``.
:param fig: (optional)
Argument for :func:`plotutils.... | python | def prophist(self,prop,fig=None,log=False, mask=None,
selected=False,**kwargs):
"""Plots a 1-d histogram of desired property.
:param prop:
Name of property to plot. Must be column of ``self.stars``.
:param fig: (optional)
Argument for :func:`plotutils.... | [
"def",
"prophist",
"(",
"self",
",",
"prop",
",",
"fig",
"=",
"None",
",",
"log",
"=",
"False",
",",
"mask",
"=",
"None",
",",
"selected",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"setfig",
"(",
"fig",
")",
"inds",
"=",
"None",
"if",
"m... | Plots a 1-d histogram of desired property.
:param prop:
Name of property to plot. Must be column of ``self.stars``.
:param fig: (optional)
Argument for :func:`plotutils.setfig`
:param log: (optional)
Whether to plot the histogram of log10 of the property.
... | [
"Plots",
"a",
"1",
"-",
"d",
"histogram",
"of",
"desired",
"property",
"."
] | 0446b54d48009f3655cfd1a3957ceea21d3adcaa | https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/stars/populations.py#L439-L492 |
47,324 | timothydmorton/VESPA | vespa/stars/populations.py | StarPopulation.constraint_stats | def constraint_stats(self,primarylist=None):
"""Returns information about effect of constraints on population.
:param primarylist:
List of constraint names that you want specific information on
(i.e., not blended within "multiple constraints".)
:return:
``dict`... | python | def constraint_stats(self,primarylist=None):
"""Returns information about effect of constraints on population.
:param primarylist:
List of constraint names that you want specific information on
(i.e., not blended within "multiple constraints".)
:return:
``dict`... | [
"def",
"constraint_stats",
"(",
"self",
",",
"primarylist",
"=",
"None",
")",
":",
"if",
"primarylist",
"is",
"None",
":",
"primarylist",
"=",
"[",
"]",
"n",
"=",
"len",
"(",
"self",
".",
"stars",
")",
"primaryOK",
"=",
"np",
".",
"ones",
"(",
"n",
... | Returns information about effect of constraints on population.
:param primarylist:
List of constraint names that you want specific information on
(i.e., not blended within "multiple constraints".)
:return:
``dict`` of what percentage of population is ruled out by
... | [
"Returns",
"information",
"about",
"effect",
"of",
"constraints",
"on",
"population",
"."
] | 0446b54d48009f3655cfd1a3957ceea21d3adcaa | https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/stars/populations.py#L494-L547 |
47,325 | timothydmorton/VESPA | vespa/stars/populations.py | StarPopulation.constraint_piechart | def constraint_piechart(self,primarylist=None,
fig=None,title='',colordict=None,
legend=True,nolabels=False):
"""Makes piechart illustrating constraints on population
:param primarylist: (optional)
List of most import constraints to sh... | python | def constraint_piechart(self,primarylist=None,
fig=None,title='',colordict=None,
legend=True,nolabels=False):
"""Makes piechart illustrating constraints on population
:param primarylist: (optional)
List of most import constraints to sh... | [
"def",
"constraint_piechart",
"(",
"self",
",",
"primarylist",
"=",
"None",
",",
"fig",
"=",
"None",
",",
"title",
"=",
"''",
",",
"colordict",
"=",
"None",
",",
"legend",
"=",
"True",
",",
"nolabels",
"=",
"False",
")",
":",
"setfig",
"(",
"fig",
",... | Makes piechart illustrating constraints on population
:param primarylist: (optional)
List of most import constraints to show (see
:func:`StarPopulation.constraint_stats`)
:param fig: (optional)
Passed to :func:`plotutils.setfig`.
:param title: (optional)
... | [
"Makes",
"piechart",
"illustrating",
"constraints",
"on",
"population"
] | 0446b54d48009f3655cfd1a3957ceea21d3adcaa | https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/stars/populations.py#L550-L637 |
47,326 | timothydmorton/VESPA | vespa/stars/populations.py | StarPopulation.constraints | def constraints(self):
"""
Constraints applied to the population.
"""
try:
return self._constraints
except AttributeError:
self._constraints = ConstraintDict()
return self._constraints | python | def constraints(self):
"""
Constraints applied to the population.
"""
try:
return self._constraints
except AttributeError:
self._constraints = ConstraintDict()
return self._constraints | [
"def",
"constraints",
"(",
"self",
")",
":",
"try",
":",
"return",
"self",
".",
"_constraints",
"except",
"AttributeError",
":",
"self",
".",
"_constraints",
"=",
"ConstraintDict",
"(",
")",
"return",
"self",
".",
"_constraints"
] | Constraints applied to the population. | [
"Constraints",
"applied",
"to",
"the",
"population",
"."
] | 0446b54d48009f3655cfd1a3957ceea21d3adcaa | https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/stars/populations.py#L670-L678 |
47,327 | timothydmorton/VESPA | vespa/stars/populations.py | StarPopulation.hidden_constraints | def hidden_constraints(self):
"""
Constraints applied to the population, but temporarily removed.
"""
try:
return self._hidden_constraints
except AttributeError:
self._hidden_constraints = ConstraintDict()
return self._hidden_constraints | python | def hidden_constraints(self):
"""
Constraints applied to the population, but temporarily removed.
"""
try:
return self._hidden_constraints
except AttributeError:
self._hidden_constraints = ConstraintDict()
return self._hidden_constraints | [
"def",
"hidden_constraints",
"(",
"self",
")",
":",
"try",
":",
"return",
"self",
".",
"_hidden_constraints",
"except",
"AttributeError",
":",
"self",
".",
"_hidden_constraints",
"=",
"ConstraintDict",
"(",
")",
"return",
"self",
".",
"_hidden_constraints"
] | Constraints applied to the population, but temporarily removed. | [
"Constraints",
"applied",
"to",
"the",
"population",
"but",
"temporarily",
"removed",
"."
] | 0446b54d48009f3655cfd1a3957ceea21d3adcaa | https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/stars/populations.py#L685-L693 |
47,328 | timothydmorton/VESPA | vespa/stars/populations.py | StarPopulation.apply_constraint | def apply_constraint(self,constraint,selectfrac_skip=False,
distribution_skip=False,overwrite=False):
"""Apply a constraint to the population
:param constraint:
Constraint to apply.
:type constraint:
:class:`Constraint`
:param selectfrac... | python | def apply_constraint(self,constraint,selectfrac_skip=False,
distribution_skip=False,overwrite=False):
"""Apply a constraint to the population
:param constraint:
Constraint to apply.
:type constraint:
:class:`Constraint`
:param selectfrac... | [
"def",
"apply_constraint",
"(",
"self",
",",
"constraint",
",",
"selectfrac_skip",
"=",
"False",
",",
"distribution_skip",
"=",
"False",
",",
"overwrite",
"=",
"False",
")",
":",
"#grab properties",
"constraints",
"=",
"self",
".",
"constraints",
"my_selectfrac_sk... | Apply a constraint to the population
:param constraint:
Constraint to apply.
:type constraint:
:class:`Constraint`
:param selectfrac_skip: (optional)
If ``True``, then this constraint will not be considered
towards diminishing the | [
"Apply",
"a",
"constraint",
"to",
"the",
"population"
] | 0446b54d48009f3655cfd1a3957ceea21d3adcaa | https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/stars/populations.py#L699-L732 |
47,329 | timothydmorton/VESPA | vespa/stars/populations.py | StarPopulation.replace_constraint | def replace_constraint(self,name,selectfrac_skip=False,distribution_skip=False):
"""
Re-apply constraint that had been removed
:param name:
Name of constraint to replace
:param selectfrac_skip,distribution_skip: (optional)
Same as :func:`StarPopulation.apply_con... | python | def replace_constraint(self,name,selectfrac_skip=False,distribution_skip=False):
"""
Re-apply constraint that had been removed
:param name:
Name of constraint to replace
:param selectfrac_skip,distribution_skip: (optional)
Same as :func:`StarPopulation.apply_con... | [
"def",
"replace_constraint",
"(",
"self",
",",
"name",
",",
"selectfrac_skip",
"=",
"False",
",",
"distribution_skip",
"=",
"False",
")",
":",
"hidden_constraints",
"=",
"self",
".",
"hidden_constraints",
"if",
"name",
"in",
"hidden_constraints",
":",
"c",
"=",
... | Re-apply constraint that had been removed
:param name:
Name of constraint to replace
:param selectfrac_skip,distribution_skip: (optional)
Same as :func:`StarPopulation.apply_constraint` | [
"Re",
"-",
"apply",
"constraint",
"that",
"had",
"been",
"removed"
] | 0446b54d48009f3655cfd1a3957ceea21d3adcaa | https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/stars/populations.py#L736-L756 |
47,330 | timothydmorton/VESPA | vespa/stars/populations.py | StarPopulation.constrain_property | def constrain_property(self,prop,lo=-np.inf,hi=np.inf,
measurement=None,thresh=3,
selectfrac_skip=False,distribution_skip=False):
"""Apply constraint that constrains property.
:param prop:
Name of property. Must be column in ``self.star... | python | def constrain_property(self,prop,lo=-np.inf,hi=np.inf,
measurement=None,thresh=3,
selectfrac_skip=False,distribution_skip=False):
"""Apply constraint that constrains property.
:param prop:
Name of property. Must be column in ``self.star... | [
"def",
"constrain_property",
"(",
"self",
",",
"prop",
",",
"lo",
"=",
"-",
"np",
".",
"inf",
",",
"hi",
"=",
"np",
".",
"inf",
",",
"measurement",
"=",
"None",
",",
"thresh",
"=",
"3",
",",
"selectfrac_skip",
"=",
"False",
",",
"distribution_skip",
... | Apply constraint that constrains property.
:param prop:
Name of property. Must be column in ``self.stars``.
:type prop:
``str``
:param lo,hi: (optional)
Low and high allowed values for ``prop``. Defaults
to ``-np.inf`` and ``np.inf`` to allow f... | [
"Apply",
"constraint",
"that",
"constrains",
"property",
"."
] | 0446b54d48009f3655cfd1a3957ceea21d3adcaa | https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/stars/populations.py#L786-L825 |
47,331 | timothydmorton/VESPA | vespa/stars/populations.py | StarPopulation.apply_trend_constraint | def apply_trend_constraint(self, limit, dt, distribution_skip=False,
**kwargs):
"""
Constrains change in RV to be less than limit over time dt.
Only works if ``dRV`` and ``Plong`` attributes are defined
for population.
:param limit:
Ra... | python | def apply_trend_constraint(self, limit, dt, distribution_skip=False,
**kwargs):
"""
Constrains change in RV to be less than limit over time dt.
Only works if ``dRV`` and ``Plong`` attributes are defined
for population.
:param limit:
Ra... | [
"def",
"apply_trend_constraint",
"(",
"self",
",",
"limit",
",",
"dt",
",",
"distribution_skip",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"type",
"(",
"limit",
")",
"!=",
"Quantity",
":",
"limit",
"=",
"limit",
"*",
"u",
".",
"m",
"/",
... | Constrains change in RV to be less than limit over time dt.
Only works if ``dRV`` and ``Plong`` attributes are defined
for population.
:param limit:
Radial velocity limit on trend. Must be
:class:`astropy.units.Quantity` object, or
else interpreted as m/s.
... | [
"Constrains",
"change",
"in",
"RV",
"to",
"be",
"less",
"than",
"limit",
"over",
"time",
"dt",
"."
] | 0446b54d48009f3655cfd1a3957ceea21d3adcaa | https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/stars/populations.py#L827-L866 |
47,332 | timothydmorton/VESPA | vespa/stars/populations.py | StarPopulation.apply_cc | def apply_cc(self, cc, distribution_skip=False,
**kwargs):
"""
Apply contrast-curve constraint to population.
Only works if object has ``Rsky``, ``dmag`` attributes
:param cc:
Contrast curve.
:type cc:
:class:`ContrastCurveConstraint`
... | python | def apply_cc(self, cc, distribution_skip=False,
**kwargs):
"""
Apply contrast-curve constraint to population.
Only works if object has ``Rsky``, ``dmag`` attributes
:param cc:
Contrast curve.
:type cc:
:class:`ContrastCurveConstraint`
... | [
"def",
"apply_cc",
"(",
"self",
",",
"cc",
",",
"distribution_skip",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"rs",
"=",
"self",
".",
"Rsky",
".",
"to",
"(",
"'arcsec'",
")",
".",
"value",
"dmags",
"=",
"self",
".",
"dmag",
"(",
"cc",
"."... | Apply contrast-curve constraint to population.
Only works if object has ``Rsky``, ``dmag`` attributes
:param cc:
Contrast curve.
:type cc:
:class:`ContrastCurveConstraint`
:param distribution_skip:
This is by default ``True``. *To be honest, I'm no... | [
"Apply",
"contrast",
"-",
"curve",
"constraint",
"to",
"population",
"."
] | 0446b54d48009f3655cfd1a3957ceea21d3adcaa | https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/stars/populations.py#L868-L893 |
47,333 | timothydmorton/VESPA | vespa/stars/populations.py | StarPopulation.apply_vcc | def apply_vcc(self, vcc, distribution_skip=False,
**kwargs):
"""
Applies "velocity contrast curve" to population.
That is, the constraint that comes from not seeing two sets
of spectral lines in a high resolution spectrum.
Only works if population has ``dmag``... | python | def apply_vcc(self, vcc, distribution_skip=False,
**kwargs):
"""
Applies "velocity contrast curve" to population.
That is, the constraint that comes from not seeing two sets
of spectral lines in a high resolution spectrum.
Only works if population has ``dmag``... | [
"def",
"apply_vcc",
"(",
"self",
",",
"vcc",
",",
"distribution_skip",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"rvs",
"=",
"self",
".",
"RV",
".",
"value",
"dmags",
"=",
"self",
".",
"dmag",
"(",
"vcc",
".",
"band",
")",
"self",
".",
"ap... | Applies "velocity contrast curve" to population.
That is, the constraint that comes from not seeing two sets
of spectral lines in a high resolution spectrum.
Only works if population has ``dmag`` and ``RV`` attributes.
:param vcc:
Velocity contrast curve; dmag vs. delta-RV... | [
"Applies",
"velocity",
"contrast",
"curve",
"to",
"population",
"."
] | 0446b54d48009f3655cfd1a3957ceea21d3adcaa | https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/stars/populations.py#L895-L924 |
47,334 | timothydmorton/VESPA | vespa/stars/populations.py | StarPopulation.set_maxrad | def set_maxrad(self,maxrad, distribution_skip=True):
"""
Adds a constraint that rejects everything with Rsky > maxrad
Requires ``Rsky`` attribute, which should always have units.
:param maxrad:
The maximum angular value of Rsky.
:type maxrad:
:class:`ast... | python | def set_maxrad(self,maxrad, distribution_skip=True):
"""
Adds a constraint that rejects everything with Rsky > maxrad
Requires ``Rsky`` attribute, which should always have units.
:param maxrad:
The maximum angular value of Rsky.
:type maxrad:
:class:`ast... | [
"def",
"set_maxrad",
"(",
"self",
",",
"maxrad",
",",
"distribution_skip",
"=",
"True",
")",
":",
"self",
".",
"maxrad",
"=",
"maxrad",
"self",
".",
"apply_constraint",
"(",
"UpperLimit",
"(",
"self",
".",
"Rsky",
",",
"maxrad",
",",
"name",
"=",
"'Max R... | Adds a constraint that rejects everything with Rsky > maxrad
Requires ``Rsky`` attribute, which should always have units.
:param maxrad:
The maximum angular value of Rsky.
:type maxrad:
:class:`astropy.units.Quantity`
:param distribution_skip:
This ... | [
"Adds",
"a",
"constraint",
"that",
"rejects",
"everything",
"with",
"Rsky",
">",
"maxrad"
] | 0446b54d48009f3655cfd1a3957ceea21d3adcaa | https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/stars/populations.py#L926-L947 |
47,335 | timothydmorton/VESPA | vespa/stars/populations.py | StarPopulation.constraint_df | def constraint_df(self):
"""
A DataFrame representing all constraints, hidden or not
"""
df = pd.DataFrame()
for name,c in self.constraints.items():
df[name] = c.ok
for name,c in self.hidden_constraints.items():
df[name] = c.ok
return df | python | def constraint_df(self):
"""
A DataFrame representing all constraints, hidden or not
"""
df = pd.DataFrame()
for name,c in self.constraints.items():
df[name] = c.ok
for name,c in self.hidden_constraints.items():
df[name] = c.ok
return df | [
"def",
"constraint_df",
"(",
"self",
")",
":",
"df",
"=",
"pd",
".",
"DataFrame",
"(",
")",
"for",
"name",
",",
"c",
"in",
"self",
".",
"constraints",
".",
"items",
"(",
")",
":",
"df",
"[",
"name",
"]",
"=",
"c",
".",
"ok",
"for",
"name",
",",... | A DataFrame representing all constraints, hidden or not | [
"A",
"DataFrame",
"representing",
"all",
"constraints",
"hidden",
"or",
"not"
] | 0446b54d48009f3655cfd1a3957ceea21d3adcaa | https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/stars/populations.py#L952-L961 |
47,336 | timothydmorton/VESPA | vespa/stars/populations.py | StarPopulation.save_hdf | def save_hdf(self,filename,path='',properties=None,
overwrite=False, append=False):
"""Saves to HDF5 file.
Subclasses should be sure to define
``_properties`` attribute to ensure that all
correct attributes get saved. Load a saved population
with :func:`StarPop... | python | def save_hdf(self,filename,path='',properties=None,
overwrite=False, append=False):
"""Saves to HDF5 file.
Subclasses should be sure to define
``_properties`` attribute to ensure that all
correct attributes get saved. Load a saved population
with :func:`StarPop... | [
"def",
"save_hdf",
"(",
"self",
",",
"filename",
",",
"path",
"=",
"''",
",",
"properties",
"=",
"None",
",",
"overwrite",
"=",
"False",
",",
"append",
"=",
"False",
")",
":",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"filename",
")",
":",
"with... | Saves to HDF5 file.
Subclasses should be sure to define
``_properties`` attribute to ensure that all
correct attributes get saved. Load a saved population
with :func:`StarPopulation.load_hdf`.
Example usage::
>>> from vespa.stars import Raghavan_BinaryPopulation, ... | [
"Saves",
"to",
"HDF5",
"file",
"."
] | 0446b54d48009f3655cfd1a3957ceea21d3adcaa | https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/stars/populations.py#L967-L1044 |
47,337 | timothydmorton/VESPA | vespa/stars/populations.py | StarPopulation.load_hdf | def load_hdf(cls, filename, path=''):
"""Loads StarPopulation from .h5 file
Correct properties should be restored to object, and object
will be original type that was saved. Complement to
:func:`StarPopulation.save_hdf`.
Example usage::
>>> from vespa.stars import... | python | def load_hdf(cls, filename, path=''):
"""Loads StarPopulation from .h5 file
Correct properties should be restored to object, and object
will be original type that was saved. Complement to
:func:`StarPopulation.save_hdf`.
Example usage::
>>> from vespa.stars import... | [
"def",
"load_hdf",
"(",
"cls",
",",
"filename",
",",
"path",
"=",
"''",
")",
":",
"stars",
"=",
"pd",
".",
"read_hdf",
"(",
"filename",
",",
"path",
"+",
"'/stars'",
")",
"constraint_df",
"=",
"pd",
".",
"read_hdf",
"(",
"filename",
",",
"path",
"+",... | Loads StarPopulation from .h5 file
Correct properties should be restored to object, and object
will be original type that was saved. Complement to
:func:`StarPopulation.save_hdf`.
Example usage::
>>> from vespa.stars import Raghavan_BinaryPopulation, StarPopulation
... | [
"Loads",
"StarPopulation",
"from",
".",
"h5",
"file"
] | 0446b54d48009f3655cfd1a3957ceea21d3adcaa | https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/stars/populations.py#L1047-L1119 |
47,338 | timothydmorton/VESPA | vespa/stars/populations.py | BinaryPopulation.binary_fraction | def binary_fraction(self,query='mass_A >= 0'):
"""
Binary fraction of stars passing given query
:param query:
Query to pass to stars ``DataFrame``.
"""
subdf = self.stars.query(query)
nbinaries = (subdf['mass_B'] > 0).sum()
frac = nbinaries/len(subdf... | python | def binary_fraction(self,query='mass_A >= 0'):
"""
Binary fraction of stars passing given query
:param query:
Query to pass to stars ``DataFrame``.
"""
subdf = self.stars.query(query)
nbinaries = (subdf['mass_B'] > 0).sum()
frac = nbinaries/len(subdf... | [
"def",
"binary_fraction",
"(",
"self",
",",
"query",
"=",
"'mass_A >= 0'",
")",
":",
"subdf",
"=",
"self",
".",
"stars",
".",
"query",
"(",
"query",
")",
"nbinaries",
"=",
"(",
"subdf",
"[",
"'mass_B'",
"]",
">",
"0",
")",
".",
"sum",
"(",
")",
"fr... | Binary fraction of stars passing given query
:param query:
Query to pass to stars ``DataFrame``. | [
"Binary",
"fraction",
"of",
"stars",
"passing",
"given",
"query"
] | 0446b54d48009f3655cfd1a3957ceea21d3adcaa | https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/stars/populations.py#L1203-L1214 |
47,339 | timothydmorton/VESPA | vespa/stars/populations.py | BinaryPopulation.dmag | def dmag(self,band):
"""
Difference in magnitude between primary and secondary stars
:param band:
Photometric bandpass.
"""
mag2 = self.stars['{}_mag_B'.format(band)]
mag1 = self.stars['{}_mag_A'.format(band)]
return mag2-mag1 | python | def dmag(self,band):
"""
Difference in magnitude between primary and secondary stars
:param band:
Photometric bandpass.
"""
mag2 = self.stars['{}_mag_B'.format(band)]
mag1 = self.stars['{}_mag_A'.format(band)]
return mag2-mag1 | [
"def",
"dmag",
"(",
"self",
",",
"band",
")",
":",
"mag2",
"=",
"self",
".",
"stars",
"[",
"'{}_mag_B'",
".",
"format",
"(",
"band",
")",
"]",
"mag1",
"=",
"self",
".",
"stars",
"[",
"'{}_mag_A'",
".",
"format",
"(",
"band",
")",
"]",
"return",
"... | Difference in magnitude between primary and secondary stars
:param band:
Photometric bandpass. | [
"Difference",
"in",
"magnitude",
"between",
"primary",
"and",
"secondary",
"stars"
] | 0446b54d48009f3655cfd1a3957ceea21d3adcaa | https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/stars/populations.py#L1227-L1237 |
47,340 | timothydmorton/VESPA | vespa/stars/populations.py | BinaryPopulation.rsky_distribution | def rsky_distribution(self,rmax=None,smooth=0.1,nbins=100):
"""
Distribution of projected separations
Returns a :class:`simpledists.Hist_Distribution` object.
:param rmax: (optional)
Maximum radius to calculate distribution.
:param dr: (optional)
Bin wi... | python | def rsky_distribution(self,rmax=None,smooth=0.1,nbins=100):
"""
Distribution of projected separations
Returns a :class:`simpledists.Hist_Distribution` object.
:param rmax: (optional)
Maximum radius to calculate distribution.
:param dr: (optional)
Bin wi... | [
"def",
"rsky_distribution",
"(",
"self",
",",
"rmax",
"=",
"None",
",",
"smooth",
"=",
"0.1",
",",
"nbins",
"=",
"100",
")",
":",
"if",
"rmax",
"is",
"None",
":",
"if",
"hasattr",
"(",
"self",
",",
"'maxrad'",
")",
":",
"rmax",
"=",
"self",
".",
... | Distribution of projected separations
Returns a :class:`simpledists.Hist_Distribution` object.
:param rmax: (optional)
Maximum radius to calculate distribution.
:param dr: (optional)
Bin width for histogram
:param smooth: (optional)
Smoothing param... | [
"Distribution",
"of",
"projected",
"separations"
] | 0446b54d48009f3655cfd1a3957ceea21d3adcaa | https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/stars/populations.py#L1239-L1267 |
47,341 | timothydmorton/VESPA | vespa/stars/populations.py | Simulated_BinaryPopulation.generate | def generate(self, M, age=9.6, feh=0.0,
ichrone='mist', n=1e4, bands=None, **kwargs):
"""
Function that generates population.
Called by ``__init__`` if ``M`` is passed.
"""
ichrone = get_ichrone(ichrone, bands=bands)
if np.size(M) > 1:
n = np... | python | def generate(self, M, age=9.6, feh=0.0,
ichrone='mist', n=1e4, bands=None, **kwargs):
"""
Function that generates population.
Called by ``__init__`` if ``M`` is passed.
"""
ichrone = get_ichrone(ichrone, bands=bands)
if np.size(M) > 1:
n = np... | [
"def",
"generate",
"(",
"self",
",",
"M",
",",
"age",
"=",
"9.6",
",",
"feh",
"=",
"0.0",
",",
"ichrone",
"=",
"'mist'",
",",
"n",
"=",
"1e4",
",",
"bands",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"ichrone",
"=",
"get_ichrone",
"(",
"ic... | Function that generates population.
Called by ``__init__`` if ``M`` is passed. | [
"Function",
"that",
"generates",
"population",
"."
] | 0446b54d48009f3655cfd1a3957ceea21d3adcaa | https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/stars/populations.py#L1358-L1384 |
47,342 | timothydmorton/VESPA | vespa/stars/populations.py | TriplePopulation.dmag | def dmag(self, band):
"""
Difference in magnitudes between fainter and brighter components in band.
:param band:
Photometric bandpass.
"""
m1 = self.stars['{}_mag_A'.format(band)]
m2 = addmags(self.stars['{}_mag_B'.format(band)],
self.st... | python | def dmag(self, band):
"""
Difference in magnitudes between fainter and brighter components in band.
:param band:
Photometric bandpass.
"""
m1 = self.stars['{}_mag_A'.format(band)]
m2 = addmags(self.stars['{}_mag_B'.format(band)],
self.st... | [
"def",
"dmag",
"(",
"self",
",",
"band",
")",
":",
"m1",
"=",
"self",
".",
"stars",
"[",
"'{}_mag_A'",
".",
"format",
"(",
"band",
")",
"]",
"m2",
"=",
"addmags",
"(",
"self",
".",
"stars",
"[",
"'{}_mag_B'",
".",
"format",
"(",
"band",
")",
"]",... | Difference in magnitudes between fainter and brighter components in band.
:param band:
Photometric bandpass. | [
"Difference",
"in",
"magnitudes",
"between",
"fainter",
"and",
"brighter",
"components",
"in",
"band",
"."
] | 0446b54d48009f3655cfd1a3957ceea21d3adcaa | https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/stars/populations.py#L1530-L1541 |
47,343 | timothydmorton/VESPA | vespa/stars/populations.py | TriplePopulation.dRV | def dRV(self, dt, band='g'):
"""Returns dRV of star A, if A is brighter than B+C, or of star B if B+C is brighter
"""
return (self.orbpop.dRV_1(dt)*self.A_brighter(band) +
self.orbpop.dRV_2(dt)*self.BC_brighter(band)) | python | def dRV(self, dt, band='g'):
"""Returns dRV of star A, if A is brighter than B+C, or of star B if B+C is brighter
"""
return (self.orbpop.dRV_1(dt)*self.A_brighter(band) +
self.orbpop.dRV_2(dt)*self.BC_brighter(band)) | [
"def",
"dRV",
"(",
"self",
",",
"dt",
",",
"band",
"=",
"'g'",
")",
":",
"return",
"(",
"self",
".",
"orbpop",
".",
"dRV_1",
"(",
"dt",
")",
"*",
"self",
".",
"A_brighter",
"(",
"band",
")",
"+",
"self",
".",
"orbpop",
".",
"dRV_2",
"(",
"dt",
... | Returns dRV of star A, if A is brighter than B+C, or of star B if B+C is brighter | [
"Returns",
"dRV",
"of",
"star",
"A",
"if",
"A",
"is",
"brighter",
"than",
"B",
"+",
"C",
"or",
"of",
"star",
"B",
"if",
"B",
"+",
"C",
"is",
"brighter"
] | 0446b54d48009f3655cfd1a3957ceea21d3adcaa | https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/stars/populations.py#L1558-L1562 |
47,344 | timothydmorton/VESPA | vespa/stars/populations.py | TriplePopulation.triple_fraction | def triple_fraction(self,query='mass_A > 0', unc=False):
"""
Triple fraction of stars following given query
"""
subdf = self.stars.query(query)
ntriples = ((subdf['mass_B'] > 0) & (subdf['mass_C'] > 0)).sum()
frac = ntriples/len(subdf)
if unc:
return f... | python | def triple_fraction(self,query='mass_A > 0', unc=False):
"""
Triple fraction of stars following given query
"""
subdf = self.stars.query(query)
ntriples = ((subdf['mass_B'] > 0) & (subdf['mass_C'] > 0)).sum()
frac = ntriples/len(subdf)
if unc:
return f... | [
"def",
"triple_fraction",
"(",
"self",
",",
"query",
"=",
"'mass_A > 0'",
",",
"unc",
"=",
"False",
")",
":",
"subdf",
"=",
"self",
".",
"stars",
".",
"query",
"(",
"query",
")",
"ntriples",
"=",
"(",
"(",
"subdf",
"[",
"'mass_B'",
"]",
">",
"0",
"... | Triple fraction of stars following given query | [
"Triple",
"fraction",
"of",
"stars",
"following",
"given",
"query"
] | 0446b54d48009f3655cfd1a3957ceea21d3adcaa | https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/stars/populations.py#L1595-L1605 |
47,345 | timothydmorton/VESPA | vespa/stars/populations.py | Observed_BinaryPopulation.starmodel_props | def starmodel_props(self):
"""Default mag_err is 0.05, arbitrarily
"""
props = {}
mags = self.mags
mag_errs = self.mag_errs
for b in mags.keys():
if np.size(mags[b])==2:
props[b] = mags[b]
elif np.size(mags[b])==1:
m... | python | def starmodel_props(self):
"""Default mag_err is 0.05, arbitrarily
"""
props = {}
mags = self.mags
mag_errs = self.mag_errs
for b in mags.keys():
if np.size(mags[b])==2:
props[b] = mags[b]
elif np.size(mags[b])==1:
m... | [
"def",
"starmodel_props",
"(",
"self",
")",
":",
"props",
"=",
"{",
"}",
"mags",
"=",
"self",
".",
"mags",
"mag_errs",
"=",
"self",
".",
"mag_errs",
"for",
"b",
"in",
"mags",
".",
"keys",
"(",
")",
":",
"if",
"np",
".",
"size",
"(",
"mags",
"[",
... | Default mag_err is 0.05, arbitrarily | [
"Default",
"mag_err",
"is",
"0",
".",
"05",
"arbitrarily"
] | 0446b54d48009f3655cfd1a3957ceea21d3adcaa | https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/stars/populations.py#L1657-L1681 |
47,346 | timothydmorton/VESPA | vespa/stars/populations.py | BGStarPopulation.dmag | def dmag(self,band):
"""
Magnitude difference between primary star and BG stars
"""
if self.mags is None:
raise ValueError('dmag is not defined because primary mags are not defined for this population.')
return self.stars['{}_mag'.format(band)] - self.mags[band] | python | def dmag(self,band):
"""
Magnitude difference between primary star and BG stars
"""
if self.mags is None:
raise ValueError('dmag is not defined because primary mags are not defined for this population.')
return self.stars['{}_mag'.format(band)] - self.mags[band] | [
"def",
"dmag",
"(",
"self",
",",
"band",
")",
":",
"if",
"self",
".",
"mags",
"is",
"None",
":",
"raise",
"ValueError",
"(",
"'dmag is not defined because primary mags are not defined for this population.'",
")",
"return",
"self",
".",
"stars",
"[",
"'{}_mag'",
".... | Magnitude difference between primary star and BG stars | [
"Magnitude",
"difference",
"between",
"primary",
"star",
"and",
"BG",
"stars"
] | 0446b54d48009f3655cfd1a3957ceea21d3adcaa | https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/stars/populations.py#L2127-L2134 |
47,347 | rxcomm/pyaxo | examples/wh.py | WHMgr.receive | def receive(self):
"""I receive data+hash, check for a match, confirm or not
confirm to the sender, and return the data payload.
"""
def _receive(input_message):
self.data = input_message[:-64]
_hash = input_message[-64:]
if h.sha256(self.data).hexdige... | python | def receive(self):
"""I receive data+hash, check for a match, confirm or not
confirm to the sender, and return the data payload.
"""
def _receive(input_message):
self.data = input_message[:-64]
_hash = input_message[-64:]
if h.sha256(self.data).hexdige... | [
"def",
"receive",
"(",
"self",
")",
":",
"def",
"_receive",
"(",
"input_message",
")",
":",
"self",
".",
"data",
"=",
"input_message",
"[",
":",
"-",
"64",
"]",
"_hash",
"=",
"input_message",
"[",
"-",
"64",
":",
"]",
"if",
"h",
".",
"sha256",
"(",... | I receive data+hash, check for a match, confirm or not
confirm to the sender, and return the data payload. | [
"I",
"receive",
"data",
"+",
"hash",
"check",
"for",
"a",
"match",
"confirm",
"or",
"not",
"confirm",
"to",
"the",
"sender",
"and",
"return",
"the",
"data",
"payload",
"."
] | 1e34cfa4c4826fb2e024812d1ce71a979d9e0370 | https://github.com/rxcomm/pyaxo/blob/1e34cfa4c4826fb2e024812d1ce71a979d9e0370/examples/wh.py#L49-L68 |
47,348 | rxcomm/pyaxo | examples/axotor.py | validator | def validator(ch):
"""
Update screen if necessary and release the lock so receiveThread can run
"""
global screen_needs_update
try:
if screen_needs_update:
curses.doupdate()
screen_needs_update = False
return ch
finally:
winlock.release()
s... | python | def validator(ch):
"""
Update screen if necessary and release the lock so receiveThread can run
"""
global screen_needs_update
try:
if screen_needs_update:
curses.doupdate()
screen_needs_update = False
return ch
finally:
winlock.release()
s... | [
"def",
"validator",
"(",
"ch",
")",
":",
"global",
"screen_needs_update",
"try",
":",
"if",
"screen_needs_update",
":",
"curses",
".",
"doupdate",
"(",
")",
"screen_needs_update",
"=",
"False",
"return",
"ch",
"finally",
":",
"winlock",
".",
"release",
"(",
... | Update screen if necessary and release the lock so receiveThread can run | [
"Update",
"screen",
"if",
"necessary",
"and",
"release",
"the",
"lock",
"so",
"receiveThread",
"can",
"run"
] | 1e34cfa4c4826fb2e024812d1ce71a979d9e0370 | https://github.com/rxcomm/pyaxo/blob/1e34cfa4c4826fb2e024812d1ce71a979d9e0370/examples/axotor.py#L165-L178 |
47,349 | timothydmorton/VESPA | vespa/stars/constraints.py | Constraint.resample | def resample(self, inds):
"""Returns copy of constraint, with mask rearranged according to indices
"""
new = copy.deepcopy(self)
for arr in self.arrays:
x = getattr(new, arr)
setattr(new, arr, x[inds])
return new | python | def resample(self, inds):
"""Returns copy of constraint, with mask rearranged according to indices
"""
new = copy.deepcopy(self)
for arr in self.arrays:
x = getattr(new, arr)
setattr(new, arr, x[inds])
return new | [
"def",
"resample",
"(",
"self",
",",
"inds",
")",
":",
"new",
"=",
"copy",
".",
"deepcopy",
"(",
"self",
")",
"for",
"arr",
"in",
"self",
".",
"arrays",
":",
"x",
"=",
"getattr",
"(",
"new",
",",
"arr",
")",
"setattr",
"(",
"new",
",",
"arr",
"... | Returns copy of constraint, with mask rearranged according to indices | [
"Returns",
"copy",
"of",
"constraint",
"with",
"mask",
"rearranged",
"according",
"to",
"indices"
] | 0446b54d48009f3655cfd1a3957ceea21d3adcaa | https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/stars/constraints.py#L52-L59 |
47,350 | timothydmorton/VESPA | vespa/fpp.py | save | def save(self, overwrite=True):
"""
Saves PopulationSet and TransitSignal.
Shouldn't need to use this if you're using
:func:`FPPCalculation.from_ini`.
Saves :class`PopulationSet` to ``[folder]/popset.h5]``
and :class:`TransitSignal` to ``[folder]/trsig.pkl``.
:... | python | def save(self, overwrite=True):
"""
Saves PopulationSet and TransitSignal.
Shouldn't need to use this if you're using
:func:`FPPCalculation.from_ini`.
Saves :class`PopulationSet` to ``[folder]/popset.h5]``
and :class:`TransitSignal` to ``[folder]/trsig.pkl``.
:... | [
"def",
"save",
"(",
"self",
",",
"overwrite",
"=",
"True",
")",
":",
"self",
".",
"save_popset",
"(",
"overwrite",
"=",
"overwrite",
")",
"self",
".",
"save_signal",
"(",
")"
] | Saves PopulationSet and TransitSignal.
Shouldn't need to use this if you're using
:func:`FPPCalculation.from_ini`.
Saves :class`PopulationSet` to ``[folder]/popset.h5]``
and :class:`TransitSignal` to ``[folder]/trsig.pkl``.
:param overwrite: (optional)
Whether to o... | [
"Saves",
"PopulationSet",
"and",
"TransitSignal",
"."
] | 0446b54d48009f3655cfd1a3957ceea21d3adcaa | https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/fpp.py#L342-L357 |
47,351 | timothydmorton/VESPA | vespa/fpp.py | load | def load(cls, folder):
"""
Loads PopulationSet from folder
``popset.h5`` and ``trsig.pkl`` must exist in folder.
:param folder:
Folder from which to load.
"""
popset = PopulationSet.load_hdf(os.path.join(folder,'popset.h5'))
sigfile = os.path.join(fo... | python | def load(cls, folder):
"""
Loads PopulationSet from folder
``popset.h5`` and ``trsig.pkl`` must exist in folder.
:param folder:
Folder from which to load.
"""
popset = PopulationSet.load_hdf(os.path.join(folder,'popset.h5'))
sigfile = os.path.join(fo... | [
"def",
"load",
"(",
"cls",
",",
"folder",
")",
":",
"popset",
"=",
"PopulationSet",
".",
"load_hdf",
"(",
"os",
".",
"path",
".",
"join",
"(",
"folder",
",",
"'popset.h5'",
")",
")",
"sigfile",
"=",
"os",
".",
"path",
".",
"join",
"(",
"folder",
",... | Loads PopulationSet from folder
``popset.h5`` and ``trsig.pkl`` must exist in folder.
:param folder:
Folder from which to load. | [
"Loads",
"PopulationSet",
"from",
"folder"
] | 0446b54d48009f3655cfd1a3957ceea21d3adcaa | https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/fpp.py#L360-L373 |
47,352 | timothydmorton/VESPA | vespa/fpp.py | FPPplots | def FPPplots(self, folder=None, format='png', tag=None, **kwargs):
"""
Make FPP diagnostic plots
Makes likelihood "fuzz plot" for each model, a FPP summary figure,
a plot of the :class:`TransitSignal`, and writes a ``results.txt``
file.
:param folder: (optional)
... | python | def FPPplots(self, folder=None, format='png', tag=None, **kwargs):
"""
Make FPP diagnostic plots
Makes likelihood "fuzz plot" for each model, a FPP summary figure,
a plot of the :class:`TransitSignal`, and writes a ``results.txt``
file.
:param folder: (optional)
... | [
"def",
"FPPplots",
"(",
"self",
",",
"folder",
"=",
"None",
",",
"format",
"=",
"'png'",
",",
"tag",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"folder",
"is",
"None",
":",
"folder",
"=",
"self",
".",
"folder",
"self",
".",
"write_result... | Make FPP diagnostic plots
Makes likelihood "fuzz plot" for each model, a FPP summary figure,
a plot of the :class:`TransitSignal`, and writes a ``results.txt``
file.
:param folder: (optional)
Destination folder for plots/``results.txt``. Default
is ``self.folde... | [
"Make",
"FPP",
"diagnostic",
"plots"
] | 0446b54d48009f3655cfd1a3957ceea21d3adcaa | https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/fpp.py#L375-L404 |
47,353 | timothydmorton/VESPA | vespa/fpp.py | write_results | def write_results(self,folder=None, filename='results.txt', to_file=True):
"""
Writes text file of calculation summary.
:param folder: (optional)
Folder to which to write ``results.txt``.
:param filename:
Filename to write. Default=``results.txt``.
:pa... | python | def write_results(self,folder=None, filename='results.txt', to_file=True):
"""
Writes text file of calculation summary.
:param folder: (optional)
Folder to which to write ``results.txt``.
:param filename:
Filename to write. Default=``results.txt``.
:pa... | [
"def",
"write_results",
"(",
"self",
",",
"folder",
"=",
"None",
",",
"filename",
"=",
"'results.txt'",
",",
"to_file",
"=",
"True",
")",
":",
"if",
"folder",
"is",
"None",
":",
"folder",
"=",
"self",
".",
"folder",
"if",
"to_file",
":",
"fout",
"=",
... | Writes text file of calculation summary.
:param folder: (optional)
Folder to which to write ``results.txt``.
:param filename:
Filename to write. Default=``results.txt``.
:param to_file:
If True, then writes file. Otherwise just return header, line.
... | [
"Writes",
"text",
"file",
"of",
"calculation",
"summary",
"."
] | 0446b54d48009f3655cfd1a3957ceea21d3adcaa | https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/fpp.py#L435-L478 |
47,354 | timothydmorton/VESPA | vespa/fpp.py | save_popset | def save_popset(self,filename='popset.h5',**kwargs):
"""Saves the PopulationSet
Calls :func:`PopulationSet.save_hdf`.
"""
self.popset.save_hdf(os.path.join(self.folder,filename)) | python | def save_popset(self,filename='popset.h5',**kwargs):
"""Saves the PopulationSet
Calls :func:`PopulationSet.save_hdf`.
"""
self.popset.save_hdf(os.path.join(self.folder,filename)) | [
"def",
"save_popset",
"(",
"self",
",",
"filename",
"=",
"'popset.h5'",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"popset",
".",
"save_hdf",
"(",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"folder",
",",
"filename",
")",
")"
] | Saves the PopulationSet
Calls :func:`PopulationSet.save_hdf`. | [
"Saves",
"the",
"PopulationSet"
] | 0446b54d48009f3655cfd1a3957ceea21d3adcaa | https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/fpp.py#L480-L485 |
47,355 | timothydmorton/VESPA | vespa/fpp.py | save_signal | def save_signal(self,filename=None):
"""
Saves TransitSignal.
Calls :func:`TransitSignal.save`; default filename is
``trsig.pkl`` in ``self.folder``.
"""
if filename is None:
filename = os.path.join(self.folder,'trsig.pkl')
self.trsig.save(filename) | python | def save_signal(self,filename=None):
"""
Saves TransitSignal.
Calls :func:`TransitSignal.save`; default filename is
``trsig.pkl`` in ``self.folder``.
"""
if filename is None:
filename = os.path.join(self.folder,'trsig.pkl')
self.trsig.save(filename) | [
"def",
"save_signal",
"(",
"self",
",",
"filename",
"=",
"None",
")",
":",
"if",
"filename",
"is",
"None",
":",
"filename",
"=",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"folder",
",",
"'trsig.pkl'",
")",
"self",
".",
"trsig",
".",
"save",
... | Saves TransitSignal.
Calls :func:`TransitSignal.save`; default filename is
``trsig.pkl`` in ``self.folder``. | [
"Saves",
"TransitSignal",
"."
] | 0446b54d48009f3655cfd1a3957ceea21d3adcaa | https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/fpp.py#L487-L496 |
47,356 | timothydmorton/VESPA | vespa/kepler.py | modelshift_weaksec | def modelshift_weaksec(koi):
"""
Max secondary depth based on model-shift secondary test from Jeff Coughlin
secondary metric: mod_depth_sec_dv * (1 + 3*mod_fred_dv / mod_sig_sec_dv)
"""
num = KOIDATA.ix[ku.koiname(koi), 'koi_tce_plnt_num']
if np.isnan(num):
num = 1
kid = KOIDATA.ix[... | python | def modelshift_weaksec(koi):
"""
Max secondary depth based on model-shift secondary test from Jeff Coughlin
secondary metric: mod_depth_sec_dv * (1 + 3*mod_fred_dv / mod_sig_sec_dv)
"""
num = KOIDATA.ix[ku.koiname(koi), 'koi_tce_plnt_num']
if np.isnan(num):
num = 1
kid = KOIDATA.ix[... | [
"def",
"modelshift_weaksec",
"(",
"koi",
")",
":",
"num",
"=",
"KOIDATA",
".",
"ix",
"[",
"ku",
".",
"koiname",
"(",
"koi",
")",
",",
"'koi_tce_plnt_num'",
"]",
"if",
"np",
".",
"isnan",
"(",
"num",
")",
":",
"num",
"=",
"1",
"kid",
"=",
"KOIDATA",... | Max secondary depth based on model-shift secondary test from Jeff Coughlin
secondary metric: mod_depth_sec_dv * (1 + 3*mod_fred_dv / mod_sig_sec_dv) | [
"Max",
"secondary",
"depth",
"based",
"on",
"model",
"-",
"shift",
"secondary",
"test",
"from",
"Jeff",
"Coughlin"
] | 0446b54d48009f3655cfd1a3957ceea21d3adcaa | https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/kepler.py#L114-L146 |
47,357 | timothydmorton/VESPA | vespa/kepler.py | use_property | def use_property(kepid, prop):
"""Returns true if provenance of property is SPE or AST
"""
try:
prov = kicu.DATA.ix[kepid, '{}_prov'.format(prop)]
return any([prov.startswith(s) for s in ['SPE', 'AST']])
except KeyError:
raise MissingStellarError('{} not in stellar table?'.format... | python | def use_property(kepid, prop):
"""Returns true if provenance of property is SPE or AST
"""
try:
prov = kicu.DATA.ix[kepid, '{}_prov'.format(prop)]
return any([prov.startswith(s) for s in ['SPE', 'AST']])
except KeyError:
raise MissingStellarError('{} not in stellar table?'.format... | [
"def",
"use_property",
"(",
"kepid",
",",
"prop",
")",
":",
"try",
":",
"prov",
"=",
"kicu",
".",
"DATA",
".",
"ix",
"[",
"kepid",
",",
"'{}_prov'",
".",
"format",
"(",
"prop",
")",
"]",
"return",
"any",
"(",
"[",
"prov",
".",
"startswith",
"(",
... | Returns true if provenance of property is SPE or AST | [
"Returns",
"true",
"if",
"provenance",
"of",
"property",
"is",
"SPE",
"or",
"AST"
] | 0446b54d48009f3655cfd1a3957ceea21d3adcaa | https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/kepler.py#L573-L580 |
47,358 | timothydmorton/VESPA | vespa/kepler.py | star_config | def star_config(koi, bands=['g','r','i','z','J','H','K'],
unc=dict(g=0.05, r=0.05, i=0.05, z=0.05,
J=0.02, H=0.02, K=0.02), **kwargs):
"""returns star config object for given KOI
"""
folder = os.path.join(KOI_FPPDIR, ku.koiname(koi))
if not os.path.exists(folder... | python | def star_config(koi, bands=['g','r','i','z','J','H','K'],
unc=dict(g=0.05, r=0.05, i=0.05, z=0.05,
J=0.02, H=0.02, K=0.02), **kwargs):
"""returns star config object for given KOI
"""
folder = os.path.join(KOI_FPPDIR, ku.koiname(koi))
if not os.path.exists(folder... | [
"def",
"star_config",
"(",
"koi",
",",
"bands",
"=",
"[",
"'g'",
",",
"'r'",
",",
"'i'",
",",
"'z'",
",",
"'J'",
",",
"'H'",
",",
"'K'",
"]",
",",
"unc",
"=",
"dict",
"(",
"g",
"=",
"0.05",
",",
"r",
"=",
"0.05",
",",
"i",
"=",
"0.05",
",",... | returns star config object for given KOI | [
"returns",
"star",
"config",
"object",
"for",
"given",
"KOI"
] | 0446b54d48009f3655cfd1a3957ceea21d3adcaa | https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/kepler.py#L583-L629 |
47,359 | timothydmorton/VESPA | vespa/kepler.py | fpp_config | def fpp_config(koi, **kwargs):
"""returns config object for given KOI
"""
folder = os.path.join(KOI_FPPDIR, ku.koiname(koi))
if not os.path.exists(folder):
os.makedirs(folder)
config = ConfigObj(os.path.join(folder,'fpp.ini'))
koi = ku.koiname(koi)
rowefit = jrowe_fit(koi)
con... | python | def fpp_config(koi, **kwargs):
"""returns config object for given KOI
"""
folder = os.path.join(KOI_FPPDIR, ku.koiname(koi))
if not os.path.exists(folder):
os.makedirs(folder)
config = ConfigObj(os.path.join(folder,'fpp.ini'))
koi = ku.koiname(koi)
rowefit = jrowe_fit(koi)
con... | [
"def",
"fpp_config",
"(",
"koi",
",",
"*",
"*",
"kwargs",
")",
":",
"folder",
"=",
"os",
".",
"path",
".",
"join",
"(",
"KOI_FPPDIR",
",",
"ku",
".",
"koiname",
"(",
"koi",
")",
")",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"folder",
... | returns config object for given KOI | [
"returns",
"config",
"object",
"for",
"given",
"KOI"
] | 0446b54d48009f3655cfd1a3957ceea21d3adcaa | https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/kepler.py#L631-L662 |
47,360 | timothydmorton/VESPA | vespa/kepler.py | KOI_FPPCalculation.apply_default_constraints | def apply_default_constraints(self):
"""Applies default secthresh & exclusion radius constraints
"""
try:
self.apply_secthresh(pipeline_weaksec(self.koi))
except NoWeakSecondaryError:
logging.warning('No secondary eclipse threshold set for {}'.format(self.koi))
... | python | def apply_default_constraints(self):
"""Applies default secthresh & exclusion radius constraints
"""
try:
self.apply_secthresh(pipeline_weaksec(self.koi))
except NoWeakSecondaryError:
logging.warning('No secondary eclipse threshold set for {}'.format(self.koi))
... | [
"def",
"apply_default_constraints",
"(",
"self",
")",
":",
"try",
":",
"self",
".",
"apply_secthresh",
"(",
"pipeline_weaksec",
"(",
"self",
".",
"koi",
")",
")",
"except",
"NoWeakSecondaryError",
":",
"logging",
".",
"warning",
"(",
"'No secondary eclipse thresho... | Applies default secthresh & exclusion radius constraints | [
"Applies",
"default",
"secthresh",
"&",
"exclusion",
"radius",
"constraints"
] | 0446b54d48009f3655cfd1a3957ceea21d3adcaa | https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/kepler.py#L361-L368 |
47,361 | dellis23/ansible-toolkit | ansible_toolkit/git_diff.py | get_old_sha | def get_old_sha(diff_part):
"""
Returns the SHA for the original file that was changed in a diff part.
"""
r = re.compile(r'index ([a-fA-F\d]*)')
return r.search(diff_part).groups()[0] | python | def get_old_sha(diff_part):
"""
Returns the SHA for the original file that was changed in a diff part.
"""
r = re.compile(r'index ([a-fA-F\d]*)')
return r.search(diff_part).groups()[0] | [
"def",
"get_old_sha",
"(",
"diff_part",
")",
":",
"r",
"=",
"re",
".",
"compile",
"(",
"r'index ([a-fA-F\\d]*)'",
")",
"return",
"r",
".",
"search",
"(",
"diff_part",
")",
".",
"groups",
"(",
")",
"[",
"0",
"]"
] | Returns the SHA for the original file that was changed in a diff part. | [
"Returns",
"the",
"SHA",
"for",
"the",
"original",
"file",
"that",
"was",
"changed",
"in",
"a",
"diff",
"part",
"."
] | 7eb5198e1f68c9a3ca1d129d9e2a52fb3f0e65c5 | https://github.com/dellis23/ansible-toolkit/blob/7eb5198e1f68c9a3ca1d129d9e2a52fb3f0e65c5/ansible_toolkit/git_diff.py#L27-L32 |
47,362 | dellis23/ansible-toolkit | ansible_toolkit/git_diff.py | get_old_filename | def get_old_filename(diff_part):
"""
Returns the filename for the original file that was changed in a diff part.
"""
regexps = (
# e.g. "+++ a/foo/bar"
r'^--- a/(.*)',
# e.g. "+++ /dev/null"
r'^\-\-\- (.*)',
)
for regexp in regexps:
r = re.compile(regexp, ... | python | def get_old_filename(diff_part):
"""
Returns the filename for the original file that was changed in a diff part.
"""
regexps = (
# e.g. "+++ a/foo/bar"
r'^--- a/(.*)',
# e.g. "+++ /dev/null"
r'^\-\-\- (.*)',
)
for regexp in regexps:
r = re.compile(regexp, ... | [
"def",
"get_old_filename",
"(",
"diff_part",
")",
":",
"regexps",
"=",
"(",
"# e.g. \"+++ a/foo/bar\"",
"r'^--- a/(.*)'",
",",
"# e.g. \"+++ /dev/null\"",
"r'^\\-\\-\\- (.*)'",
",",
")",
"for",
"regexp",
"in",
"regexps",
":",
"r",
"=",
"re",
".",
"compile",
"(",
... | Returns the filename for the original file that was changed in a diff part. | [
"Returns",
"the",
"filename",
"for",
"the",
"original",
"file",
"that",
"was",
"changed",
"in",
"a",
"diff",
"part",
"."
] | 7eb5198e1f68c9a3ca1d129d9e2a52fb3f0e65c5 | https://github.com/dellis23/ansible-toolkit/blob/7eb5198e1f68c9a3ca1d129d9e2a52fb3f0e65c5/ansible_toolkit/git_diff.py#L35-L51 |
47,363 | dellis23/ansible-toolkit | ansible_toolkit/git_diff.py | get_new_filename | def get_new_filename(diff_part):
"""
Returns the filename for the updated file in a diff part.
"""
regexps = (
# e.g. "+++ b/foo/bar"
r'^\+\+\+ b/(.*)',
# e.g. "+++ /dev/null"
r'^\+\+\+ (.*)',
)
for regexp in regexps:
r = re.compile(regexp, re.MULTILINE)
... | python | def get_new_filename(diff_part):
"""
Returns the filename for the updated file in a diff part.
"""
regexps = (
# e.g. "+++ b/foo/bar"
r'^\+\+\+ b/(.*)',
# e.g. "+++ /dev/null"
r'^\+\+\+ (.*)',
)
for regexp in regexps:
r = re.compile(regexp, re.MULTILINE)
... | [
"def",
"get_new_filename",
"(",
"diff_part",
")",
":",
"regexps",
"=",
"(",
"# e.g. \"+++ b/foo/bar\"",
"r'^\\+\\+\\+ b/(.*)'",
",",
"# e.g. \"+++ /dev/null\"",
"r'^\\+\\+\\+ (.*)'",
",",
")",
"for",
"regexp",
"in",
"regexps",
":",
"r",
"=",
"re",
".",
"compile",
... | Returns the filename for the updated file in a diff part. | [
"Returns",
"the",
"filename",
"for",
"the",
"updated",
"file",
"in",
"a",
"diff",
"part",
"."
] | 7eb5198e1f68c9a3ca1d129d9e2a52fb3f0e65c5 | https://github.com/dellis23/ansible-toolkit/blob/7eb5198e1f68c9a3ca1d129d9e2a52fb3f0e65c5/ansible_toolkit/git_diff.py#L58-L74 |
47,364 | dellis23/ansible-toolkit | ansible_toolkit/git_diff.py | get_contents | def get_contents(diff_part):
"""
Returns a tuple of old content and new content.
"""
old_sha = get_old_sha(diff_part)
old_filename = get_old_filename(diff_part)
old_contents = get_old_contents(old_sha, old_filename)
new_filename = get_new_filename(diff_part)
new_contents = get_new_conten... | python | def get_contents(diff_part):
"""
Returns a tuple of old content and new content.
"""
old_sha = get_old_sha(diff_part)
old_filename = get_old_filename(diff_part)
old_contents = get_old_contents(old_sha, old_filename)
new_filename = get_new_filename(diff_part)
new_contents = get_new_conten... | [
"def",
"get_contents",
"(",
"diff_part",
")",
":",
"old_sha",
"=",
"get_old_sha",
"(",
"diff_part",
")",
"old_filename",
"=",
"get_old_filename",
"(",
"diff_part",
")",
"old_contents",
"=",
"get_old_contents",
"(",
"old_sha",
",",
"old_filename",
")",
"new_filenam... | Returns a tuple of old content and new content. | [
"Returns",
"a",
"tuple",
"of",
"old",
"content",
"and",
"new",
"content",
"."
] | 7eb5198e1f68c9a3ca1d129d9e2a52fb3f0e65c5 | https://github.com/dellis23/ansible-toolkit/blob/7eb5198e1f68c9a3ca1d129d9e2a52fb3f0e65c5/ansible_toolkit/git_diff.py#L96-L105 |
47,365 | timothydmorton/VESPA | vespa/populations.py | _loadcache | def _loadcache(cachefile):
""" Returns a dictionary resulting from reading a likelihood cachefile
"""
cache = {}
if os.path.exists(cachefile):
with open(cachefile) as f:
for line in f:
line = line.split()
if len(line) == 2:
try:
... | python | def _loadcache(cachefile):
""" Returns a dictionary resulting from reading a likelihood cachefile
"""
cache = {}
if os.path.exists(cachefile):
with open(cachefile) as f:
for line in f:
line = line.split()
if len(line) == 2:
try:
... | [
"def",
"_loadcache",
"(",
"cachefile",
")",
":",
"cache",
"=",
"{",
"}",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"cachefile",
")",
":",
"with",
"open",
"(",
"cachefile",
")",
"as",
"f",
":",
"for",
"line",
"in",
"f",
":",
"line",
"=",
"line"... | Returns a dictionary resulting from reading a likelihood cachefile | [
"Returns",
"a",
"dictionary",
"resulting",
"from",
"reading",
"a",
"likelihood",
"cachefile"
] | 0446b54d48009f3655cfd1a3957ceea21d3adcaa | https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/populations.py#L2953-L2966 |
47,366 | timothydmorton/VESPA | vespa/populations.py | EclipsePopulation.fit_trapezoids | def fit_trapezoids(self, MAfn=None, msg=None, use_pbar=True, **kwargs):
"""
Fit trapezoid shape to each eclipse in population
For each instance in the population, first the correct,
physical Mandel-Agol transit shape is simulated,
and then this curve is fit with a trapezoid mode... | python | def fit_trapezoids(self, MAfn=None, msg=None, use_pbar=True, **kwargs):
"""
Fit trapezoid shape to each eclipse in population
For each instance in the population, first the correct,
physical Mandel-Agol transit shape is simulated,
and then this curve is fit with a trapezoid mode... | [
"def",
"fit_trapezoids",
"(",
"self",
",",
"MAfn",
"=",
"None",
",",
"msg",
"=",
"None",
",",
"use_pbar",
"=",
"True",
",",
"*",
"*",
"kwargs",
")",
":",
"logging",
".",
"info",
"(",
"'Fitting trapezoid models for {}...'",
".",
"format",
"(",
"self",
"."... | Fit trapezoid shape to each eclipse in population
For each instance in the population, first the correct,
physical Mandel-Agol transit shape is simulated,
and then this curve is fit with a trapezoid model
:param MAfn:
:class:`transit_basic.MAInterpolationFunction` object.
... | [
"Fit",
"trapezoid",
"shape",
"to",
"each",
"eclipse",
"in",
"population"
] | 0446b54d48009f3655cfd1a3957ceea21d3adcaa | https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/populations.py#L200-L274 |
47,367 | timothydmorton/VESPA | vespa/populations.py | EclipsePopulation.eclipseprob | def eclipseprob(self):
"""
Array of eclipse probabilities.
"""
#TODO: incorporate eccentricity/omega for exact calculation?
s = self.stars
return ((s['radius_1'] + s['radius_2'])*RSUN /
(semimajor(s['P'],s['mass_1'] + s['mass_2'])*AU)) | python | def eclipseprob(self):
"""
Array of eclipse probabilities.
"""
#TODO: incorporate eccentricity/omega for exact calculation?
s = self.stars
return ((s['radius_1'] + s['radius_2'])*RSUN /
(semimajor(s['P'],s['mass_1'] + s['mass_2'])*AU)) | [
"def",
"eclipseprob",
"(",
"self",
")",
":",
"#TODO: incorporate eccentricity/omega for exact calculation?",
"s",
"=",
"self",
".",
"stars",
"return",
"(",
"(",
"s",
"[",
"'radius_1'",
"]",
"+",
"s",
"[",
"'radius_2'",
"]",
")",
"*",
"RSUN",
"/",
"(",
"semim... | Array of eclipse probabilities. | [
"Array",
"of",
"eclipse",
"probabilities",
"."
] | 0446b54d48009f3655cfd1a3957ceea21d3adcaa | https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/populations.py#L317-L324 |
47,368 | timothydmorton/VESPA | vespa/populations.py | EclipsePopulation.modelshort | def modelshort(self):
"""
Short version of model name
Dictionary defined in ``populations.py``::
SHORT_MODELNAMES = {'Planets':'pl',
'EBs':'eb',
'HEBs':'heb',
'BEBs':'beb',
'Blended Planets':'bpl',
... | python | def modelshort(self):
"""
Short version of model name
Dictionary defined in ``populations.py``::
SHORT_MODELNAMES = {'Planets':'pl',
'EBs':'eb',
'HEBs':'heb',
'BEBs':'beb',
'Blended Planets':'bpl',
... | [
"def",
"modelshort",
"(",
"self",
")",
":",
"try",
":",
"name",
"=",
"SHORT_MODELNAMES",
"[",
"self",
".",
"model",
"]",
"#add index if specific model is indexed",
"if",
"hasattr",
"(",
"self",
",",
"'index'",
")",
":",
"name",
"+=",
"'-{}'",
".",
"format",
... | Short version of model name
Dictionary defined in ``populations.py``::
SHORT_MODELNAMES = {'Planets':'pl',
'EBs':'eb',
'HEBs':'heb',
'BEBs':'beb',
'Blended Planets':'bpl',
'Specific BEB':'sbeb',
... | [
"Short",
"version",
"of",
"model",
"name"
] | 0446b54d48009f3655cfd1a3957ceea21d3adcaa | https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/populations.py#L333-L359 |
47,369 | timothydmorton/VESPA | vespa/populations.py | EclipsePopulation.constrain_secdepth | def constrain_secdepth(self, thresh):
"""
Constrain the observed secondary depth to be less than a given value
:param thresh:
Maximum allowed fractional depth for diluted secondary
eclipse depth
"""
self.apply_constraint(UpperLimit(self.secondary_depth, ... | python | def constrain_secdepth(self, thresh):
"""
Constrain the observed secondary depth to be less than a given value
:param thresh:
Maximum allowed fractional depth for diluted secondary
eclipse depth
"""
self.apply_constraint(UpperLimit(self.secondary_depth, ... | [
"def",
"constrain_secdepth",
"(",
"self",
",",
"thresh",
")",
":",
"self",
".",
"apply_constraint",
"(",
"UpperLimit",
"(",
"self",
".",
"secondary_depth",
",",
"thresh",
",",
"name",
"=",
"'secondary depth'",
")",
")"
] | Constrain the observed secondary depth to be less than a given value
:param thresh:
Maximum allowed fractional depth for diluted secondary
eclipse depth | [
"Constrain",
"the",
"observed",
"secondary",
"depth",
"to",
"be",
"less",
"than",
"a",
"given",
"value"
] | 0446b54d48009f3655cfd1a3957ceea21d3adcaa | https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/populations.py#L382-L391 |
47,370 | timothydmorton/VESPA | vespa/populations.py | EclipsePopulation.prior | def prior(self):
"""
Model prior for particular model.
Product of eclipse probability (``self.prob``),
the fraction of scenario that is allowed by the various
constraints (``self.selectfrac``), and all additional
factors in ``self.priorfactors``.
"""
pri... | python | def prior(self):
"""
Model prior for particular model.
Product of eclipse probability (``self.prob``),
the fraction of scenario that is allowed by the various
constraints (``self.selectfrac``), and all additional
factors in ``self.priorfactors``.
"""
pri... | [
"def",
"prior",
"(",
"self",
")",
":",
"prior",
"=",
"self",
".",
"prob",
"*",
"self",
".",
"selectfrac",
"for",
"f",
"in",
"self",
".",
"priorfactors",
":",
"prior",
"*=",
"self",
".",
"priorfactors",
"[",
"f",
"]",
"return",
"prior"
] | Model prior for particular model.
Product of eclipse probability (``self.prob``),
the fraction of scenario that is allowed by the various
constraints (``self.selectfrac``), and all additional
factors in ``self.priorfactors``. | [
"Model",
"prior",
"for",
"particular",
"model",
"."
] | 0446b54d48009f3655cfd1a3957ceea21d3adcaa | https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/populations.py#L409-L422 |
47,371 | timothydmorton/VESPA | vespa/populations.py | EclipsePopulation.add_priorfactor | def add_priorfactor(self,**kwargs):
"""Adds given values to priorfactors
If given keyword exists already, error will be raised
to use :func:`EclipsePopulation.change_prior` instead.
"""
for kw in kwargs:
if kw in self.priorfactors:
logging.error('%s a... | python | def add_priorfactor(self,**kwargs):
"""Adds given values to priorfactors
If given keyword exists already, error will be raised
to use :func:`EclipsePopulation.change_prior` instead.
"""
for kw in kwargs:
if kw in self.priorfactors:
logging.error('%s a... | [
"def",
"add_priorfactor",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"for",
"kw",
"in",
"kwargs",
":",
"if",
"kw",
"in",
"self",
".",
"priorfactors",
":",
"logging",
".",
"error",
"(",
"'%s already in prior factors for %s. use change_prior function instead.'... | Adds given values to priorfactors
If given keyword exists already, error will be raised
to use :func:`EclipsePopulation.change_prior` instead. | [
"Adds",
"given",
"values",
"to",
"priorfactors"
] | 0446b54d48009f3655cfd1a3957ceea21d3adcaa | https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/populations.py#L424-L436 |
47,372 | timothydmorton/VESPA | vespa/populations.py | EclipsePopulation.change_prior | def change_prior(self, **kwargs):
"""
Changes existing priorfactors.
If given keyword isn't already in priorfactors,
then will be ignored.
"""
for kw in kwargs:
if kw in self.priorfactors:
self.priorfactors[kw] = kwargs[kw]
log... | python | def change_prior(self, **kwargs):
"""
Changes existing priorfactors.
If given keyword isn't already in priorfactors,
then will be ignored.
"""
for kw in kwargs:
if kw in self.priorfactors:
self.priorfactors[kw] = kwargs[kw]
log... | [
"def",
"change_prior",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"for",
"kw",
"in",
"kwargs",
":",
"if",
"kw",
"in",
"self",
".",
"priorfactors",
":",
"self",
".",
"priorfactors",
"[",
"kw",
"]",
"=",
"kwargs",
"[",
"kw",
"]",
"logging",
".",... | Changes existing priorfactors.
If given keyword isn't already in priorfactors,
then will be ignored. | [
"Changes",
"existing",
"priorfactors",
"."
] | 0446b54d48009f3655cfd1a3957ceea21d3adcaa | https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/populations.py#L438-L449 |
47,373 | timothydmorton/VESPA | vespa/populations.py | EclipsePopulation._density | def _density(self, logd, dur, slope):
"""
Evaluate KDE at given points.
Prepares data according to whether sklearn or scipy
KDE in use.
:param log, dur, slope:
Trapezoidal shape parameters.
"""
if self.sklearn_kde:
#TODO: fix preprocessin... | python | def _density(self, logd, dur, slope):
"""
Evaluate KDE at given points.
Prepares data according to whether sklearn or scipy
KDE in use.
:param log, dur, slope:
Trapezoidal shape parameters.
"""
if self.sklearn_kde:
#TODO: fix preprocessin... | [
"def",
"_density",
"(",
"self",
",",
"logd",
",",
"dur",
",",
"slope",
")",
":",
"if",
"self",
".",
"sklearn_kde",
":",
"#TODO: fix preprocessing",
"pts",
"=",
"np",
".",
"array",
"(",
"[",
"(",
"logd",
"-",
"self",
".",
"mean_logdepth",
")",
"/",
"s... | Evaluate KDE at given points.
Prepares data according to whether sklearn or scipy
KDE in use.
:param log, dur, slope:
Trapezoidal shape parameters. | [
"Evaluate",
"KDE",
"at",
"given",
"points",
"."
] | 0446b54d48009f3655cfd1a3957ceea21d3adcaa | https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/populations.py#L569-L586 |
47,374 | timothydmorton/VESPA | vespa/populations.py | EclipsePopulation.lhood | def lhood(self, trsig, recalc=False, cachefile=None):
"""Returns likelihood of transit signal
Returns sum of ``trsig`` MCMC samples evaluated
at ``self.kde``.
:param trsig:
:class:`vespa.TransitSignal` object.
:param recalc: (optional)
Whether to recalc... | python | def lhood(self, trsig, recalc=False, cachefile=None):
"""Returns likelihood of transit signal
Returns sum of ``trsig`` MCMC samples evaluated
at ``self.kde``.
:param trsig:
:class:`vespa.TransitSignal` object.
:param recalc: (optional)
Whether to recalc... | [
"def",
"lhood",
"(",
"self",
",",
"trsig",
",",
"recalc",
"=",
"False",
",",
"cachefile",
"=",
"None",
")",
":",
"if",
"not",
"hasattr",
"(",
"self",
",",
"'kde'",
")",
":",
"self",
".",
"_make_kde",
"(",
")",
"if",
"cachefile",
"is",
"None",
":",
... | Returns likelihood of transit signal
Returns sum of ``trsig`` MCMC samples evaluated
at ``self.kde``.
:param trsig:
:class:`vespa.TransitSignal` object.
:param recalc: (optional)
Whether to recalculate likelihood (if calculation
is cached).
... | [
"Returns",
"likelihood",
"of",
"transit",
"signal"
] | 0446b54d48009f3655cfd1a3957ceea21d3adcaa | https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/populations.py#L588-L627 |
47,375 | timothydmorton/VESPA | vespa/populations.py | EclipsePopulation.load_hdf | def load_hdf(cls, filename, path=''): #perhaps this doesn't need to be written?
"""
Loads EclipsePopulation from HDF file
Also runs :func:`EclipsePopulation._make_kde` if it can.
:param filename:
HDF file
:param path: (optional)
Path within HDF file
... | python | def load_hdf(cls, filename, path=''): #perhaps this doesn't need to be written?
"""
Loads EclipsePopulation from HDF file
Also runs :func:`EclipsePopulation._make_kde` if it can.
:param filename:
HDF file
:param path: (optional)
Path within HDF file
... | [
"def",
"load_hdf",
"(",
"cls",
",",
"filename",
",",
"path",
"=",
"''",
")",
":",
"#perhaps this doesn't need to be written?",
"new",
"=",
"StarPopulation",
".",
"load_hdf",
"(",
"filename",
",",
"path",
"=",
"path",
")",
"#setup lazy loading of starmodel if present... | Loads EclipsePopulation from HDF file
Also runs :func:`EclipsePopulation._make_kde` if it can.
:param filename:
HDF file
:param path: (optional)
Path within HDF file | [
"Loads",
"EclipsePopulation",
"from",
"HDF",
"file"
] | 0446b54d48009f3655cfd1a3957ceea21d3adcaa | https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/populations.py#L928-L958 |
47,376 | timothydmorton/VESPA | vespa/populations.py | PopulationSet.constraints | def constraints(self):
"""
Unique list of constraints among all populations in set.
"""
cs = []
for pop in self.poplist:
cs += [c for c in pop.constraints]
return list(set(cs)) | python | def constraints(self):
"""
Unique list of constraints among all populations in set.
"""
cs = []
for pop in self.poplist:
cs += [c for c in pop.constraints]
return list(set(cs)) | [
"def",
"constraints",
"(",
"self",
")",
":",
"cs",
"=",
"[",
"]",
"for",
"pop",
"in",
"self",
".",
"poplist",
":",
"cs",
"+=",
"[",
"c",
"for",
"c",
"in",
"pop",
".",
"constraints",
"]",
"return",
"list",
"(",
"set",
"(",
"cs",
")",
")"
] | Unique list of constraints among all populations in set. | [
"Unique",
"list",
"of",
"constraints",
"among",
"all",
"populations",
"in",
"set",
"."
] | 0446b54d48009f3655cfd1a3957ceea21d3adcaa | https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/populations.py#L2206-L2213 |
47,377 | timothydmorton/VESPA | vespa/populations.py | PopulationSet.save_hdf | def save_hdf(self, filename, path='', overwrite=False):
"""
Saves PopulationSet to HDF file.
"""
if os.path.exists(filename) and overwrite:
os.remove(filename)
for pop in self.poplist:
name = pop.modelshort
pop.save_hdf(filename, path='{}/{}'.... | python | def save_hdf(self, filename, path='', overwrite=False):
"""
Saves PopulationSet to HDF file.
"""
if os.path.exists(filename) and overwrite:
os.remove(filename)
for pop in self.poplist:
name = pop.modelshort
pop.save_hdf(filename, path='{}/{}'.... | [
"def",
"save_hdf",
"(",
"self",
",",
"filename",
",",
"path",
"=",
"''",
",",
"overwrite",
"=",
"False",
")",
":",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"filename",
")",
"and",
"overwrite",
":",
"os",
".",
"remove",
"(",
"filename",
")",
"fo... | Saves PopulationSet to HDF file. | [
"Saves",
"PopulationSet",
"to",
"HDF",
"file",
"."
] | 0446b54d48009f3655cfd1a3957ceea21d3adcaa | https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/populations.py#L2229-L2238 |
47,378 | timothydmorton/VESPA | vespa/populations.py | PopulationSet.load_hdf | def load_hdf(cls, filename, path=''):
"""
Loads PopulationSet from file
"""
with pd.HDFStore(filename) as store:
models = []
types = []
for k in store.keys():
m = re.search('/(\S+)/stars', k)
if m:
mo... | python | def load_hdf(cls, filename, path=''):
"""
Loads PopulationSet from file
"""
with pd.HDFStore(filename) as store:
models = []
types = []
for k in store.keys():
m = re.search('/(\S+)/stars', k)
if m:
mo... | [
"def",
"load_hdf",
"(",
"cls",
",",
"filename",
",",
"path",
"=",
"''",
")",
":",
"with",
"pd",
".",
"HDFStore",
"(",
"filename",
")",
"as",
"store",
":",
"models",
"=",
"[",
"]",
"types",
"=",
"[",
"]",
"for",
"k",
"in",
"store",
".",
"keys",
... | Loads PopulationSet from file | [
"Loads",
"PopulationSet",
"from",
"file"
] | 0446b54d48009f3655cfd1a3957ceea21d3adcaa | https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/populations.py#L2241-L2257 |
47,379 | timothydmorton/VESPA | vespa/populations.py | PopulationSet.add_population | def add_population(self,pop):
"""Adds population to PopulationSet
"""
if pop.model in self.modelnames:
raise ValueError('%s model already in PopulationSet.' % pop.model)
self.modelnames.append(pop.model)
self.shortmodelnames.append(pop.modelshort)
self.poplist... | python | def add_population(self,pop):
"""Adds population to PopulationSet
"""
if pop.model in self.modelnames:
raise ValueError('%s model already in PopulationSet.' % pop.model)
self.modelnames.append(pop.model)
self.shortmodelnames.append(pop.modelshort)
self.poplist... | [
"def",
"add_population",
"(",
"self",
",",
"pop",
")",
":",
"if",
"pop",
".",
"model",
"in",
"self",
".",
"modelnames",
":",
"raise",
"ValueError",
"(",
"'%s model already in PopulationSet.'",
"%",
"pop",
".",
"model",
")",
"self",
".",
"modelnames",
".",
... | Adds population to PopulationSet | [
"Adds",
"population",
"to",
"PopulationSet"
] | 0446b54d48009f3655cfd1a3957ceea21d3adcaa | https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/populations.py#L2261-L2268 |
47,380 | timothydmorton/VESPA | vespa/populations.py | PopulationSet.remove_population | def remove_population(self,pop):
"""Removes population from PopulationSet
"""
iremove=None
for i in range(len(self.poplist)):
if self.modelnames[i]==self.poplist[i].model:
iremove=i
if iremove is not None:
self.modelnames.pop(i)
... | python | def remove_population(self,pop):
"""Removes population from PopulationSet
"""
iremove=None
for i in range(len(self.poplist)):
if self.modelnames[i]==self.poplist[i].model:
iremove=i
if iremove is not None:
self.modelnames.pop(i)
... | [
"def",
"remove_population",
"(",
"self",
",",
"pop",
")",
":",
"iremove",
"=",
"None",
"for",
"i",
"in",
"range",
"(",
"len",
"(",
"self",
".",
"poplist",
")",
")",
":",
"if",
"self",
".",
"modelnames",
"[",
"i",
"]",
"==",
"self",
".",
"poplist",
... | Removes population from PopulationSet | [
"Removes",
"population",
"from",
"PopulationSet"
] | 0446b54d48009f3655cfd1a3957ceea21d3adcaa | https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/populations.py#L2271-L2281 |
47,381 | timothydmorton/VESPA | vespa/populations.py | PopulationSet.colordict | def colordict(self):
"""
Dictionary holding colors that correspond to constraints.
"""
d = {}
i=0
n = len(self.constraints)
for c in self.constraints:
#self.colordict[c] = colors[i % 6]
d[c] = cm.jet(1.*i/n)
i+=1
return ... | python | def colordict(self):
"""
Dictionary holding colors that correspond to constraints.
"""
d = {}
i=0
n = len(self.constraints)
for c in self.constraints:
#self.colordict[c] = colors[i % 6]
d[c] = cm.jet(1.*i/n)
i+=1
return ... | [
"def",
"colordict",
"(",
"self",
")",
":",
"d",
"=",
"{",
"}",
"i",
"=",
"0",
"n",
"=",
"len",
"(",
"self",
".",
"constraints",
")",
"for",
"c",
"in",
"self",
".",
"constraints",
":",
"#self.colordict[c] = colors[i % 6]",
"d",
"[",
"c",
"]",
"=",
"... | Dictionary holding colors that correspond to constraints. | [
"Dictionary",
"holding",
"colors",
"that",
"correspond",
"to",
"constraints",
"."
] | 0446b54d48009f3655cfd1a3957ceea21d3adcaa | https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/populations.py#L2317-L2328 |
47,382 | timothydmorton/VESPA | vespa/populations.py | PopulationSet.priorfactors | def priorfactors(self):
"""Combinartion of priorfactors from all populations
"""
priorfactors = {}
for pop in self.poplist:
for f in pop.priorfactors:
if f in priorfactors:
if pop.priorfactors[f] != priorfactors[f]:
... | python | def priorfactors(self):
"""Combinartion of priorfactors from all populations
"""
priorfactors = {}
for pop in self.poplist:
for f in pop.priorfactors:
if f in priorfactors:
if pop.priorfactors[f] != priorfactors[f]:
... | [
"def",
"priorfactors",
"(",
"self",
")",
":",
"priorfactors",
"=",
"{",
"}",
"for",
"pop",
"in",
"self",
".",
"poplist",
":",
"for",
"f",
"in",
"pop",
".",
"priorfactors",
":",
"if",
"f",
"in",
"priorfactors",
":",
"if",
"pop",
".",
"priorfactors",
"... | Combinartion of priorfactors from all populations | [
"Combinartion",
"of",
"priorfactors",
"from",
"all",
"populations"
] | 0446b54d48009f3655cfd1a3957ceea21d3adcaa | https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/populations.py#L2331-L2342 |
47,383 | timothydmorton/VESPA | vespa/populations.py | PopulationSet.apply_multicolor_transit | def apply_multicolor_transit(self,band,depth):
"""
Applies constraint corresponding to measuring transit in different band
This is not implemented yet.
"""
if '{} band transit'.format(band) not in self.constraints:
self.constraints.append('{} band transit'.format(ban... | python | def apply_multicolor_transit(self,band,depth):
"""
Applies constraint corresponding to measuring transit in different band
This is not implemented yet.
"""
if '{} band transit'.format(band) not in self.constraints:
self.constraints.append('{} band transit'.format(ban... | [
"def",
"apply_multicolor_transit",
"(",
"self",
",",
"band",
",",
"depth",
")",
":",
"if",
"'{} band transit'",
".",
"format",
"(",
"band",
")",
"not",
"in",
"self",
".",
"constraints",
":",
"self",
".",
"constraints",
".",
"append",
"(",
"'{} band transit'"... | Applies constraint corresponding to measuring transit in different band
This is not implemented yet. | [
"Applies",
"constraint",
"corresponding",
"to",
"measuring",
"transit",
"in",
"different",
"band"
] | 0446b54d48009f3655cfd1a3957ceea21d3adcaa | https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/populations.py#L2356-L2365 |
47,384 | timothydmorton/VESPA | vespa/populations.py | PopulationSet.set_maxrad | def set_maxrad(self,newrad):
"""
Sets max allowed radius in populations.
Doesn't operate via the :class:`stars.Constraint`
protocol; rather just rescales the sky positions
for the background objects and recalculates
sky area, etc.
"""
if not isinstance(n... | python | def set_maxrad(self,newrad):
"""
Sets max allowed radius in populations.
Doesn't operate via the :class:`stars.Constraint`
protocol; rather just rescales the sky positions
for the background objects and recalculates
sky area, etc.
"""
if not isinstance(n... | [
"def",
"set_maxrad",
"(",
"self",
",",
"newrad",
")",
":",
"if",
"not",
"isinstance",
"(",
"newrad",
",",
"Quantity",
")",
":",
"newrad",
"=",
"newrad",
"*",
"u",
".",
"arcsec",
"#if 'Rsky' not in self.constraints:",
"# self.constraints.append('Rsky')",
"for",
... | Sets max allowed radius in populations.
Doesn't operate via the :class:`stars.Constraint`
protocol; rather just rescales the sky positions
for the background objects and recalculates
sky area, etc. | [
"Sets",
"max",
"allowed",
"radius",
"in",
"populations",
"."
] | 0446b54d48009f3655cfd1a3957ceea21d3adcaa | https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/populations.py#L2367-L2386 |
47,385 | timothydmorton/VESPA | vespa/populations.py | PopulationSet.apply_dmaglim | def apply_dmaglim(self,dmaglim=None):
"""
Applies a constraint that sets the maximum brightness for non-target star
:func:`stars.StarPopulation.set_dmaglim` not yet implemented.
"""
raise NotImplementedError
if 'bright blend limit' not in self.constraints:
s... | python | def apply_dmaglim(self,dmaglim=None):
"""
Applies a constraint that sets the maximum brightness for non-target star
:func:`stars.StarPopulation.set_dmaglim` not yet implemented.
"""
raise NotImplementedError
if 'bright blend limit' not in self.constraints:
s... | [
"def",
"apply_dmaglim",
"(",
"self",
",",
"dmaglim",
"=",
"None",
")",
":",
"raise",
"NotImplementedError",
"if",
"'bright blend limit'",
"not",
"in",
"self",
".",
"constraints",
":",
"self",
".",
"constraints",
".",
"append",
"(",
"'bright blend limit'",
")",
... | Applies a constraint that sets the maximum brightness for non-target star
:func:`stars.StarPopulation.set_dmaglim` not yet implemented. | [
"Applies",
"a",
"constraint",
"that",
"sets",
"the",
"maximum",
"brightness",
"for",
"non",
"-",
"target",
"star"
] | 0446b54d48009f3655cfd1a3957ceea21d3adcaa | https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/populations.py#L2388-L2406 |
47,386 | timothydmorton/VESPA | vespa/populations.py | PopulationSet.apply_trend_constraint | def apply_trend_constraint(self, limit, dt, **kwargs):
"""
Applies constraint corresponding to RV trend non-detection to each population
See :func:`stars.StarPopulation.apply_trend_constraint`;
all arguments passed to that function for each population.
"""
if 'RV monito... | python | def apply_trend_constraint(self, limit, dt, **kwargs):
"""
Applies constraint corresponding to RV trend non-detection to each population
See :func:`stars.StarPopulation.apply_trend_constraint`;
all arguments passed to that function for each population.
"""
if 'RV monito... | [
"def",
"apply_trend_constraint",
"(",
"self",
",",
"limit",
",",
"dt",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"'RV monitoring'",
"not",
"in",
"self",
".",
"constraints",
":",
"self",
".",
"constraints",
".",
"append",
"(",
"'RV monitoring'",
")",
"for",
... | Applies constraint corresponding to RV trend non-detection to each population
See :func:`stars.StarPopulation.apply_trend_constraint`;
all arguments passed to that function for each population. | [
"Applies",
"constraint",
"corresponding",
"to",
"RV",
"trend",
"non",
"-",
"detection",
"to",
"each",
"population"
] | 0446b54d48009f3655cfd1a3957ceea21d3adcaa | https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/populations.py#L2408-L2423 |
47,387 | timothydmorton/VESPA | vespa/populations.py | PopulationSet.apply_secthresh | def apply_secthresh(self, secthresh, **kwargs):
"""Applies secondary depth constraint to each population
See :func:`EclipsePopulation.apply_secthresh`;
all arguments passed to that function for each population.
"""
if 'secondary depth' not in self.constraints:
self... | python | def apply_secthresh(self, secthresh, **kwargs):
"""Applies secondary depth constraint to each population
See :func:`EclipsePopulation.apply_secthresh`;
all arguments passed to that function for each population.
"""
if 'secondary depth' not in self.constraints:
self... | [
"def",
"apply_secthresh",
"(",
"self",
",",
"secthresh",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"'secondary depth'",
"not",
"in",
"self",
".",
"constraints",
":",
"self",
".",
"constraints",
".",
"append",
"(",
"'secondary depth'",
")",
"for",
"pop",
"in... | Applies secondary depth constraint to each population
See :func:`EclipsePopulation.apply_secthresh`;
all arguments passed to that function for each population. | [
"Applies",
"secondary",
"depth",
"constraint",
"to",
"each",
"population"
] | 0446b54d48009f3655cfd1a3957ceea21d3adcaa | https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/populations.py#L2425-L2438 |
47,388 | timothydmorton/VESPA | vespa/populations.py | PopulationSet.constrain_property | def constrain_property(self,prop,**kwargs):
"""
Constrains property for each population
See :func:`vespa.stars.StarPopulation.constrain_property`;
all arguments passed to that function for each population.
"""
if prop not in self.constraints:
self.constraint... | python | def constrain_property(self,prop,**kwargs):
"""
Constrains property for each population
See :func:`vespa.stars.StarPopulation.constrain_property`;
all arguments passed to that function for each population.
"""
if prop not in self.constraints:
self.constraint... | [
"def",
"constrain_property",
"(",
"self",
",",
"prop",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"prop",
"not",
"in",
"self",
".",
"constraints",
":",
"self",
".",
"constraints",
".",
"append",
"(",
"prop",
")",
"for",
"pop",
"in",
"self",
".",
"popli... | Constrains property for each population
See :func:`vespa.stars.StarPopulation.constrain_property`;
all arguments passed to that function for each population. | [
"Constrains",
"property",
"for",
"each",
"population"
] | 0446b54d48009f3655cfd1a3957ceea21d3adcaa | https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/populations.py#L2452-L2466 |
47,389 | timothydmorton/VESPA | vespa/populations.py | PopulationSet.replace_constraint | def replace_constraint(self,name,**kwargs):
"""
Replaces removed constraint in each population.
See :func:`vespa.stars.StarPopulation.replace_constraint`
"""
for pop in self.poplist:
pop.replace_constraint(name,**kwargs)
if name not in self.constraints:
... | python | def replace_constraint(self,name,**kwargs):
"""
Replaces removed constraint in each population.
See :func:`vespa.stars.StarPopulation.replace_constraint`
"""
for pop in self.poplist:
pop.replace_constraint(name,**kwargs)
if name not in self.constraints:
... | [
"def",
"replace_constraint",
"(",
"self",
",",
"name",
",",
"*",
"*",
"kwargs",
")",
":",
"for",
"pop",
"in",
"self",
".",
"poplist",
":",
"pop",
".",
"replace_constraint",
"(",
"name",
",",
"*",
"*",
"kwargs",
")",
"if",
"name",
"not",
"in",
"self",... | Replaces removed constraint in each population.
See :func:`vespa.stars.StarPopulation.replace_constraint` | [
"Replaces",
"removed",
"constraint",
"in",
"each",
"population",
"."
] | 0446b54d48009f3655cfd1a3957ceea21d3adcaa | https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/populations.py#L2468-L2479 |
47,390 | timothydmorton/VESPA | vespa/populations.py | PopulationSet.remove_constraint | def remove_constraint(self,*names):
"""
Removes constraint from each population
See :func:`vespa.stars.StarPopulation.remove_constraint
"""
for name in names:
for pop in self.poplist:
if name in pop.constraints:
pop.remove_constra... | python | def remove_constraint(self,*names):
"""
Removes constraint from each population
See :func:`vespa.stars.StarPopulation.remove_constraint
"""
for name in names:
for pop in self.poplist:
if name in pop.constraints:
pop.remove_constra... | [
"def",
"remove_constraint",
"(",
"self",
",",
"*",
"names",
")",
":",
"for",
"name",
"in",
"names",
":",
"for",
"pop",
"in",
"self",
".",
"poplist",
":",
"if",
"name",
"in",
"pop",
".",
"constraints",
":",
"pop",
".",
"remove_constraint",
"(",
"name",
... | Removes constraint from each population
See :func:`vespa.stars.StarPopulation.remove_constraint | [
"Removes",
"constraint",
"from",
"each",
"population"
] | 0446b54d48009f3655cfd1a3957ceea21d3adcaa | https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/populations.py#L2481-L2495 |
47,391 | timothydmorton/VESPA | vespa/populations.py | PopulationSet.apply_cc | def apply_cc(self, cc, **kwargs):
"""
Applies contrast curve constraint to each population
See :func:`vespa.stars.StarPopulation.apply_cc`;
all arguments passed to that function for each population.
"""
if type(cc)==type(''):
pass
if cc.name not in s... | python | def apply_cc(self, cc, **kwargs):
"""
Applies contrast curve constraint to each population
See :func:`vespa.stars.StarPopulation.apply_cc`;
all arguments passed to that function for each population.
"""
if type(cc)==type(''):
pass
if cc.name not in s... | [
"def",
"apply_cc",
"(",
"self",
",",
"cc",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"type",
"(",
"cc",
")",
"==",
"type",
"(",
"''",
")",
":",
"pass",
"if",
"cc",
".",
"name",
"not",
"in",
"self",
".",
"constraints",
":",
"self",
".",
"constrai... | Applies contrast curve constraint to each population
See :func:`vespa.stars.StarPopulation.apply_cc`;
all arguments passed to that function for each population. | [
"Applies",
"contrast",
"curve",
"constraint",
"to",
"each",
"population"
] | 0446b54d48009f3655cfd1a3957ceea21d3adcaa | https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/populations.py#L2497-L2514 |
47,392 | timothydmorton/VESPA | vespa/populations.py | PopulationSet.apply_vcc | def apply_vcc(self,vcc):
"""
Applies velocity contrast curve constraint to each population
See :func:`vespa.stars.StarPopulation.apply_vcc`;
all arguments passed to that function for each population.
"""
if 'secondary spectrum' not in self.constraints:
self.... | python | def apply_vcc(self,vcc):
"""
Applies velocity contrast curve constraint to each population
See :func:`vespa.stars.StarPopulation.apply_vcc`;
all arguments passed to that function for each population.
"""
if 'secondary spectrum' not in self.constraints:
self.... | [
"def",
"apply_vcc",
"(",
"self",
",",
"vcc",
")",
":",
"if",
"'secondary spectrum'",
"not",
"in",
"self",
".",
"constraints",
":",
"self",
".",
"constraints",
".",
"append",
"(",
"'secondary spectrum'",
")",
"for",
"pop",
"in",
"self",
".",
"poplist",
":",... | Applies velocity contrast curve constraint to each population
See :func:`vespa.stars.StarPopulation.apply_vcc`;
all arguments passed to that function for each population. | [
"Applies",
"velocity",
"contrast",
"curve",
"constraint",
"to",
"each",
"population"
] | 0446b54d48009f3655cfd1a3957ceea21d3adcaa | https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/populations.py#L2516-L2531 |
47,393 | timothydmorton/VESPA | vespa/stars/trilegal.py | get_trilegal | def get_trilegal(filename,ra,dec,folder='.', galactic=False,
filterset='kepler_2mass',area=1,maglim=27,binaries=False,
trilegal_version='1.6',sigma_AV=0.1,convert_h5=True):
"""Runs get_trilegal perl script; optionally saves output into .h5 file
Depends on a perl script provide... | python | def get_trilegal(filename,ra,dec,folder='.', galactic=False,
filterset='kepler_2mass',area=1,maglim=27,binaries=False,
trilegal_version='1.6',sigma_AV=0.1,convert_h5=True):
"""Runs get_trilegal perl script; optionally saves output into .h5 file
Depends on a perl script provide... | [
"def",
"get_trilegal",
"(",
"filename",
",",
"ra",
",",
"dec",
",",
"folder",
"=",
"'.'",
",",
"galactic",
"=",
"False",
",",
"filterset",
"=",
"'kepler_2mass'",
",",
"area",
"=",
"1",
",",
"maglim",
"=",
"27",
",",
"binaries",
"=",
"False",
",",
"tr... | Runs get_trilegal perl script; optionally saves output into .h5 file
Depends on a perl script provided by L. Girardi; calls the
web form simulation, downloads the file, and (optionally) converts
to HDF format.
Uses A_V at infinity from :func:`utils.get_AV_infinity`.
.. note::
Would be de... | [
"Runs",
"get_trilegal",
"perl",
"script",
";",
"optionally",
"saves",
"output",
"into",
".",
"h5",
"file"
] | 0446b54d48009f3655cfd1a3957ceea21d3adcaa | https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/stars/trilegal.py#L23-L118 |
47,394 | dmsimard/python-cephclient | cephclient/client.py | CephClient.log_wrapper | def log_wrapper(self):
"""
Wrapper to set logging parameters for output
"""
log = logging.getLogger('client.py')
# Set the log format and log level
try:
debug = self.params["debug"]
log.setLevel(logging.DEBUG)
except KeyError:
... | python | def log_wrapper(self):
"""
Wrapper to set logging parameters for output
"""
log = logging.getLogger('client.py')
# Set the log format and log level
try:
debug = self.params["debug"]
log.setLevel(logging.DEBUG)
except KeyError:
... | [
"def",
"log_wrapper",
"(",
"self",
")",
":",
"log",
"=",
"logging",
".",
"getLogger",
"(",
"'client.py'",
")",
"# Set the log format and log level",
"try",
":",
"debug",
"=",
"self",
".",
"params",
"[",
"\"debug\"",
"]",
"log",
".",
"setLevel",
"(",
"logging... | Wrapper to set logging parameters for output | [
"Wrapper",
"to",
"set",
"logging",
"parameters",
"for",
"output"
] | 44aea09d8c512b3bbd3bc12dfd185205ac8b551b | https://github.com/dmsimard/python-cephclient/blob/44aea09d8c512b3bbd3bc12dfd185205ac8b551b/cephclient/client.py#L135-L156 |
47,395 | ternaris/marv | marv_node/setid.py | decode_setid | def decode_setid(encoded):
"""Decode setid as uint128"""
try:
lo, hi = struct.unpack('<QQ', b32decode(encoded.upper() + '======'))
except struct.error:
raise ValueError('Cannot decode {!r}'.format(encoded))
return (hi << 64) + lo | python | def decode_setid(encoded):
"""Decode setid as uint128"""
try:
lo, hi = struct.unpack('<QQ', b32decode(encoded.upper() + '======'))
except struct.error:
raise ValueError('Cannot decode {!r}'.format(encoded))
return (hi << 64) + lo | [
"def",
"decode_setid",
"(",
"encoded",
")",
":",
"try",
":",
"lo",
",",
"hi",
"=",
"struct",
".",
"unpack",
"(",
"'<QQ'",
",",
"b32decode",
"(",
"encoded",
".",
"upper",
"(",
")",
"+",
"'======'",
")",
")",
"except",
"struct",
".",
"error",
":",
"r... | Decode setid as uint128 | [
"Decode",
"setid",
"as",
"uint128"
] | c221354d912ff869bbdb4f714a86a70be30d823e | https://github.com/ternaris/marv/blob/c221354d912ff869bbdb4f714a86a70be30d823e/marv_node/setid.py#L28-L34 |
47,396 | ternaris/marv | marv_node/setid.py | encode_setid | def encode_setid(uint128):
"""Encode uint128 setid as stripped b32encoded string"""
hi, lo = divmod(uint128, 2**64)
return b32encode(struct.pack('<QQ', lo, hi))[:-6].lower() | python | def encode_setid(uint128):
"""Encode uint128 setid as stripped b32encoded string"""
hi, lo = divmod(uint128, 2**64)
return b32encode(struct.pack('<QQ', lo, hi))[:-6].lower() | [
"def",
"encode_setid",
"(",
"uint128",
")",
":",
"hi",
",",
"lo",
"=",
"divmod",
"(",
"uint128",
",",
"2",
"**",
"64",
")",
"return",
"b32encode",
"(",
"struct",
".",
"pack",
"(",
"'<QQ'",
",",
"lo",
",",
"hi",
")",
")",
"[",
":",
"-",
"6",
"]"... | Encode uint128 setid as stripped b32encoded string | [
"Encode",
"uint128",
"setid",
"as",
"stripped",
"b32encoded",
"string"
] | c221354d912ff869bbdb4f714a86a70be30d823e | https://github.com/ternaris/marv/blob/c221354d912ff869bbdb4f714a86a70be30d823e/marv_node/setid.py#L37-L40 |
47,397 | originell/sorl-watermark | sorl_watermarker/engines/pgmagick_engine.py | Engine._reduce_opacity | def _reduce_opacity(self, watermark, opacity):
"""
Returns an image with reduced opacity. Converts image to RGBA if needs.
Simple watermark.opacity(65535 - int(65535 * opacity) would not work for
images with the Opacity channel (RGBA images). So we have to convert RGB or any
oth... | python | def _reduce_opacity(self, watermark, opacity):
"""
Returns an image with reduced opacity. Converts image to RGBA if needs.
Simple watermark.opacity(65535 - int(65535 * opacity) would not work for
images with the Opacity channel (RGBA images). So we have to convert RGB or any
oth... | [
"def",
"_reduce_opacity",
"(",
"self",
",",
"watermark",
",",
"opacity",
")",
":",
"if",
"watermark",
".",
"type",
"(",
")",
"!=",
"ImageType",
".",
"TrueColorMatteType",
":",
"watermark",
".",
"type",
"(",
"ImageType",
".",
"TrueColorMatteType",
")",
"depth... | Returns an image with reduced opacity. Converts image to RGBA if needs.
Simple watermark.opacity(65535 - int(65535 * opacity) would not work for
images with the Opacity channel (RGBA images). So we have to convert RGB or any
other type to RGBA in this case | [
"Returns",
"an",
"image",
"with",
"reduced",
"opacity",
".",
"Converts",
"image",
"to",
"RGBA",
"if",
"needs",
"."
] | d9ce72a05477158520d70d70a99203b36fb66a30 | https://github.com/originell/sorl-watermark/blob/d9ce72a05477158520d70d70a99203b36fb66a30/sorl_watermarker/engines/pgmagick_engine.py#L48-L60 |
47,398 | ternaris/marv | marv/site.py | Site.cleanup_relations | def cleanup_relations(self):
"""Cleanup listing relations"""
collections = self.collections
for relation in [x for col in collections.values()
for x in col.model.relations.values()]:
db.session.query(relation)\
.filter(~relation.listing... | python | def cleanup_relations(self):
"""Cleanup listing relations"""
collections = self.collections
for relation in [x for col in collections.values()
for x in col.model.relations.values()]:
db.session.query(relation)\
.filter(~relation.listing... | [
"def",
"cleanup_relations",
"(",
"self",
")",
":",
"collections",
"=",
"self",
".",
"collections",
"for",
"relation",
"in",
"[",
"x",
"for",
"col",
"in",
"collections",
".",
"values",
"(",
")",
"for",
"x",
"in",
"col",
".",
"model",
".",
"relations",
"... | Cleanup listing relations | [
"Cleanup",
"listing",
"relations"
] | c221354d912ff869bbdb4f714a86a70be30d823e | https://github.com/ternaris/marv/blob/c221354d912ff869bbdb4f714a86a70be30d823e/marv/site.py#L261-L269 |
47,399 | ternaris/marv | marv/cli.py | marvcli_cleanup | def marvcli_cleanup(ctx, discarded, unused_tags):
"""Cleanup unused tags and discarded datasets."""
if not any([discarded, unused_tags]):
click.echo(ctx.get_help())
ctx.exit(1)
site = create_app().site
if discarded:
site.cleanup_discarded()
if unused_tags:
site.cle... | python | def marvcli_cleanup(ctx, discarded, unused_tags):
"""Cleanup unused tags and discarded datasets."""
if not any([discarded, unused_tags]):
click.echo(ctx.get_help())
ctx.exit(1)
site = create_app().site
if discarded:
site.cleanup_discarded()
if unused_tags:
site.cle... | [
"def",
"marvcli_cleanup",
"(",
"ctx",
",",
"discarded",
",",
"unused_tags",
")",
":",
"if",
"not",
"any",
"(",
"[",
"discarded",
",",
"unused_tags",
"]",
")",
":",
"click",
".",
"echo",
"(",
"ctx",
".",
"get_help",
"(",
")",
")",
"ctx",
".",
"exit",
... | Cleanup unused tags and discarded datasets. | [
"Cleanup",
"unused",
"tags",
"and",
"discarded",
"datasets",
"."
] | c221354d912ff869bbdb4f714a86a70be30d823e | https://github.com/ternaris/marv/blob/c221354d912ff869bbdb4f714a86a70be30d823e/marv/cli.py#L108-L121 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.