_id stringlengths 2 7 | title stringlengths 1 88 | partition stringclasses 3
values | text stringlengths 75 19.8k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q239500 | import_gssapi_extension | train | def import_gssapi_extension(name):
"""Import a GSSAPI extension module
This method imports a GSSAPI extension module based
on the name of the extension (not including the
'ext_' prefix). If the extension is not available,
the method retuns None.
Args:
name (str): the name of the exten... | python | {
"resource": ""
} |
q239501 | inquire_property | train | def inquire_property(name, doc=None):
"""Creates a property based on an inquire result
This method creates a property that calls the
:python:`_inquire` method, and return the value of the
requested information.
Args:
name (str): the name of the 'inquire' result information
Returns:
... | python | {
"resource": ""
} |
q239502 | _encode_dict | train | def _encode_dict(d):
"""Encodes any relevant strings in a dict"""
def enc(x):
if isinstance(x, six.text_type):
return x.encode(_ENCODING)
else:
return x
return dict((enc(k), enc(v)) for k, v in six.iteritems(d)) | python | {
"resource": ""
} |
q239503 | catch_and_return_token | train | def catch_and_return_token(func, self, *args, **kwargs):
"""Optionally defer exceptions and return a token instead
When `__DEFER_STEP_ERRORS__` is set on the implementing class
or instance, methods wrapped with this wrapper will
catch and save their :python:`GSSError` exceptions and
instead return ... | python | {
"resource": ""
} |
q239504 | check_last_err | train | def check_last_err(func, self, *args, **kwargs):
"""Check and raise deferred errors before running the function
This method checks :python:`_last_err` before running the wrapped
function. If present and not None, the exception will be raised
with its original traceback.
"""
if self._last_err ... | python | {
"resource": ""
} |
q239505 | velocity_graph | train | def velocity_graph(adata, basis=None, vkey='velocity', which_graph='velocity', n_neighbors=10,
alpha=.8, perc=90, edge_width=.2, edge_color='grey', color=None, use_raw=None, layer=None,
color_map=None, colorbar=True, palette=None, size=None, sort_order=True, groups=None,
... | python | {
"resource": ""
} |
q239506 | cleanup | train | def cleanup(data, clean='layers', keep=None, copy=False):
"""Deletes attributes not needed.
Arguments
---------
data: :class:`~anndata.AnnData`
Annotated data matrix.
clean: `str` or list of `str` (default: `layers`)
Which attributes to consider for freeing memory.
keep: `str` o... | python | {
"resource": ""
} |
q239507 | filter_genes | train | def filter_genes(data, min_counts=None, min_cells=None, max_counts=None, max_cells=None,
min_counts_u=None, min_cells_u=None, max_counts_u=None, max_cells_u=None,
min_shared_counts=None, min_shared_cells=None, copy=False):
"""Filter genes based on number of cells or counts.
Ke... | python | {
"resource": ""
} |
q239508 | filter_genes_dispersion | train | def filter_genes_dispersion(data, flavor='seurat', min_disp=None, max_disp=None, min_mean=None, max_mean=None,
n_bins=20, n_top_genes=None, log=True, copy=False):
"""Extract highly variable genes.
The normalized dispersion is obtained by scaling with the mean and standard
deviati... | python | {
"resource": ""
} |
q239509 | normalize_per_cell | train | def normalize_per_cell(data, counts_per_cell_after=None, counts_per_cell=None, key_n_counts=None,
max_proportion_per_cell=None, use_initial_size=True, layers=['spliced', 'unspliced'],
enforce=False, copy=False):
"""Normalize each cell by total counts over all genes.
... | python | {
"resource": ""
} |
q239510 | filter_and_normalize | train | def filter_and_normalize(data, min_counts=None, min_counts_u=None, min_cells=None, min_cells_u=None,
min_shared_counts=None, min_shared_cells=None, n_top_genes=None, flavor='seurat', log=True,
copy=False):
"""Filtering, normalization and log transform
Expects n... | python | {
"resource": ""
} |
q239511 | toy_data | train | def toy_data(n_obs):
"""
Randomly samples from the Dentate Gyrus dataset.
Arguments
---------
n_obs: `int`
Size of the sampled dataset
Returns
-------
Returns `adata` object
"""
"""Random samples from Dentate Gyrus.
"""
adata = dentategyrus()
indices = np.r... | python | {
"resource": ""
} |
q239512 | forebrain | train | def forebrain():
"""Developing human forebrain.
Forebrain tissue of a week 10 embryo, focusing on the glutamatergic neuronal lineage.
Returns
-------
Returns `adata` object
"""
filename = 'data/ForebrainGlut/hgForebrainGlut.loom'
url = 'http://pklab.med.harvard.edu/velocyto/hgForebrainG... | python | {
"resource": ""
} |
q239513 | set_rcParams_scvelo | train | def set_rcParams_scvelo(fontsize=8, color_map=None, frameon=None):
"""Set matplotlib.rcParams to scvelo defaults."""
# dpi options (mpl default: 100, 100)
rcParams['figure.dpi'] = 100
rcParams['savefig.dpi'] = 150
# figure (mpl default: 0.125, 0.96, 0.15, 0.91)
rcParams['figure.figsize'] = (7,... | python | {
"resource": ""
} |
q239514 | merge | train | def merge(adata, ldata, copy=True):
"""Merges two annotated data matrices.
Arguments
---------
adata: :class:`~anndata.AnnData`
Annotated data matrix (reference data set).
ldata: :class:`~anndata.AnnData`
Annotated data matrix (to be merged into adata).
Returns
-------
... | python | {
"resource": ""
} |
q239515 | velocity_graph | train | def velocity_graph(data, vkey='velocity', xkey='Ms', tkey=None, basis=None, n_neighbors=None, n_recurse_neighbors=None,
random_neighbors_at_max=None, sqrt_transform=False, approx=False, copy=False):
"""Computes velocity graph based on cosine similarities.
The cosine similarities are computed... | python | {
"resource": ""
} |
q239516 | optimize_NxN | train | def optimize_NxN(x, y, fit_offset=False, perc=None):
"""Just to compare with closed-form solution
"""
if perc is not None:
if not fit_offset and isinstance(perc, (list, tuple)): perc = perc[1]
weights = get_weight(x, y, perc).astype(bool)
if issparse(weights): weights = weights.A
... | python | {
"resource": ""
} |
q239517 | velocity_confidence | train | def velocity_confidence(data, vkey='velocity', copy=False):
"""Computes confidences of velocities.
Arguments
---------
data: :class:`~anndata.AnnData`
Annotated data matrix.
vkey: `str` (default: `'velocity'`)
Name of velocity estimates to be used.
copy: `bool` (default: `False`... | python | {
"resource": ""
} |
q239518 | velocity_confidence_transition | train | def velocity_confidence_transition(data, vkey='velocity', scale=10, copy=False):
"""Computes confidences of velocity transitions.
Arguments
---------
data: :class:`~anndata.AnnData`
Annotated data matrix.
vkey: `str` (default: `'velocity'`)
Name of velocity estimates to be used.
... | python | {
"resource": ""
} |
q239519 | cell_fate | train | def cell_fate(data, groupby='clusters', disconnected_groups=None, self_transitions=False, n_neighbors=None, copy=False):
"""Computes individual cell endpoints
Arguments
---------
data: :class:`~anndata.AnnData`
Annotated data matrix.
groupby: `str` (default: `'clusters'`)
Key to whi... | python | {
"resource": ""
} |
q239520 | moments | train | def moments(data, n_neighbors=30, n_pcs=30, mode='connectivities', method='umap', metric='euclidean', use_rep=None,
recurse_neighbors=False, renormalize=False, copy=False):
"""Computes moments for velocity estimation.
Arguments
---------
data: :class:`~anndata.AnnData`
Annotated dat... | python | {
"resource": ""
} |
q239521 | transition_matrix | train | def transition_matrix(adata, vkey='velocity', basis=None, backward=False, self_transitions=True, scale=10, perc=None,
use_negative_cosines=False, weight_diffusion=0, scale_diffusion=1, weight_indirect_neighbors=None,
n_neighbors=None, vgraph=None):
"""Computes transition ... | python | {
"resource": ""
} |
q239522 | Context.apply | train | def apply(self):
"""Apply the rules of the context to its occurrences.
This method executes all the functions defined in
self.tasks in the order they are listed.
Every function that acts as a context task receives the
Context object itself as its only argument.
The con... | python | {
"resource": ""
} |
q239523 | average_price | train | def average_price(quantity_1, price_1, quantity_2, price_2):
"""Calculates the average price between two asset states."""
return (quantity_1 * price_1 + quantity_2 * price_2) / \
(quantity_1 + quantity_2) | python | {
"resource": ""
} |
q239524 | Occurrence.update_holder | train | def update_holder(self, holder):
"""Udpate the Holder state according to the occurrence.
This implementation is a example of how a Occurrence object
can update the Holder state; this method should be overriden
by classes that inherit from the Occurrence class.
This sample imple... | python | {
"resource": ""
} |
q239525 | fitserver.fitter | train | def fitter(self, n=0, ftype="real", colfac=1.0e-8, lmfac=1.0e-3):
"""Create a sub-fitter.
The created sub-fitter can be used in the same way as a fitter
default fitter. This function returns an identification, which has to
be used in the `fid` argument of subsequent calls. The call can
... | python | {
"resource": ""
} |
q239526 | fitserver.done | train | def done(self, fid=0):
"""Terminates the fitserver."""
self._checkid(fid)
self._fitids[fid] = {}
self._fitproxy.done(fid) | python | {
"resource": ""
} |
q239527 | fitserver.reset | train | def reset(self, fid=0):
"""Reset the object's resources to its initialized state.
:param fid: the id of a sub-fitter
"""
self._checkid(fid)
self._fitids[fid]["solved"] = False
self._fitids[fid]["haserr"] = False
if not self._fitids[fid]["looped"]:
ret... | python | {
"resource": ""
} |
q239528 | fitserver.addconstraint | train | def addconstraint(self, x, y=0, fnct=None, fid=0):
"""Add constraint."""
self._checkid(fid)
i = 0
if "constraint" in self._fitids[fid]:
i = len(self._fitids[fid]["constraint"])
else:
self._fitids[fid]["constraint"] = {}
# dict key needs to be strin... | python | {
"resource": ""
} |
q239529 | fitserver.fitspoly | train | def fitspoly(self, n, x, y, sd=None, wt=1.0, fid=0):
"""Create normal equations from the specified condition equations, and
solve the resulting normal equations. It is in essence a combination.
The method expects that the properties of the fitter to be used have
been initialized or set ... | python | {
"resource": ""
} |
q239530 | fitserver.functional | train | def functional(self, fnct, x, y, sd=None, wt=1.0, mxit=50, fid=0):
"""Make a non-linear least squares solution.
This will make a non-linear least squares solution for the points
through the ordinates at the abscissa values, using the specified
`fnct`. Details can be found in the :meth:`... | python | {
"resource": ""
} |
q239531 | fitserver.linear | train | def linear(self, fnct, x, y, sd=None, wt=1.0, fid=0):
"""Make a linear least squares solution.
Makes a linear least squares solution for the points through the
ordinates at the x values, using the specified fnct. The x can be of
any dimension, depending on the number of arguments needed... | python | {
"resource": ""
} |
q239532 | fitserver.constraint | train | def constraint(self, n=-1, fid=0):
"""Obtain the set of orthogonal equations that make the solution of
the rank deficient normal equations possible.
:param fid: the id of the sub-fitter (numerical)
"""
c = self._getval("constr", fid)
if n < 0 or n > self.deficiency(fid)... | python | {
"resource": ""
} |
q239533 | fitserver.fitted | train | def fitted(self, fid=0):
"""Test if enough Levenberg-Marquardt loops have been done.
It returns True if no improvement possible.
:param fid: the id of the sub-fitter (numerical)
"""
self._checkid(fid)
return not (self._fitids[fid]["fit"] > 0
or self.... | python | {
"resource": ""
} |
q239534 | measures.set_data_path | train | def set_data_path(self, pth):
"""Set the location of the measures data directory.
:param pth: The absolute path to the measures data directory.
"""
if os.path.exists(pth):
if not os.path.exists(os.path.join(pth, 'data', 'geodetic')):
raise IOError("The given ... | python | {
"resource": ""
} |
q239535 | measures.asbaseline | train | def asbaseline(self, pos):
"""Convert a position measure into a baseline measure. No actual
baseline is calculated, since operations can be done on positions,
with subtractions to obtain baselines at a later stage.
:param pos: a position measure
:returns: a baseline measure
... | python | {
"resource": ""
} |
q239536 | measures.getvalue | train | def getvalue(self, v):
"""
Return a list of quantities making up the measures' value.
:param v: a measure
"""
if not is_measure(v):
raise TypeError('Incorrect input type for getvalue()')
import re
rx = re.compile("m\d+")
out = []
keys ... | python | {
"resource": ""
} |
q239537 | measures.doframe | train | def doframe(self, v):
"""This method will set the measure specified as part of a frame.
If conversion from one type to another is necessary (with the measure
function), the following frames should be set if one of the reference
types involved in the conversion is as in the following lis... | python | {
"resource": ""
} |
q239538 | addImagingColumns | train | def addImagingColumns(msname, ack=True):
""" Add the columns to an MS needed for the casa imager.
It adds the columns MODEL_DATA, CORRECTED_DATA, and IMAGING_WEIGHT.
It also sets the CHANNEL_SELECTION keyword needed for the older casa
imagers.
A column is not added if already existing.
"""
... | python | {
"resource": ""
} |
q239539 | addDerivedMSCal | train | def addDerivedMSCal(msname):
""" Add the derived columns like HA to an MS or CalTable.
It adds the columns HA, HA1, HA2, PA1, PA2, LAST, LAST1, LAST2, AZEL1,
AZEL2, and UVW_J2000.
They are all bound to the DerivedMSCal virtual data manager.
It fails if one of the columns already exists.
"""
... | python | {
"resource": ""
} |
q239540 | removeDerivedMSCal | train | def removeDerivedMSCal(msname):
""" Remove the derived columns like HA from an MS or CalTable.
It removes the columns using the data manager DerivedMSCal.
Such columns are HA, HA1, HA2, PA1, PA2, LAST, LAST1, LAST2, AZEL1,
AZEL2, and UVW_J2000.
It fails if one of the columns already exists.
"... | python | {
"resource": ""
} |
q239541 | msregularize | train | def msregularize(msname, newname):
""" Regularize an MS
The output MS will be such that it has the same number of baselines
for each time stamp. Where needed fully flagged rows are added.
Possibly missing rows are written into a separate MS <newname>-add.
It is concatenated with the original MS an... | python | {
"resource": ""
} |
q239542 | tablecolumn._repr_html_ | train | def _repr_html_(self):
"""Give a nice representation of columns in notebooks."""
out="<table class='taqltable'>\n"
# Print column name (not if it is auto-generated)
if not(self.name()[:4]=="Col_"):
out+="<tr>"
out+="<th><b>"+self.name()+"</b></th>"
ou... | python | {
"resource": ""
} |
q239543 | coordinatesystem._get_coordinatenames | train | def _get_coordinatenames(self):
"""Create ordered list of coordinate names
"""
validnames = ("direction", "spectral", "linear", "stokes", "tabular")
self._names = [""] * len(validnames)
n = 0
for key in self._csys.keys():
for name in validnames:
... | python | {
"resource": ""
} |
q239544 | directioncoordinate.set_projection | train | def set_projection(self, val):
"""Set the projection of the given axis in this coordinate.
The known projections are SIN, ZEA, TAN, NCP, AIT, ZEA
"""
knownproj = ["SIN", "ZEA", "TAN", "NCP", "AIT", "ZEA"] # etc
assert val.upper() in knownproj
self._coord["projection"] =... | python | {
"resource": ""
} |
q239545 | tablefromascii | train | def tablefromascii(tablename, asciifile,
headerfile='',
autoheader=False, autoshape=[],
columnnames=[], datatypes=[],
sep=' ',
commentmarker='',
firstline=1, lastline=-1,
readonly=True,
... | python | {
"resource": ""
} |
q239546 | makescacoldesc | train | def makescacoldesc(columnname, value,
datamanagertype='',
datamanagergroup='',
options=0, maxlen=0, comment='',
valuetype='', keywords={}):
"""Create description of a scalar column.
A description for a scalar column can be created from... | python | {
"resource": ""
} |
q239547 | makearrcoldesc | train | def makearrcoldesc(columnname, value, ndim=0,
shape=[], datamanagertype='',
datamanagergroup='',
options=0, maxlen=0, comment='',
valuetype='', keywords={}):
"""Create description of an array column.
A description for a scalar column c... | python | {
"resource": ""
} |
q239548 | maketabdesc | train | def maketabdesc(descs=[]):
"""Create a table description.
Creates a table description from a set of column descriptions. The
resulting table description can be used in the :class:`table` constructor.
For example::
scd1 = makescacoldesc("col2", "aa")
scd2 = makescacoldesc("col1", 1, "Incre... | python | {
"resource": ""
} |
q239549 | makedminfo | train | def makedminfo(tabdesc, group_spec=None):
"""Creates a data manager information object.
Create a data manager information dictionary outline from a table description.
The resulting dictionary is a bare outline and is available for the purposes of
further customising the data manager via the `group_spec` argume... | python | {
"resource": ""
} |
q239550 | tabledefinehypercolumn | train | def tabledefinehypercolumn(tabdesc,
name, ndim, datacolumns,
coordcolumns=False,
idcolumns=False):
"""Add a hypercolumn to a table description.
It defines a hypercolumn and adds it the given table description.
A hypercolumn is... | python | {
"resource": ""
} |
q239551 | tabledelete | train | def tabledelete(tablename, checksubtables=False, ack=True):
"""Delete a table on disk.
It is the same as :func:`table.delete`, but without the need to open
the table first.
"""
tabname = _remove_prefix(tablename)
t = table(tabname, ack=False)
if t.ismultiused(checksubtables):
six.p... | python | {
"resource": ""
} |
q239552 | tableexists | train | def tableexists(tablename):
"""Test if a table exists."""
result = True
try:
t = table(tablename, ack=False)
except:
result = False
return result | python | {
"resource": ""
} |
q239553 | tableiswritable | train | def tableiswritable(tablename):
"""Test if a table is writable."""
result = True
try:
t = table(tablename, readonly=False, ack=False)
result = t.iswritable()
except:
result = False
return result | python | {
"resource": ""
} |
q239554 | tablestructure | train | def tablestructure(tablename, dataman=True, column=True, subtable=False,
sort=False):
"""Print the structure of a table.
It is the same as :func:`table.showstructure`, but without the need to open
the table first.
"""
t = table(tablename, ack=False)
six.print_(t.showstructur... | python | {
"resource": ""
} |
q239555 | image.attrget | train | def attrget(self, groupname, attrname, rownr):
"""Get the value of an attribute in the given row in a group."""
return self._attrget(groupname, attrname, rownr) | python | {
"resource": ""
} |
q239556 | image.attrgetcol | train | def attrgetcol(self, groupname, attrname):
"""Get the value of an attribute for all rows in a group."""
values = []
for rownr in range(self.attrnrows(groupname)):
values.append(self.attrget(groupname, attrname, rownr))
return values | python | {
"resource": ""
} |
q239557 | image.attrfindrows | train | def attrfindrows(self, groupname, attrname, value):
"""Get the row numbers of all rows where the attribute matches the given value."""
values = self.attrgetcol(groupname, attrname)
return [i for i in range(len(values)) if values[i] == value] | python | {
"resource": ""
} |
q239558 | image.attrgetrow | train | def attrgetrow(self, groupname, key, value=None):
"""Get the values of all attributes of a row in a group.
If the key is an integer, the key is the row number for which
the attribute values have to be returned.
Otherwise the key has to be a string and it defines the name of an
... | python | {
"resource": ""
} |
q239559 | image.attrput | train | def attrput(self, groupname, attrname, rownr, value, unit=[], meas=[]):
"""Put the value and optionally unit and measinfo
of an attribute in a row in a group."""
return self._attrput(groupname, attrname, rownr, value, unit, meas) | python | {
"resource": ""
} |
q239560 | image.getdata | train | def getdata(self, blc=(), trc=(), inc=()):
"""Get image data.
Using the arguments blc (bottom left corner), trc (top right corner),
and inc (stride) it is possible to get a data slice.
The data is returned as a numpy array. Its dimensionality is the same
as the dimensionality o... | python | {
"resource": ""
} |
q239561 | image.getmask | train | def getmask(self, blc=(), trc=(), inc=()):
"""Get image mask.
Using the arguments blc (bottom left corner), trc (top right corner),
and inc (stride) it is possible to get a mask slice. Not all axes
need to be specified. Missing values default to begin, end, and 1.
The mask is r... | python | {
"resource": ""
} |
q239562 | image.get | train | def get(self, blc=(), trc=(), inc=()):
"""Get image data and mask.
Get the image data and mask (see ::func:`getdata` and :func:`getmask`)
as a numpy masked array.
"""
return nma.masked_array(self.getdata(blc, trc, inc),
self.getmask(blc, trc, inc... | python | {
"resource": ""
} |
q239563 | image.putdata | train | def putdata(self, value, blc=(), trc=(), inc=()):
"""Put image data.
Using the arguments blc (bottom left corner), trc (top right corner),
and inc (stride) it is possible to put a data slice. Not all axes
need to be specified. Missing values default to begin, end, and 1.
The da... | python | {
"resource": ""
} |
q239564 | image.putmask | train | def putmask(self, value, blc=(), trc=(), inc=()):
"""Put image mask.
Using the arguments blc (bottom left corner), trc (top right corner),
and inc (stride) it is possible to put a data slice. Not all axes
need to be specified. Missing values default to begin, end, and 1.
The da... | python | {
"resource": ""
} |
q239565 | image.put | train | def put(self, value, blc=(), trc=(), inc=()):
"""Put image data and mask.
Put the image data and optionally the mask (see ::func:`getdata`
and :func:`getmask`).
If the `value` argument is a numpy masked array, but data and mask will
bw written. If it is a normal numpy array, onl... | python | {
"resource": ""
} |
q239566 | image.subimage | train | def subimage(self, blc=(), trc=(), inc=(), dropdegenerate=True):
"""Form a subimage.
An image object containing a subset of an image is returned.
The arguments blc (bottom left corner), trc (top right corner),
and inc (stride) define the subset. Not all axes need to be specified.
... | python | {
"resource": ""
} |
q239567 | image.info | train | def info(self):
"""Get coordinates, image info, and unit"."""
return {'coordinates': self._coordinates(),
'imageinfo': self._imageinfo(),
'miscinfo': self._miscinfo(),
'unit': self._unit()
} | python | {
"resource": ""
} |
q239568 | image.tofits | train | def tofits(self, filename, overwrite=True, velocity=True,
optical=True, bitpix=-32, minpix=1, maxpix=-1):
"""Write the image to a file in FITS format.
`filename`
FITS file name
`overwrite`
If False, an exception is raised if the new image file already exists.
... | python | {
"resource": ""
} |
q239569 | image.saveas | train | def saveas(self, filename, overwrite=True, hdf5=False,
copymask=True, newmaskname="", newtileshape=()):
"""Write the image to disk.
Note that the created disk file is a snapshot, so it is not updated
for possible later changes in the image object.
`overwrite`
I... | python | {
"resource": ""
} |
q239570 | image.statistics | train | def statistics(self, axes=(), minmaxvalues=(), exclude=False, robust=True):
"""Calculate statistics for the image.
Statistics are returned in a dict for the given axes.
E.g. if axes [0,1] is given in a 3-dim image, the statistics are
calculated for each plane along the 3rd axis. By defa... | python | {
"resource": ""
} |
q239571 | image.regrid | train | def regrid(self, axes, coordsys, outname="", overwrite=True,
outshape=(), interpolation="linear",
decimate=10, replicate=False,
refchange=True, forceregrid=False):
"""Regrid the image to a new image object.
Regrid the image on the given axes to the given co... | python | {
"resource": ""
} |
q239572 | image.view | train | def view(self, tempname='/tmp/tempimage'):
"""Display the image using casaviewer.
If the image is not persistent, a copy will be made that the user
has to delete once viewing has finished. The name of the copy can be
given in argument `tempname`. Default is '/tmp/tempimage'.
""... | python | {
"resource": ""
} |
q239573 | find_library_file | train | def find_library_file(libname):
"""
Try to get the directory of the specified library.
It adds to the search path the library paths given to distutil's build_ext.
"""
# Use a dummy argument parser to get user specified library dirs
parser = argparse.ArgumentParser(add_help=False)
parser.add_... | python | {
"resource": ""
} |
q239574 | find_boost | train | def find_boost():
"""Find the name of the boost-python library. Returns None if none is found."""
short_version = "{}{}".format(sys.version_info[0], sys.version_info[1])
boostlibnames = ['boost_python-py' + short_version,
'boost_python' + short_version,
'boost_pytho... | python | {
"resource": ""
} |
q239575 | _tablerow.put | train | def put(self, rownr, value, matchingfields=True):
"""Put the values into the given row.
The value should be a dict (as returned by method :func:`get`.
The names of the fields in the dict should match the names of the
columns used in the `tablerow` object.
`matchingfields=True` ... | python | {
"resource": ""
} |
q239576 | quantity | train | def quantity(*args):
"""Create a quantity. This can be from a scalar or vector.
Example::
q1 = quantity(1.0, "km/s")
q2 = quantity("1km/s")
q1 = quantity([1.0,2.0], "km/s")
"""
if len(args) == 1:
if isinstance(args[0], str):
# use copy constructor to create quant... | python | {
"resource": ""
} |
q239577 | getvariable | train | def getvariable(name):
"""Get the value of a local variable somewhere in the call stack."""
import inspect
fr = inspect.currentframe()
try:
while fr:
fr = fr.f_back
vars = fr.f_locals
if name in vars:
return vars[name]
except:
pass
... | python | {
"resource": ""
} |
q239578 | substitute | train | def substitute(s, objlist=(), globals={}, locals={}):
"""Substitute global python variables in a command string.
This function parses a string and tries to substitute parts like
`$name` by their value. It is uses by :mod:`image` and :mod:`table`
to handle image and table objects in a command, but also ... | python | {
"resource": ""
} |
q239579 | taql | train | def taql(command, style='Python', tables=[], globals={}, locals={}):
"""Execute a TaQL command and return a table object.
A `TaQL <../../doc/199.html>`_
command is an SQL-like command to do a selection of rows and/or
columns in a table.
The default style used in a TaQL command is python, which mea... | python | {
"resource": ""
} |
q239580 | table.iter | train | def iter(self, columnnames, order='', sort=True):
"""Return a tableiter object.
:class:`tableiter` lets one iterate over a table by returning in each
iteration step a reference table containing equal values for the given
columns.
By default a sort is done on the given columns to... | python | {
"resource": ""
} |
q239581 | table.index | train | def index(self, columnnames, sort=True):
"""Return a tableindex object.
:class:`tableindex` lets one get the row numbers of the rows holding
given values for the columns for which the index is created.
It uses an in-memory index on which a binary search is done.
By default the t... | python | {
"resource": ""
} |
q239582 | table.toascii | train | def toascii(self, asciifile, headerfile='', columnnames=(), sep=' ',
precision=(), usebrackets=True):
"""Write the table in ASCII format.
It is approximately the inverse of the from-ASCII-contructor.
`asciifile`
The name of the resulting ASCII file.
`headerfil... | python | {
"resource": ""
} |
q239583 | table.copy | train | def copy(self, newtablename, deep=False, valuecopy=False, dminfo={},
endian='aipsrc', memorytable=False, copynorows=False):
"""Copy the table and return a table object for the copy.
It copies all data in the columns and keywords.
Besides the table, all its subtables are copied too.... | python | {
"resource": ""
} |
q239584 | table.copyrows | train | def copyrows(self, outtable, startrowin=0, startrowout=-1, nrow=-1):
"""Copy the contents of rows from this table to outtable.
The contents of the columns with matching names are copied.
The other arguments can be used to specify where to start copying.
By default the entire input table... | python | {
"resource": ""
} |
q239585 | table.rownumbers | train | def rownumbers(self, table=None):
"""Return a list containing the row numbers of this table.
This method can be useful after a selection or a sort.
It returns the row numbers of the rows in this table with respect
to the given table. If no table is given, the original table is used.
... | python | {
"resource": ""
} |
q239586 | table.getcolshapestring | train | def getcolshapestring(self, columnname,
startrow=0, nrow=-1, rowincr=1):
"""Get the shapes of all cells in the column in string format.
It returns the shape in a string like [10,20,30].
If the column contains fixed shape arrays, a single shape is returned.
Oth... | python | {
"resource": ""
} |
q239587 | table.getcellnp | train | def getcellnp(self, columnname, rownr, nparray):
"""Get data from a column cell into the given numpy array .
Get the contents of a cell containing an array into the
given numpy array. The numpy array has to be C-contiguous
with a shape matching the shape of the column cell.
Data... | python | {
"resource": ""
} |
q239588 | table.getcellslice | train | def getcellslice(self, columnname, rownr, blc, trc, inc=[]):
"""Get a slice from a column cell holding an array.
The columnname and (0-relative) rownr indicate the table cell.
The slice to get is defined by the blc, trc, and optional inc arguments
(blc = bottom-left corner, trc=top-rig... | python | {
"resource": ""
} |
q239589 | table.getcellslicenp | train | def getcellslicenp(self, columnname, nparray, rownr, blc, trc, inc=[]):
"""Get a slice from a column cell into the given numpy array.
The columnname and (0-relative) rownr indicate the table cell.
The numpy array has to be C-contiguous with a shape matching the
shape of the slice. Data... | python | {
"resource": ""
} |
q239590 | table.getcolnp | train | def getcolnp(self, columnname, nparray, startrow=0, nrow=-1, rowincr=1):
"""Get the contents of a column or part of it into the given
numpy array.
The numpy array has to be C-contiguous with a shape matching the
shape of the column (part). Data type coercion will be done as needed.
... | python | {
"resource": ""
} |
q239591 | table.getcolslice | train | def getcolslice(self, columnname, blc, trc, inc=[],
startrow=0, nrow=-1, rowincr=1):
"""Get a slice from a table column holding arrays.
The slice in each array is given by blc, trc, and inc
(as in getcellslice).
The column can be sliced by giving a start row (default... | python | {
"resource": ""
} |
q239592 | table.getcolslicenp | train | def getcolslicenp(self, columnname, nparray, blc, trc, inc=[],
startrow=0, nrow=-1, rowincr=1):
"""Get a slice from a table column into the given numpy array.
The numpy array has to be C-contiguous with a shape matching the
shape of the column (slice). Data type coercion w... | python | {
"resource": ""
} |
q239593 | table.putcell | train | def putcell(self, columnname, rownr, value):
"""Put a value into one or more table cells.
The columnname and (0-relative) rownrs indicate the table cells.
rownr can be a single row number or a sequence of row numbers.
If multiple rownrs are given, the given value is put in all those ro... | python | {
"resource": ""
} |
q239594 | table.putcellslice | train | def putcellslice(self, columnname, rownr, value, blc, trc, inc=[]):
"""Put into a slice of a table cell holding an array.
The columnname and (0-relative) rownr indicate the table cell.
Unlike putcell only a single row can be given.
The slice to put is defined by the blc, trc, and optio... | python | {
"resource": ""
} |
q239595 | table.putcolslice | train | def putcolslice(self, columnname, value, blc, trc, inc=[],
startrow=0, nrow=-1, rowincr=1):
"""Put into a slice in a table column holding arrays.
Its arguments are the same as for getcolslice and putcellslice.
"""
self._putcolslice(columnname, value, blc, trc, inc,
... | python | {
"resource": ""
} |
q239596 | table.addcols | train | def addcols(self, desc, dminfo={}, addtoparent=True):
"""Add one or more columns.
Columns can always be added to a normal table.
They can also be added to a reference table and optionally to its
parent table.
`desc`
contains a description of the column(s) to be added.... | python | {
"resource": ""
} |
q239597 | table.renamecol | train | def renamecol(self, oldname, newname):
"""Rename a single table column.
Renaming a column in a reference table does NOT rename the column in
the referenced table.
"""
self._renamecol(oldname, newname)
self._makerow() | python | {
"resource": ""
} |
q239598 | table.fieldnames | train | def fieldnames(self, keyword=''):
"""Get the names of the fields in a table keyword value.
The value of a keyword can be a struct (python dict). This method
returns the names of the fields in that struct.
Each field in a struct can be a struct in itself. Names of fields in a
sub... | python | {
"resource": ""
} |
q239599 | table.colfieldnames | train | def colfieldnames(self, columnname, keyword=''):
"""Get the names of the fields in a column keyword value.
The value of a keyword can be a struct (python dict). This method
returns the names of the fields in that struct.
Each field in a struct can be a struct in itself. Names of fields ... | python | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.