partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
train | MOC.add_neighbours | Extends the MOC instance so that it includes the HEALPix cells touching its border.
The depth of the HEALPix cells added at the border is equal to the maximum depth of the MOC instance.
Returns
-------
moc : `~mocpy.moc.MOC`
self extended by one degree of neighbours. | mocpy/moc/moc.py | def add_neighbours(self):
"""
Extends the MOC instance so that it includes the HEALPix cells touching its border.
The depth of the HEALPix cells added at the border is equal to the maximum depth of the MOC instance.
Returns
-------
moc : `~mocpy.moc.MOC`
sel... | def add_neighbours(self):
"""
Extends the MOC instance so that it includes the HEALPix cells touching its border.
The depth of the HEALPix cells added at the border is equal to the maximum depth of the MOC instance.
Returns
-------
moc : `~mocpy.moc.MOC`
sel... | [
"Extends",
"the",
"MOC",
"instance",
"so",
"that",
"it",
"includes",
"the",
"HEALPix",
"cells",
"touching",
"its",
"border",
"."
] | cds-astro/mocpy | python | https://github.com/cds-astro/mocpy/blob/09472cabe537f6bfdb049eeea64d3ea57b391c21/mocpy/moc/moc.py#L124-L151 | [
"def",
"add_neighbours",
"(",
"self",
")",
":",
"# Get the pixels array of the MOC at the its max order.",
"ipix",
"=",
"self",
".",
"_best_res_pixels",
"(",
")",
"hp",
"=",
"HEALPix",
"(",
"nside",
"=",
"(",
"1",
"<<",
"self",
".",
"max_order",
")",
",",
"ord... | 09472cabe537f6bfdb049eeea64d3ea57b391c21 |
train | MOC.remove_neighbours | Removes from the MOC instance the HEALPix cells located at its border.
The depth of the HEALPix cells removed is equal to the maximum depth of the MOC instance.
Returns
-------
moc : `~mocpy.moc.MOC`
self minus its HEALPix cells located at its border. | mocpy/moc/moc.py | def remove_neighbours(self):
"""
Removes from the MOC instance the HEALPix cells located at its border.
The depth of the HEALPix cells removed is equal to the maximum depth of the MOC instance.
Returns
-------
moc : `~mocpy.moc.MOC`
self minus its HEALPix ce... | def remove_neighbours(self):
"""
Removes from the MOC instance the HEALPix cells located at its border.
The depth of the HEALPix cells removed is equal to the maximum depth of the MOC instance.
Returns
-------
moc : `~mocpy.moc.MOC`
self minus its HEALPix ce... | [
"Removes",
"from",
"the",
"MOC",
"instance",
"the",
"HEALPix",
"cells",
"located",
"at",
"its",
"border",
"."
] | cds-astro/mocpy | python | https://github.com/cds-astro/mocpy/blob/09472cabe537f6bfdb049eeea64d3ea57b391c21/mocpy/moc/moc.py#L153-L182 | [
"def",
"remove_neighbours",
"(",
"self",
")",
":",
"# Get the HEALPix cells of the MOC at its max depth",
"ipix",
"=",
"self",
".",
"_best_res_pixels",
"(",
")",
"hp",
"=",
"HEALPix",
"(",
"nside",
"=",
"(",
"1",
"<<",
"self",
".",
"max_order",
")",
",",
"orde... | 09472cabe537f6bfdb049eeea64d3ea57b391c21 |
train | MOC.fill | Draws the MOC on a matplotlib axis.
This performs the projection of the cells from the world coordinate system to the pixel image coordinate system.
You are able to specify various styling kwargs for `matplotlib.patches.PathPatch`
(see the `list of valid keywords <https://matplotlib.org/api/_as... | mocpy/moc/moc.py | def fill(self, ax, wcs, **kw_mpl_pathpatch):
"""
Draws the MOC on a matplotlib axis.
This performs the projection of the cells from the world coordinate system to the pixel image coordinate system.
You are able to specify various styling kwargs for `matplotlib.patches.PathPatch`
... | def fill(self, ax, wcs, **kw_mpl_pathpatch):
"""
Draws the MOC on a matplotlib axis.
This performs the projection of the cells from the world coordinate system to the pixel image coordinate system.
You are able to specify various styling kwargs for `matplotlib.patches.PathPatch`
... | [
"Draws",
"the",
"MOC",
"on",
"a",
"matplotlib",
"axis",
"."
] | cds-astro/mocpy | python | https://github.com/cds-astro/mocpy/blob/09472cabe537f6bfdb049eeea64d3ea57b391c21/mocpy/moc/moc.py#L184-L229 | [
"def",
"fill",
"(",
"self",
",",
"ax",
",",
"wcs",
",",
"*",
"*",
"kw_mpl_pathpatch",
")",
":",
"fill",
".",
"fill",
"(",
"self",
",",
"ax",
",",
"wcs",
",",
"*",
"*",
"kw_mpl_pathpatch",
")"
] | 09472cabe537f6bfdb049eeea64d3ea57b391c21 |
train | MOC.border | Draws the MOC border(s) on a matplotlib axis.
This performs the projection of the sky coordinates defining the perimeter of the MOC to the pixel image coordinate system.
You are able to specify various styling kwargs for `matplotlib.patches.PathPatch`
(see the `list of valid keywords <https://... | mocpy/moc/moc.py | def border(self, ax, wcs, **kw_mpl_pathpatch):
"""
Draws the MOC border(s) on a matplotlib axis.
This performs the projection of the sky coordinates defining the perimeter of the MOC to the pixel image coordinate system.
You are able to specify various styling kwargs for `matplotlib.pat... | def border(self, ax, wcs, **kw_mpl_pathpatch):
"""
Draws the MOC border(s) on a matplotlib axis.
This performs the projection of the sky coordinates defining the perimeter of the MOC to the pixel image coordinate system.
You are able to specify various styling kwargs for `matplotlib.pat... | [
"Draws",
"the",
"MOC",
"border",
"(",
"s",
")",
"on",
"a",
"matplotlib",
"axis",
"."
] | cds-astro/mocpy | python | https://github.com/cds-astro/mocpy/blob/09472cabe537f6bfdb049eeea64d3ea57b391c21/mocpy/moc/moc.py#L231-L273 | [
"def",
"border",
"(",
"self",
",",
"ax",
",",
"wcs",
",",
"*",
"*",
"kw_mpl_pathpatch",
")",
":",
"border",
".",
"border",
"(",
"self",
",",
"ax",
",",
"wcs",
",",
"*",
"*",
"kw_mpl_pathpatch",
")"
] | 09472cabe537f6bfdb049eeea64d3ea57b391c21 |
train | MOC.from_image | Creates a `~mocpy.moc.MOC` from an image stored as a FITS file.
Parameters
----------
header : `astropy.io.fits.Header`
FITS header containing all the info of where the image is located (position, size, etc...)
max_norder : int
The moc resolution.
mask : ... | mocpy/moc/moc.py | def from_image(cls, header, max_norder, mask=None):
"""
Creates a `~mocpy.moc.MOC` from an image stored as a FITS file.
Parameters
----------
header : `astropy.io.fits.Header`
FITS header containing all the info of where the image is located (position, size, etc...)
... | def from_image(cls, header, max_norder, mask=None):
"""
Creates a `~mocpy.moc.MOC` from an image stored as a FITS file.
Parameters
----------
header : `astropy.io.fits.Header`
FITS header containing all the info of where the image is located (position, size, etc...)
... | [
"Creates",
"a",
"~mocpy",
".",
"moc",
".",
"MOC",
"from",
"an",
"image",
"stored",
"as",
"a",
"FITS",
"file",
"."
] | cds-astro/mocpy | python | https://github.com/cds-astro/mocpy/blob/09472cabe537f6bfdb049eeea64d3ea57b391c21/mocpy/moc/moc.py#L299-L359 | [
"def",
"from_image",
"(",
"cls",
",",
"header",
",",
"max_norder",
",",
"mask",
"=",
"None",
")",
":",
"# load the image data",
"height",
"=",
"header",
"[",
"'NAXIS2'",
"]",
"width",
"=",
"header",
"[",
"'NAXIS1'",
"]",
"# use wcs from astropy to locate the ima... | 09472cabe537f6bfdb049eeea64d3ea57b391c21 |
train | MOC.from_fits_images | Loads a MOC from a set of FITS file images.
Parameters
----------
path_l : [str]
A list of path where the fits image are located.
max_norder : int
The MOC resolution.
Returns
-------
moc : `~mocpy.moc.MOC`
The union of all the... | mocpy/moc/moc.py | def from_fits_images(cls, path_l, max_norder):
"""
Loads a MOC from a set of FITS file images.
Parameters
----------
path_l : [str]
A list of path where the fits image are located.
max_norder : int
The MOC resolution.
Returns
----... | def from_fits_images(cls, path_l, max_norder):
"""
Loads a MOC from a set of FITS file images.
Parameters
----------
path_l : [str]
A list of path where the fits image are located.
max_norder : int
The MOC resolution.
Returns
----... | [
"Loads",
"a",
"MOC",
"from",
"a",
"set",
"of",
"FITS",
"file",
"images",
"."
] | cds-astro/mocpy | python | https://github.com/cds-astro/mocpy/blob/09472cabe537f6bfdb049eeea64d3ea57b391c21/mocpy/moc/moc.py#L362-L384 | [
"def",
"from_fits_images",
"(",
"cls",
",",
"path_l",
",",
"max_norder",
")",
":",
"moc",
"=",
"MOC",
"(",
")",
"for",
"path",
"in",
"path_l",
":",
"header",
"=",
"fits",
".",
"getheader",
"(",
"path",
")",
"current_moc",
"=",
"MOC",
".",
"from_image",... | 09472cabe537f6bfdb049eeea64d3ea57b391c21 |
train | MOC.from_vizier_table | Creates a `~mocpy.moc.MOC` object from a VizieR table.
**Info**: This method is already implemented in `astroquery.cds <https://astroquery.readthedocs.io/en/latest/cds/cds.html>`__. You can ask to get a `mocpy.moc.MOC` object
from a vizier catalog ID.
Parameters
----------
tabl... | mocpy/moc/moc.py | def from_vizier_table(cls, table_id, nside=256):
"""
Creates a `~mocpy.moc.MOC` object from a VizieR table.
**Info**: This method is already implemented in `astroquery.cds <https://astroquery.readthedocs.io/en/latest/cds/cds.html>`__. You can ask to get a `mocpy.moc.MOC` object
from a v... | def from_vizier_table(cls, table_id, nside=256):
"""
Creates a `~mocpy.moc.MOC` object from a VizieR table.
**Info**: This method is already implemented in `astroquery.cds <https://astroquery.readthedocs.io/en/latest/cds/cds.html>`__. You can ask to get a `mocpy.moc.MOC` object
from a v... | [
"Creates",
"a",
"~mocpy",
".",
"moc",
".",
"MOC",
"object",
"from",
"a",
"VizieR",
"table",
"."
] | cds-astro/mocpy | python | https://github.com/cds-astro/mocpy/blob/09472cabe537f6bfdb049eeea64d3ea57b391c21/mocpy/moc/moc.py#L387-L411 | [
"def",
"from_vizier_table",
"(",
"cls",
",",
"table_id",
",",
"nside",
"=",
"256",
")",
":",
"nside_possible_values",
"=",
"(",
"8",
",",
"16",
",",
"32",
",",
"64",
",",
"128",
",",
"256",
",",
"512",
")",
"if",
"nside",
"not",
"in",
"nside_possible... | 09472cabe537f6bfdb049eeea64d3ea57b391c21 |
train | MOC.from_ivorn | Creates a `~mocpy.moc.MOC` object from a given ivorn.
Parameters
----------
ivorn : str
nside : int, optional
256 by default
Returns
-------
result : `~mocpy.moc.MOC`
The resulting MOC. | mocpy/moc/moc.py | def from_ivorn(cls, ivorn, nside=256):
"""
Creates a `~mocpy.moc.MOC` object from a given ivorn.
Parameters
----------
ivorn : str
nside : int, optional
256 by default
Returns
-------
result : `~mocpy.moc.MOC`
The resultin... | def from_ivorn(cls, ivorn, nside=256):
"""
Creates a `~mocpy.moc.MOC` object from a given ivorn.
Parameters
----------
ivorn : str
nside : int, optional
256 by default
Returns
-------
result : `~mocpy.moc.MOC`
The resultin... | [
"Creates",
"a",
"~mocpy",
".",
"moc",
".",
"MOC",
"object",
"from",
"a",
"given",
"ivorn",
"."
] | cds-astro/mocpy | python | https://github.com/cds-astro/mocpy/blob/09472cabe537f6bfdb049eeea64d3ea57b391c21/mocpy/moc/moc.py#L416-L436 | [
"def",
"from_ivorn",
"(",
"cls",
",",
"ivorn",
",",
"nside",
"=",
"256",
")",
":",
"return",
"cls",
".",
"from_url",
"(",
"'%s?%s'",
"%",
"(",
"MOC",
".",
"MOC_SERVER_ROOT_URL",
",",
"urlencode",
"(",
"{",
"'ivorn'",
":",
"ivorn",
",",
"'get'",
":",
... | 09472cabe537f6bfdb049eeea64d3ea57b391c21 |
train | MOC.from_url | Creates a `~mocpy.moc.MOC` object from a given url.
Parameters
----------
url : str
The url of a FITS file storing a MOC.
Returns
-------
result : `~mocpy.moc.MOC`
The resulting MOC. | mocpy/moc/moc.py | def from_url(cls, url):
"""
Creates a `~mocpy.moc.MOC` object from a given url.
Parameters
----------
url : str
The url of a FITS file storing a MOC.
Returns
-------
result : `~mocpy.moc.MOC`
The resulting MOC.
"""
... | def from_url(cls, url):
"""
Creates a `~mocpy.moc.MOC` object from a given url.
Parameters
----------
url : str
The url of a FITS file storing a MOC.
Returns
-------
result : `~mocpy.moc.MOC`
The resulting MOC.
"""
... | [
"Creates",
"a",
"~mocpy",
".",
"moc",
".",
"MOC",
"object",
"from",
"a",
"given",
"url",
"."
] | cds-astro/mocpy | python | https://github.com/cds-astro/mocpy/blob/09472cabe537f6bfdb049eeea64d3ea57b391c21/mocpy/moc/moc.py#L439-L454 | [
"def",
"from_url",
"(",
"cls",
",",
"url",
")",
":",
"path",
"=",
"download_file",
"(",
"url",
",",
"show_progress",
"=",
"False",
",",
"timeout",
"=",
"60",
")",
"return",
"cls",
".",
"from_fits",
"(",
"path",
")"
] | 09472cabe537f6bfdb049eeea64d3ea57b391c21 |
train | MOC.from_skycoords | Creates a MOC from an `astropy.coordinates.SkyCoord`.
Parameters
----------
skycoords : `astropy.coordinates.SkyCoord`
The sky coordinates that will belong to the MOC.
max_norder : int
The depth of the smallest HEALPix cells contained in the MOC.
... | mocpy/moc/moc.py | def from_skycoords(cls, skycoords, max_norder):
"""
Creates a MOC from an `astropy.coordinates.SkyCoord`.
Parameters
----------
skycoords : `astropy.coordinates.SkyCoord`
The sky coordinates that will belong to the MOC.
max_norder : int
The depth ... | def from_skycoords(cls, skycoords, max_norder):
"""
Creates a MOC from an `astropy.coordinates.SkyCoord`.
Parameters
----------
skycoords : `astropy.coordinates.SkyCoord`
The sky coordinates that will belong to the MOC.
max_norder : int
The depth ... | [
"Creates",
"a",
"MOC",
"from",
"an",
"astropy",
".",
"coordinates",
".",
"SkyCoord",
"."
] | cds-astro/mocpy | python | https://github.com/cds-astro/mocpy/blob/09472cabe537f6bfdb049eeea64d3ea57b391c21/mocpy/moc/moc.py#L457-L480 | [
"def",
"from_skycoords",
"(",
"cls",
",",
"skycoords",
",",
"max_norder",
")",
":",
"hp",
"=",
"HEALPix",
"(",
"nside",
"=",
"(",
"1",
"<<",
"max_norder",
")",
",",
"order",
"=",
"'nested'",
")",
"ipix",
"=",
"hp",
".",
"lonlat_to_healpix",
"(",
"skyco... | 09472cabe537f6bfdb049eeea64d3ea57b391c21 |
train | MOC.from_lonlat | Creates a MOC from astropy lon, lat `astropy.units.Quantity`.
Parameters
----------
lon : `astropy.units.Quantity`
The longitudes of the sky coordinates belonging to the MOC.
lat : `astropy.units.Quantity`
The latitudes of the sky coordinates belonging to... | mocpy/moc/moc.py | def from_lonlat(cls, lon, lat, max_norder):
"""
Creates a MOC from astropy lon, lat `astropy.units.Quantity`.
Parameters
----------
lon : `astropy.units.Quantity`
The longitudes of the sky coordinates belonging to the MOC.
lat : `astropy.units.Quantit... | def from_lonlat(cls, lon, lat, max_norder):
"""
Creates a MOC from astropy lon, lat `astropy.units.Quantity`.
Parameters
----------
lon : `astropy.units.Quantity`
The longitudes of the sky coordinates belonging to the MOC.
lat : `astropy.units.Quantit... | [
"Creates",
"a",
"MOC",
"from",
"astropy",
"lon",
"lat",
"astropy",
".",
"units",
".",
"Quantity",
".",
"Parameters",
"----------",
"lon",
":",
"astropy",
".",
"units",
".",
"Quantity",
"The",
"longitudes",
"of",
"the",
"sky",
"coordinates",
"belonging",
"to"... | cds-astro/mocpy | python | https://github.com/cds-astro/mocpy/blob/09472cabe537f6bfdb049eeea64d3ea57b391c21/mocpy/moc/moc.py#L483-L508 | [
"def",
"from_lonlat",
"(",
"cls",
",",
"lon",
",",
"lat",
",",
"max_norder",
")",
":",
"hp",
"=",
"HEALPix",
"(",
"nside",
"=",
"(",
"1",
"<<",
"max_norder",
")",
",",
"order",
"=",
"'nested'",
")",
"ipix",
"=",
"hp",
".",
"lonlat_to_healpix",
"(",
... | 09472cabe537f6bfdb049eeea64d3ea57b391c21 |
train | MOC.from_polygon_skycoord | Creates a MOC from a polygon.
The polygon is given as an `astropy.coordinates.SkyCoord` that contains the
vertices of the polygon. Concave and convex polygons are accepted but
self-intersecting ones are currently not properly handled.
Parameters
----------
skycoord : `... | mocpy/moc/moc.py | def from_polygon_skycoord(cls, skycoord, inside=None, max_depth=10):
"""
Creates a MOC from a polygon.
The polygon is given as an `astropy.coordinates.SkyCoord` that contains the
vertices of the polygon. Concave and convex polygons are accepted but
self-intersecting ones are cu... | def from_polygon_skycoord(cls, skycoord, inside=None, max_depth=10):
"""
Creates a MOC from a polygon.
The polygon is given as an `astropy.coordinates.SkyCoord` that contains the
vertices of the polygon. Concave and convex polygons are accepted but
self-intersecting ones are cu... | [
"Creates",
"a",
"MOC",
"from",
"a",
"polygon",
"."
] | cds-astro/mocpy | python | https://github.com/cds-astro/mocpy/blob/09472cabe537f6bfdb049eeea64d3ea57b391c21/mocpy/moc/moc.py#L511-L541 | [
"def",
"from_polygon_skycoord",
"(",
"cls",
",",
"skycoord",
",",
"inside",
"=",
"None",
",",
"max_depth",
"=",
"10",
")",
":",
"return",
"MOC",
".",
"from_polygon",
"(",
"lon",
"=",
"skycoord",
".",
"icrs",
".",
"ra",
",",
"lat",
"=",
"skycoord",
".",... | 09472cabe537f6bfdb049eeea64d3ea57b391c21 |
train | MOC.from_polygon | Creates a MOC from a polygon
The polygon is given as lon and lat `astropy.units.Quantity` that define the
vertices of the polygon. Concave and convex polygons are accepted but
self-intersecting ones are currently not properly handled.
Parameters
----------
lon : `astro... | mocpy/moc/moc.py | def from_polygon(cls, lon, lat, inside=None, max_depth=10):
"""
Creates a MOC from a polygon
The polygon is given as lon and lat `astropy.units.Quantity` that define the
vertices of the polygon. Concave and convex polygons are accepted but
self-intersecting ones are currently n... | def from_polygon(cls, lon, lat, inside=None, max_depth=10):
"""
Creates a MOC from a polygon
The polygon is given as lon and lat `astropy.units.Quantity` that define the
vertices of the polygon. Concave and convex polygons are accepted but
self-intersecting ones are currently n... | [
"Creates",
"a",
"MOC",
"from",
"a",
"polygon"
] | cds-astro/mocpy | python | https://github.com/cds-astro/mocpy/blob/09472cabe537f6bfdb049eeea64d3ea57b391c21/mocpy/moc/moc.py#L544-L586 | [
"def",
"from_polygon",
"(",
"cls",
",",
"lon",
",",
"lat",
",",
"inside",
"=",
"None",
",",
"max_depth",
"=",
"10",
")",
":",
"from",
".",
"polygon",
"import",
"PolygonComputer",
"polygon_computer",
"=",
"PolygonComputer",
"(",
"lon",
",",
"lat",
",",
"i... | 09472cabe537f6bfdb049eeea64d3ea57b391c21 |
train | MOC.sky_fraction | Sky fraction covered by the MOC | mocpy/moc/moc.py | def sky_fraction(self):
"""
Sky fraction covered by the MOC
"""
pix_id = self._best_res_pixels()
nb_pix_filled = pix_id.size
return nb_pix_filled / float(3 << (2*(self.max_order + 1))) | def sky_fraction(self):
"""
Sky fraction covered by the MOC
"""
pix_id = self._best_res_pixels()
nb_pix_filled = pix_id.size
return nb_pix_filled / float(3 << (2*(self.max_order + 1))) | [
"Sky",
"fraction",
"covered",
"by",
"the",
"MOC"
] | cds-astro/mocpy | python | https://github.com/cds-astro/mocpy/blob/09472cabe537f6bfdb049eeea64d3ea57b391c21/mocpy/moc/moc.py#L589-L595 | [
"def",
"sky_fraction",
"(",
"self",
")",
":",
"pix_id",
"=",
"self",
".",
"_best_res_pixels",
"(",
")",
"nb_pix_filled",
"=",
"pix_id",
".",
"size",
"return",
"nb_pix_filled",
"/",
"float",
"(",
"3",
"<<",
"(",
"2",
"*",
"(",
"self",
".",
"max_order",
... | 09472cabe537f6bfdb049eeea64d3ea57b391c21 |
train | MOC._query | Internal method to query Simbad or a VizieR table
for sources in the coverage of the MOC instance | mocpy/moc/moc.py | def _query(self, resource_id, max_rows):
"""
Internal method to query Simbad or a VizieR table
for sources in the coverage of the MOC instance
"""
from astropy.io.votable import parse_single_table
if max_rows is not None and max_rows >= 0:
max_rows_str = str(... | def _query(self, resource_id, max_rows):
"""
Internal method to query Simbad or a VizieR table
for sources in the coverage of the MOC instance
"""
from astropy.io.votable import parse_single_table
if max_rows is not None and max_rows >= 0:
max_rows_str = str(... | [
"Internal",
"method",
"to",
"query",
"Simbad",
"or",
"a",
"VizieR",
"table",
"for",
"sources",
"in",
"the",
"coverage",
"of",
"the",
"MOC",
"instance"
] | cds-astro/mocpy | python | https://github.com/cds-astro/mocpy/blob/09472cabe537f6bfdb049eeea64d3ea57b391c21/mocpy/moc/moc.py#L612-L644 | [
"def",
"_query",
"(",
"self",
",",
"resource_id",
",",
"max_rows",
")",
":",
"from",
"astropy",
".",
"io",
".",
"votable",
"import",
"parse_single_table",
"if",
"max_rows",
"is",
"not",
"None",
"and",
"max_rows",
">=",
"0",
":",
"max_rows_str",
"=",
"str",... | 09472cabe537f6bfdb049eeea64d3ea57b391c21 |
train | MOC.plot | Plot the MOC object using a mollweide projection.
**Deprecated**: New `fill` and `border` methods produce more reliable results and allow you to specify additional
matplotlib style parameters.
Parameters
----------
title : str
The title of the plot
frame : ... | mocpy/moc/moc.py | def plot(self, title='MOC', frame=None):
"""
Plot the MOC object using a mollweide projection.
**Deprecated**: New `fill` and `border` methods produce more reliable results and allow you to specify additional
matplotlib style parameters.
Parameters
----------
t... | def plot(self, title='MOC', frame=None):
"""
Plot the MOC object using a mollweide projection.
**Deprecated**: New `fill` and `border` methods produce more reliable results and allow you to specify additional
matplotlib style parameters.
Parameters
----------
t... | [
"Plot",
"the",
"MOC",
"object",
"using",
"a",
"mollweide",
"projection",
"."
] | cds-astro/mocpy | python | https://github.com/cds-astro/mocpy/blob/09472cabe537f6bfdb049eeea64d3ea57b391c21/mocpy/moc/moc.py#L646-L712 | [
"def",
"plot",
"(",
"self",
",",
"title",
"=",
"'MOC'",
",",
"frame",
"=",
"None",
")",
":",
"frame",
"=",
"ICRS",
"(",
")",
"if",
"frame",
"is",
"None",
"else",
"frame",
"from",
"matplotlib",
".",
"colors",
"import",
"LinearSegmentedColormap",
"import",... | 09472cabe537f6bfdb049eeea64d3ea57b391c21 |
train | BaseTransform.inverse | The inverse of this transform. | glue_vispy_viewers/extern/vispy/visuals/transforms/base_transform.py | def inverse(self):
""" The inverse of this transform.
"""
if self._inverse is None:
self._inverse = InverseTransform(self)
return self._inverse | def inverse(self):
""" The inverse of this transform.
"""
if self._inverse is None:
self._inverse = InverseTransform(self)
return self._inverse | [
"The",
"inverse",
"of",
"this",
"transform",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/transforms/base_transform.py#L99-L104 | [
"def",
"inverse",
"(",
"self",
")",
":",
"if",
"self",
".",
"_inverse",
"is",
"None",
":",
"self",
".",
"_inverse",
"=",
"InverseTransform",
"(",
"self",
")",
"return",
"self",
".",
"_inverse"
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | Ticker._tile_ticks | Tiles tick marks along the axis. | glue_vispy_viewers/extern/vispy/visuals/axis.py | def _tile_ticks(self, frac, tickvec):
"""Tiles tick marks along the axis."""
origins = np.tile(self.axis._vec, (len(frac), 1))
origins = self.axis.pos[0].T + (origins.T*frac).T
endpoints = tickvec + origins
return origins, endpoints | def _tile_ticks(self, frac, tickvec):
"""Tiles tick marks along the axis."""
origins = np.tile(self.axis._vec, (len(frac), 1))
origins = self.axis.pos[0].T + (origins.T*frac).T
endpoints = tickvec + origins
return origins, endpoints | [
"Tiles",
"tick",
"marks",
"along",
"the",
"axis",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/axis.py#L345-L350 | [
"def",
"_tile_ticks",
"(",
"self",
",",
"frac",
",",
"tickvec",
")",
":",
"origins",
"=",
"np",
".",
"tile",
"(",
"self",
".",
"axis",
".",
"_vec",
",",
"(",
"len",
"(",
"frac",
")",
",",
"1",
")",
")",
"origins",
"=",
"self",
".",
"axis",
".",... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | Ticker._get_tick_frac_labels | Get the major ticks, minor ticks, and major labels | glue_vispy_viewers/extern/vispy/visuals/axis.py | def _get_tick_frac_labels(self):
"""Get the major ticks, minor ticks, and major labels"""
minor_num = 4 # number of minor ticks per major division
if (self.axis.scale_type == 'linear'):
domain = self.axis.domain
if domain[1] < domain[0]:
flip = True
... | def _get_tick_frac_labels(self):
"""Get the major ticks, minor ticks, and major labels"""
minor_num = 4 # number of minor ticks per major division
if (self.axis.scale_type == 'linear'):
domain = self.axis.domain
if domain[1] < domain[0]:
flip = True
... | [
"Get",
"the",
"major",
"ticks",
"minor",
"ticks",
"and",
"major",
"labels"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/axis.py#L352-L396 | [
"def",
"_get_tick_frac_labels",
"(",
"self",
")",
":",
"minor_num",
"=",
"4",
"# number of minor ticks per major division",
"if",
"(",
"self",
".",
"axis",
".",
"scale_type",
"==",
"'linear'",
")",
":",
"domain",
"=",
"self",
".",
"axis",
".",
"domain",
"if",
... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | interleave_planes | Interleave (colour) planes, e.g. RGB + A = RGBA.
Return an array of pixels consisting of the `ipsize` elements of
data from each pixel in `ipixels` followed by the `apsize` elements
of data from each pixel in `apixels`. Conventionally `ipixels`
and `apixels` are byte arrays so the sizes are bytes, but... | glue_vispy_viewers/extern/vispy/ext/_bundled/png.py | def interleave_planes(ipixels, apixels, ipsize, apsize):
"""
Interleave (colour) planes, e.g. RGB + A = RGBA.
Return an array of pixels consisting of the `ipsize` elements of
data from each pixel in `ipixels` followed by the `apsize` elements
of data from each pixel in `apixels`. Conventionally `i... | def interleave_planes(ipixels, apixels, ipsize, apsize):
"""
Interleave (colour) planes, e.g. RGB + A = RGBA.
Return an array of pixels consisting of the `ipsize` elements of
data from each pixel in `ipixels` followed by the `apsize` elements
of data from each pixel in `apixels`. Conventionally `i... | [
"Interleave",
"(",
"colour",
")",
"planes",
"e",
".",
"g",
".",
"RGB",
"+",
"A",
"=",
"RGBA",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/ext/_bundled/png.py#L101-L129 | [
"def",
"interleave_planes",
"(",
"ipixels",
",",
"apixels",
",",
"ipsize",
",",
"apsize",
")",
":",
"itotal",
"=",
"len",
"(",
"ipixels",
")",
"atotal",
"=",
"len",
"(",
"apixels",
")",
"newtotal",
"=",
"itotal",
"+",
"atotal",
"newpsize",
"=",
"ipsize",... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | write_chunks | Create a PNG file by writing out the chunks. | glue_vispy_viewers/extern/vispy/ext/_bundled/png.py | def write_chunks(out, chunks):
"""Create a PNG file by writing out the chunks."""
out.write(_signature)
for chunk in chunks:
write_chunk(out, *chunk) | def write_chunks(out, chunks):
"""Create a PNG file by writing out the chunks."""
out.write(_signature)
for chunk in chunks:
write_chunk(out, *chunk) | [
"Create",
"a",
"PNG",
"file",
"by",
"writing",
"out",
"the",
"chunks",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/ext/_bundled/png.py#L838-L843 | [
"def",
"write_chunks",
"(",
"out",
",",
"chunks",
")",
":",
"out",
".",
"write",
"(",
"_signature",
")",
"for",
"chunk",
"in",
"chunks",
":",
"write_chunk",
"(",
"out",
",",
"*",
"chunk",
")"
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | filter_scanline | Apply a scanline filter to a scanline. `type` specifies the
filter type (0 to 4); `line` specifies the current (unfiltered)
scanline as a sequence of bytes; `prev` specifies the previous
(unfiltered) scanline as a sequence of bytes. `fo` specifies the
filter offset; normally this is size of a pixel in ... | glue_vispy_viewers/extern/vispy/ext/_bundled/png.py | def filter_scanline(type, line, fo, prev=None):
"""Apply a scanline filter to a scanline. `type` specifies the
filter type (0 to 4); `line` specifies the current (unfiltered)
scanline as a sequence of bytes; `prev` specifies the previous
(unfiltered) scanline as a sequence of bytes. `fo` specifies the
... | def filter_scanline(type, line, fo, prev=None):
"""Apply a scanline filter to a scanline. `type` specifies the
filter type (0 to 4); `line` specifies the current (unfiltered)
scanline as a sequence of bytes; `prev` specifies the previous
(unfiltered) scanline as a sequence of bytes. `fo` specifies the
... | [
"Apply",
"a",
"scanline",
"filter",
"to",
"a",
"scanline",
".",
"type",
"specifies",
"the",
"filter",
"type",
"(",
"0",
"to",
"4",
")",
";",
"line",
"specifies",
"the",
"current",
"(",
"unfiltered",
")",
"scanline",
"as",
"a",
"sequence",
"of",
"bytes",
... | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/ext/_bundled/png.py#L845-L929 | [
"def",
"filter_scanline",
"(",
"type",
",",
"line",
",",
"fo",
",",
"prev",
"=",
"None",
")",
":",
"assert",
"0",
"<=",
"type",
"<",
"5",
"# The output array. Which, pathetically, we extend one-byte at a",
"# time (fortunately this is linear).",
"out",
"=",
"array",
... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | from_array | Create a PNG :class:`Image` object from a 2- or 3-dimensional
array. One application of this function is easy PIL-style saving:
``png.from_array(pixels, 'L').save('foo.png')``.
.. note :
The use of the term *3-dimensional* is for marketing purposes
only. It doesn't actually work. Please bea... | glue_vispy_viewers/extern/vispy/ext/_bundled/png.py | def from_array(a, mode=None, info={}):
"""Create a PNG :class:`Image` object from a 2- or 3-dimensional
array. One application of this function is easy PIL-style saving:
``png.from_array(pixels, 'L').save('foo.png')``.
.. note :
The use of the term *3-dimensional* is for marketing purposes
... | def from_array(a, mode=None, info={}):
"""Create a PNG :class:`Image` object from a 2- or 3-dimensional
array. One application of this function is easy PIL-style saving:
``png.from_array(pixels, 'L').save('foo.png')``.
.. note :
The use of the term *3-dimensional* is for marketing purposes
... | [
"Create",
"a",
"PNG",
":",
"class",
":",
"Image",
"object",
"from",
"a",
"2",
"-",
"or",
"3",
"-",
"dimensional",
"array",
".",
"One",
"application",
"of",
"this",
"function",
"is",
"easy",
"PIL",
"-",
"style",
"saving",
":",
"png",
".",
"from_array",
... | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/ext/_bundled/png.py#L932-L1136 | [
"def",
"from_array",
"(",
"a",
",",
"mode",
"=",
"None",
",",
"info",
"=",
"{",
"}",
")",
":",
"# We abuse the *info* parameter by modifying it. Take a copy here.",
"# (Also typechecks *info* to some extent).",
"info",
"=",
"dict",
"(",
"info",
")",
"# Syntax check mod... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | Writer.make_palette | Create the byte sequences for a ``PLTE`` and if necessary a
``tRNS`` chunk. Returned as a pair (*p*, *t*). *t* will be
``None`` if no ``tRNS`` chunk is necessary. | glue_vispy_viewers/extern/vispy/ext/_bundled/png.py | def make_palette(self):
"""Create the byte sequences for a ``PLTE`` and if necessary a
``tRNS`` chunk. Returned as a pair (*p*, *t*). *t* will be
``None`` if no ``tRNS`` chunk is necessary.
"""
p = array('B')
t = array('B')
for x in self.palette:
p... | def make_palette(self):
"""Create the byte sequences for a ``PLTE`` and if necessary a
``tRNS`` chunk. Returned as a pair (*p*, *t*). *t* will be
``None`` if no ``tRNS`` chunk is necessary.
"""
p = array('B')
t = array('B')
for x in self.palette:
p... | [
"Create",
"the",
"byte",
"sequences",
"for",
"a",
"PLTE",
"and",
"if",
"necessary",
"a",
"tRNS",
"chunk",
".",
"Returned",
"as",
"a",
"pair",
"(",
"*",
"p",
"*",
"*",
"t",
"*",
")",
".",
"*",
"t",
"*",
"will",
"be",
"None",
"if",
"no",
"tRNS",
... | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/ext/_bundled/png.py#L464-L481 | [
"def",
"make_palette",
"(",
"self",
")",
":",
"p",
"=",
"array",
"(",
"'B'",
")",
"t",
"=",
"array",
"(",
"'B'",
")",
"for",
"x",
"in",
"self",
".",
"palette",
":",
"p",
".",
"extend",
"(",
"x",
"[",
"0",
":",
"3",
"]",
")",
"if",
"len",
"(... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | Writer.write | Write a PNG image to the output file. `rows` should be
an iterable that yields each row in boxed row flat pixel
format. The rows should be the rows of the original image,
so there should be ``self.height`` rows of ``self.width *
self.planes`` values. If `interlace` is specified (when
... | glue_vispy_viewers/extern/vispy/ext/_bundled/png.py | def write(self, outfile, rows):
"""Write a PNG image to the output file. `rows` should be
an iterable that yields each row in boxed row flat pixel
format. The rows should be the rows of the original image,
so there should be ``self.height`` rows of ``self.width *
self.planes`` ... | def write(self, outfile, rows):
"""Write a PNG image to the output file. `rows` should be
an iterable that yields each row in boxed row flat pixel
format. The rows should be the rows of the original image,
so there should be ``self.height`` rows of ``self.width *
self.planes`` ... | [
"Write",
"a",
"PNG",
"image",
"to",
"the",
"output",
"file",
".",
"rows",
"should",
"be",
"an",
"iterable",
"that",
"yields",
"each",
"row",
"in",
"boxed",
"row",
"flat",
"pixel",
"format",
".",
"The",
"rows",
"should",
"be",
"the",
"rows",
"of",
"the"... | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/ext/_bundled/png.py#L483-L508 | [
"def",
"write",
"(",
"self",
",",
"outfile",
",",
"rows",
")",
":",
"if",
"self",
".",
"interlace",
":",
"fmt",
"=",
"'BH'",
"[",
"self",
".",
"bitdepth",
">",
"8",
"]",
"a",
"=",
"array",
"(",
"fmt",
",",
"itertools",
".",
"chain",
"(",
"*",
"... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | Writer.write_passes | Write a PNG image to the output file.
Most users are expected to find the :meth:`write` or
:meth:`write_array` method more convenient.
The rows should be given to this method in the order that
they appear in the output file. For straightlaced images,
this is the usual ... | glue_vispy_viewers/extern/vispy/ext/_bundled/png.py | def write_passes(self, outfile, rows, packed=False):
"""
Write a PNG image to the output file.
Most users are expected to find the :meth:`write` or
:meth:`write_array` method more convenient.
The rows should be given to this method in the order that
they appear ... | def write_passes(self, outfile, rows, packed=False):
"""
Write a PNG image to the output file.
Most users are expected to find the :meth:`write` or
:meth:`write_array` method more convenient.
The rows should be given to this method in the order that
they appear ... | [
"Write",
"a",
"PNG",
"image",
"to",
"the",
"output",
"file",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/ext/_bundled/png.py#L510-L676 | [
"def",
"write_passes",
"(",
"self",
",",
"outfile",
",",
"rows",
",",
"packed",
"=",
"False",
")",
":",
"# http://www.w3.org/TR/PNG/#5PNG-file-signature",
"outfile",
".",
"write",
"(",
"_signature",
")",
"# http://www.w3.org/TR/PNG/#11IHDR",
"write_chunk",
"(",
"outfi... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | Writer.write_packed | Write PNG file to `outfile`. The pixel data comes from `rows`
which should be in boxed row packed format. Each row should be
a sequence of packed bytes.
Technically, this method does work for interlaced images but it
is best avoided. For interlaced images, the rows should be
... | glue_vispy_viewers/extern/vispy/ext/_bundled/png.py | def write_packed(self, outfile, rows):
"""
Write PNG file to `outfile`. The pixel data comes from `rows`
which should be in boxed row packed format. Each row should be
a sequence of packed bytes.
Technically, this method does work for interlaced images but it
is best a... | def write_packed(self, outfile, rows):
"""
Write PNG file to `outfile`. The pixel data comes from `rows`
which should be in boxed row packed format. Each row should be
a sequence of packed bytes.
Technically, this method does work for interlaced images but it
is best a... | [
"Write",
"PNG",
"file",
"to",
"outfile",
".",
"The",
"pixel",
"data",
"comes",
"from",
"rows",
"which",
"should",
"be",
"in",
"boxed",
"row",
"packed",
"format",
".",
"Each",
"row",
"should",
"be",
"a",
"sequence",
"of",
"packed",
"bytes",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/ext/_bundled/png.py#L689-L707 | [
"def",
"write_packed",
"(",
"self",
",",
"outfile",
",",
"rows",
")",
":",
"if",
"self",
".",
"rescale",
":",
"raise",
"Error",
"(",
"\"write_packed method not suitable for bit depth %d\"",
"%",
"self",
".",
"rescale",
"[",
"0",
"]",
")",
"return",
"self",
"... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | Writer.convert_pnm | Convert a PNM file containing raw pixel data into a PNG file
with the parameters set in the writer object. Works for
(binary) PGM, PPM, and PAM formats. | glue_vispy_viewers/extern/vispy/ext/_bundled/png.py | def convert_pnm(self, infile, outfile):
"""
Convert a PNM file containing raw pixel data into a PNG file
with the parameters set in the writer object. Works for
(binary) PGM, PPM, and PAM formats.
"""
if self.interlace:
pixels = array('B')
pixels... | def convert_pnm(self, infile, outfile):
"""
Convert a PNM file containing raw pixel data into a PNG file
with the parameters set in the writer object. Works for
(binary) PGM, PPM, and PAM formats.
"""
if self.interlace:
pixels = array('B')
pixels... | [
"Convert",
"a",
"PNM",
"file",
"containing",
"raw",
"pixel",
"data",
"into",
"a",
"PNG",
"file",
"with",
"the",
"parameters",
"set",
"in",
"the",
"writer",
"object",
".",
"Works",
"for",
"(",
"binary",
")",
"PGM",
"PPM",
"and",
"PAM",
"formats",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/ext/_bundled/png.py#L709-L723 | [
"def",
"convert_pnm",
"(",
"self",
",",
"infile",
",",
"outfile",
")",
":",
"if",
"self",
".",
"interlace",
":",
"pixels",
"=",
"array",
"(",
"'B'",
")",
"pixels",
".",
"fromfile",
"(",
"infile",
",",
"(",
"self",
".",
"bitdepth",
"/",
"8",
")",
"*... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | Writer.convert_ppm_and_pgm | Convert a PPM and PGM file containing raw pixel data into a
PNG outfile with the parameters set in the writer object. | glue_vispy_viewers/extern/vispy/ext/_bundled/png.py | def convert_ppm_and_pgm(self, ppmfile, pgmfile, outfile):
"""
Convert a PPM and PGM file containing raw pixel data into a
PNG outfile with the parameters set in the writer object.
"""
pixels = array('B')
pixels.fromfile(ppmfile,
(self.bitdepth/8) *... | def convert_ppm_and_pgm(self, ppmfile, pgmfile, outfile):
"""
Convert a PPM and PGM file containing raw pixel data into a
PNG outfile with the parameters set in the writer object.
"""
pixels = array('B')
pixels.fromfile(ppmfile,
(self.bitdepth/8) *... | [
"Convert",
"a",
"PPM",
"and",
"PGM",
"file",
"containing",
"raw",
"pixel",
"data",
"into",
"a",
"PNG",
"outfile",
"with",
"the",
"parameters",
"set",
"in",
"the",
"writer",
"object",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/ext/_bundled/png.py#L725-L744 | [
"def",
"convert_ppm_and_pgm",
"(",
"self",
",",
"ppmfile",
",",
"pgmfile",
",",
"outfile",
")",
":",
"pixels",
"=",
"array",
"(",
"'B'",
")",
"pixels",
".",
"fromfile",
"(",
"ppmfile",
",",
"(",
"self",
".",
"bitdepth",
"/",
"8",
")",
"*",
"self",
".... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | Writer.file_scanlines | Generates boxed rows in flat pixel format, from the input file
`infile`. It assumes that the input file is in a "Netpbm-like"
binary format, and is positioned at the beginning of the first
pixel. The number of pixels to read is taken from the image
dimensions (`width`, `height`, `plane... | glue_vispy_viewers/extern/vispy/ext/_bundled/png.py | def file_scanlines(self, infile):
"""
Generates boxed rows in flat pixel format, from the input file
`infile`. It assumes that the input file is in a "Netpbm-like"
binary format, and is positioned at the beginning of the first
pixel. The number of pixels to read is taken from t... | def file_scanlines(self, infile):
"""
Generates boxed rows in flat pixel format, from the input file
`infile`. It assumes that the input file is in a "Netpbm-like"
binary format, and is positioned at the beginning of the first
pixel. The number of pixels to read is taken from t... | [
"Generates",
"boxed",
"rows",
"in",
"flat",
"pixel",
"format",
"from",
"the",
"input",
"file",
"infile",
".",
"It",
"assumes",
"that",
"the",
"input",
"file",
"is",
"in",
"a",
"Netpbm",
"-",
"like",
"binary",
"format",
"and",
"is",
"positioned",
"at",
"t... | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/ext/_bundled/png.py#L746-L770 | [
"def",
"file_scanlines",
"(",
"self",
",",
"infile",
")",
":",
"# Values per row",
"vpr",
"=",
"self",
".",
"width",
"*",
"self",
".",
"planes",
"row_bytes",
"=",
"vpr",
"if",
"self",
".",
"bitdepth",
">",
"8",
":",
"assert",
"self",
".",
"bitdepth",
"... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | Writer.array_scanlines_interlace | Generator for interlaced scanlines from an array. `pixels` is
the full source image in flat row flat pixel format. The
generator yields each scanline of the reduced passes in turn, in
boxed row flat pixel format. | glue_vispy_viewers/extern/vispy/ext/_bundled/png.py | def array_scanlines_interlace(self, pixels):
"""
Generator for interlaced scanlines from an array. `pixels` is
the full source image in flat row flat pixel format. The
generator yields each scanline of the reduced passes in turn, in
boxed row flat pixel format.
"""
... | def array_scanlines_interlace(self, pixels):
"""
Generator for interlaced scanlines from an array. `pixels` is
the full source image in flat row flat pixel format. The
generator yields each scanline of the reduced passes in turn, in
boxed row flat pixel format.
"""
... | [
"Generator",
"for",
"interlaced",
"scanlines",
"from",
"an",
"array",
".",
"pixels",
"is",
"the",
"full",
"source",
"image",
"in",
"flat",
"row",
"flat",
"pixel",
"format",
".",
"The",
"generator",
"yields",
"each",
"scanline",
"of",
"the",
"reduced",
"passe... | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/ext/_bundled/png.py#L786-L820 | [
"def",
"array_scanlines_interlace",
"(",
"self",
",",
"pixels",
")",
":",
"# http://www.w3.org/TR/PNG/#8InterlaceMethods",
"# Array type.",
"fmt",
"=",
"'BH'",
"[",
"self",
".",
"bitdepth",
">",
"8",
"]",
"# Value per row",
"vpr",
"=",
"self",
".",
"width",
"*",
... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | Reader.undo_filter | Undo the filter for a scanline. `scanline` is a sequence of
bytes that does not include the initial filter type byte.
`previous` is decoded previous scanline (for straightlaced
images this is the previous pixel row, but for interlaced
images, it is the previous scanline in the reduced i... | glue_vispy_viewers/extern/vispy/ext/_bundled/png.py | def undo_filter(self, filter_type, scanline, previous):
"""Undo the filter for a scanline. `scanline` is a sequence of
bytes that does not include the initial filter type byte.
`previous` is decoded previous scanline (for straightlaced
images this is the previous pixel row, but for inte... | def undo_filter(self, filter_type, scanline, previous):
"""Undo the filter for a scanline. `scanline` is a sequence of
bytes that does not include the initial filter type byte.
`previous` is decoded previous scanline (for straightlaced
images this is the previous pixel row, but for inte... | [
"Undo",
"the",
"filter",
"for",
"a",
"scanline",
".",
"scanline",
"is",
"a",
"sequence",
"of",
"bytes",
"that",
"does",
"not",
"include",
"the",
"initial",
"filter",
"type",
"byte",
".",
"previous",
"is",
"decoded",
"previous",
"scanline",
"(",
"for",
"str... | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/ext/_bundled/png.py#L1315-L1424 | [
"def",
"undo_filter",
"(",
"self",
",",
"filter_type",
",",
"scanline",
",",
"previous",
")",
":",
"# :todo: Would it be better to update scanline in place?",
"# Yes, with the Cython extension making the undo_filter fast,",
"# updating scanline inplace makes the code 3 times faster",
"... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | Reader.deinterlace | Read raw pixel data, undo filters, deinterlace, and flatten.
Return in flat row flat pixel format. | glue_vispy_viewers/extern/vispy/ext/_bundled/png.py | def deinterlace(self, raw):
"""
Read raw pixel data, undo filters, deinterlace, and flatten.
Return in flat row flat pixel format.
"""
# Values per row (of the target image)
vpr = self.width * self.planes
# Make a result array, and make it big enough. Interleav... | def deinterlace(self, raw):
"""
Read raw pixel data, undo filters, deinterlace, and flatten.
Return in flat row flat pixel format.
"""
# Values per row (of the target image)
vpr = self.width * self.planes
# Make a result array, and make it big enough. Interleav... | [
"Read",
"raw",
"pixel",
"data",
"undo",
"filters",
"deinterlace",
"and",
"flatten",
".",
"Return",
"in",
"flat",
"row",
"flat",
"pixel",
"format",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/ext/_bundled/png.py#L1426-L1472 | [
"def",
"deinterlace",
"(",
"self",
",",
"raw",
")",
":",
"# Values per row (of the target image)",
"vpr",
"=",
"self",
".",
"width",
"*",
"self",
".",
"planes",
"# Make a result array, and make it big enough. Interleaving",
"# writes to the output array randomly (well, not qui... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | Reader.iterboxed | Iterator that yields each scanline in boxed row flat pixel
format. `rows` should be an iterator that yields the bytes of
each row in turn. | glue_vispy_viewers/extern/vispy/ext/_bundled/png.py | def iterboxed(self, rows):
"""Iterator that yields each scanline in boxed row flat pixel
format. `rows` should be an iterator that yields the bytes of
each row in turn.
"""
def asvalues(raw):
"""Convert a row of raw bytes into a flat row. Result will
be... | def iterboxed(self, rows):
"""Iterator that yields each scanline in boxed row flat pixel
format. `rows` should be an iterator that yields the bytes of
each row in turn.
"""
def asvalues(raw):
"""Convert a row of raw bytes into a flat row. Result will
be... | [
"Iterator",
"that",
"yields",
"each",
"scanline",
"in",
"boxed",
"row",
"flat",
"pixel",
"format",
".",
"rows",
"should",
"be",
"an",
"iterator",
"that",
"yields",
"the",
"bytes",
"of",
"each",
"row",
"in",
"turn",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/ext/_bundled/png.py#L1474-L1502 | [
"def",
"iterboxed",
"(",
"self",
",",
"rows",
")",
":",
"def",
"asvalues",
"(",
"raw",
")",
":",
"\"\"\"Convert a row of raw bytes into a flat row. Result will\n be a freshly allocated object, not shared with\n argument.\n \"\"\"",
"if",
"self",
".... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | Reader.serialtoflat | Convert serial format (byte stream) pixel data to flat row
flat pixel. | glue_vispy_viewers/extern/vispy/ext/_bundled/png.py | def serialtoflat(self, bytes, width=None):
"""Convert serial format (byte stream) pixel data to flat row
flat pixel.
"""
if self.bitdepth == 8:
return bytes
if self.bitdepth == 16:
bytes = tostring(bytes)
return array('H',
struct... | def serialtoflat(self, bytes, width=None):
"""Convert serial format (byte stream) pixel data to flat row
flat pixel.
"""
if self.bitdepth == 8:
return bytes
if self.bitdepth == 16:
bytes = tostring(bytes)
return array('H',
struct... | [
"Convert",
"serial",
"format",
"(",
"byte",
"stream",
")",
"pixel",
"data",
"to",
"flat",
"row",
"flat",
"pixel",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/ext/_bundled/png.py#L1504-L1529 | [
"def",
"serialtoflat",
"(",
"self",
",",
"bytes",
",",
"width",
"=",
"None",
")",
":",
"if",
"self",
".",
"bitdepth",
"==",
"8",
":",
"return",
"bytes",
"if",
"self",
".",
"bitdepth",
"==",
"16",
":",
"bytes",
"=",
"tostring",
"(",
"bytes",
")",
"r... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | Reader.iterstraight | Iterator that undoes the effect of filtering, and yields
each row in serialised format (as a sequence of bytes).
Assumes input is straightlaced. `raw` should be an iterable
that yields the raw bytes in chunks of arbitrary size. | glue_vispy_viewers/extern/vispy/ext/_bundled/png.py | def iterstraight(self, raw):
"""Iterator that undoes the effect of filtering, and yields
each row in serialised format (as a sequence of bytes).
Assumes input is straightlaced. `raw` should be an iterable
that yields the raw bytes in chunks of arbitrary size.
"""
# leng... | def iterstraight(self, raw):
"""Iterator that undoes the effect of filtering, and yields
each row in serialised format (as a sequence of bytes).
Assumes input is straightlaced. `raw` should be an iterable
that yields the raw bytes in chunks of arbitrary size.
"""
# leng... | [
"Iterator",
"that",
"undoes",
"the",
"effect",
"of",
"filtering",
"and",
"yields",
"each",
"row",
"in",
"serialised",
"format",
"(",
"as",
"a",
"sequence",
"of",
"bytes",
")",
".",
"Assumes",
"input",
"is",
"straightlaced",
".",
"raw",
"should",
"be",
"an"... | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/ext/_bundled/png.py#L1531-L1558 | [
"def",
"iterstraight",
"(",
"self",
",",
"raw",
")",
":",
"# length of row, in bytes",
"rb",
"=",
"self",
".",
"row_bytes",
"a",
"=",
"array",
"(",
"'B'",
")",
"# The previous (reconstructed) scanline. None indicates first",
"# line of image.",
"recon",
"=",
"None",
... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | Reader.chunklentype | Reads just enough of the input to determine the next
chunk's length and type, returned as a (*length*, *type*) pair
where *type* is a string. If there are no more chunks, ``None``
is returned. | glue_vispy_viewers/extern/vispy/ext/_bundled/png.py | def chunklentype(self):
"""Reads just enough of the input to determine the next
chunk's length and type, returned as a (*length*, *type*) pair
where *type* is a string. If there are no more chunks, ``None``
is returned.
"""
x = self.file.read(8)
if not x:
... | def chunklentype(self):
"""Reads just enough of the input to determine the next
chunk's length and type, returned as a (*length*, *type*) pair
where *type* is a string. If there are no more chunks, ``None``
is returned.
"""
x = self.file.read(8)
if not x:
... | [
"Reads",
"just",
"enough",
"of",
"the",
"input",
"to",
"determine",
"the",
"next",
"chunk",
"s",
"length",
"and",
"type",
"returned",
"as",
"a",
"(",
"*",
"length",
"*",
"*",
"type",
"*",
")",
"pair",
"where",
"*",
"type",
"*",
"is",
"a",
"string",
... | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/ext/_bundled/png.py#L1594-L1611 | [
"def",
"chunklentype",
"(",
"self",
")",
":",
"x",
"=",
"self",
".",
"file",
".",
"read",
"(",
"8",
")",
"if",
"not",
"x",
":",
"return",
"None",
"if",
"len",
"(",
"x",
")",
"!=",
"8",
":",
"raise",
"FormatError",
"(",
"'End of file whilst reading ch... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | Reader.read | Read the PNG file and decode it. Returns (`width`, `height`,
`pixels`, `metadata`).
May use excessive memory.
`pixels` are returned in boxed row flat pixel format.
If the optional `lenient` argument evaluates to True,
checksum failures will raise warnings rather than exceptio... | glue_vispy_viewers/extern/vispy/ext/_bundled/png.py | def read(self, lenient=False):
"""
Read the PNG file and decode it. Returns (`width`, `height`,
`pixels`, `metadata`).
May use excessive memory.
`pixels` are returned in boxed row flat pixel format.
If the optional `lenient` argument evaluates to True,
checksu... | def read(self, lenient=False):
"""
Read the PNG file and decode it. Returns (`width`, `height`,
`pixels`, `metadata`).
May use excessive memory.
`pixels` are returned in boxed row flat pixel format.
If the optional `lenient` argument evaluates to True,
checksu... | [
"Read",
"the",
"PNG",
"file",
"and",
"decode",
"it",
".",
"Returns",
"(",
"width",
"height",
"pixels",
"metadata",
")",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/ext/_bundled/png.py#L1735-L1805 | [
"def",
"read",
"(",
"self",
",",
"lenient",
"=",
"False",
")",
":",
"def",
"iteridat",
"(",
")",
":",
"\"\"\"Iterator that yields all the ``IDAT`` chunks as strings.\"\"\"",
"while",
"True",
":",
"try",
":",
"type",
",",
"data",
"=",
"self",
".",
"chunk",
"(",... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | Reader.palette | Returns a palette that is a sequence of 3-tuples or 4-tuples,
synthesizing it from the ``PLTE`` and ``tRNS`` chunks. These
chunks should have already been processed (for example, by
calling the :meth:`preamble` method). All the tuples are the
same size: 3-tuples if there is no ``tRNS``... | glue_vispy_viewers/extern/vispy/ext/_bundled/png.py | def palette(self, alpha='natural'):
"""Returns a palette that is a sequence of 3-tuples or 4-tuples,
synthesizing it from the ``PLTE`` and ``tRNS`` chunks. These
chunks should have already been processed (for example, by
calling the :meth:`preamble` method). All the tuples are the
... | def palette(self, alpha='natural'):
"""Returns a palette that is a sequence of 3-tuples or 4-tuples,
synthesizing it from the ``PLTE`` and ``tRNS`` chunks. These
chunks should have already been processed (for example, by
calling the :meth:`preamble` method). All the tuples are the
... | [
"Returns",
"a",
"palette",
"that",
"is",
"a",
"sequence",
"of",
"3",
"-",
"tuples",
"or",
"4",
"-",
"tuples",
"synthesizing",
"it",
"from",
"the",
"PLTE",
"and",
"tRNS",
"chunks",
".",
"These",
"chunks",
"should",
"have",
"already",
"been",
"processed",
... | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/ext/_bundled/png.py#L1826-L1847 | [
"def",
"palette",
"(",
"self",
",",
"alpha",
"=",
"'natural'",
")",
":",
"if",
"not",
"self",
".",
"plte",
":",
"raise",
"FormatError",
"(",
"\"Required PLTE chunk is missing in colour type 3 image.\"",
")",
"plte",
"=",
"group",
"(",
"array",
"(",
"'B'",
",",... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | Reader.asDirect | Returns the image data as a direct representation of an
``x * y * planes`` array. This method is intended to remove the
need for callers to deal with palettes and transparency
themselves. Images with a palette (colour type 3)
are converted to RGB or RGBA; images with transparency (a
... | glue_vispy_viewers/extern/vispy/ext/_bundled/png.py | def asDirect(self):
"""Returns the image data as a direct representation of an
``x * y * planes`` array. This method is intended to remove the
need for callers to deal with palettes and transparency
themselves. Images with a palette (colour type 3)
are converted to RGB or RGBA;... | def asDirect(self):
"""Returns the image data as a direct representation of an
``x * y * planes`` array. This method is intended to remove the
need for callers to deal with palettes and transparency
themselves. Images with a palette (colour type 3)
are converted to RGB or RGBA;... | [
"Returns",
"the",
"image",
"data",
"as",
"a",
"direct",
"representation",
"of",
"an",
"x",
"*",
"y",
"*",
"planes",
"array",
".",
"This",
"method",
"is",
"intended",
"to",
"remove",
"the",
"need",
"for",
"callers",
"to",
"deal",
"with",
"palettes",
"and"... | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/ext/_bundled/png.py#L1849-L1952 | [
"def",
"asDirect",
"(",
"self",
")",
":",
"self",
".",
"preamble",
"(",
")",
"# Simple case, no conversion necessary.",
"if",
"not",
"self",
".",
"colormap",
"and",
"not",
"self",
".",
"trns",
"and",
"not",
"self",
".",
"sbit",
":",
"return",
"self",
".",
... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | Reader.asFloat | Return image pixels as per :meth:`asDirect` method, but scale
all pixel values to be floating point values between 0.0 and
*maxval*. | glue_vispy_viewers/extern/vispy/ext/_bundled/png.py | def asFloat(self, maxval=1.0):
"""Return image pixels as per :meth:`asDirect` method, but scale
all pixel values to be floating point values between 0.0 and
*maxval*.
"""
x,y,pixels,info = self.asDirect()
sourcemaxval = 2**info['bitdepth']-1
del info['bitdepth']
... | def asFloat(self, maxval=1.0):
"""Return image pixels as per :meth:`asDirect` method, but scale
all pixel values to be floating point values between 0.0 and
*maxval*.
"""
x,y,pixels,info = self.asDirect()
sourcemaxval = 2**info['bitdepth']-1
del info['bitdepth']
... | [
"Return",
"image",
"pixels",
"as",
"per",
":",
"meth",
":",
"asDirect",
"method",
"but",
"scale",
"all",
"pixel",
"values",
"to",
"be",
"floating",
"point",
"values",
"between",
"0",
".",
"0",
"and",
"*",
"maxval",
"*",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/ext/_bundled/png.py#L1954-L1968 | [
"def",
"asFloat",
"(",
"self",
",",
"maxval",
"=",
"1.0",
")",
":",
"x",
",",
"y",
",",
"pixels",
",",
"info",
"=",
"self",
".",
"asDirect",
"(",
")",
"sourcemaxval",
"=",
"2",
"**",
"info",
"[",
"'bitdepth'",
"]",
"-",
"1",
"del",
"info",
"[",
... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | Reader._as_rescale | Helper used by :meth:`asRGB8` and :meth:`asRGBA8`. | glue_vispy_viewers/extern/vispy/ext/_bundled/png.py | def _as_rescale(self, get, targetbitdepth):
"""Helper used by :meth:`asRGB8` and :meth:`asRGBA8`."""
width,height,pixels,meta = get()
maxval = 2**meta['bitdepth'] - 1
targetmaxval = 2**targetbitdepth - 1
factor = float(targetmaxval) / float(maxval)
meta['bitdepth'] = tar... | def _as_rescale(self, get, targetbitdepth):
"""Helper used by :meth:`asRGB8` and :meth:`asRGBA8`."""
width,height,pixels,meta = get()
maxval = 2**meta['bitdepth'] - 1
targetmaxval = 2**targetbitdepth - 1
factor = float(targetmaxval) / float(maxval)
meta['bitdepth'] = tar... | [
"Helper",
"used",
"by",
":",
"meth",
":",
"asRGB8",
"and",
":",
"meth",
":",
"asRGBA8",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/ext/_bundled/png.py#L1970-L1984 | [
"def",
"_as_rescale",
"(",
"self",
",",
"get",
",",
"targetbitdepth",
")",
":",
"width",
",",
"height",
",",
"pixels",
",",
"meta",
"=",
"get",
"(",
")",
"maxval",
"=",
"2",
"**",
"meta",
"[",
"'bitdepth'",
"]",
"-",
"1",
"targetmaxval",
"=",
"2",
... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | Reader.asRGB | Return image as RGB pixels. RGB colour images are passed
through unchanged; greyscales are expanded into RGB
triplets (there is a small speed overhead for doing this).
An alpha channel in the source image will raise an
exception.
The return values are as for the :meth:`read` m... | glue_vispy_viewers/extern/vispy/ext/_bundled/png.py | def asRGB(self):
"""Return image as RGB pixels. RGB colour images are passed
through unchanged; greyscales are expanded into RGB
triplets (there is a small speed overhead for doing this).
An alpha channel in the source image will raise an
exception.
The return values a... | def asRGB(self):
"""Return image as RGB pixels. RGB colour images are passed
through unchanged; greyscales are expanded into RGB
triplets (there is a small speed overhead for doing this).
An alpha channel in the source image will raise an
exception.
The return values a... | [
"Return",
"image",
"as",
"RGB",
"pixels",
".",
"RGB",
"colour",
"images",
"are",
"passed",
"through",
"unchanged",
";",
"greyscales",
"are",
"expanded",
"into",
"RGB",
"triplets",
"(",
"there",
"is",
"a",
"small",
"speed",
"overhead",
"for",
"doing",
"this",... | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/ext/_bundled/png.py#L2017-L2044 | [
"def",
"asRGB",
"(",
"self",
")",
":",
"width",
",",
"height",
",",
"pixels",
",",
"meta",
"=",
"self",
".",
"asDirect",
"(",
")",
"if",
"meta",
"[",
"'alpha'",
"]",
":",
"raise",
"Error",
"(",
"\"will not convert image with alpha channel to RGB\"",
")",
"... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | Reader.asRGBA | Return image as RGBA pixels. Greyscales are expanded into
RGB triplets; an alpha channel is synthesized if necessary.
The return values are as for the :meth:`read` method
except that the *metadata* reflect the returned pixels, not the
source image. In particular, for this method
... | glue_vispy_viewers/extern/vispy/ext/_bundled/png.py | def asRGBA(self):
"""Return image as RGBA pixels. Greyscales are expanded into
RGB triplets; an alpha channel is synthesized if necessary.
The return values are as for the :meth:`read` method
except that the *metadata* reflect the returned pixels, not the
source image. In parti... | def asRGBA(self):
"""Return image as RGBA pixels. Greyscales are expanded into
RGB triplets; an alpha channel is synthesized if necessary.
The return values are as for the :meth:`read` method
except that the *metadata* reflect the returned pixels, not the
source image. In parti... | [
"Return",
"image",
"as",
"RGBA",
"pixels",
".",
"Greyscales",
"are",
"expanded",
"into",
"RGB",
"triplets",
";",
"an",
"alpha",
"channel",
"is",
"synthesized",
"if",
"necessary",
".",
"The",
"return",
"values",
"are",
"as",
"for",
"the",
":",
"meth",
":",
... | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/ext/_bundled/png.py#L2046-L2092 | [
"def",
"asRGBA",
"(",
"self",
")",
":",
"width",
",",
"height",
",",
"pixels",
",",
"meta",
"=",
"self",
".",
"asDirect",
"(",
")",
"if",
"meta",
"[",
"'alpha'",
"]",
"and",
"not",
"meta",
"[",
"'greyscale'",
"]",
":",
"return",
"width",
",",
"heig... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | load_data_file | Get a standard vispy demo data file
Parameters
----------
fname : str
The filename on the remote ``demo-data`` repository to download,
e.g. ``'molecular_viewer/micelle.npy'``. These correspond to paths
on ``https://github.com/vispy/demo-data/``.
directory : str | None
Di... | glue_vispy_viewers/extern/vispy/util/fetching.py | def load_data_file(fname, directory=None, force_download=False):
"""Get a standard vispy demo data file
Parameters
----------
fname : str
The filename on the remote ``demo-data`` repository to download,
e.g. ``'molecular_viewer/micelle.npy'``. These correspond to paths
on ``http... | def load_data_file(fname, directory=None, force_download=False):
"""Get a standard vispy demo data file
Parameters
----------
fname : str
The filename on the remote ``demo-data`` repository to download,
e.g. ``'molecular_viewer/micelle.npy'``. These correspond to paths
on ``http... | [
"Get",
"a",
"standard",
"vispy",
"demo",
"data",
"file"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/util/fetching.py#L23-L69 | [
"def",
"load_data_file",
"(",
"fname",
",",
"directory",
"=",
"None",
",",
"force_download",
"=",
"False",
")",
":",
"_url_root",
"=",
"'http://github.com/vispy/demo-data/raw/master/'",
"url",
"=",
"_url_root",
"+",
"fname",
"if",
"directory",
"is",
"None",
":",
... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | _chunk_read | Download a file chunk by chunk and show advancement
Can also be used when resuming downloads over http.
Parameters
----------
response: urllib.response.addinfourl
Response to the download request in order to get file size.
local_file: file
Hard disk file where data should be writte... | glue_vispy_viewers/extern/vispy/util/fetching.py | def _chunk_read(response, local_file, chunk_size=65536, initial_size=0):
"""Download a file chunk by chunk and show advancement
Can also be used when resuming downloads over http.
Parameters
----------
response: urllib.response.addinfourl
Response to the download request in order to get fi... | def _chunk_read(response, local_file, chunk_size=65536, initial_size=0):
"""Download a file chunk by chunk and show advancement
Can also be used when resuming downloads over http.
Parameters
----------
response: urllib.response.addinfourl
Response to the download request in order to get fi... | [
"Download",
"a",
"file",
"chunk",
"by",
"chunk",
"and",
"show",
"advancement"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/util/fetching.py#L174-L207 | [
"def",
"_chunk_read",
"(",
"response",
",",
"local_file",
",",
"chunk_size",
"=",
"65536",
",",
"initial_size",
"=",
"0",
")",
":",
"# Adapted from NISL:",
"# https://github.com/nisl/tutorial/blob/master/nisl/datasets.py",
"bytes_so_far",
"=",
"initial_size",
"# Returns onl... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | _chunk_write | Write a chunk to file and update the progress bar | glue_vispy_viewers/extern/vispy/util/fetching.py | def _chunk_write(chunk, local_file, progress):
"""Write a chunk to file and update the progress bar"""
local_file.write(chunk)
progress.update_with_increment_value(len(chunk)) | def _chunk_write(chunk, local_file, progress):
"""Write a chunk to file and update the progress bar"""
local_file.write(chunk)
progress.update_with_increment_value(len(chunk)) | [
"Write",
"a",
"chunk",
"to",
"file",
"and",
"update",
"the",
"progress",
"bar"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/util/fetching.py#L210-L213 | [
"def",
"_chunk_write",
"(",
"chunk",
",",
"local_file",
",",
"progress",
")",
":",
"local_file",
".",
"write",
"(",
"chunk",
")",
"progress",
".",
"update_with_increment_value",
"(",
"len",
"(",
"chunk",
")",
")"
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | _fetch_file | Load requested file, downloading it if needed or requested
Parameters
----------
url: string
The url of file to be downloaded.
file_name: string
Name, along with the path, of where downloaded file will be saved.
print_destination: bool, optional
If true, destination of where... | glue_vispy_viewers/extern/vispy/util/fetching.py | def _fetch_file(url, file_name, print_destination=True):
"""Load requested file, downloading it if needed or requested
Parameters
----------
url: string
The url of file to be downloaded.
file_name: string
Name, along with the path, of where downloaded file will be saved.
print_d... | def _fetch_file(url, file_name, print_destination=True):
"""Load requested file, downloading it if needed or requested
Parameters
----------
url: string
The url of file to be downloaded.
file_name: string
Name, along with the path, of where downloaded file will be saved.
print_d... | [
"Load",
"requested",
"file",
"downloading",
"it",
"if",
"needed",
"or",
"requested"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/util/fetching.py#L216-L261 | [
"def",
"_fetch_file",
"(",
"url",
",",
"file_name",
",",
"print_destination",
"=",
"True",
")",
":",
"# Adapted from NISL:",
"# https://github.com/nisl/tutorial/blob/master/nisl/datasets.py",
"temp_file_name",
"=",
"file_name",
"+",
"\".part\"",
"local_file",
"=",
"None",
... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | ProgressBar.update | Update progressbar with current value of process
Parameters
----------
cur_value : number
Current value of process. Should be <= max_value (but this is not
enforced). The percent of the progressbar will be computed as
(cur_value / max_value) * 100
m... | glue_vispy_viewers/extern/vispy/util/fetching.py | def update(self, cur_value, mesg=None):
"""Update progressbar with current value of process
Parameters
----------
cur_value : number
Current value of process. Should be <= max_value (but this is not
enforced). The percent of the progressbar will be computed as
... | def update(self, cur_value, mesg=None):
"""Update progressbar with current value of process
Parameters
----------
cur_value : number
Current value of process. Should be <= max_value (but this is not
enforced). The percent of the progressbar will be computed as
... | [
"Update",
"progressbar",
"with",
"current",
"value",
"of",
"process"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/util/fetching.py#L113-L153 | [
"def",
"update",
"(",
"self",
",",
"cur_value",
",",
"mesg",
"=",
"None",
")",
":",
"# Ensure floating-point division so we can get fractions of a percent",
"# for the progressbar.",
"self",
".",
"cur_value",
"=",
"cur_value",
"progress",
"=",
"float",
"(",
"self",
".... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | ProgressBar.update_with_increment_value | Update progressbar with the value of the increment instead of the
current value of process as in update()
Parameters
----------
increment_value : int
Value of the increment of process. The percent of the progressbar
will be computed as
(self.cur_valu... | glue_vispy_viewers/extern/vispy/util/fetching.py | def update_with_increment_value(self, increment_value, mesg=None):
"""Update progressbar with the value of the increment instead of the
current value of process as in update()
Parameters
----------
increment_value : int
Value of the increment of process. The percent... | def update_with_increment_value(self, increment_value, mesg=None):
"""Update progressbar with the value of the increment instead of the
current value of process as in update()
Parameters
----------
increment_value : int
Value of the increment of process. The percent... | [
"Update",
"progressbar",
"with",
"the",
"value",
"of",
"the",
"increment",
"instead",
"of",
"the",
"current",
"value",
"of",
"process",
"as",
"in",
"update",
"()"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/util/fetching.py#L155-L171 | [
"def",
"update_with_increment_value",
"(",
"self",
",",
"increment_value",
",",
"mesg",
"=",
"None",
")",
":",
"self",
".",
"cur_value",
"+=",
"increment_value",
"self",
".",
"update",
"(",
"self",
".",
"cur_value",
",",
"mesg",
")"
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | SceneCanvas.central_widget | Returns the default widget that occupies the entire area of the
canvas. | glue_vispy_viewers/extern/vispy/scene/canvas.py | def central_widget(self):
""" Returns the default widget that occupies the entire area of the
canvas.
"""
if self._central_widget is None:
self._central_widget = Widget(size=self.size, parent=self.scene)
return self._central_widget | def central_widget(self):
""" Returns the default widget that occupies the entire area of the
canvas.
"""
if self._central_widget is None:
self._central_widget = Widget(size=self.size, parent=self.scene)
return self._central_widget | [
"Returns",
"the",
"default",
"widget",
"that",
"occupies",
"the",
"entire",
"area",
"of",
"the",
"canvas",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/canvas.py#L164-L170 | [
"def",
"central_widget",
"(",
"self",
")",
":",
"if",
"self",
".",
"_central_widget",
"is",
"None",
":",
"self",
".",
"_central_widget",
"=",
"Widget",
"(",
"size",
"=",
"self",
".",
"size",
",",
"parent",
"=",
"self",
".",
"scene",
")",
"return",
"sel... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | SceneCanvas.render | Render the scene to an offscreen buffer and return the image array.
Parameters
----------
region : tuple | None
Specifies the region of the canvas to render. Format is
(x, y, w, h). By default, the entire canvas is rendered.
size : tuple | None
... | glue_vispy_viewers/extern/vispy/scene/canvas.py | def render(self, region=None, size=None, bgcolor=None):
"""Render the scene to an offscreen buffer and return the image array.
Parameters
----------
region : tuple | None
Specifies the region of the canvas to render. Format is
(x, y, w, h). By default, t... | def render(self, region=None, size=None, bgcolor=None):
"""Render the scene to an offscreen buffer and return the image array.
Parameters
----------
region : tuple | None
Specifies the region of the canvas to render. Format is
(x, y, w, h). By default, t... | [
"Render",
"the",
"scene",
"to",
"an",
"offscreen",
"buffer",
"and",
"return",
"the",
"image",
"array",
".",
"Parameters",
"----------",
"region",
":",
"tuple",
"|",
"None",
"Specifies",
"the",
"region",
"of",
"the",
"canvas",
"to",
"render",
".",
"Format",
... | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/canvas.py#L209-L247 | [
"def",
"render",
"(",
"self",
",",
"region",
"=",
"None",
",",
"size",
"=",
"None",
",",
"bgcolor",
"=",
"None",
")",
":",
"self",
".",
"set_current",
"(",
")",
"# Set up a framebuffer to render to",
"offset",
"=",
"(",
"0",
",",
"0",
")",
"if",
"regio... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | SceneCanvas.draw_visual | Draw a visual and its children to the canvas or currently active
framebuffer.
Parameters
----------
visual : Visual
The visual to draw
event : None or DrawEvent
Optionally specifies the original canvas draw event that initiated
this dr... | glue_vispy_viewers/extern/vispy/scene/canvas.py | def draw_visual(self, visual, event=None):
""" Draw a visual and its children to the canvas or currently active
framebuffer.
Parameters
----------
visual : Visual
The visual to draw
event : None or DrawEvent
Optionally specifies the origin... | def draw_visual(self, visual, event=None):
""" Draw a visual and its children to the canvas or currently active
framebuffer.
Parameters
----------
visual : Visual
The visual to draw
event : None or DrawEvent
Optionally specifies the origin... | [
"Draw",
"a",
"visual",
"and",
"its",
"children",
"to",
"the",
"canvas",
"or",
"currently",
"active",
"framebuffer",
".",
"Parameters",
"----------",
"visual",
":",
"Visual",
"The",
"visual",
"to",
"draw",
"event",
":",
"None",
"or",
"DrawEvent",
"Optionally",
... | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/canvas.py#L255-L298 | [
"def",
"draw_visual",
"(",
"self",
",",
"visual",
",",
"event",
"=",
"None",
")",
":",
"prof",
"=",
"Profiler",
"(",
")",
"# make sure this canvas's context is active",
"self",
".",
"set_current",
"(",
")",
"try",
":",
"self",
".",
"_drawing",
"=",
"True",
... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | SceneCanvas._generate_draw_order | Return a list giving the order to draw visuals.
Each node appears twice in the list--(node, True) appears before the
node's children are drawn, and (node, False) appears after. | glue_vispy_viewers/extern/vispy/scene/canvas.py | def _generate_draw_order(self, node=None):
"""Return a list giving the order to draw visuals.
Each node appears twice in the list--(node, True) appears before the
node's children are drawn, and (node, False) appears after.
"""
if node is None:
node = self._sc... | def _generate_draw_order(self, node=None):
"""Return a list giving the order to draw visuals.
Each node appears twice in the list--(node, True) appears before the
node's children are drawn, and (node, False) appears after.
"""
if node is None:
node = self._sc... | [
"Return",
"a",
"list",
"giving",
"the",
"order",
"to",
"draw",
"visuals",
".",
"Each",
"node",
"appears",
"twice",
"in",
"the",
"list",
"--",
"(",
"node",
"True",
")",
"appears",
"before",
"the",
"node",
"s",
"children",
"are",
"drawn",
"and",
"(",
"no... | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/canvas.py#L300-L314 | [
"def",
"_generate_draw_order",
"(",
"self",
",",
"node",
"=",
"None",
")",
":",
"if",
"node",
"is",
"None",
":",
"node",
"=",
"self",
".",
"_scene",
"order",
"=",
"[",
"(",
"node",
",",
"True",
")",
"]",
"children",
"=",
"node",
".",
"children",
"c... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | SceneCanvas.visual_at | Return the visual at a given position
Parameters
----------
pos : tuple
The position in logical coordinates to query.
Returns
-------
visual : instance of Visual | None
The visual at the position, if it exists. | glue_vispy_viewers/extern/vispy/scene/canvas.py | def visual_at(self, pos):
"""Return the visual at a given position
Parameters
----------
pos : tuple
The position in logical coordinates to query.
Returns
-------
visual : instance of Visual | None
The visual at the position, if it exists... | def visual_at(self, pos):
"""Return the visual at a given position
Parameters
----------
pos : tuple
The position in logical coordinates to query.
Returns
-------
visual : instance of Visual | None
The visual at the position, if it exists... | [
"Return",
"the",
"visual",
"at",
"a",
"given",
"position"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/canvas.py#L367-L391 | [
"def",
"visual_at",
"(",
"self",
",",
"pos",
")",
":",
"tr",
"=",
"self",
".",
"transforms",
".",
"get_transform",
"(",
"'canvas'",
",",
"'framebuffer'",
")",
"fbpos",
"=",
"tr",
".",
"map",
"(",
"pos",
")",
"[",
":",
"2",
"]",
"try",
":",
"id_",
... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | SceneCanvas._visual_bounds_at | Find a visual whose bounding rect encompasses *pos*. | glue_vispy_viewers/extern/vispy/scene/canvas.py | def _visual_bounds_at(self, pos, node=None):
"""Find a visual whose bounding rect encompasses *pos*.
"""
if node is None:
node = self.scene
for ch in node.children:
hit = self._visual_bounds_at(pos, ch)
if hit is not None:
... | def _visual_bounds_at(self, pos, node=None):
"""Find a visual whose bounding rect encompasses *pos*.
"""
if node is None:
node = self.scene
for ch in node.children:
hit = self._visual_bounds_at(pos, ch)
if hit is not None:
... | [
"Find",
"a",
"visual",
"whose",
"bounding",
"rect",
"encompasses",
"*",
"pos",
"*",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/canvas.py#L393-L423 | [
"def",
"_visual_bounds_at",
"(",
"self",
",",
"pos",
",",
"node",
"=",
"None",
")",
":",
"if",
"node",
"is",
"None",
":",
"node",
"=",
"self",
".",
"scene",
"for",
"ch",
"in",
"node",
".",
"children",
":",
"hit",
"=",
"self",
".",
"_visual_bounds_at"... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | SceneCanvas.visuals_at | Return a list of visuals within *radius* pixels of *pos*.
Visuals are sorted by their proximity to *pos*.
Parameters
----------
pos : tuple
(x, y) position at which to find visuals.
radius : int
Distance away from *pos* to search for visu... | glue_vispy_viewers/extern/vispy/scene/canvas.py | def visuals_at(self, pos, radius=10):
"""Return a list of visuals within *radius* pixels of *pos*.
Visuals are sorted by their proximity to *pos*.
Parameters
----------
pos : tuple
(x, y) position at which to find visuals.
radius : int
... | def visuals_at(self, pos, radius=10):
"""Return a list of visuals within *radius* pixels of *pos*.
Visuals are sorted by their proximity to *pos*.
Parameters
----------
pos : tuple
(x, y) position at which to find visuals.
radius : int
... | [
"Return",
"a",
"list",
"of",
"visuals",
"within",
"*",
"radius",
"*",
"pixels",
"of",
"*",
"pos",
"*",
".",
"Visuals",
"are",
"sorted",
"by",
"their",
"proximity",
"to",
"*",
"pos",
"*",
".",
"Parameters",
"----------",
"pos",
":",
"tuple",
"(",
"x",
... | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/canvas.py#L425-L450 | [
"def",
"visuals_at",
"(",
"self",
",",
"pos",
",",
"radius",
"=",
"10",
")",
":",
"tr",
"=",
"self",
".",
"transforms",
".",
"get_transform",
"(",
"'canvas'",
",",
"'framebuffer'",
")",
"pos",
"=",
"tr",
".",
"map",
"(",
"pos",
")",
"[",
":",
"2",
... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | SceneCanvas._render_picking | Render the scene in picking mode, returning a 2D array of visual
IDs. | glue_vispy_viewers/extern/vispy/scene/canvas.py | def _render_picking(self, **kwargs):
"""Render the scene in picking mode, returning a 2D array of visual
IDs.
"""
try:
self._scene.picking = True
img = self.render(bgcolor=(0, 0, 0, 0), **kwargs)
finally:
self._scene.picking = False
im... | def _render_picking(self, **kwargs):
"""Render the scene in picking mode, returning a 2D array of visual
IDs.
"""
try:
self._scene.picking = True
img = self.render(bgcolor=(0, 0, 0, 0), **kwargs)
finally:
self._scene.picking = False
im... | [
"Render",
"the",
"scene",
"in",
"picking",
"mode",
"returning",
"a",
"2D",
"array",
"of",
"visual",
"IDs",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/canvas.py#L452-L463 | [
"def",
"_render_picking",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"try",
":",
"self",
".",
"_scene",
".",
"picking",
"=",
"True",
"img",
"=",
"self",
".",
"render",
"(",
"bgcolor",
"=",
"(",
"0",
",",
"0",
",",
"0",
",",
"0",
")",
",",
... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | SceneCanvas.on_resize | Resize handler
Parameters
----------
event : instance of Event
The resize event. | glue_vispy_viewers/extern/vispy/scene/canvas.py | def on_resize(self, event):
"""Resize handler
Parameters
----------
event : instance of Event
The resize event.
"""
self._update_transforms()
if self._central_widget is not None:
self._central_widget.size = self.size
... | def on_resize(self, event):
"""Resize handler
Parameters
----------
event : instance of Event
The resize event.
"""
self._update_transforms()
if self._central_widget is not None:
self._central_widget.size = self.size
... | [
"Resize",
"handler"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/canvas.py#L465-L479 | [
"def",
"on_resize",
"(",
"self",
",",
"event",
")",
":",
"self",
".",
"_update_transforms",
"(",
")",
"if",
"self",
".",
"_central_widget",
"is",
"not",
"None",
":",
"self",
".",
"_central_widget",
".",
"size",
"=",
"self",
".",
"size",
"if",
"len",
"(... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | SceneCanvas.on_close | Close event handler
Parameters
----------
event : instance of Event
The event. | glue_vispy_viewers/extern/vispy/scene/canvas.py | def on_close(self, event):
"""Close event handler
Parameters
----------
event : instance of Event
The event.
"""
self.events.mouse_press.disconnect(self._process_mouse_event)
self.events.mouse_move.disconnect(self._process_mouse_event)
self.ev... | def on_close(self, event):
"""Close event handler
Parameters
----------
event : instance of Event
The event.
"""
self.events.mouse_press.disconnect(self._process_mouse_event)
self.events.mouse_move.disconnect(self._process_mouse_event)
self.ev... | [
"Close",
"event",
"handler"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/canvas.py#L481-L492 | [
"def",
"on_close",
"(",
"self",
",",
"event",
")",
":",
"self",
".",
"events",
".",
"mouse_press",
".",
"disconnect",
"(",
"self",
".",
"_process_mouse_event",
")",
"self",
".",
"events",
".",
"mouse_move",
".",
"disconnect",
"(",
"self",
".",
"_process_mo... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | SceneCanvas.push_viewport | Push a viewport (x, y, w, h) on the stack. Values must be integers
relative to the active framebuffer.
Parameters
----------
viewport : tuple
The viewport as (x, y, w, h). | glue_vispy_viewers/extern/vispy/scene/canvas.py | def push_viewport(self, viewport):
""" Push a viewport (x, y, w, h) on the stack. Values must be integers
relative to the active framebuffer.
Parameters
----------
viewport : tuple
The viewport as (x, y, w, h).
"""
vp = list(viewport)
# Normal... | def push_viewport(self, viewport):
""" Push a viewport (x, y, w, h) on the stack. Values must be integers
relative to the active framebuffer.
Parameters
----------
viewport : tuple
The viewport as (x, y, w, h).
"""
vp = list(viewport)
# Normal... | [
"Push",
"a",
"viewport",
"(",
"x",
"y",
"w",
"h",
")",
"on",
"the",
"stack",
".",
"Values",
"must",
"be",
"integers",
"relative",
"to",
"the",
"active",
"framebuffer",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/canvas.py#L495-L520 | [
"def",
"push_viewport",
"(",
"self",
",",
"viewport",
")",
":",
"vp",
"=",
"list",
"(",
"viewport",
")",
"# Normalize viewport before setting;",
"if",
"vp",
"[",
"2",
"]",
"<",
"0",
":",
"vp",
"[",
"0",
"]",
"+=",
"vp",
"[",
"2",
"]",
"vp",
"[",
"2... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | SceneCanvas.pop_viewport | Pop a viewport from the stack. | glue_vispy_viewers/extern/vispy/scene/canvas.py | def pop_viewport(self):
""" Pop a viewport from the stack.
"""
vp = self._vp_stack.pop()
# Activate latest
if len(self._vp_stack) > 0:
self.context.set_viewport(*self._vp_stack[-1])
else:
self.context.set_viewport(0, 0, *self.physical_size)
... | def pop_viewport(self):
""" Pop a viewport from the stack.
"""
vp = self._vp_stack.pop()
# Activate latest
if len(self._vp_stack) > 0:
self.context.set_viewport(*self._vp_stack[-1])
else:
self.context.set_viewport(0, 0, *self.physical_size)
... | [
"Pop",
"a",
"viewport",
"from",
"the",
"stack",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/canvas.py#L522-L533 | [
"def",
"pop_viewport",
"(",
"self",
")",
":",
"vp",
"=",
"self",
".",
"_vp_stack",
".",
"pop",
"(",
")",
"# Activate latest",
"if",
"len",
"(",
"self",
".",
"_vp_stack",
")",
">",
"0",
":",
"self",
".",
"context",
".",
"set_viewport",
"(",
"*",
"self... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | SceneCanvas.push_fbo | Push an FBO on the stack.
This activates the framebuffer and causes subsequent rendering to be
written to the framebuffer rather than the canvas's back buffer. This
will also set the canvas viewport to cover the boundaries of the
framebuffer.
Parameters
-------... | glue_vispy_viewers/extern/vispy/scene/canvas.py | def push_fbo(self, fbo, offset, csize):
""" Push an FBO on the stack.
This activates the framebuffer and causes subsequent rendering to be
written to the framebuffer rather than the canvas's back buffer. This
will also set the canvas viewport to cover the boundaries of the
... | def push_fbo(self, fbo, offset, csize):
""" Push an FBO on the stack.
This activates the framebuffer and causes subsequent rendering to be
written to the framebuffer rather than the canvas's back buffer. This
will also set the canvas viewport to cover the boundaries of the
... | [
"Push",
"an",
"FBO",
"on",
"the",
"stack",
".",
"This",
"activates",
"the",
"framebuffer",
"and",
"causes",
"subsequent",
"rendering",
"to",
"be",
"written",
"to",
"the",
"framebuffer",
"rather",
"than",
"the",
"canvas",
"s",
"back",
"buffer",
".",
"This",
... | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/canvas.py#L535-L563 | [
"def",
"push_fbo",
"(",
"self",
",",
"fbo",
",",
"offset",
",",
"csize",
")",
":",
"self",
".",
"_fb_stack",
".",
"append",
"(",
"(",
"fbo",
",",
"offset",
",",
"csize",
")",
")",
"try",
":",
"fbo",
".",
"activate",
"(",
")",
"h",
",",
"w",
"="... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | SceneCanvas.pop_fbo | Pop an FBO from the stack. | glue_vispy_viewers/extern/vispy/scene/canvas.py | def pop_fbo(self):
""" Pop an FBO from the stack.
"""
fbo = self._fb_stack.pop()
fbo[0].deactivate()
self.pop_viewport()
if len(self._fb_stack) > 0:
old_fbo = self._fb_stack[-1]
old_fbo[0].activate()
self._update_transforms()
... | def pop_fbo(self):
""" Pop an FBO from the stack.
"""
fbo = self._fb_stack.pop()
fbo[0].deactivate()
self.pop_viewport()
if len(self._fb_stack) > 0:
old_fbo = self._fb_stack[-1]
old_fbo[0].activate()
self._update_transforms()
... | [
"Pop",
"an",
"FBO",
"from",
"the",
"stack",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/canvas.py#L565-L576 | [
"def",
"pop_fbo",
"(",
"self",
")",
":",
"fbo",
"=",
"self",
".",
"_fb_stack",
".",
"pop",
"(",
")",
"fbo",
"[",
"0",
"]",
".",
"deactivate",
"(",
")",
"self",
".",
"pop_viewport",
"(",
")",
"if",
"len",
"(",
"self",
".",
"_fb_stack",
")",
">",
... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | SceneCanvas._update_transforms | Update the canvas's TransformSystem to correct for the current
canvas size, framebuffer, and viewport. | glue_vispy_viewers/extern/vispy/scene/canvas.py | def _update_transforms(self):
"""Update the canvas's TransformSystem to correct for the current
canvas size, framebuffer, and viewport.
"""
if len(self._fb_stack) == 0:
fb_size = fb_rect = None
else:
fb, origin, fb_size = self._fb_stack[-1]
fb... | def _update_transforms(self):
"""Update the canvas's TransformSystem to correct for the current
canvas size, framebuffer, and viewport.
"""
if len(self._fb_stack) == 0:
fb_size = fb_rect = None
else:
fb, origin, fb_size = self._fb_stack[-1]
fb... | [
"Update",
"the",
"canvas",
"s",
"TransformSystem",
"to",
"correct",
"for",
"the",
"current",
"canvas",
"size",
"framebuffer",
"and",
"viewport",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/scene/canvas.py#L587-L603 | [
"def",
"_update_transforms",
"(",
"self",
")",
":",
"if",
"len",
"(",
"self",
".",
"_fb_stack",
")",
"==",
"0",
":",
"fb_size",
"=",
"fb_rect",
"=",
"None",
"else",
":",
"fb",
",",
"origin",
",",
"fb_size",
"=",
"self",
".",
"_fb_stack",
"[",
"-",
... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | BaseTexture.wrapping | Texture wrapping mode | glue_vispy_viewers/extern/vispy/gloo/texture.py | def wrapping(self):
""" Texture wrapping mode """
value = self._wrapping
return value[0] if all([v == value[0] for v in value]) else value | def wrapping(self):
""" Texture wrapping mode """
value = self._wrapping
return value[0] if all([v == value[0] for v in value]) else value | [
"Texture",
"wrapping",
"mode"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/texture.py#L156-L159 | [
"def",
"wrapping",
"(",
"self",
")",
":",
"value",
"=",
"self",
".",
"_wrapping",
"return",
"value",
"[",
"0",
"]",
"if",
"all",
"(",
"[",
"v",
"==",
"value",
"[",
"0",
"]",
"for",
"v",
"in",
"value",
"]",
")",
"else",
"value"
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | BaseTexture.resize | Set the texture size and format
Parameters
----------
shape : tuple of integers
New texture shape in zyx order. Optionally, an extra dimention
may be specified to indicate the number of color channels.
format : str | enum | None
The format of the text... | glue_vispy_viewers/extern/vispy/gloo/texture.py | def resize(self, shape, format=None, internalformat=None):
"""Set the texture size and format
Parameters
----------
shape : tuple of integers
New texture shape in zyx order. Optionally, an extra dimention
may be specified to indicate the number of color channels.... | def resize(self, shape, format=None, internalformat=None):
"""Set the texture size and format
Parameters
----------
shape : tuple of integers
New texture shape in zyx order. Optionally, an extra dimention
may be specified to indicate the number of color channels.... | [
"Set",
"the",
"texture",
"size",
"and",
"format"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/texture.py#L202-L224 | [
"def",
"resize",
"(",
"self",
",",
"shape",
",",
"format",
"=",
"None",
",",
"internalformat",
"=",
"None",
")",
":",
"return",
"self",
".",
"_resize",
"(",
"shape",
",",
"format",
",",
"internalformat",
")"
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | BaseTexture._resize | Internal method for resize. | glue_vispy_viewers/extern/vispy/gloo/texture.py | def _resize(self, shape, format=None, internalformat=None):
"""Internal method for resize.
"""
shape = self._normalize_shape(shape)
# Check
if not self._resizable:
raise RuntimeError("Texture is not resizable")
# Determine format
if format is None:
... | def _resize(self, shape, format=None, internalformat=None):
"""Internal method for resize.
"""
shape = self._normalize_shape(shape)
# Check
if not self._resizable:
raise RuntimeError("Texture is not resizable")
# Determine format
if format is None:
... | [
"Internal",
"method",
"for",
"resize",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/texture.py#L226-L277 | [
"def",
"_resize",
"(",
"self",
",",
"shape",
",",
"format",
"=",
"None",
",",
"internalformat",
"=",
"None",
")",
":",
"shape",
"=",
"self",
".",
"_normalize_shape",
"(",
"shape",
")",
"# Check",
"if",
"not",
"self",
".",
"_resizable",
":",
"raise",
"R... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | BaseTexture.set_data | Set texture data
Parameters
----------
data : ndarray
Data to be uploaded
offset: int | tuple of ints
Offset in texture where to start copying data
copy: bool
Since the operation is deferred, data may change before
data is actually... | glue_vispy_viewers/extern/vispy/gloo/texture.py | def set_data(self, data, offset=None, copy=False):
"""Set texture data
Parameters
----------
data : ndarray
Data to be uploaded
offset: int | tuple of ints
Offset in texture where to start copying data
copy: bool
Since the operation is... | def set_data(self, data, offset=None, copy=False):
"""Set texture data
Parameters
----------
data : ndarray
Data to be uploaded
offset: int | tuple of ints
Offset in texture where to start copying data
copy: bool
Since the operation is... | [
"Set",
"texture",
"data"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/texture.py#L279-L298 | [
"def",
"set_data",
"(",
"self",
",",
"data",
",",
"offset",
"=",
"None",
",",
"copy",
"=",
"False",
")",
":",
"return",
"self",
".",
"_set_data",
"(",
"data",
",",
"offset",
",",
"copy",
")"
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | BaseTexture._set_data | Internal method for set_data. | glue_vispy_viewers/extern/vispy/gloo/texture.py | def _set_data(self, data, offset=None, copy=False):
"""Internal method for set_data.
"""
# Copy if needed, check/normalize shape
data = np.array(data, copy=copy)
data = self._normalize_shape(data)
# Maybe resize to purge DATA commands?
if offset ... | def _set_data(self, data, offset=None, copy=False):
"""Internal method for set_data.
"""
# Copy if needed, check/normalize shape
data = np.array(data, copy=copy)
data = self._normalize_shape(data)
# Maybe resize to purge DATA commands?
if offset ... | [
"Internal",
"method",
"for",
"set_data",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/texture.py#L300-L324 | [
"def",
"_set_data",
"(",
"self",
",",
"data",
",",
"offset",
"=",
"None",
",",
"copy",
"=",
"False",
")",
":",
"# Copy if needed, check/normalize shape",
"data",
"=",
"np",
".",
"array",
"(",
"data",
",",
"copy",
"=",
"copy",
")",
"data",
"=",
"self",
... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | TextureEmulated3D.set_data | Set texture data
Parameters
----------
data : ndarray
Data to be uploaded
offset: int | tuple of ints
Offset in texture where to start copying data
copy: bool
Since the operation is deferred, data may change before
data is actually... | glue_vispy_viewers/extern/vispy/gloo/texture.py | def set_data(self, data, offset=None, copy=False):
"""Set texture data
Parameters
----------
data : ndarray
Data to be uploaded
offset: int | tuple of ints
Offset in texture where to start copying data
copy: bool
Since the operation is... | def set_data(self, data, offset=None, copy=False):
"""Set texture data
Parameters
----------
data : ndarray
Data to be uploaded
offset: int | tuple of ints
Offset in texture where to start copying data
copy: bool
Since the operation is... | [
"Set",
"texture",
"data"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/texture.py#L726-L748 | [
"def",
"set_data",
"(",
"self",
",",
"data",
",",
"offset",
"=",
"None",
",",
"copy",
"=",
"False",
")",
":",
"self",
".",
"_set_emulated_shape",
"(",
"data",
")",
"Texture2D",
".",
"set_data",
"(",
"self",
",",
"self",
".",
"_normalize_emulated_shape",
... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | TextureEmulated3D.resize | Set the texture size and format
Parameters
----------
shape : tuple of integers
New texture shape in zyx order. Optionally, an extra dimention
may be specified to indicate the number of color channels.
format : str | enum | None
The format of the text... | glue_vispy_viewers/extern/vispy/gloo/texture.py | def resize(self, shape, format=None, internalformat=None):
"""Set the texture size and format
Parameters
----------
shape : tuple of integers
New texture shape in zyx order. Optionally, an extra dimention
may be specified to indicate the number of color channels.... | def resize(self, shape, format=None, internalformat=None):
"""Set the texture size and format
Parameters
----------
shape : tuple of integers
New texture shape in zyx order. Optionally, an extra dimention
may be specified to indicate the number of color channels.... | [
"Set",
"the",
"texture",
"size",
"and",
"format"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/texture.py#L750-L775 | [
"def",
"resize",
"(",
"self",
",",
"shape",
",",
"format",
"=",
"None",
",",
"internalformat",
"=",
"None",
")",
":",
"self",
".",
"_set_emulated_shape",
"(",
"shape",
")",
"Texture2D",
".",
"resize",
"(",
"self",
",",
"self",
".",
"_normalize_emulated_sha... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | TextureAtlas.get_free_region | Get a free region of given size and allocate it
Parameters
----------
width : int
Width of region to allocate
height : int
Height of region to allocate
Returns
-------
bounds : tuple | None
A newly allocated region as (x, y, w... | glue_vispy_viewers/extern/vispy/gloo/texture.py | def get_free_region(self, width, height):
"""Get a free region of given size and allocate it
Parameters
----------
width : int
Width of region to allocate
height : int
Height of region to allocate
Returns
-------
bounds : tuple | ... | def get_free_region(self, width, height):
"""Get a free region of given size and allocate it
Parameters
----------
width : int
Width of region to allocate
height : int
Height of region to allocate
Returns
-------
bounds : tuple | ... | [
"Get",
"a",
"free",
"region",
"of",
"given",
"size",
"and",
"allocate",
"it"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/texture.py#L839-L900 | [
"def",
"get_free_region",
"(",
"self",
",",
"width",
",",
"height",
")",
":",
"best_height",
"=",
"best_width",
"=",
"np",
".",
"inf",
"best_index",
"=",
"-",
"1",
"for",
"i",
"in",
"range",
"(",
"len",
"(",
"self",
".",
"_atlas_nodes",
")",
")",
":"... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | TextureAtlas._fit | Test if region (width, height) fit into self._atlas_nodes[index] | glue_vispy_viewers/extern/vispy/gloo/texture.py | def _fit(self, index, width, height):
"""Test if region (width, height) fit into self._atlas_nodes[index]"""
node = self._atlas_nodes[index]
x, y = node[0], node[1]
width_left = width
if x+width > self._shape[1]:
return -1
i = index
while width_left > ... | def _fit(self, index, width, height):
"""Test if region (width, height) fit into self._atlas_nodes[index]"""
node = self._atlas_nodes[index]
x, y = node[0], node[1]
width_left = width
if x+width > self._shape[1]:
return -1
i = index
while width_left > ... | [
"Test",
"if",
"region",
"(",
"width",
"height",
")",
"fit",
"into",
"self",
".",
"_atlas_nodes",
"[",
"index",
"]"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/gloo/texture.py#L902-L917 | [
"def",
"_fit",
"(",
"self",
",",
"index",
",",
"width",
",",
"height",
")",
":",
"node",
"=",
"self",
".",
"_atlas_nodes",
"[",
"index",
"]",
"x",
",",
"y",
"=",
"node",
"[",
"0",
"]",
",",
"node",
"[",
"1",
"]",
"width_left",
"=",
"width",
"if... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | _vector_or_scalar | Convert an object to either a scalar or a row or column vector. | glue_vispy_viewers/extern/vispy/color/colormap.py | def _vector_or_scalar(x, type='row'):
"""Convert an object to either a scalar or a row or column vector."""
if isinstance(x, (list, tuple)):
x = np.array(x)
if isinstance(x, np.ndarray):
assert x.ndim == 1
if type == 'column':
x = x[:, None]
return x | def _vector_or_scalar(x, type='row'):
"""Convert an object to either a scalar or a row or column vector."""
if isinstance(x, (list, tuple)):
x = np.array(x)
if isinstance(x, np.ndarray):
assert x.ndim == 1
if type == 'column':
x = x[:, None]
return x | [
"Convert",
"an",
"object",
"to",
"either",
"a",
"scalar",
"or",
"a",
"row",
"or",
"column",
"vector",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/color/colormap.py#L20-L28 | [
"def",
"_vector_or_scalar",
"(",
"x",
",",
"type",
"=",
"'row'",
")",
":",
"if",
"isinstance",
"(",
"x",
",",
"(",
"list",
",",
"tuple",
")",
")",
":",
"x",
"=",
"np",
".",
"array",
"(",
"x",
")",
"if",
"isinstance",
"(",
"x",
",",
"np",
".",
... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | _vector | Convert an object to a row or column vector. | glue_vispy_viewers/extern/vispy/color/colormap.py | def _vector(x, type='row'):
"""Convert an object to a row or column vector."""
if isinstance(x, (list, tuple)):
x = np.array(x, dtype=np.float32)
elif not isinstance(x, np.ndarray):
x = np.array([x], dtype=np.float32)
assert x.ndim == 1
if type == 'column':
x = x[:, None]
... | def _vector(x, type='row'):
"""Convert an object to a row or column vector."""
if isinstance(x, (list, tuple)):
x = np.array(x, dtype=np.float32)
elif not isinstance(x, np.ndarray):
x = np.array([x], dtype=np.float32)
assert x.ndim == 1
if type == 'column':
x = x[:, None]
... | [
"Convert",
"an",
"object",
"to",
"a",
"row",
"or",
"column",
"vector",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/color/colormap.py#L31-L40 | [
"def",
"_vector",
"(",
"x",
",",
"type",
"=",
"'row'",
")",
":",
"if",
"isinstance",
"(",
"x",
",",
"(",
"list",
",",
"tuple",
")",
")",
":",
"x",
"=",
"np",
".",
"array",
"(",
"x",
",",
"dtype",
"=",
"np",
".",
"float32",
")",
"elif",
"not",... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | _normalize | Normalize an array from the range [cmin, cmax] to [0,1],
with optional clipping. | glue_vispy_viewers/extern/vispy/color/colormap.py | def _normalize(x, cmin=None, cmax=None, clip=True):
"""Normalize an array from the range [cmin, cmax] to [0,1],
with optional clipping."""
if not isinstance(x, np.ndarray):
x = np.array(x)
if cmin is None:
cmin = x.min()
if cmax is None:
cmax = x.max()
if cmin == cmax:
... | def _normalize(x, cmin=None, cmax=None, clip=True):
"""Normalize an array from the range [cmin, cmax] to [0,1],
with optional clipping."""
if not isinstance(x, np.ndarray):
x = np.array(x)
if cmin is None:
cmin = x.min()
if cmax is None:
cmax = x.max()
if cmin == cmax:
... | [
"Normalize",
"an",
"array",
"from",
"the",
"range",
"[",
"cmin",
"cmax",
"]",
"to",
"[",
"0",
"1",
"]",
"with",
"optional",
"clipping",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/color/colormap.py#L49-L65 | [
"def",
"_normalize",
"(",
"x",
",",
"cmin",
"=",
"None",
",",
"cmax",
"=",
"None",
",",
"clip",
"=",
"True",
")",
":",
"if",
"not",
"isinstance",
"(",
"x",
",",
"np",
".",
"ndarray",
")",
":",
"x",
"=",
"np",
".",
"array",
"(",
"x",
")",
"if"... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | _mix_simple | Mix b (with proportion x) with a. | glue_vispy_viewers/extern/vispy/color/colormap.py | def _mix_simple(a, b, x):
"""Mix b (with proportion x) with a."""
x = np.clip(x, 0.0, 1.0)
return (1.0 - x)*a + x*b | def _mix_simple(a, b, x):
"""Mix b (with proportion x) with a."""
x = np.clip(x, 0.0, 1.0)
return (1.0 - x)*a + x*b | [
"Mix",
"b",
"(",
"with",
"proportion",
"x",
")",
"with",
"a",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/color/colormap.py#L69-L72 | [
"def",
"_mix_simple",
"(",
"a",
",",
"b",
",",
"x",
")",
":",
"x",
"=",
"np",
".",
"clip",
"(",
"x",
",",
"0.0",
",",
"1.0",
")",
"return",
"(",
"1.0",
"-",
"x",
")",
"*",
"a",
"+",
"x",
"*",
"b"
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | smoothstep | performs smooth Hermite interpolation
between 0 and 1 when edge0 < x < edge1. | glue_vispy_viewers/extern/vispy/color/colormap.py | def smoothstep(edge0, edge1, x):
""" performs smooth Hermite interpolation
between 0 and 1 when edge0 < x < edge1. """
# Scale, bias and saturate x to 0..1 range
x = np.clip((x - edge0)/(edge1 - edge0), 0.0, 1.0)
# Evaluate polynomial
return x*x*(3 - 2*x) | def smoothstep(edge0, edge1, x):
""" performs smooth Hermite interpolation
between 0 and 1 when edge0 < x < edge1. """
# Scale, bias and saturate x to 0..1 range
x = np.clip((x - edge0)/(edge1 - edge0), 0.0, 1.0)
# Evaluate polynomial
return x*x*(3 - 2*x) | [
"performs",
"smooth",
"Hermite",
"interpolation",
"between",
"0",
"and",
"1",
"when",
"edge0",
"<",
"x",
"<",
"edge1",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/color/colormap.py#L98-L104 | [
"def",
"smoothstep",
"(",
"edge0",
",",
"edge1",
",",
"x",
")",
":",
"# Scale, bias and saturate x to 0..1 range",
"x",
"=",
"np",
".",
"clip",
"(",
"(",
"x",
"-",
"edge0",
")",
"/",
"(",
"edge1",
"-",
"edge0",
")",
",",
"0.0",
",",
"1.0",
")",
"# Ev... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | step | Step interpolation from a set of colors. x belongs in [0, 1]. | glue_vispy_viewers/extern/vispy/color/colormap.py | def step(colors, x, controls=None):
x = x.ravel()
"""Step interpolation from a set of colors. x belongs in [0, 1]."""
assert (controls[0], controls[-1]) == (0., 1.)
ncolors = len(colors)
assert ncolors == len(controls) - 1
assert ncolors >= 2
x_step = _find_controls(x, controls, ncolors-1)
... | def step(colors, x, controls=None):
x = x.ravel()
"""Step interpolation from a set of colors. x belongs in [0, 1]."""
assert (controls[0], controls[-1]) == (0., 1.)
ncolors = len(colors)
assert ncolors == len(controls) - 1
assert ncolors >= 2
x_step = _find_controls(x, controls, ncolors-1)
... | [
"Step",
"interpolation",
"from",
"a",
"set",
"of",
"colors",
".",
"x",
"belongs",
"in",
"[",
"0",
"1",
"]",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/color/colormap.py#L107-L115 | [
"def",
"step",
"(",
"colors",
",",
"x",
",",
"controls",
"=",
"None",
")",
":",
"x",
"=",
"x",
".",
"ravel",
"(",
")",
"assert",
"(",
"controls",
"[",
"0",
"]",
",",
"controls",
"[",
"-",
"1",
"]",
")",
"==",
"(",
"0.",
",",
"1.",
")",
"nco... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | _glsl_mix | Generate a GLSL template function from a given interpolation patterns
and control points. | glue_vispy_viewers/extern/vispy/color/colormap.py | def _glsl_mix(controls=None):
"""Generate a GLSL template function from a given interpolation patterns
and control points."""
assert (controls[0], controls[-1]) == (0., 1.)
ncolors = len(controls)
assert ncolors >= 2
if ncolors == 2:
s = " return mix($color_0, $color_1, t);\n"
els... | def _glsl_mix(controls=None):
"""Generate a GLSL template function from a given interpolation patterns
and control points."""
assert (controls[0], controls[-1]) == (0., 1.)
ncolors = len(controls)
assert ncolors >= 2
if ncolors == 2:
s = " return mix($color_0, $color_1, t);\n"
els... | [
"Generate",
"a",
"GLSL",
"template",
"function",
"from",
"a",
"given",
"interpolation",
"patterns",
"and",
"control",
"points",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/color/colormap.py#L119-L140 | [
"def",
"_glsl_mix",
"(",
"controls",
"=",
"None",
")",
":",
"assert",
"(",
"controls",
"[",
"0",
"]",
",",
"controls",
"[",
"-",
"1",
"]",
")",
"==",
"(",
"0.",
",",
"1.",
")",
"ncolors",
"=",
"len",
"(",
"controls",
")",
"assert",
"ncolors",
">=... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | _process_glsl_template | Replace $color_i by color #i in the GLSL template. | glue_vispy_viewers/extern/vispy/color/colormap.py | def _process_glsl_template(template, colors):
"""Replace $color_i by color #i in the GLSL template."""
for i in range(len(colors) - 1, -1, -1):
color = colors[i]
assert len(color) == 4
vec4_color = 'vec4(%.3f, %.3f, %.3f, %.3f)' % tuple(color)
template = template.replace('$color_... | def _process_glsl_template(template, colors):
"""Replace $color_i by color #i in the GLSL template."""
for i in range(len(colors) - 1, -1, -1):
color = colors[i]
assert len(color) == 4
vec4_color = 'vec4(%.3f, %.3f, %.3f, %.3f)' % tuple(color)
template = template.replace('$color_... | [
"Replace",
"$color_i",
"by",
"color",
"#i",
"in",
"the",
"GLSL",
"template",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/color/colormap.py#L160-L167 | [
"def",
"_process_glsl_template",
"(",
"template",
",",
"colors",
")",
":",
"for",
"i",
"in",
"range",
"(",
"len",
"(",
"colors",
")",
"-",
"1",
",",
"-",
"1",
",",
"-",
"1",
")",
":",
"color",
"=",
"colors",
"[",
"i",
"]",
"assert",
"len",
"(",
... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | get_colormap | Obtain a colormap
Some colormaps can have additional configuration parameters. Refer to
their corresponding documentation for more information.
Parameters
----------
name : str | Colormap
Colormap name. Can also be a Colormap for pass-through.
Examples
--------
>>> get_co... | glue_vispy_viewers/extern/vispy/color/colormap.py | def get_colormap(name, *args, **kwargs):
"""Obtain a colormap
Some colormaps can have additional configuration parameters. Refer to
their corresponding documentation for more information.
Parameters
----------
name : str | Colormap
Colormap name. Can also be a Colormap for pass-through... | def get_colormap(name, *args, **kwargs):
"""Obtain a colormap
Some colormaps can have additional configuration parameters. Refer to
their corresponding documentation for more information.
Parameters
----------
name : str | Colormap
Colormap name. Can also be a Colormap for pass-through... | [
"Obtain",
"a",
"colormap"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/color/colormap.py#L980-L1009 | [
"def",
"get_colormap",
"(",
"name",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"isinstance",
"(",
"name",
",",
"BaseColormap",
")",
":",
"cmap",
"=",
"name",
"else",
":",
"if",
"not",
"isinstance",
"(",
"name",
",",
"string_types",
")... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | Colormap.map | The Python mapping function from the [0,1] interval to a
list of rgba colors
Parameters
----------
x : array-like
The values to map.
Returns
-------
colors : list
List of rgba colors. | glue_vispy_viewers/extern/vispy/color/colormap.py | def map(self, x):
"""The Python mapping function from the [0,1] interval to a
list of rgba colors
Parameters
----------
x : array-like
The values to map.
Returns
-------
colors : list
List of rgba colors.
"""
retur... | def map(self, x):
"""The Python mapping function from the [0,1] interval to a
list of rgba colors
Parameters
----------
x : array-like
The values to map.
Returns
-------
colors : list
List of rgba colors.
"""
retur... | [
"The",
"Python",
"mapping",
"function",
"from",
"the",
"[",
"0",
"1",
"]",
"interval",
"to",
"a",
"list",
"of",
"rgba",
"colors"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/color/colormap.py#L363-L377 | [
"def",
"map",
"(",
"self",
",",
"x",
")",
":",
"return",
"self",
".",
"_map_function",
"(",
"self",
".",
"colors",
".",
"rgba",
",",
"x",
",",
"self",
".",
"_controls",
")"
] | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | _BorderVisual.visual_border_width | The border width in visual coordinates | glue_vispy_viewers/extern/vispy/visuals/border.py | def visual_border_width(self):
""" The border width in visual coordinates
"""
render_to_doc = \
self.transforms.get_transform('document', 'visual')
vec = render_to_doc.map([self.border_width, self.border_width, 0])
origin = render_to_doc.map([0, 0, 0])
visu... | def visual_border_width(self):
""" The border width in visual coordinates
"""
render_to_doc = \
self.transforms.get_transform('document', 'visual')
vec = render_to_doc.map([self.border_width, self.border_width, 0])
origin = render_to_doc.map([0, 0, 0])
visu... | [
"The",
"border",
"width",
"in",
"visual",
"coordinates"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/visuals/border.py#L110-L124 | [
"def",
"visual_border_width",
"(",
"self",
")",
":",
"render_to_doc",
"=",
"self",
".",
"transforms",
".",
"get_transform",
"(",
"'document'",
",",
"'visual'",
")",
"vec",
"=",
"render_to_doc",
".",
"map",
"(",
"[",
"self",
".",
"border_width",
",",
"self",
... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | Exporter.run | Run the exporter on the given figure
Parmeters
---------
fig : matplotlib.Figure instance
The figure to export | glue_vispy_viewers/extern/vispy/ext/_bundled/mplexporter.py | def run(self, fig):
"""
Run the exporter on the given figure
Parmeters
---------
fig : matplotlib.Figure instance
The figure to export
"""
# Calling savefig executes the draw() command, putting elements
# in the correct place.
fig.save... | def run(self, fig):
"""
Run the exporter on the given figure
Parmeters
---------
fig : matplotlib.Figure instance
The figure to export
"""
# Calling savefig executes the draw() command, putting elements
# in the correct place.
fig.save... | [
"Run",
"the",
"exporter",
"on",
"the",
"given",
"figure"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/ext/_bundled/mplexporter.py#L63-L78 | [
"def",
"run",
"(",
"self",
",",
"fig",
")",
":",
"# Calling savefig executes the draw() command, putting elements",
"# in the correct place.",
"fig",
".",
"savefig",
"(",
"io",
".",
"BytesIO",
"(",
")",
",",
"format",
"=",
"'png'",
",",
"dpi",
"=",
"fig",
".",
... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | Exporter.process_transform | Process the transform and convert data to figure or data coordinates
Parameters
----------
transform : matplotlib Transform object
The transform applied to the data
ax : matplotlib Axes object (optional)
The axes the data is associated with
data : ndarray... | glue_vispy_viewers/extern/vispy/ext/_bundled/mplexporter.py | def process_transform(transform, ax=None, data=None, return_trans=False,
force_trans=None):
"""Process the transform and convert data to figure or data coordinates
Parameters
----------
transform : matplotlib Transform object
The transform applied t... | def process_transform(transform, ax=None, data=None, return_trans=False,
force_trans=None):
"""Process the transform and convert data to figure or data coordinates
Parameters
----------
transform : matplotlib Transform object
The transform applied t... | [
"Process",
"the",
"transform",
"and",
"convert",
"data",
"to",
"figure",
"or",
"data",
"coordinates"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/ext/_bundled/mplexporter.py#L81-L138 | [
"def",
"process_transform",
"(",
"transform",
",",
"ax",
"=",
"None",
",",
"data",
"=",
"None",
",",
"return_trans",
"=",
"False",
",",
"force_trans",
"=",
"None",
")",
":",
"if",
"isinstance",
"(",
"transform",
",",
"transforms",
".",
"BlendedGenericTransfo... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | Exporter.crawl_fig | Crawl the figure and process all axes | glue_vispy_viewers/extern/vispy/ext/_bundled/mplexporter.py | def crawl_fig(self, fig):
"""Crawl the figure and process all axes"""
with self.renderer.draw_figure(fig=fig,
props=utils.get_figure_properties(fig)):
for ax in fig.axes:
self.crawl_ax(ax) | def crawl_fig(self, fig):
"""Crawl the figure and process all axes"""
with self.renderer.draw_figure(fig=fig,
props=utils.get_figure_properties(fig)):
for ax in fig.axes:
self.crawl_ax(ax) | [
"Crawl",
"the",
"figure",
"and",
"process",
"all",
"axes"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/ext/_bundled/mplexporter.py#L140-L145 | [
"def",
"crawl_fig",
"(",
"self",
",",
"fig",
")",
":",
"with",
"self",
".",
"renderer",
".",
"draw_figure",
"(",
"fig",
"=",
"fig",
",",
"props",
"=",
"utils",
".",
"get_figure_properties",
"(",
"fig",
")",
")",
":",
"for",
"ax",
"in",
"fig",
".",
... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | Exporter.crawl_ax | Crawl the axes and process all elements within | glue_vispy_viewers/extern/vispy/ext/_bundled/mplexporter.py | def crawl_ax(self, ax):
"""Crawl the axes and process all elements within"""
with self.renderer.draw_axes(ax=ax,
props=utils.get_axes_properties(ax)):
for line in ax.lines:
self.draw_line(ax, line)
for text in ax.texts:
... | def crawl_ax(self, ax):
"""Crawl the axes and process all elements within"""
with self.renderer.draw_axes(ax=ax,
props=utils.get_axes_properties(ax)):
for line in ax.lines:
self.draw_line(ax, line)
for text in ax.texts:
... | [
"Crawl",
"the",
"axes",
"and",
"process",
"all",
"elements",
"within"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/ext/_bundled/mplexporter.py#L147-L176 | [
"def",
"crawl_ax",
"(",
"self",
",",
"ax",
")",
":",
"with",
"self",
".",
"renderer",
".",
"draw_axes",
"(",
"ax",
"=",
"ax",
",",
"props",
"=",
"utils",
".",
"get_axes_properties",
"(",
"ax",
")",
")",
":",
"for",
"line",
"in",
"ax",
".",
"lines",... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | Exporter.crawl_legend | Recursively look through objects in legend children | glue_vispy_viewers/extern/vispy/ext/_bundled/mplexporter.py | def crawl_legend(self, ax, legend):
"""
Recursively look through objects in legend children
"""
legendElements = list(utils.iter_all_children(legend._legend_box,
skipContainers=True))
legendElements.append(legend.legendPatch)
... | def crawl_legend(self, ax, legend):
"""
Recursively look through objects in legend children
"""
legendElements = list(utils.iter_all_children(legend._legend_box,
skipContainers=True))
legendElements.append(legend.legendPatch)
... | [
"Recursively",
"look",
"through",
"objects",
"in",
"legend",
"children"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/ext/_bundled/mplexporter.py#L178-L205 | [
"def",
"crawl_legend",
"(",
"self",
",",
"ax",
",",
"legend",
")",
":",
"legendElements",
"=",
"list",
"(",
"utils",
".",
"iter_all_children",
"(",
"legend",
".",
"_legend_box",
",",
"skipContainers",
"=",
"True",
")",
")",
"legendElements",
".",
"append",
... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | Exporter.draw_line | Process a matplotlib line and call renderer.draw_line | glue_vispy_viewers/extern/vispy/ext/_bundled/mplexporter.py | def draw_line(self, ax, line, force_trans=None):
"""Process a matplotlib line and call renderer.draw_line"""
coordinates, data = self.process_transform(line.get_transform(),
ax, line.get_xydata(),
force... | def draw_line(self, ax, line, force_trans=None):
"""Process a matplotlib line and call renderer.draw_line"""
coordinates, data = self.process_transform(line.get_transform(),
ax, line.get_xydata(),
force... | [
"Process",
"a",
"matplotlib",
"line",
"and",
"call",
"renderer",
".",
"draw_line"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/ext/_bundled/mplexporter.py#L207-L225 | [
"def",
"draw_line",
"(",
"self",
",",
"ax",
",",
"line",
",",
"force_trans",
"=",
"None",
")",
":",
"coordinates",
",",
"data",
"=",
"self",
".",
"process_transform",
"(",
"line",
".",
"get_transform",
"(",
")",
",",
"ax",
",",
"line",
".",
"get_xydata... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | Exporter.draw_text | Process a matplotlib text object and call renderer.draw_text | glue_vispy_viewers/extern/vispy/ext/_bundled/mplexporter.py | def draw_text(self, ax, text, force_trans=None, text_type=None):
"""Process a matplotlib text object and call renderer.draw_text"""
content = text.get_text()
if content:
transform = text.get_transform()
position = text.get_position()
coords, position = self.pr... | def draw_text(self, ax, text, force_trans=None, text_type=None):
"""Process a matplotlib text object and call renderer.draw_text"""
content = text.get_text()
if content:
transform = text.get_transform()
position = text.get_position()
coords, position = self.pr... | [
"Process",
"a",
"matplotlib",
"text",
"object",
"and",
"call",
"renderer",
".",
"draw_text"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/ext/_bundled/mplexporter.py#L227-L240 | [
"def",
"draw_text",
"(",
"self",
",",
"ax",
",",
"text",
",",
"force_trans",
"=",
"None",
",",
"text_type",
"=",
"None",
")",
":",
"content",
"=",
"text",
".",
"get_text",
"(",
")",
"if",
"content",
":",
"transform",
"=",
"text",
".",
"get_transform",
... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | Exporter.draw_patch | Process a matplotlib patch object and call renderer.draw_path | glue_vispy_viewers/extern/vispy/ext/_bundled/mplexporter.py | def draw_patch(self, ax, patch, force_trans=None):
"""Process a matplotlib patch object and call renderer.draw_path"""
vertices, pathcodes = utils.SVG_path(patch.get_path())
transform = patch.get_transform()
coordinates, vertices = self.process_transform(transform,
... | def draw_patch(self, ax, patch, force_trans=None):
"""Process a matplotlib patch object and call renderer.draw_path"""
vertices, pathcodes = utils.SVG_path(patch.get_path())
transform = patch.get_transform()
coordinates, vertices = self.process_transform(transform,
... | [
"Process",
"a",
"matplotlib",
"patch",
"object",
"and",
"call",
"renderer",
".",
"draw_path"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/ext/_bundled/mplexporter.py#L242-L254 | [
"def",
"draw_patch",
"(",
"self",
",",
"ax",
",",
"patch",
",",
"force_trans",
"=",
"None",
")",
":",
"vertices",
",",
"pathcodes",
"=",
"utils",
".",
"SVG_path",
"(",
"patch",
".",
"get_path",
"(",
")",
")",
"transform",
"=",
"patch",
".",
"get_transf... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | Exporter.draw_collection | Process a matplotlib collection and call renderer.draw_collection | glue_vispy_viewers/extern/vispy/ext/_bundled/mplexporter.py | def draw_collection(self, ax, collection,
force_pathtrans=None,
force_offsettrans=None):
"""Process a matplotlib collection and call renderer.draw_collection"""
(transform, transOffset,
offsets, paths) = collection._prepare_points()
offse... | def draw_collection(self, ax, collection,
force_pathtrans=None,
force_offsettrans=None):
"""Process a matplotlib collection and call renderer.draw_collection"""
(transform, transOffset,
offsets, paths) = collection._prepare_points()
offse... | [
"Process",
"a",
"matplotlib",
"collection",
"and",
"call",
"renderer",
".",
"draw_collection"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/ext/_bundled/mplexporter.py#L256-L299 | [
"def",
"draw_collection",
"(",
"self",
",",
"ax",
",",
"collection",
",",
"force_pathtrans",
"=",
"None",
",",
"force_offsettrans",
"=",
"None",
")",
":",
"(",
"transform",
",",
"transOffset",
",",
"offsets",
",",
"paths",
")",
"=",
"collection",
".",
"_pr... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | Exporter.draw_image | Process a matplotlib image object and call renderer.draw_image | glue_vispy_viewers/extern/vispy/ext/_bundled/mplexporter.py | def draw_image(self, ax, image):
"""Process a matplotlib image object and call renderer.draw_image"""
self.renderer.draw_image(imdata=utils.image_to_base64(image),
extent=image.get_extent(),
coordinates="data",
... | def draw_image(self, ax, image):
"""Process a matplotlib image object and call renderer.draw_image"""
self.renderer.draw_image(imdata=utils.image_to_base64(image),
extent=image.get_extent(),
coordinates="data",
... | [
"Process",
"a",
"matplotlib",
"image",
"object",
"and",
"call",
"renderer",
".",
"draw_image"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/ext/_bundled/mplexporter.py#L301-L308 | [
"def",
"draw_image",
"(",
"self",
",",
"ax",
",",
"image",
")",
":",
"self",
".",
"renderer",
".",
"draw_image",
"(",
"imdata",
"=",
"utils",
".",
"image_to_base64",
"(",
"image",
")",
",",
"extent",
"=",
"image",
".",
"get_extent",
"(",
")",
",",
"c... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | Renderer.draw_marked_line | Draw a line that also has markers.
If this isn't reimplemented by a renderer object, by default, it will
make a call to BOTH draw_line and draw_markers when both markerstyle
and linestyle are not None in the same Line2D object. | glue_vispy_viewers/extern/vispy/ext/_bundled/mplexporter.py | def draw_marked_line(self, data, coordinates, linestyle, markerstyle,
label, mplobj=None):
"""Draw a line that also has markers.
If this isn't reimplemented by a renderer object, by default, it will
make a call to BOTH draw_line and draw_markers when both markerstyle
... | def draw_marked_line(self, data, coordinates, linestyle, markerstyle,
label, mplobj=None):
"""Draw a line that also has markers.
If this isn't reimplemented by a renderer object, by default, it will
make a call to BOTH draw_line and draw_markers when both markerstyle
... | [
"Draw",
"a",
"line",
"that",
"also",
"has",
"markers",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/ext/_bundled/mplexporter.py#L455-L467 | [
"def",
"draw_marked_line",
"(",
"self",
",",
"data",
",",
"coordinates",
",",
"linestyle",
",",
"markerstyle",
",",
"label",
",",
"mplobj",
"=",
"None",
")",
":",
"if",
"linestyle",
"is",
"not",
"None",
":",
"self",
".",
"draw_line",
"(",
"data",
",",
... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | Renderer.draw_line | Draw a line. By default, draw the line via the draw_path() command.
Some renderers might wish to override this and provide more
fine-grained behavior.
In matplotlib, lines are generally created via the plt.plot() command,
though this command also can create marker collections.
... | glue_vispy_viewers/extern/vispy/ext/_bundled/mplexporter.py | def draw_line(self, data, coordinates, style, label, mplobj=None):
"""
Draw a line. By default, draw the line via the draw_path() command.
Some renderers might wish to override this and provide more
fine-grained behavior.
In matplotlib, lines are generally created via the plt.pl... | def draw_line(self, data, coordinates, style, label, mplobj=None):
"""
Draw a line. By default, draw the line via the draw_path() command.
Some renderers might wish to override this and provide more
fine-grained behavior.
In matplotlib, lines are generally created via the plt.pl... | [
"Draw",
"a",
"line",
".",
"By",
"default",
"draw",
"the",
"line",
"via",
"the",
"draw_path",
"()",
"command",
".",
"Some",
"renderers",
"might",
"wish",
"to",
"override",
"this",
"and",
"provide",
"more",
"fine",
"-",
"grained",
"behavior",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/ext/_bundled/mplexporter.py#L469-L495 | [
"def",
"draw_line",
"(",
"self",
",",
"data",
",",
"coordinates",
",",
"style",
",",
"label",
",",
"mplobj",
"=",
"None",
")",
":",
"pathcodes",
"=",
"[",
"'M'",
"]",
"+",
"(",
"data",
".",
"shape",
"[",
"0",
"]",
"-",
"1",
")",
"*",
"[",
"'L'"... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | Renderer._iter_path_collection | Build an iterator over the elements of the path collection | glue_vispy_viewers/extern/vispy/ext/_bundled/mplexporter.py | def _iter_path_collection(paths, path_transforms, offsets, styles):
"""Build an iterator over the elements of the path collection"""
N = max(len(paths), len(offsets))
if not path_transforms:
path_transforms = [np.eye(3)]
edgecolor = styles['edgecolor']
if np.size(ed... | def _iter_path_collection(paths, path_transforms, offsets, styles):
"""Build an iterator over the elements of the path collection"""
N = max(len(paths), len(offsets))
if not path_transforms:
path_transforms = [np.eye(3)]
edgecolor = styles['edgecolor']
if np.size(ed... | [
"Build",
"an",
"iterator",
"over",
"the",
"elements",
"of",
"the",
"path",
"collection"
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/ext/_bundled/mplexporter.py#L498-L516 | [
"def",
"_iter_path_collection",
"(",
"paths",
",",
"path_transforms",
",",
"offsets",
",",
"styles",
")",
":",
"N",
"=",
"max",
"(",
"len",
"(",
"paths",
")",
",",
"len",
"(",
"offsets",
")",
")",
"if",
"not",
"path_transforms",
":",
"path_transforms",
"... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | Renderer.draw_path_collection | Draw a collection of paths. The paths, offsets, and styles are all
iterables, and the number of paths is max(len(paths), len(offsets)).
By default, this is implemented via multiple calls to the draw_path()
function. For efficiency, Renderers may choose to customize this
implementation.
... | glue_vispy_viewers/extern/vispy/ext/_bundled/mplexporter.py | def draw_path_collection(self, paths, path_coordinates, path_transforms,
offsets, offset_coordinates, offset_order,
styles, mplobj=None):
"""
Draw a collection of paths. The paths, offsets, and styles are all
iterables, and the number of ... | def draw_path_collection(self, paths, path_coordinates, path_transforms,
offsets, offset_coordinates, offset_order,
styles, mplobj=None):
"""
Draw a collection of paths. The paths, offsets, and styles are all
iterables, and the number of ... | [
"Draw",
"a",
"collection",
"of",
"paths",
".",
"The",
"paths",
"offsets",
"and",
"styles",
"are",
"all",
"iterables",
"and",
"the",
"number",
"of",
"paths",
"is",
"max",
"(",
"len",
"(",
"paths",
")",
"len",
"(",
"offsets",
"))",
"."
] | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/ext/_bundled/mplexporter.py#L518-L582 | [
"def",
"draw_path_collection",
"(",
"self",
",",
"paths",
",",
"path_coordinates",
",",
"path_transforms",
",",
"offsets",
",",
"offset_coordinates",
",",
"offset_order",
",",
"styles",
",",
"mplobj",
"=",
"None",
")",
":",
"if",
"offset_order",
"==",
"\"before\... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
train | Renderer.draw_markers | Draw a set of markers. By default, this is done by repeatedly
calling draw_path(), but renderers should generally overload
this method to provide a more efficient implementation.
In matplotlib, markers are created using the plt.plot() command.
Parameters
----------
data... | glue_vispy_viewers/extern/vispy/ext/_bundled/mplexporter.py | def draw_markers(self, data, coordinates, style, label, mplobj=None):
"""
Draw a set of markers. By default, this is done by repeatedly
calling draw_path(), but renderers should generally overload
this method to provide a more efficient implementation.
In matplotlib, markers are... | def draw_markers(self, data, coordinates, style, label, mplobj=None):
"""
Draw a set of markers. By default, this is done by repeatedly
calling draw_path(), but renderers should generally overload
this method to provide a more efficient implementation.
In matplotlib, markers are... | [
"Draw",
"a",
"set",
"of",
"markers",
".",
"By",
"default",
"this",
"is",
"done",
"by",
"repeatedly",
"calling",
"draw_path",
"()",
"but",
"renderers",
"should",
"generally",
"overload",
"this",
"method",
"to",
"provide",
"a",
"more",
"efficient",
"implementati... | glue-viz/glue-vispy-viewers | python | https://github.com/glue-viz/glue-vispy-viewers/blob/54a4351d98c1f90dfb1a557d1b447c1f57470eea/glue_vispy_viewers/extern/vispy/ext/_bundled/mplexporter.py#L584-L613 | [
"def",
"draw_markers",
"(",
"self",
",",
"data",
",",
"coordinates",
",",
"style",
",",
"label",
",",
"mplobj",
"=",
"None",
")",
":",
"vertices",
",",
"pathcodes",
"=",
"style",
"[",
"'markerpath'",
"]",
"pathstyle",
"=",
"dict",
"(",
"(",
"key",
",",... | 54a4351d98c1f90dfb1a557d1b447c1f57470eea |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.