body_hash stringlengths 64 64 | body stringlengths 23 109k | docstring stringlengths 1 57k | path stringlengths 4 198 | name stringlengths 1 115 | repository_name stringlengths 7 111 | repository_stars float64 0 191k | lang stringclasses 1
value | body_without_docstring stringlengths 14 108k | unified stringlengths 45 133k |
|---|---|---|---|---|---|---|---|---|---|
5f76fffd49f07232339a9dd4552029f0d3a34d5578de17d33a93b8d159c0a2a3 | def test_promote_user(self):
'Test error raised when accessing nonexisting user'
response = self.app.put('/api/v2/auth/users/{}'.format(User.query.order_by(User.created_at).first().id), content_type='application/json', headers={'x-access-token': self.admintoken})
self.assertEqual(response.status_code, 200)
... | Test error raised when accessing nonexisting user | tests/v2/test_user.py | test_promote_user | ThaDeveloper/weConnect | 1 | python | def test_promote_user(self):
response = self.app.put('/api/v2/auth/users/{}'.format(User.query.order_by(User.created_at).first().id), content_type='application/json', headers={'x-access-token': self.admintoken})
self.assertEqual(response.status_code, 200)
response_msg = json.loads(response.data.decode(... | def test_promote_user(self):
response = self.app.put('/api/v2/auth/users/{}'.format(User.query.order_by(User.created_at).first().id), content_type='application/json', headers={'x-access-token': self.admintoken})
self.assertEqual(response.status_code, 200)
response_msg = json.loads(response.data.decode(... |
342b88b2a63b3702545dd32606570c61f0e1dd15fa85c977f86a2a163eeb478d | def test_unauthorized_promote_user(self):
'Test error raised for unauthorized user promotion'
response = self.app.put('/api/v2/auth/users/{}'.format(User.query.order_by(User.created_at).first().id), content_type='application/json', headers={'x-access-token': self.token})
self.assertEqual(response.status_cod... | Test error raised for unauthorized user promotion | tests/v2/test_user.py | test_unauthorized_promote_user | ThaDeveloper/weConnect | 1 | python | def test_unauthorized_promote_user(self):
response = self.app.put('/api/v2/auth/users/{}'.format(User.query.order_by(User.created_at).first().id), content_type='application/json', headers={'x-access-token': self.token})
self.assertEqual(response.status_code, 401)
response_msg = json.loads(response.data... | def test_unauthorized_promote_user(self):
response = self.app.put('/api/v2/auth/users/{}'.format(User.query.order_by(User.created_at).first().id), content_type='application/json', headers={'x-access-token': self.token})
self.assertEqual(response.status_code, 401)
response_msg = json.loads(response.data... |
dd5159a04267a132b314da2dc584564c53cde638a94c24ff1756b91f4359c0bf | def test_delete_user(self):
'Tests deleting user from db'
response = self.app.delete('/api/v2/auth/users/{}'.format(User.query.order_by(User.created_at).first().id), content_type='application/json', headers={'x-access-token': self.admintoken})
self.assertEqual(response.status_code, 200)
response_msg = j... | Tests deleting user from db | tests/v2/test_user.py | test_delete_user | ThaDeveloper/weConnect | 1 | python | def test_delete_user(self):
response = self.app.delete('/api/v2/auth/users/{}'.format(User.query.order_by(User.created_at).first().id), content_type='application/json', headers={'x-access-token': self.admintoken})
self.assertEqual(response.status_code, 200)
response_msg = json.loads(response.data.decod... | def test_delete_user(self):
response = self.app.delete('/api/v2/auth/users/{}'.format(User.query.order_by(User.created_at).first().id), content_type='application/json', headers={'x-access-token': self.admintoken})
self.assertEqual(response.status_code, 200)
response_msg = json.loads(response.data.decod... |
53d8cd2e50cc03d5039c54a3e6149fc8d117b74b7afde366202fc1d1394c923a | def test_unauthorized_user_delete(self):
'Tests error raised for unauthorized user delete from db'
response = self.app.delete('/api/v2/auth/users/{}'.format(User.query.order_by(User.created_at).first().id), content_type='application/json', headers={'x-access-token': self.token})
self.assertEqual(response.st... | Tests error raised for unauthorized user delete from db | tests/v2/test_user.py | test_unauthorized_user_delete | ThaDeveloper/weConnect | 1 | python | def test_unauthorized_user_delete(self):
response = self.app.delete('/api/v2/auth/users/{}'.format(User.query.order_by(User.created_at).first().id), content_type='application/json', headers={'x-access-token': self.token})
self.assertEqual(response.status_code, 401)
response_msg = json.loads(response.da... | def test_unauthorized_user_delete(self):
response = self.app.delete('/api/v2/auth/users/{}'.format(User.query.order_by(User.created_at).first().id), content_type='application/json', headers={'x-access-token': self.token})
self.assertEqual(response.status_code, 401)
response_msg = json.loads(response.da... |
56f6aa568a433e646d4a9703cb9a81d057eff5cbfb3ed7604e658a4d4c64bf67 | def test_read_user_businesses(self):
'Tests user can read the businesses of a particular user'
response = self.app.get('/api/v2/auth/users/{}/businesses'.format(User.query.order_by(User.created_at).first().id), content_type='application/json')
self.assertEqual(response.status_code, 200) | Tests user can read the businesses of a particular user | tests/v2/test_user.py | test_read_user_businesses | ThaDeveloper/weConnect | 1 | python | def test_read_user_businesses(self):
response = self.app.get('/api/v2/auth/users/{}/businesses'.format(User.query.order_by(User.created_at).first().id), content_type='application/json')
self.assertEqual(response.status_code, 200) | def test_read_user_businesses(self):
response = self.app.get('/api/v2/auth/users/{}/businesses'.format(User.query.order_by(User.created_at).first().id), content_type='application/json')
self.assertEqual(response.status_code, 200)<|docstring|>Tests user can read the businesses of a particular user<|endoftex... |
6c83967a47408d57f8dd08a65b7de29663ed40d614607a8cf2164b170cd0f60d | def gauss_image(shape=(101, 101), wcs=None, factor=1, gauss=None, center=None, flux=1.0, fwhm=(1.0, 1.0), peak=False, rot=0.0, cont=0, unit_center=u.deg, unit_fwhm=u.arcsec, unit=u.dimensionless_unscaled):
'Create a new image from a 2D gaussian.\n\n Parameters\n ----------\n shape : int or (int,int)\n ... | Create a new image from a 2D gaussian.
Parameters
----------
shape : int or (int,int)
Lengths of the image in Y and X with python notation: (ny,nx).
(101,101) by default. If wcs object contains dimensions, shape is
ignored and wcs dimensions are used.
wcs : `mpdaf.obj.WCS`
World coordinates.
factor : i... | lib/mpdaf/obj/image.py | gauss_image | musevlt/mpdaf | 4 | python | def gauss_image(shape=(101, 101), wcs=None, factor=1, gauss=None, center=None, flux=1.0, fwhm=(1.0, 1.0), peak=False, rot=0.0, cont=0, unit_center=u.deg, unit_fwhm=u.arcsec, unit=u.dimensionless_unscaled):
'Create a new image from a 2D gaussian.\n\n Parameters\n ----------\n shape : int or (int,int)\n ... | def gauss_image(shape=(101, 101), wcs=None, factor=1, gauss=None, center=None, flux=1.0, fwhm=(1.0, 1.0), peak=False, rot=0.0, cont=0, unit_center=u.deg, unit_fwhm=u.arcsec, unit=u.dimensionless_unscaled):
'Create a new image from a 2D gaussian.\n\n Parameters\n ----------\n shape : int or (int,int)\n ... |
b5b3171dcf7ffebc8e9718a571758048f542faf56bd0d30d09aa15fff9c7a7ac | def moffat_image(shape=(101, 101), wcs=None, factor=1, moffat=None, center=None, flux=1.0, fwhm=(1.0, 1.0), peak=False, n=2, rot=0.0, cont=0, unit_center=u.deg, unit_fwhm=u.arcsec, unit=u.dimensionless_unscaled):
'Create a new image from a 2D Moffat function.\n\n Parameters\n ----------\n shape : int or (i... | Create a new image from a 2D Moffat function.
Parameters
----------
shape : int or (int,int)
Lengths of the image in Y and X with python notation: (ny,nx).
(101,101) by default. If wcs object contains dimensions, shape is
ignored and wcs dimensions are used.
wcs : `mpdaf.obj.WCS`
World coordinates.
fac... | lib/mpdaf/obj/image.py | moffat_image | musevlt/mpdaf | 4 | python | def moffat_image(shape=(101, 101), wcs=None, factor=1, moffat=None, center=None, flux=1.0, fwhm=(1.0, 1.0), peak=False, n=2, rot=0.0, cont=0, unit_center=u.deg, unit_fwhm=u.arcsec, unit=u.dimensionless_unscaled):
'Create a new image from a 2D Moffat function.\n\n Parameters\n ----------\n shape : int or (i... | def moffat_image(shape=(101, 101), wcs=None, factor=1, moffat=None, center=None, flux=1.0, fwhm=(1.0, 1.0), peak=False, n=2, rot=0.0, cont=0, unit_center=u.deg, unit_fwhm=u.arcsec, unit=u.dimensionless_unscaled):
'Create a new image from a 2D Moffat function.\n\n Parameters\n ----------\n shape : int or (i... |
1313520c0591c3193254dbb398ca62ac5a02f9d5c84dd4d64add07d7b94bc2b6 | def _antialias_filter_image(data, oldstep, newstep, oldfmax=None, window='blackman'):
'Apply an anti-aliasing prefilter to an image to prepare\n it for subsampling.\n\n Parameters\n ----------\n data : np.ndimage\n The 2D image to be filtered.\n oldstep: float or (float, float)\n The ce... | Apply an anti-aliasing prefilter to an image to prepare
it for subsampling.
Parameters
----------
data : np.ndimage
The 2D image to be filtered.
oldstep: float or (float, float)
The cell size of the input image. This can be a single
number for both the X and Y axes, or it can be two
numbers in an itera... | lib/mpdaf/obj/image.py | _antialias_filter_image | musevlt/mpdaf | 4 | python | def _antialias_filter_image(data, oldstep, newstep, oldfmax=None, window='blackman'):
'Apply an anti-aliasing prefilter to an image to prepare\n it for subsampling.\n\n Parameters\n ----------\n data : np.ndimage\n The 2D image to be filtered.\n oldstep: float or (float, float)\n The ce... | def _antialias_filter_image(data, oldstep, newstep, oldfmax=None, window='blackman'):
'Apply an anti-aliasing prefilter to an image to prepare\n it for subsampling.\n\n Parameters\n ----------\n data : np.ndimage\n The 2D image to be filtered.\n oldstep: float or (float, float)\n The ce... |
c1a791cef8948a940b891e6a6069c481066dbdf914d966a2568fdc4e8284d196 | def _find_quadratic_peak(y):
'Given an array of 3 numbers in which the first and last numbers are\n less than the central number, determine the array index at which a\n quadratic curve through the 3 points reaches its peak value.\n\n Parameters\n ----------\n y : float,float,float\n The values ... | Given an array of 3 numbers in which the first and last numbers are
less than the central number, determine the array index at which a
quadratic curve through the 3 points reaches its peak value.
Parameters
----------
y : float,float,float
The values of the curve at x=0,1,2 respectively. Note that y[1]
must be gr... | lib/mpdaf/obj/image.py | _find_quadratic_peak | musevlt/mpdaf | 4 | python | def _find_quadratic_peak(y):
'Given an array of 3 numbers in which the first and last numbers are\n less than the central number, determine the array index at which a\n quadratic curve through the 3 points reaches its peak value.\n\n Parameters\n ----------\n y : float,float,float\n The values ... | def _find_quadratic_peak(y):
'Given an array of 3 numbers in which the first and last numbers are\n less than the central number, determine the array index at which a\n quadratic curve through the 3 points reaches its peak value.\n\n Parameters\n ----------\n y : float,float,float\n The values ... |
7199eaf312bdc4c3be02558bfd77f2bbca402f06de164fa755fb8f3012da852c | def copy(self):
'Return a new copy of an Image object.'
obj = super(Image, self).copy()
if (self._spflims is not None):
obj._spflims = self._spflims.deepcopy()
return obj | Return a new copy of an Image object. | lib/mpdaf/obj/image.py | copy | musevlt/mpdaf | 4 | python | def copy(self):
obj = super(Image, self).copy()
if (self._spflims is not None):
obj._spflims = self._spflims.deepcopy()
return obj | def copy(self):
obj = super(Image, self).copy()
if (self._spflims is not None):
obj._spflims = self._spflims.deepcopy()
return obj<|docstring|>Return a new copy of an Image object.<|endoftext|> |
fff9857ada8dddfa7f79900053d75831166c80fd2f6e12568e973203d20ddd5e | def get_step(self, unit=None):
"Return the angular height and width of a pixel along the\n Y and X axes of the image array.\n\n In MPDAF, images are sampled on a regular grid of square\n pixels that represent a flat projection of the celestial\n sphere. The get_step() method returns the ... | Return the angular height and width of a pixel along the
Y and X axes of the image array.
In MPDAF, images are sampled on a regular grid of square
pixels that represent a flat projection of the celestial
sphere. The get_step() method returns the angular width and
height of these pixels on the sky.
See also get_axis_i... | lib/mpdaf/obj/image.py | get_step | musevlt/mpdaf | 4 | python | def get_step(self, unit=None):
"Return the angular height and width of a pixel along the\n Y and X axes of the image array.\n\n In MPDAF, images are sampled on a regular grid of square\n pixels that represent a flat projection of the celestial\n sphere. The get_step() method returns the ... | def get_step(self, unit=None):
"Return the angular height and width of a pixel along the\n Y and X axes of the image array.\n\n In MPDAF, images are sampled on a regular grid of square\n pixels that represent a flat projection of the celestial\n sphere. The get_step() method returns the ... |
1e0469f187e1d230c5919ec16e2a2ac0605e1ecf7cd0562e70a85a707fadc3ee | def get_axis_increments(self, unit=None):
"Return the displacements on the sky that result from\n incrementing the array indexes of the image by one along the Y\n and X axes, respectively.\n\n In MPDAF, images are sampled on a regular grid of square\n pixels that represent a flat project... | Return the displacements on the sky that result from
incrementing the array indexes of the image by one along the Y
and X axes, respectively.
In MPDAF, images are sampled on a regular grid of square
pixels that represent a flat projection of the celestial
sphere. The get_axis_increments() method returns the angular
wi... | lib/mpdaf/obj/image.py | get_axis_increments | musevlt/mpdaf | 4 | python | def get_axis_increments(self, unit=None):
"Return the displacements on the sky that result from\n incrementing the array indexes of the image by one along the Y\n and X axes, respectively.\n\n In MPDAF, images are sampled on a regular grid of square\n pixels that represent a flat project... | def get_axis_increments(self, unit=None):
"Return the displacements on the sky that result from\n incrementing the array indexes of the image by one along the Y\n and X axes, respectively.\n\n In MPDAF, images are sampled on a regular grid of square\n pixels that represent a flat project... |
c513ef4730fcaaf4f16d452ecbca080a75e9b5d5f762cfa7148719259001e27f | def get_range(self, unit=None):
"Return the minimum and maximum right-ascensions and declinations\n in the image array.\n\n Specifically a list is returned with the following contents:\n\n [dec_min, ra_min, dec_max, ra_max]\n\n Note that if the Y axis of the image is not parallel to the... | Return the minimum and maximum right-ascensions and declinations
in the image array.
Specifically a list is returned with the following contents:
[dec_min, ra_min, dec_max, ra_max]
Note that if the Y axis of the image is not parallel to the
declination axis, then the 4 returned values will all come
from different c... | lib/mpdaf/obj/image.py | get_range | musevlt/mpdaf | 4 | python | def get_range(self, unit=None):
"Return the minimum and maximum right-ascensions and declinations\n in the image array.\n\n Specifically a list is returned with the following contents:\n\n [dec_min, ra_min, dec_max, ra_max]\n\n Note that if the Y axis of the image is not parallel to the... | def get_range(self, unit=None):
"Return the minimum and maximum right-ascensions and declinations\n in the image array.\n\n Specifically a list is returned with the following contents:\n\n [dec_min, ra_min, dec_max, ra_max]\n\n Note that if the Y axis of the image is not parallel to the... |
0de4e2b912a5579c27e301a234bc48b2a168d68e13e84678eba4633f1c403227 | def get_start(self, unit=None):
'Return [y,x] corresponding to pixel (0,0).\n\n Parameters\n ----------\n unit : `astropy.units.Unit`\n type of the world coordinates\n\n Returns\n -------\n out : float array\n '
if (self.wcs is not None):
retur... | Return [y,x] corresponding to pixel (0,0).
Parameters
----------
unit : `astropy.units.Unit`
type of the world coordinates
Returns
-------
out : float array | lib/mpdaf/obj/image.py | get_start | musevlt/mpdaf | 4 | python | def get_start(self, unit=None):
'Return [y,x] corresponding to pixel (0,0).\n\n Parameters\n ----------\n unit : `astropy.units.Unit`\n type of the world coordinates\n\n Returns\n -------\n out : float array\n '
if (self.wcs is not None):
retur... | def get_start(self, unit=None):
'Return [y,x] corresponding to pixel (0,0).\n\n Parameters\n ----------\n unit : `astropy.units.Unit`\n type of the world coordinates\n\n Returns\n -------\n out : float array\n '
if (self.wcs is not None):
retur... |
71be15f4c8fbb29b845243c9d233d2a0ce1909987ef3441e7fe5b97db3fdc7f3 | def get_end(self, unit=None):
'Return [y,x] corresponding to pixel (-1,-1).\n\n Parameters\n ----------\n unit : `astropy.units.Unit`\n type of the world coordinates\n\n Returns\n -------\n out : float array\n '
if (self.wcs is not None):
retur... | Return [y,x] corresponding to pixel (-1,-1).
Parameters
----------
unit : `astropy.units.Unit`
type of the world coordinates
Returns
-------
out : float array | lib/mpdaf/obj/image.py | get_end | musevlt/mpdaf | 4 | python | def get_end(self, unit=None):
'Return [y,x] corresponding to pixel (-1,-1).\n\n Parameters\n ----------\n unit : `astropy.units.Unit`\n type of the world coordinates\n\n Returns\n -------\n out : float array\n '
if (self.wcs is not None):
retur... | def get_end(self, unit=None):
'Return [y,x] corresponding to pixel (-1,-1).\n\n Parameters\n ----------\n unit : `astropy.units.Unit`\n type of the world coordinates\n\n Returns\n -------\n out : float array\n '
if (self.wcs is not None):
retur... |
88df5816365793a84653588b6537cc57f06ade138f6a4a72a40e0dca149c66d8 | def get_rot(self, unit=u.deg):
'Return the rotation angle of the image, defined such that a\n rotation angle of zero aligns north along the positive Y axis,\n and a positive rotation angle rotates north away from the Y\n axis, in the sense of a rotation from north to east.\n\n Note that ... | Return the rotation angle of the image, defined such that a
rotation angle of zero aligns north along the positive Y axis,
and a positive rotation angle rotates north away from the Y
axis, in the sense of a rotation from north to east.
Note that the rotation angle is defined in a flat
map-projection of the sky. It is ... | lib/mpdaf/obj/image.py | get_rot | musevlt/mpdaf | 4 | python | def get_rot(self, unit=u.deg):
'Return the rotation angle of the image, defined such that a\n rotation angle of zero aligns north along the positive Y axis,\n and a positive rotation angle rotates north away from the Y\n axis, in the sense of a rotation from north to east.\n\n Note that ... | def get_rot(self, unit=u.deg):
'Return the rotation angle of the image, defined such that a\n rotation angle of zero aligns north along the positive Y axis,\n and a positive rotation angle rotates north away from the Y\n axis, in the sense of a rotation from north to east.\n\n Note that ... |
43249c194d221f552ed63c2231553f453dc7226c1357d8170381fec578d66a8f | def mask_region(self, center, radius, unit_center=u.deg, unit_radius=u.arcsec, inside=True, posangle=0.0):
'Mask values inside or outside a circular or rectangular region.\n\n Parameters\n ----------\n center : (float,float)\n Center (y,x) of the region, where y,x are usually celesti... | Mask values inside or outside a circular or rectangular region.
Parameters
----------
center : (float,float)
Center (y,x) of the region, where y,x are usually celestial
coordinates along the Y and X axes of the image, but are
interpretted as Y,X array-indexes if unit_center is changed
to None.
radius :... | lib/mpdaf/obj/image.py | mask_region | musevlt/mpdaf | 4 | python | def mask_region(self, center, radius, unit_center=u.deg, unit_radius=u.arcsec, inside=True, posangle=0.0):
'Mask values inside or outside a circular or rectangular region.\n\n Parameters\n ----------\n center : (float,float)\n Center (y,x) of the region, where y,x are usually celesti... | def mask_region(self, center, radius, unit_center=u.deg, unit_radius=u.arcsec, inside=True, posangle=0.0):
'Mask values inside or outside a circular or rectangular region.\n\n Parameters\n ----------\n center : (float,float)\n Center (y,x) of the region, where y,x are usually celesti... |
8ba0e99d38f58fe33ff4d8b162041eb3a626526b266a18343c29f350d162beb9 | def mask_ellipse(self, center, radius, posangle, unit_center=u.deg, unit_radius=u.arcsec, inside=True):
'Mask values inside or outside an elliptical region.\n\n Parameters\n ----------\n center : (float,float)\n Center (y,x) of the region, where y,x are usually celestial\n ... | Mask values inside or outside an elliptical region.
Parameters
----------
center : (float,float)
Center (y,x) of the region, where y,x are usually celestial
coordinates along the Y and X axes of the image, but are
interpretted as Y,X array-indexes if unit_center is changed
to None.
radius : (float,floa... | lib/mpdaf/obj/image.py | mask_ellipse | musevlt/mpdaf | 4 | python | def mask_ellipse(self, center, radius, posangle, unit_center=u.deg, unit_radius=u.arcsec, inside=True):
'Mask values inside or outside an elliptical region.\n\n Parameters\n ----------\n center : (float,float)\n Center (y,x) of the region, where y,x are usually celestial\n ... | def mask_ellipse(self, center, radius, posangle, unit_center=u.deg, unit_radius=u.arcsec, inside=True):
'Mask values inside or outside an elliptical region.\n\n Parameters\n ----------\n center : (float,float)\n Center (y,x) of the region, where y,x are usually celestial\n ... |
42860fdb00e194dfefae82c118f1eb3821dd5cc78e949ec1bad97b72527418dd | def mask_polygon(self, poly, unit=u.deg, inside=True):
'Mask values inside or outside a polygonal region.\n\n Parameters\n ----------\n poly : (float, float)\n An array of (float,float) containing a set of (p,q) or (dec,ra)\n values for the polygon vertices.\n unit ... | Mask values inside or outside a polygonal region.
Parameters
----------
poly : (float, float)
An array of (float,float) containing a set of (p,q) or (dec,ra)
values for the polygon vertices.
unit : `astropy.units.Unit`
The units of the polygon coordinates (by default in degrees).
Use unit=None to have ... | lib/mpdaf/obj/image.py | mask_polygon | musevlt/mpdaf | 4 | python | def mask_polygon(self, poly, unit=u.deg, inside=True):
'Mask values inside or outside a polygonal region.\n\n Parameters\n ----------\n poly : (float, float)\n An array of (float,float) containing a set of (p,q) or (dec,ra)\n values for the polygon vertices.\n unit ... | def mask_polygon(self, poly, unit=u.deg, inside=True):
'Mask values inside or outside a polygonal region.\n\n Parameters\n ----------\n poly : (float, float)\n An array of (float,float) containing a set of (p,q) or (dec,ra)\n values for the polygon vertices.\n unit ... |
236808df98925d12d49e7d9f985803df2d1248a77c26e3b20b63c40b4a0c294e | def truncate(self, y_min, y_max, x_min, x_max, mask=True, unit=u.deg, inplace=False):
'Return a sub-image that contains a specified area of the sky.\n\n The ranges x_min to x_max and y_min to y_max, specify a rectangular\n region of the sky in world coordinates. The truncate function returns\n ... | Return a sub-image that contains a specified area of the sky.
The ranges x_min to x_max and y_min to y_max, specify a rectangular
region of the sky in world coordinates. The truncate function returns
the sub-image that just encloses this region. Note that if the world
coordinate axes are not parallel to the array axes... | lib/mpdaf/obj/image.py | truncate | musevlt/mpdaf | 4 | python | def truncate(self, y_min, y_max, x_min, x_max, mask=True, unit=u.deg, inplace=False):
'Return a sub-image that contains a specified area of the sky.\n\n The ranges x_min to x_max and y_min to y_max, specify a rectangular\n region of the sky in world coordinates. The truncate function returns\n ... | def truncate(self, y_min, y_max, x_min, x_max, mask=True, unit=u.deg, inplace=False):
'Return a sub-image that contains a specified area of the sky.\n\n The ranges x_min to x_max and y_min to y_max, specify a rectangular\n region of the sky in world coordinates. The truncate function returns\n ... |
4b28541d41a1e94bb554d258d94a5c4f077fe34b7eb50854265986f59a778fd7 | def subimage(self, center, size, unit_center=u.deg, unit_size=u.arcsec, minsize=2.0):
'Return a view on a square or rectangular part.\n\n This method returns a square or rectangular sub-image whose center and\n size are specified in world coordinates. Note that this is a view on\n the original... | Return a view on a square or rectangular part.
This method returns a square or rectangular sub-image whose center and
size are specified in world coordinates. Note that this is a view on
the original map and that both will be modified at the same time. If
you need to modify only the sub-image, copy() the result of th... | lib/mpdaf/obj/image.py | subimage | musevlt/mpdaf | 4 | python | def subimage(self, center, size, unit_center=u.deg, unit_size=u.arcsec, minsize=2.0):
'Return a view on a square or rectangular part.\n\n This method returns a square or rectangular sub-image whose center and\n size are specified in world coordinates. Note that this is a view on\n the original... | def subimage(self, center, size, unit_center=u.deg, unit_size=u.arcsec, minsize=2.0):
'Return a view on a square or rectangular part.\n\n This method returns a square or rectangular sub-image whose center and\n size are specified in world coordinates. Note that this is a view on\n the original... |
2bedd89a648b2bd2f16f99f5c0a26d2b47b86a63d996f5e3523ec8d24983a490 | def rotate(self, theta=0.0, interp='no', reshape=False, order=1, pivot=None, unit=u.deg, regrid=None, flux=False, cutoff=0.25, inplace=False):
"Rotate the sky within an image in the sense of a rotation from\n north to east.\n\n For example if the image rotation angle that is currently\n returne... | Rotate the sky within an image in the sense of a rotation from
north to east.
For example if the image rotation angle that is currently
returned by image.get_rot() is zero, image.rotate(10.0) will
rotate the northward direction of the image 10 degrees
eastward of where it was, and self.get_rot() will thereafter
return... | lib/mpdaf/obj/image.py | rotate | musevlt/mpdaf | 4 | python | def rotate(self, theta=0.0, interp='no', reshape=False, order=1, pivot=None, unit=u.deg, regrid=None, flux=False, cutoff=0.25, inplace=False):
"Rotate the sky within an image in the sense of a rotation from\n north to east.\n\n For example if the image rotation angle that is currently\n returne... | def rotate(self, theta=0.0, interp='no', reshape=False, order=1, pivot=None, unit=u.deg, regrid=None, flux=False, cutoff=0.25, inplace=False):
"Rotate the sky within an image in the sense of a rotation from\n north to east.\n\n For example if the image rotation angle that is currently\n returne... |
edd9237b9cf72d7c67df234aae223466c830f610e24770dd9e3f27a0cb60d0ec | def norm(self, typ='flux', value=1.0):
"Normalize in place total flux to value (default 1).\n\n Parameters\n ----------\n type : 'flux' | 'sum' | 'max'\n If 'flux',the flux is normalized and\n the pixel area is taken into account.\n\n If 'sum', the flux is norma... | Normalize in place total flux to value (default 1).
Parameters
----------
type : 'flux' | 'sum' | 'max'
If 'flux',the flux is normalized and
the pixel area is taken into account.
If 'sum', the flux is normalized to the sum
of flux independently of pixel size.
If 'max', the flux is normalized so t... | lib/mpdaf/obj/image.py | norm | musevlt/mpdaf | 4 | python | def norm(self, typ='flux', value=1.0):
"Normalize in place total flux to value (default 1).\n\n Parameters\n ----------\n type : 'flux' | 'sum' | 'max'\n If 'flux',the flux is normalized and\n the pixel area is taken into account.\n\n If 'sum', the flux is norma... | def norm(self, typ='flux', value=1.0):
"Normalize in place total flux to value (default 1).\n\n Parameters\n ----------\n type : 'flux' | 'sum' | 'max'\n If 'flux',the flux is normalized and\n the pixel area is taken into account.\n\n If 'sum', the flux is norma... |
48d23a4abc0841f2aaeda8102d950c5307bdecff4cdcf25787c1d2e5044f4961 | def background(self, niter=3, sigma=3.0):
'Compute the image background with sigma-clipping.\n\n Returns the background value and its standard deviation.\n\n Parameters\n ----------\n niter : int\n Number of iterations.\n sigma : float\n Number of sigma used ... | Compute the image background with sigma-clipping.
Returns the background value and its standard deviation.
Parameters
----------
niter : int
Number of iterations.
sigma : float
Number of sigma used for the clipping.
Returns
-------
out : 2-dim float array | lib/mpdaf/obj/image.py | background | musevlt/mpdaf | 4 | python | def background(self, niter=3, sigma=3.0):
'Compute the image background with sigma-clipping.\n\n Returns the background value and its standard deviation.\n\n Parameters\n ----------\n niter : int\n Number of iterations.\n sigma : float\n Number of sigma used ... | def background(self, niter=3, sigma=3.0):
'Compute the image background with sigma-clipping.\n\n Returns the background value and its standard deviation.\n\n Parameters\n ----------\n niter : int\n Number of iterations.\n sigma : float\n Number of sigma used ... |
5cee9db0255daec95f24edafe747917331cb509332e94b4b2b864efedc13e488 | def peak_detection(self, nstruct, niter, threshold=None):
'Return a list of peak locations.\n\n Parameters\n ----------\n nstruct : int\n Size of the structuring element used for the erosion.\n niter : int\n Number of iterations used for the erosion and the dilatati... | Return a list of peak locations.
Parameters
----------
nstruct : int
Size of the structuring element used for the erosion.
niter : int
Number of iterations used for the erosion and the dilatation.
threshold : float
Threshold value. If None, it is initialized with background value.
Returns
-------
out : np... | lib/mpdaf/obj/image.py | peak_detection | musevlt/mpdaf | 4 | python | def peak_detection(self, nstruct, niter, threshold=None):
'Return a list of peak locations.\n\n Parameters\n ----------\n nstruct : int\n Size of the structuring element used for the erosion.\n niter : int\n Number of iterations used for the erosion and the dilatati... | def peak_detection(self, nstruct, niter, threshold=None):
'Return a list of peak locations.\n\n Parameters\n ----------\n nstruct : int\n Size of the structuring element used for the erosion.\n niter : int\n Number of iterations used for the erosion and the dilatati... |
ee2e49f99544b36818a312efc44ef3f63091d46fcf3e27520482663892b592ce | def peak(self, center=None, radius=0, unit_center=u.deg, unit_radius=u.arcsec, dpix=2, background=None, plot=False):
"Find image peak location.\n\n Used `scipy.ndimage.measurements.maximum_position` and\n `scipy.ndimage.measurements.center_of_mass`.\n\n Parameters\n ----------\n c... | Find image peak location.
Used `scipy.ndimage.measurements.maximum_position` and
`scipy.ndimage.measurements.center_of_mass`.
Parameters
----------
center : (float,float)
Center (y,x) of the explored region.
If center is None, the full image is explored.
radius : float or (float,float)
Radius defined the ... | lib/mpdaf/obj/image.py | peak | musevlt/mpdaf | 4 | python | def peak(self, center=None, radius=0, unit_center=u.deg, unit_radius=u.arcsec, dpix=2, background=None, plot=False):
"Find image peak location.\n\n Used `scipy.ndimage.measurements.maximum_position` and\n `scipy.ndimage.measurements.center_of_mass`.\n\n Parameters\n ----------\n c... | def peak(self, center=None, radius=0, unit_center=u.deg, unit_radius=u.arcsec, dpix=2, background=None, plot=False):
"Find image peak location.\n\n Used `scipy.ndimage.measurements.maximum_position` and\n `scipy.ndimage.measurements.center_of_mass`.\n\n Parameters\n ----------\n c... |
25cb2e81adfb65854e6ad7a74b516434135b0dc9fd8f7ad1fbcc406a747a4149 | def fwhm(self, center=None, radius=0, unit_center=u.deg, unit_radius=u.arcsec):
'Compute the fwhm.\n\n Parameters\n ----------\n center : (float,float)\n Center of the explored region.\n If center is None, the full image is explored.\n radius : float or (float,float... | Compute the fwhm.
Parameters
----------
center : (float,float)
Center of the explored region.
If center is None, the full image is explored.
radius : float or (float,float)
Radius defined the explored region.
unit_center : `astropy.units.Unit`
type of the center coordinates.
Degrees by default (use... | lib/mpdaf/obj/image.py | fwhm | musevlt/mpdaf | 4 | python | def fwhm(self, center=None, radius=0, unit_center=u.deg, unit_radius=u.arcsec):
'Compute the fwhm.\n\n Parameters\n ----------\n center : (float,float)\n Center of the explored region.\n If center is None, the full image is explored.\n radius : float or (float,float... | def fwhm(self, center=None, radius=0, unit_center=u.deg, unit_radius=u.arcsec):
'Compute the fwhm.\n\n Parameters\n ----------\n center : (float,float)\n Center of the explored region.\n If center is None, the full image is explored.\n radius : float or (float,float... |
0e0d8f0d58bb8efdb3826b11876e1e0908bda704832e7ee0fd2d638a58a37a8f | def ee(self, center=None, radius=0, unit_center=u.deg, unit_radius=u.arcsec, frac=False, cont=0):
'Compute ensquared/encircled energy.\n\n Parameters\n ----------\n center : (float,float)\n Center of the explored region.\n If center is None, the full image is explored.\n ... | Compute ensquared/encircled energy.
Parameters
----------
center : (float,float)
Center of the explored region.
If center is None, the full image is explored.
radius : float or (float,float)
Radius defined the explored region.
If float, it defined a circular region (encircled energy).
If (float,flo... | lib/mpdaf/obj/image.py | ee | musevlt/mpdaf | 4 | python | def ee(self, center=None, radius=0, unit_center=u.deg, unit_radius=u.arcsec, frac=False, cont=0):
'Compute ensquared/encircled energy.\n\n Parameters\n ----------\n center : (float,float)\n Center of the explored region.\n If center is None, the full image is explored.\n ... | def ee(self, center=None, radius=0, unit_center=u.deg, unit_radius=u.arcsec, frac=False, cont=0):
'Compute ensquared/encircled energy.\n\n Parameters\n ----------\n center : (float,float)\n Center of the explored region.\n If center is None, the full image is explored.\n ... |
f837873776f51f00ad91f8cd0172891c18b4295c2787cf3aca6d98d331426915 | def eer_curve(self, center=None, unit_center=u.deg, unit_radius=u.arcsec, etot=None, cont=0):
'Return containing enclosed energy as function of radius.\n\n The enclosed energy ratio (EER) shows how much light is concentrated\n within a certain radius around the image-center.\n\n\n Parameters\n ... | Return containing enclosed energy as function of radius.
The enclosed energy ratio (EER) shows how much light is concentrated
within a certain radius around the image-center.
Parameters
----------
center : (float,float)
Center of the explored region.
If center is None, center of the image is used.
unit_cente... | lib/mpdaf/obj/image.py | eer_curve | musevlt/mpdaf | 4 | python | def eer_curve(self, center=None, unit_center=u.deg, unit_radius=u.arcsec, etot=None, cont=0):
'Return containing enclosed energy as function of radius.\n\n The enclosed energy ratio (EER) shows how much light is concentrated\n within a certain radius around the image-center.\n\n\n Parameters\n ... | def eer_curve(self, center=None, unit_center=u.deg, unit_radius=u.arcsec, etot=None, cont=0):
'Return containing enclosed energy as function of radius.\n\n The enclosed energy ratio (EER) shows how much light is concentrated\n within a certain radius around the image-center.\n\n\n Parameters\n ... |
4fc89064d43eb0c22d530d7df2d21e5bd5ade552486793d62275fed8646c8baa | def ee_size(self, center=None, unit_center=u.deg, etot=None, frac=0.9, cont=0, unit_size=u.arcsec):
'Compute the size of the square centered on (y,x) containing the\n fraction of the energy.\n\n Parameters\n ----------\n center : (float,float)\n Center (y,x) of the explored re... | Compute the size of the square centered on (y,x) containing the
fraction of the energy.
Parameters
----------
center : (float,float)
Center (y,x) of the explored region.
If center is None, center of the image is used.
unit : `astropy.units.Unit`
Type of the center coordinates.
Degrees by default (use N... | lib/mpdaf/obj/image.py | ee_size | musevlt/mpdaf | 4 | python | def ee_size(self, center=None, unit_center=u.deg, etot=None, frac=0.9, cont=0, unit_size=u.arcsec):
'Compute the size of the square centered on (y,x) containing the\n fraction of the energy.\n\n Parameters\n ----------\n center : (float,float)\n Center (y,x) of the explored re... | def ee_size(self, center=None, unit_center=u.deg, etot=None, frac=0.9, cont=0, unit_size=u.arcsec):
'Compute the size of the square centered on (y,x) containing the\n fraction of the energy.\n\n Parameters\n ----------\n center : (float,float)\n Center (y,x) of the explored re... |
f847119ab6ae3f4f625f4d127abcceac344f8177de4d0be11bbf361a3613cce4 | def _interp(self, grid, spline=False):
'Return the interpolated values corresponding to the grid points.\n\n Parameters\n ----------\n grid :\n pixel values\n spline : bool\n If False, linear interpolation (uses\n `scipy.interpolate.griddata`), or if True... | Return the interpolated values corresponding to the grid points.
Parameters
----------
grid :
pixel values
spline : bool
If False, linear interpolation (uses
`scipy.interpolate.griddata`), or if True: spline
interpolation (uses `scipy.interpolate.bisplrep` and
`scipy.interpolate.bisplev`). | lib/mpdaf/obj/image.py | _interp | musevlt/mpdaf | 4 | python | def _interp(self, grid, spline=False):
'Return the interpolated values corresponding to the grid points.\n\n Parameters\n ----------\n grid :\n pixel values\n spline : bool\n If False, linear interpolation (uses\n `scipy.interpolate.griddata`), or if True... | def _interp(self, grid, spline=False):
'Return the interpolated values corresponding to the grid points.\n\n Parameters\n ----------\n grid :\n pixel values\n spline : bool\n If False, linear interpolation (uses\n `scipy.interpolate.griddata`), or if True... |
0b7d72056c1e5b8cb407b8bcf186e7ac7b21cb82daf8f11968dc6cb8a0c0fe40 | def _interp_data(self, spline=False):
'Return data array with interpolated values for masked pixels.\n\n Parameters\n ----------\n spline : bool\n False: bilinear interpolation (it uses\n `scipy.interpolate.griddata`), True: spline interpolation (it\n uses `scip... | Return data array with interpolated values for masked pixels.
Parameters
----------
spline : bool
False: bilinear interpolation (it uses
`scipy.interpolate.griddata`), True: spline interpolation (it
uses `scipy.interpolate.bisplrep` and
`scipy.interpolate.bisplev`). | lib/mpdaf/obj/image.py | _interp_data | musevlt/mpdaf | 4 | python | def _interp_data(self, spline=False):
'Return data array with interpolated values for masked pixels.\n\n Parameters\n ----------\n spline : bool\n False: bilinear interpolation (it uses\n `scipy.interpolate.griddata`), True: spline interpolation (it\n uses `scip... | def _interp_data(self, spline=False):
'Return data array with interpolated values for masked pixels.\n\n Parameters\n ----------\n spline : bool\n False: bilinear interpolation (it uses\n `scipy.interpolate.griddata`), True: spline interpolation (it\n uses `scip... |
e0e940d6856df625cacda3cd7c246cf67def0f43d076ceed7b73d8f1c1378ecc | def _prepare_data(self, interp='no'):
"Return a copy of the data array in which masked values\n have been filled, either with the median value of the image,\n or by interpolating neighboring pixels.\n\n Parameters\n ----------\n interp : 'no' | 'linear' | 'spline'\n If ... | Return a copy of the data array in which masked values
have been filled, either with the median value of the image,
or by interpolating neighboring pixels.
Parameters
----------
interp : 'no' | 'linear' | 'spline'
If 'no', replace masked data with the median image value.
If 'linear', replace masked values usin... | lib/mpdaf/obj/image.py | _prepare_data | musevlt/mpdaf | 4 | python | def _prepare_data(self, interp='no'):
"Return a copy of the data array in which masked values\n have been filled, either with the median value of the image,\n or by interpolating neighboring pixels.\n\n Parameters\n ----------\n interp : 'no' | 'linear' | 'spline'\n If ... | def _prepare_data(self, interp='no'):
"Return a copy of the data array in which masked values\n have been filled, either with the median value of the image,\n or by interpolating neighboring pixels.\n\n Parameters\n ----------\n interp : 'no' | 'linear' | 'spline'\n If ... |
35c224b3105a075a687d515327b88f466bdf7b326d4d259cfe11cfc187dfa916 | def moments(self, unit=u.arcsec):
'Return [width_y, width_x] first moments of the 2D gaussian.\n\n Parameters\n ----------\n unit : `astropy.units.Unit`\n Unit of the returned moments (arcseconds by default).\n If None, moments will be in pixels.\n\n Returns\n ... | Return [width_y, width_x] first moments of the 2D gaussian.
Parameters
----------
unit : `astropy.units.Unit`
Unit of the returned moments (arcseconds by default).
If None, moments will be in pixels.
Returns
-------
out : float array | lib/mpdaf/obj/image.py | moments | musevlt/mpdaf | 4 | python | def moments(self, unit=u.arcsec):
'Return [width_y, width_x] first moments of the 2D gaussian.\n\n Parameters\n ----------\n unit : `astropy.units.Unit`\n Unit of the returned moments (arcseconds by default).\n If None, moments will be in pixels.\n\n Returns\n ... | def moments(self, unit=u.arcsec):
'Return [width_y, width_x] first moments of the 2D gaussian.\n\n Parameters\n ----------\n unit : `astropy.units.Unit`\n Unit of the returned moments (arcseconds by default).\n If None, moments will be in pixels.\n\n Returns\n ... |
ffeec4a997d9a57ffafa78163f1ee149a72e2885d272234490e2d0da45510a82 | def gauss_fit(self, pos_min=None, pos_max=None, center=None, flux=None, fwhm=None, circular=False, cont=0, fit_back=True, rot=0, peak=False, factor=1, weight=True, plot=False, unit_center=u.deg, unit_fwhm=u.arcsec, maxiter=0, verbose=True, full_output=0):
'Perform Gaussian fit on image.\n\n Parameters\n ... | Perform Gaussian fit on image.
Parameters
----------
pos_min : (float,float)
Minimum y and x values. Their unit is given by the unit_center
parameter (degrees by default).
pos_max : (float,float)
Maximum y and x values. Their unit is given by the unit_center
parameter (degrees by default).
center : (fl... | lib/mpdaf/obj/image.py | gauss_fit | musevlt/mpdaf | 4 | python | def gauss_fit(self, pos_min=None, pos_max=None, center=None, flux=None, fwhm=None, circular=False, cont=0, fit_back=True, rot=0, peak=False, factor=1, weight=True, plot=False, unit_center=u.deg, unit_fwhm=u.arcsec, maxiter=0, verbose=True, full_output=0):
'Perform Gaussian fit on image.\n\n Parameters\n ... | def gauss_fit(self, pos_min=None, pos_max=None, center=None, flux=None, fwhm=None, circular=False, cont=0, fit_back=True, rot=0, peak=False, factor=1, weight=True, plot=False, unit_center=u.deg, unit_fwhm=u.arcsec, maxiter=0, verbose=True, full_output=0):
'Perform Gaussian fit on image.\n\n Parameters\n ... |
43409319e973e56b775632bb6be1b3a5d64787d645a0ec4e36d2cf640cc030b3 | def moffat_fit(self, pos_min=None, pos_max=None, center=None, fwhm=None, flux=None, n=2.0, circular=False, cont=0, fit_back=True, rot=0, peak=False, factor=1, weight=True, plot=False, unit_center=u.deg, unit_fwhm=u.arcsec, verbose=True, full_output=0, fit_n=True, maxiter=0):
'Perform moffat fit on image.\n\n ... | Perform moffat fit on image.
Parameters
----------
pos_min : (float,float)
Minimum y and x values. Their unit is given by the unit_center
parameter (degrees by default).
pos_max : (float,float)
Maximum y and x values. Their unit is given by the unit_center
parameter (degrees by default).
center : (flo... | lib/mpdaf/obj/image.py | moffat_fit | musevlt/mpdaf | 4 | python | def moffat_fit(self, pos_min=None, pos_max=None, center=None, fwhm=None, flux=None, n=2.0, circular=False, cont=0, fit_back=True, rot=0, peak=False, factor=1, weight=True, plot=False, unit_center=u.deg, unit_fwhm=u.arcsec, verbose=True, full_output=0, fit_n=True, maxiter=0):
'Perform moffat fit on image.\n\n ... | def moffat_fit(self, pos_min=None, pos_max=None, center=None, fwhm=None, flux=None, n=2.0, circular=False, cont=0, fit_back=True, rot=0, peak=False, factor=1, weight=True, plot=False, unit_center=u.deg, unit_fwhm=u.arcsec, verbose=True, full_output=0, fit_n=True, maxiter=0):
'Perform moffat fit on image.\n\n ... |
447bd5a70c29c637f07181566f4696e69a64fbe20a7cb73b1cac620c9e9577e8 | def rebin(self, factor, margin='center', inplace=False):
"Combine neighboring pixels to reduce the size of an image by\n integer factors along each axis.\n\n Each output pixel is the mean of n pixels, where n is the\n product of the reduction factors in the factor argument.\n\n Parameter... | Combine neighboring pixels to reduce the size of an image by
integer factors along each axis.
Each output pixel is the mean of n pixels, where n is the
product of the reduction factors in the factor argument.
Parameters
----------
factor : int or (int,int)
The integer reduction factor along the y and x array axes... | lib/mpdaf/obj/image.py | rebin | musevlt/mpdaf | 4 | python | def rebin(self, factor, margin='center', inplace=False):
"Combine neighboring pixels to reduce the size of an image by\n integer factors along each axis.\n\n Each output pixel is the mean of n pixels, where n is the\n product of the reduction factors in the factor argument.\n\n Parameter... | def rebin(self, factor, margin='center', inplace=False):
"Combine neighboring pixels to reduce the size of an image by\n integer factors along each axis.\n\n Each output pixel is the mean of n pixels, where n is the\n product of the reduction factors in the factor argument.\n\n Parameter... |
26be9bb57e144d7412cf2a5e37fe3d40bc85dbf46a132b47cef02278c7f1b896 | def resample(self, newdim, newstart, newstep, flux=False, order=1, interp='no', unit_start=u.deg, unit_step=u.arcsec, antialias=True, inplace=False, window='blackman'):
"Resample an image of the sky to select its angular resolution and\n to specify which sky position appears at the center of pixel [0,0].\n\n... | Resample an image of the sky to select its angular resolution and
to specify which sky position appears at the center of pixel [0,0].
This function is a simplified interface to the `mpdaf.obj.Image.regrid`
function, which it calls with the following arguments::
regrid(newdim, newstart, [0.0, 0.0],
[abs... | lib/mpdaf/obj/image.py | resample | musevlt/mpdaf | 4 | python | def resample(self, newdim, newstart, newstep, flux=False, order=1, interp='no', unit_start=u.deg, unit_step=u.arcsec, antialias=True, inplace=False, window='blackman'):
"Resample an image of the sky to select its angular resolution and\n to specify which sky position appears at the center of pixel [0,0].\n\n... | def resample(self, newdim, newstart, newstep, flux=False, order=1, interp='no', unit_start=u.deg, unit_step=u.arcsec, antialias=True, inplace=False, window='blackman'):
"Resample an image of the sky to select its angular resolution and\n to specify which sky position appears at the center of pixel [0,0].\n\n... |
ce1904c92da3f1302d328cf75e8563098e9861c6c23f1d8992876e6fdce7077e | def regrid(self, newdim, refpos, refpix, newinc, flux=False, order=1, interp='no', unit_pos=u.deg, unit_inc=u.arcsec, antialias=True, inplace=False, cutoff=0.25, window='blackman'):
"Resample an image of the sky to select its angular resolution,\n to specify the position of the sky in the image array, and\n ... | Resample an image of the sky to select its angular resolution,
to specify the position of the sky in the image array, and
optionally to reflect one or more of its axes.
This function can be used to decrease or increase the
resolution of an image. It can also shift the contents of an
image to place a specific (dec,ra) ... | lib/mpdaf/obj/image.py | regrid | musevlt/mpdaf | 4 | python | def regrid(self, newdim, refpos, refpix, newinc, flux=False, order=1, interp='no', unit_pos=u.deg, unit_inc=u.arcsec, antialias=True, inplace=False, cutoff=0.25, window='blackman'):
"Resample an image of the sky to select its angular resolution,\n to specify the position of the sky in the image array, and\n ... | def regrid(self, newdim, refpos, refpix, newinc, flux=False, order=1, interp='no', unit_pos=u.deg, unit_inc=u.arcsec, antialias=True, inplace=False, cutoff=0.25, window='blackman'):
"Resample an image of the sky to select its angular resolution,\n to specify the position of the sky in the image array, and\n ... |
0e104b35daab298637558af0caf68b266138d36c9a66a84523943405a8f7357c | def align_with_image(self, other, flux=False, inplace=False, cutoff=0.25, antialias=True, window='blackman'):
"Resample the image to give it the same orientation, position,\n resolution and size as a given image.\n\n The image is first rotated to give it the same orientation on\n the sky as the... | Resample the image to give it the same orientation, position,
resolution and size as a given image.
The image is first rotated to give it the same orientation on
the sky as the other image. The resampling process also
eliminates any shear terms from the original image, so that
its pixels can be correctly drawn on a re... | lib/mpdaf/obj/image.py | align_with_image | musevlt/mpdaf | 4 | python | def align_with_image(self, other, flux=False, inplace=False, cutoff=0.25, antialias=True, window='blackman'):
"Resample the image to give it the same orientation, position,\n resolution and size as a given image.\n\n The image is first rotated to give it the same orientation on\n the sky as the... | def align_with_image(self, other, flux=False, inplace=False, cutoff=0.25, antialias=True, window='blackman'):
"Resample the image to give it the same orientation, position,\n resolution and size as a given image.\n\n The image is first rotated to give it the same orientation on\n the sky as the... |
575f30a67aa9881120c8d95036e6536deb747a9d2f00addc3d83b2cdf0498aa1 | def estimate_coordinate_offset(self, ref, nsigma=1.0):
'Given a reference image of the sky that is expected to\n overlap with the current image, attempt to fit for any offset\n between the sky coordinate system of the current image and\n that of the reference image. The returned value is design... | Given a reference image of the sky that is expected to
overlap with the current image, attempt to fit for any offset
between the sky coordinate system of the current image and
that of the reference image. The returned value is designed to
be added to the coordinate reference pixel values of self.wcs.
This function per... | lib/mpdaf/obj/image.py | estimate_coordinate_offset | musevlt/mpdaf | 4 | python | def estimate_coordinate_offset(self, ref, nsigma=1.0):
'Given a reference image of the sky that is expected to\n overlap with the current image, attempt to fit for any offset\n between the sky coordinate system of the current image and\n that of the reference image. The returned value is design... | def estimate_coordinate_offset(self, ref, nsigma=1.0):
'Given a reference image of the sky that is expected to\n overlap with the current image, attempt to fit for any offset\n between the sky coordinate system of the current image and\n that of the reference image. The returned value is design... |
20c84b5f48fa5948a045d492c1cffdaae48ed6aa47a30ae2ddf2df8d47bb07ad | def adjust_coordinates(self, ref, nsigma=1.0, inplace=False):
'Given a reference image of the sky that is expected to\n overlap with the current image, attempt to fit for any offset\n between the sky coordinate system of the current image and\n that of the reference image. Apply this offset to ... | Given a reference image of the sky that is expected to
overlap with the current image, attempt to fit for any offset
between the sky coordinate system of the current image and
that of the reference image. Apply this offset to the
coordinates of the current image, to bring it into line with
the reference image.
This fu... | lib/mpdaf/obj/image.py | adjust_coordinates | musevlt/mpdaf | 4 | python | def adjust_coordinates(self, ref, nsigma=1.0, inplace=False):
'Given a reference image of the sky that is expected to\n overlap with the current image, attempt to fit for any offset\n between the sky coordinate system of the current image and\n that of the reference image. Apply this offset to ... | def adjust_coordinates(self, ref, nsigma=1.0, inplace=False):
'Given a reference image of the sky that is expected to\n overlap with the current image, attempt to fit for any offset\n between the sky coordinate system of the current image and\n that of the reference image. Apply this offset to ... |
dff07a790efe5376d65a45a28195b7535ebcb14de866365f81957090f3565d12 | def gaussian_filter(self, sigma=3, interp='no', inplace=False):
"Return an image containing Gaussian filter applied to the current\n image.\n\n Uses `scipy.ndimage.gaussian_filter`.\n\n Parameters\n ----------\n sigma : float\n Standard deviation for Gaussian kernel\n ... | Return an image containing Gaussian filter applied to the current
image.
Uses `scipy.ndimage.gaussian_filter`.
Parameters
----------
sigma : float
Standard deviation for Gaussian kernel
interp : 'no' | 'linear' | 'spline'
if 'no', data median value replaced masked values.
if 'linear', linear interpolation... | lib/mpdaf/obj/image.py | gaussian_filter | musevlt/mpdaf | 4 | python | def gaussian_filter(self, sigma=3, interp='no', inplace=False):
"Return an image containing Gaussian filter applied to the current\n image.\n\n Uses `scipy.ndimage.gaussian_filter`.\n\n Parameters\n ----------\n sigma : float\n Standard deviation for Gaussian kernel\n ... | def gaussian_filter(self, sigma=3, interp='no', inplace=False):
"Return an image containing Gaussian filter applied to the current\n image.\n\n Uses `scipy.ndimage.gaussian_filter`.\n\n Parameters\n ----------\n sigma : float\n Standard deviation for Gaussian kernel\n ... |
f6f39f01f026190207034053ab627db358ceffadd7a0c04a454d62e53939221f | def segment(self, shape=(2, 2), minsize=20, minpts=None, background=20, interp='no', median=None):
"Segment the image in a number of smaller images.\n\n Returns a list of images. Uses\n `scipy.ndimage.generate_binary_structure`,\n `scipy.ndimage.grey_dilation`, `scipy.ndimage.measurements.label... | Segment the image in a number of smaller images.
Returns a list of images. Uses
`scipy.ndimage.generate_binary_structure`,
`scipy.ndimage.grey_dilation`, `scipy.ndimage.measurements.label`, and
`scipy.ndimage.measurements.find_objects`.
Parameters
----------
shape : (int,int)
Shape used for connectivity.
minsize ... | lib/mpdaf/obj/image.py | segment | musevlt/mpdaf | 4 | python | def segment(self, shape=(2, 2), minsize=20, minpts=None, background=20, interp='no', median=None):
"Segment the image in a number of smaller images.\n\n Returns a list of images. Uses\n `scipy.ndimage.generate_binary_structure`,\n `scipy.ndimage.grey_dilation`, `scipy.ndimage.measurements.label... | def segment(self, shape=(2, 2), minsize=20, minpts=None, background=20, interp='no', median=None):
"Segment the image in a number of smaller images.\n\n Returns a list of images. Uses\n `scipy.ndimage.generate_binary_structure`,\n `scipy.ndimage.grey_dilation`, `scipy.ndimage.measurements.label... |
2a1fd1062280f5f3e95e60be8547cd66bafdac2c11bed39d604ed177341ab53b | def add_gaussian_noise(self, sigma, interp='no'):
"Add Gaussian noise to image in place.\n\n Parameters\n ----------\n sigma : float\n Standard deviation.\n interp : 'no' | 'linear' | 'spline'\n if 'no', data median value replaced masked values.\n ... | Add Gaussian noise to image in place.
Parameters
----------
sigma : float
Standard deviation.
interp : 'no' | 'linear' | 'spline'
if 'no', data median value replaced masked values.
if 'linear', linear interpolation of the masked values.
if 'spline', spline interpolation of the maske... | lib/mpdaf/obj/image.py | add_gaussian_noise | musevlt/mpdaf | 4 | python | def add_gaussian_noise(self, sigma, interp='no'):
"Add Gaussian noise to image in place.\n\n Parameters\n ----------\n sigma : float\n Standard deviation.\n interp : 'no' | 'linear' | 'spline'\n if 'no', data median value replaced masked values.\n ... | def add_gaussian_noise(self, sigma, interp='no'):
"Add Gaussian noise to image in place.\n\n Parameters\n ----------\n sigma : float\n Standard deviation.\n interp : 'no' | 'linear' | 'spline'\n if 'no', data median value replaced masked values.\n ... |
a0d6b11c1b527ff1f524dafd545bd27b00a30604fd2d6575934adba4c72a44bd | def inside(self, coord, unit=u.deg):
'Return True if coord is inside image.\n\n Parameters\n ----------\n coord : (float,float)\n coordinates (y,x).\n unit : `astropy.units.Unit`\n Type of the coordinates (degrees by default)\n\n Returns\n ----... | Return True if coord is inside image.
Parameters
----------
coord : (float,float)
coordinates (y,x).
unit : `astropy.units.Unit`
Type of the coordinates (degrees by default)
Returns
-------
out : bool | lib/mpdaf/obj/image.py | inside | musevlt/mpdaf | 4 | python | def inside(self, coord, unit=u.deg):
'Return True if coord is inside image.\n\n Parameters\n ----------\n coord : (float,float)\n coordinates (y,x).\n unit : `astropy.units.Unit`\n Type of the coordinates (degrees by default)\n\n Returns\n ----... | def inside(self, coord, unit=u.deg):
'Return True if coord is inside image.\n\n Parameters\n ----------\n coord : (float,float)\n coordinates (y,x).\n unit : `astropy.units.Unit`\n Type of the coordinates (degrees by default)\n\n Returns\n ----... |
ee8babfb87dd68c7802ff2c8ff25618aa08c87936258c574d795428e1ada46b1 | def convolve(self, other, inplace=False):
'Convolve an Image with a 2D array or another Image, using the\n discrete convolution equation.\n\n This function, which uses the discrete convolution equation, is\n usually slower than Image.fftconvolve(). However it can be faster when\n other.d... | Convolve an Image with a 2D array or another Image, using the
discrete convolution equation.
This function, which uses the discrete convolution equation, is
usually slower than Image.fftconvolve(). However it can be faster when
other.data.size is small, and it always uses much less memory, so it
is sometimes the only ... | lib/mpdaf/obj/image.py | convolve | musevlt/mpdaf | 4 | python | def convolve(self, other, inplace=False):
'Convolve an Image with a 2D array or another Image, using the\n discrete convolution equation.\n\n This function, which uses the discrete convolution equation, is\n usually slower than Image.fftconvolve(). However it can be faster when\n other.d... | def convolve(self, other, inplace=False):
'Convolve an Image with a 2D array or another Image, using the\n discrete convolution equation.\n\n This function, which uses the discrete convolution equation, is\n usually slower than Image.fftconvolve(). However it can be faster when\n other.d... |
17ae3c73165da0fa9d2e19e6661291785d21f4b7beeed874ea38af2a8f385436 | def fftconvolve(self, other, inplace=False):
'Convolve an Image with a 2D array or another Image, using the\n Fourier convolution theorem.\n\n This function, which performs the convolution by multiplying the\n Fourier transforms of the two images, is usually much faster than\n Image.conv... | Convolve an Image with a 2D array or another Image, using the
Fourier convolution theorem.
This function, which performs the convolution by multiplying the
Fourier transforms of the two images, is usually much faster than
Image.convolve(), except when other.data.size is small. However it
uses much more memory, so Imag... | lib/mpdaf/obj/image.py | fftconvolve | musevlt/mpdaf | 4 | python | def fftconvolve(self, other, inplace=False):
'Convolve an Image with a 2D array or another Image, using the\n Fourier convolution theorem.\n\n This function, which performs the convolution by multiplying the\n Fourier transforms of the two images, is usually much faster than\n Image.conv... | def fftconvolve(self, other, inplace=False):
'Convolve an Image with a 2D array or another Image, using the\n Fourier convolution theorem.\n\n This function, which performs the convolution by multiplying the\n Fourier transforms of the two images, is usually much faster than\n Image.conv... |
944028d1c24fc555c4876cea54f910ca39b041ac09047b5da4893989122608c9 | def fftconvolve_gauss(self, center=None, flux=1.0, fwhm=(1.0, 1.0), peak=False, rot=0.0, factor=1, unit_center=u.deg, unit_fwhm=u.arcsec, inplace=False):
'Return the convolution of the image with a 2D gaussian.\n\n Parameters\n ----------\n center : (float,float)\n Gaussian center (y... | Return the convolution of the image with a 2D gaussian.
Parameters
----------
center : (float,float)
Gaussian center (y_peak, x_peak). If None the center of the image
is used. The unit is given by the unit_center parameter (degrees
by default).
flux : float
Integrated gaussian flux or gaussian peak va... | lib/mpdaf/obj/image.py | fftconvolve_gauss | musevlt/mpdaf | 4 | python | def fftconvolve_gauss(self, center=None, flux=1.0, fwhm=(1.0, 1.0), peak=False, rot=0.0, factor=1, unit_center=u.deg, unit_fwhm=u.arcsec, inplace=False):
'Return the convolution of the image with a 2D gaussian.\n\n Parameters\n ----------\n center : (float,float)\n Gaussian center (y... | def fftconvolve_gauss(self, center=None, flux=1.0, fwhm=(1.0, 1.0), peak=False, rot=0.0, factor=1, unit_center=u.deg, unit_fwhm=u.arcsec, inplace=False):
'Return the convolution of the image with a 2D gaussian.\n\n Parameters\n ----------\n center : (float,float)\n Gaussian center (y... |
f415674fda1b94025de92bc7ff58be311d836fe031c990dc7bc891b56c358a24 | def fftconvolve_moffat(self, center=None, flux=1.0, a=1.0, q=1.0, n=2, peak=False, rot=0.0, factor=1, unit_center=u.deg, unit_a=u.arcsec, inplace=False):
'Return the convolution of the image with a 2D moffat.\n\n Parameters\n ----------\n center : (float,float)\n Gaussian center (y_p... | Return the convolution of the image with a 2D moffat.
Parameters
----------
center : (float,float)
Gaussian center (y_peak, x_peak). If None the center of the image
is used. The unit is given by the unit_center parameter (degrees
by default).
flux : float
Integrated gaussian flux or gaussian peak val... | lib/mpdaf/obj/image.py | fftconvolve_moffat | musevlt/mpdaf | 4 | python | def fftconvolve_moffat(self, center=None, flux=1.0, a=1.0, q=1.0, n=2, peak=False, rot=0.0, factor=1, unit_center=u.deg, unit_a=u.arcsec, inplace=False):
'Return the convolution of the image with a 2D moffat.\n\n Parameters\n ----------\n center : (float,float)\n Gaussian center (y_p... | def fftconvolve_moffat(self, center=None, flux=1.0, a=1.0, q=1.0, n=2, peak=False, rot=0.0, factor=1, unit_center=u.deg, unit_a=u.arcsec, inplace=False):
'Return the convolution of the image with a 2D moffat.\n\n Parameters\n ----------\n center : (float,float)\n Gaussian center (y_p... |
7f4ed1832529a4abb99151f1c15661a3e094fc18b70ad89c73aac97ef763d4a0 | def correlate2d(self, other, interp='no'):
"Return the cross-correlation of the image with an array/image\n\n Uses `scipy.signal.correlate2d`.\n\n Parameters\n ----------\n other : 2d-array or Image\n Second Image or 2d-array.\n interp : 'no' | 'linear' | 'spline'\n ... | Return the cross-correlation of the image with an array/image
Uses `scipy.signal.correlate2d`.
Parameters
----------
other : 2d-array or Image
Second Image or 2d-array.
interp : 'no' | 'linear' | 'spline'
if 'no', data median value replaced masked values.
if 'linear', linear interpolation of the masked va... | lib/mpdaf/obj/image.py | correlate2d | musevlt/mpdaf | 4 | python | def correlate2d(self, other, interp='no'):
"Return the cross-correlation of the image with an array/image\n\n Uses `scipy.signal.correlate2d`.\n\n Parameters\n ----------\n other : 2d-array or Image\n Second Image or 2d-array.\n interp : 'no' | 'linear' | 'spline'\n ... | def correlate2d(self, other, interp='no'):
"Return the cross-correlation of the image with an array/image\n\n Uses `scipy.signal.correlate2d`.\n\n Parameters\n ----------\n other : 2d-array or Image\n Second Image or 2d-array.\n interp : 'no' | 'linear' | 'spline'\n ... |
dd54454368849795308652461fd2046296af316f45af2756af45a569ef02aeed | def plot(self, title=None, scale='linear', vmin=None, vmax=None, zscale=False, colorbar=None, var=False, show_xlabel=False, show_ylabel=False, ax=None, unit=u.deg, use_wcs=False, **kwargs):
"Plot the image with axes labeled in pixels.\n\n If either axis has just one pixel, plot a line instead of an image.\n\... | Plot the image with axes labeled in pixels.
If either axis has just one pixel, plot a line instead of an image.
Colors are assigned to each pixel value as follows. First each
pixel value, ``pv``, is normalized over the range ``vmin`` to ``vmax``,
to have a value ``nv``, that goes from 0 to 1, as follows::
nv = (... | lib/mpdaf/obj/image.py | plot | musevlt/mpdaf | 4 | python | def plot(self, title=None, scale='linear', vmin=None, vmax=None, zscale=False, colorbar=None, var=False, show_xlabel=False, show_ylabel=False, ax=None, unit=u.deg, use_wcs=False, **kwargs):
"Plot the image with axes labeled in pixels.\n\n If either axis has just one pixel, plot a line instead of an image.\n\... | def plot(self, title=None, scale='linear', vmin=None, vmax=None, zscale=False, colorbar=None, var=False, show_xlabel=False, show_ylabel=False, ax=None, unit=u.deg, use_wcs=False, **kwargs):
"Plot the image with axes labeled in pixels.\n\n If either axis has just one pixel, plot a line instead of an image.\n\... |
e97dd6f4f6974782d63e2b27fa2bb01706d30966ba59330e1f9be533cf5ae501 | def get_spatial_fmax(self, rot=None):
'Return the spatial-frequency band-limits of the image along\n the Y and X axes.\n\n See the documentation of set_spatial_fmax() for an explanation\n of what the band-limits are used for.\n\n If no band limits have been specified yet, this function h... | Return the spatial-frequency band-limits of the image along
the Y and X axes.
See the documentation of set_spatial_fmax() for an explanation
of what the band-limits are used for.
If no band limits have been specified yet, this function has the
side-effect of setting them to the band-limits dictated by the
sampling in... | lib/mpdaf/obj/image.py | get_spatial_fmax | musevlt/mpdaf | 4 | python | def get_spatial_fmax(self, rot=None):
'Return the spatial-frequency band-limits of the image along\n the Y and X axes.\n\n See the documentation of set_spatial_fmax() for an explanation\n of what the band-limits are used for.\n\n If no band limits have been specified yet, this function h... | def get_spatial_fmax(self, rot=None):
'Return the spatial-frequency band-limits of the image along\n the Y and X axes.\n\n See the documentation of set_spatial_fmax() for an explanation\n of what the band-limits are used for.\n\n If no band limits have been specified yet, this function h... |
41ffd62089ee12f572c6522b5f18d7b0c7ad5531a9f79294b35bfbea020f174e | def update_spatial_fmax(self, newfmax, rot=None):
'Update the spatial-frequency band-limits recorded for the\n current image.\n\n See the documentation of set_spatial_fmax() for an explanation\n of what the band-limits are used for.\n\n If either of the new limits is less than an existin... | Update the spatial-frequency band-limits recorded for the
current image.
See the documentation of set_spatial_fmax() for an explanation
of what the band-limits are used for.
If either of the new limits is less than an existing
band-limit, and the rotation angle of the new limits is
the same as the angle of the record... | lib/mpdaf/obj/image.py | update_spatial_fmax | musevlt/mpdaf | 4 | python | def update_spatial_fmax(self, newfmax, rot=None):
'Update the spatial-frequency band-limits recorded for the\n current image.\n\n See the documentation of set_spatial_fmax() for an explanation\n of what the band-limits are used for.\n\n If either of the new limits is less than an existin... | def update_spatial_fmax(self, newfmax, rot=None):
'Update the spatial-frequency band-limits recorded for the\n current image.\n\n See the documentation of set_spatial_fmax() for an explanation\n of what the band-limits are used for.\n\n If either of the new limits is less than an existin... |
dcc5d5e331de47d393b6c3d5178f6ce3c370a319b326ed8f5975d3a9ddb34d57 | def set_spatial_fmax(self, newfmax=None, rot=None):
'Specify the spatial-frequency band-limits of the image along\n the Y and X axis. This function completely replaces any existing\n band-limits. See also update_spatial_fmax().\n\n The recorded limits are used to avoid redundantly performing\n ... | Specify the spatial-frequency band-limits of the image along
the Y and X axis. This function completely replaces any existing
band-limits. See also update_spatial_fmax().
The recorded limits are used to avoid redundantly performing
anti-aliasing measures such as low-pass filtering an image
before resampling to a lower... | lib/mpdaf/obj/image.py | set_spatial_fmax | musevlt/mpdaf | 4 | python | def set_spatial_fmax(self, newfmax=None, rot=None):
'Specify the spatial-frequency band-limits of the image along\n the Y and X axis. This function completely replaces any existing\n band-limits. See also update_spatial_fmax().\n\n The recorded limits are used to avoid redundantly performing\n ... | def set_spatial_fmax(self, newfmax=None, rot=None):
'Specify the spatial-frequency band-limits of the image along\n the Y and X axis. This function completely replaces any existing\n band-limits. See also update_spatial_fmax().\n\n The recorded limits are used to avoid redundantly performing\n ... |
162c5b36b4a67e59fb48ab24c461a127f9e047346e4eeeaa841519ddcd8d579d | def get_fmax(self, rot):
"Return the spatial-frequency band-limits along a Y axis that is\n 'rot' degrees west of north, and an X axis that is 90 degrees\n away from this Y axis in the sense of a rotation from north to east.\n\n Parameters\n ----------\n rot : float\n Th... | Return the spatial-frequency band-limits along a Y axis that is
'rot' degrees west of north, and an X axis that is 90 degrees
away from this Y axis in the sense of a rotation from north to east.
Parameters
----------
rot : float
The angle of the target Y axis west of north (degrees).
Returns
-------
out : numpy.nd... | lib/mpdaf/obj/image.py | get_fmax | musevlt/mpdaf | 4 | python | def get_fmax(self, rot):
"Return the spatial-frequency band-limits along a Y axis that is\n 'rot' degrees west of north, and an X axis that is 90 degrees\n away from this Y axis in the sense of a rotation from north to east.\n\n Parameters\n ----------\n rot : float\n Th... | def get_fmax(self, rot):
"Return the spatial-frequency band-limits along a Y axis that is\n 'rot' degrees west of north, and an X axis that is 90 degrees\n away from this Y axis in the sense of a rotation from north to east.\n\n Parameters\n ----------\n rot : float\n Th... |
7a01d1f5253093f7505117276bbb3403fc41f1cb91eb603a575fdba3c6017a62 | def ellipse_locus(self, t, rot):
'Return the Y,X coordinates of the band-limiting ellipse\n at ellipse phase t.\n\n Parameters\n ----------\n t : float\n The elliptical phase at which the calculate the\n coordinates (radians).\n rot : float\n The r... | Return the Y,X coordinates of the band-limiting ellipse
at ellipse phase t.
Parameters
----------
t : float
The elliptical phase at which the calculate the
coordinates (radians).
rot : float
The rotation angle of the Y axis of the ellipse west
of north (degrees).
Returns
-------
out : numpy.ndarray
... | lib/mpdaf/obj/image.py | ellipse_locus | musevlt/mpdaf | 4 | python | def ellipse_locus(self, t, rot):
'Return the Y,X coordinates of the band-limiting ellipse\n at ellipse phase t.\n\n Parameters\n ----------\n t : float\n The elliptical phase at which the calculate the\n coordinates (radians).\n rot : float\n The r... | def ellipse_locus(self, t, rot):
'Return the Y,X coordinates of the band-limiting ellipse\n at ellipse phase t.\n\n Parameters\n ----------\n t : float\n The elliptical phase at which the calculate the\n coordinates (radians).\n rot : float\n The r... |
685ae25b1b5d6778c33d14a35b75480553b7e418bf2521b4ce9be209394039da | def moffat(c, x, y, amplitude, x_0, y_0, alpha, beta, e):
'Two dimensional Moffat model function'
rr_gg = ((((x - x_0) / alpha) ** 2) + ((((y - y_0) / alpha) / e) ** 2))
return (c + (amplitude * ((1 + rr_gg) ** (- beta)))) | Two dimensional Moffat model function | lib/mpdaf/obj/image.py | moffat | musevlt/mpdaf | 4 | python | def moffat(c, x, y, amplitude, x_0, y_0, alpha, beta, e):
rr_gg = ((((x - x_0) / alpha) ** 2) + ((((y - y_0) / alpha) / e) ** 2))
return (c + (amplitude * ((1 + rr_gg) ** (- beta)))) | def moffat(c, x, y, amplitude, x_0, y_0, alpha, beta, e):
rr_gg = ((((x - x_0) / alpha) ** 2) + ((((y - y_0) / alpha) / e) ** 2))
return (c + (amplitude * ((1 + rr_gg) ** (- beta))))<|docstring|>Two dimensional Moffat model function<|endoftext|> |
90e14161f806edd2a544f57f87a9c2255051c09b16e529149d9bb7aaa00867f5 | def _dict_repr(self) -> Any:
'\n Returns the dict representation of your object.\n\n It is the only method that you would want to redefine in most cases to represent data.\n '
return vars(self).copy() | Returns the dict representation of your object.
It is the only method that you would want to redefine in most cases to represent data. | flanautils/models/bases.py | _dict_repr | AlberLC/flanautils | 0 | python | def _dict_repr(self) -> Any:
'\n Returns the dict representation of your object.\n\n It is the only method that you would want to redefine in most cases to represent data.\n '
return vars(self).copy() | def _dict_repr(self) -> Any:
'\n Returns the dict representation of your object.\n\n It is the only method that you would want to redefine in most cases to represent data.\n '
return vars(self).copy()<|docstring|>Returns the dict representation of your object.
It is the only method that yo... |
12f4df84341e8debf8c63ac6b7bffc4538dc6caecd7dac275cb8e6550bbf898c | def _json_repr(self) -> Any:
'\n Returns the JSON representation of your object.\n\n It is the only method that you would want to redefine in most cases to represent data.\n '
return vars(self) | Returns the JSON representation of your object.
It is the only method that you would want to redefine in most cases to represent data. | flanautils/models/bases.py | _json_repr | AlberLC/flanautils | 0 | python | def _json_repr(self) -> Any:
'\n Returns the JSON representation of your object.\n\n It is the only method that you would want to redefine in most cases to represent data.\n '
return vars(self) | def _json_repr(self) -> Any:
'\n Returns the JSON representation of your object.\n\n It is the only method that you would want to redefine in most cases to represent data.\n '
return vars(self)<|docstring|>Returns the JSON representation of your object.
It is the only method that you would... |
9c98464d3cb3699a63b3cf8a977e0072bdec061505eadfff9a32f31826846eb7 | @classmethod
def from_json(cls, text: str) -> Any:
'Classmethod that constructs an object given a JSON string.'
def decode_str(obj_: Any) -> Any:
'Inner function to decode JSON strings to anything.'
if (not isinstance(obj_, str)):
return obj_
try:
bytes_ = base64... | Classmethod that constructs an object given a JSON string. | flanautils/models/bases.py | from_json | AlberLC/flanautils | 0 | python | @classmethod
def from_json(cls, text: str) -> Any:
def decode_str(obj_: Any) -> Any:
'Inner function to decode JSON strings to anything.'
if (not isinstance(obj_, str)):
return obj_
try:
bytes_ = base64.b64decode(obj_.encode(), validate=True)
decoded... | @classmethod
def from_json(cls, text: str) -> Any:
def decode_str(obj_: Any) -> Any:
'Inner function to decode JSON strings to anything.'
if (not isinstance(obj_, str)):
return obj_
try:
bytes_ = base64.b64decode(obj_.encode(), validate=True)
decoded... |
5be833807f0878afbc9772952ef6a9e2a9d79c6b29a4c2b54af81ce8bdb1f1d7 | @classmethod
def mean(cls, objects: Sequence, ratios: list[float]=None, attribute_names: Iterable[str]=()) -> MeanBase:
'\n Classmethod that builds a new object calculating the mean of the objects in the iterable for the attributes\n specified in attribute_names with the provided ratios.\n\n Wh... | Classmethod that builds a new object calculating the mean of the objects in the iterable for the attributes
specified in attribute_names with the provided ratios.
When calculating the mean, if an attribute is None, the ratio given for that object is distributed among the
rest whose attributes with that name contain so... | flanautils/models/bases.py | mean | AlberLC/flanautils | 0 | python | @classmethod
def mean(cls, objects: Sequence, ratios: list[float]=None, attribute_names: Iterable[str]=()) -> MeanBase:
'\n Classmethod that builds a new object calculating the mean of the objects in the iterable for the attributes\n specified in attribute_names with the provided ratios.\n\n Wh... | @classmethod
def mean(cls, objects: Sequence, ratios: list[float]=None, attribute_names: Iterable[str]=()) -> MeanBase:
'\n Classmethod that builds a new object calculating the mean of the objects in the iterable for the attributes\n specified in attribute_names with the provided ratios.\n\n Wh... |
53b2ec0e5a462a8b9a56c1e317ba2a94ee964404dc20a97f4beb5ee9788b9177 | def _create_unique_indices(self):
'Create the unique indices in the database based on _unique_keys and _nullable_unique_keys attributes.'
if (not self._unique_keys):
return
unique_keys = [(unique_key, pymongo.ASCENDING) for unique_key in self._unique_keys]
type_filter = {'$type': ['number', 'str... | Create the unique indices in the database based on _unique_keys and _nullable_unique_keys attributes. | flanautils/models/bases.py | _create_unique_indices | AlberLC/flanautils | 0 | python | def _create_unique_indices(self):
if (not self._unique_keys):
return
unique_keys = [(unique_key, pymongo.ASCENDING) for unique_key in self._unique_keys]
type_filter = {'$type': ['number', 'string', 'object', 'array', 'binData', 'objectId', 'bool', 'date', 'regex', 'javascript', 'regex', 'timest... | def _create_unique_indices(self):
if (not self._unique_keys):
return
unique_keys = [(unique_key, pymongo.ASCENDING) for unique_key in self._unique_keys]
type_filter = {'$type': ['number', 'string', 'object', 'array', 'binData', 'objectId', 'bool', 'date', 'regex', 'javascript', 'regex', 'timest... |
598bbab90dce5e515f3985e6509e89ba434c8e18dd4d9745a49ac7ed4157a7c0 | def _mongo_repr(self) -> Any:
'Returns the object representation to save in mongo database.'
return {k: (v.value if isinstance(v, Enum) else v) for (k, v) in self._dict_repr().items()} | Returns the object representation to save in mongo database. | flanautils/models/bases.py | _mongo_repr | AlberLC/flanautils | 0 | python | def _mongo_repr(self) -> Any:
return {k: (v.value if isinstance(v, Enum) else v) for (k, v) in self._dict_repr().items()} | def _mongo_repr(self) -> Any:
return {k: (v.value if isinstance(v, Enum) else v) for (k, v) in self._dict_repr().items()}<|docstring|>Returns the object representation to save in mongo database.<|endoftext|> |
afc24950ba3b94507e45ee894b25b8bfb5b2ac701de9ea7da6ff664c1e6ce7c3 | def delete(self, cascade=False):
'\n Delete the object from the database.\n\n If cascade=True all objects whose classes inherit from MongoBase are also deleted.\n '
if cascade:
for referenced_object in self.get_referenced_objects():
referenced_object.delete(cascade)
... | Delete the object from the database.
If cascade=True all objects whose classes inherit from MongoBase are also deleted. | flanautils/models/bases.py | delete | AlberLC/flanautils | 0 | python | def delete(self, cascade=False):
'\n Delete the object from the database.\n\n If cascade=True all objects whose classes inherit from MongoBase are also deleted.\n '
if cascade:
for referenced_object in self.get_referenced_objects():
referenced_object.delete(cascade)
... | def delete(self, cascade=False):
'\n Delete the object from the database.\n\n If cascade=True all objects whose classes inherit from MongoBase are also deleted.\n '
if cascade:
for referenced_object in self.get_referenced_objects():
referenced_object.delete(cascade)
... |
05fb812aa2c4bb78571e5431b4101ed8b10765d07848a6424fd2a3e59cc30870 | @classmethod
def find_one(cls, query: dict=None, sort_keys: (str | Iterable[(str | tuple[(str, int)])])=()) -> (MongoBase | None):
'Query the collection and return the first match.'
return next(cls.find(query, sort_keys, lazy=True), None) | Query the collection and return the first match. | flanautils/models/bases.py | find_one | AlberLC/flanautils | 0 | python | @classmethod
def find_one(cls, query: dict=None, sort_keys: (str | Iterable[(str | tuple[(str, int)])])=()) -> (MongoBase | None):
return next(cls.find(query, sort_keys, lazy=True), None) | @classmethod
def find_one(cls, query: dict=None, sort_keys: (str | Iterable[(str | tuple[(str, int)])])=()) -> (MongoBase | None):
return next(cls.find(query, sort_keys, lazy=True), None)<|docstring|>Query the collection and return the first match.<|endoftext|> |
0be46f89a912f20060f47fd047d163843ae3fad813a4b4f360b5fdb5ff463aef | def find_in_database_by_id(self, object_id: ObjectId) -> (dict | None):
'Find an object in all database collections by its ObjectId.'
collections = (self._database[name] for name in self._database.list_collection_names())
return next((document for collection in collections if (document := collection.find_on... | Find an object in all database collections by its ObjectId. | flanautils/models/bases.py | find_in_database_by_id | AlberLC/flanautils | 0 | python | def find_in_database_by_id(self, object_id: ObjectId) -> (dict | None):
collections = (self._database[name] for name in self._database.list_collection_names())
return next((document for collection in collections if (document := collection.find_one({'_id': object_id}))), None) | def find_in_database_by_id(self, object_id: ObjectId) -> (dict | None):
collections = (self._database[name] for name in self._database.list_collection_names())
return next((document for collection in collections if (document := collection.find_one({'_id': object_id}))), None)<|docstring|>Find an object in ... |
b6683193fa67185af8726f8620e66230b8688b239987da920cecf0d6f5c1238a | def pull_from_database(self, overwrite_fields: Iterable[str]=('_id',), exclude: Iterable[str]=()):
'\n Updates the values of the current object with the values of the same object located in the database.\n\n By default, it updates the ObjectId and the attributes of the current object that contain None... | Updates the values of the current object with the values of the same object located in the database.
By default, it updates the ObjectId and the attributes of the current object that contain None. You can force
write from database with database_priority=True (by default database_priority=False).
Ignore the attributes... | flanautils/models/bases.py | pull_from_database | AlberLC/flanautils | 0 | python | def pull_from_database(self, overwrite_fields: Iterable[str]=('_id',), exclude: Iterable[str]=()):
'\n Updates the values of the current object with the values of the same object located in the database.\n\n By default, it updates the ObjectId and the attributes of the current object that contain None... | def pull_from_database(self, overwrite_fields: Iterable[str]=('_id',), exclude: Iterable[str]=()):
'\n Updates the values of the current object with the values of the same object located in the database.\n\n By default, it updates the ObjectId and the attributes of the current object that contain None... |
76257ed2efa89e695a3ab77630f84fbd7e35391e6d198e42a18e973212e345f6 | def resolve(self):
'Resolve all the ObjectId references (ObjectId -> MongoBase).'
for k in vars(self):
getattr(self, k) | Resolve all the ObjectId references (ObjectId -> MongoBase). | flanautils/models/bases.py | resolve | AlberLC/flanautils | 0 | python | def resolve(self):
for k in vars(self):
getattr(self, k) | def resolve(self):
for k in vars(self):
getattr(self, k)<|docstring|>Resolve all the ObjectId references (ObjectId -> MongoBase).<|endoftext|> |
53c39b0c6ff257c0a841e0c3440b7e4fe8355396945a409d2823fc503b792bed | @property
def unique_attributes(self):
'\n Property that returns a dictionary with the name of the attributes that must be unique in the database and their\n values.\n '
unique_attributes = {}
for unique_key in self._unique_keys:
attribute_value = getattr(self, unique_key, None)... | Property that returns a dictionary with the name of the attributes that must be unique in the database and their
values. | flanautils/models/bases.py | unique_attributes | AlberLC/flanautils | 0 | python | @property
def unique_attributes(self):
'\n Property that returns a dictionary with the name of the attributes that must be unique in the database and their\n values.\n '
unique_attributes = {}
for unique_key in self._unique_keys:
attribute_value = getattr(self, unique_key, None)... | @property
def unique_attributes(self):
'\n Property that returns a dictionary with the name of the attributes that must be unique in the database and their\n values.\n '
unique_attributes = {}
for unique_key in self._unique_keys:
attribute_value = getattr(self, unique_key, None)... |
aba467cd151537856c76861f5f0278bfa1247001459e9bd237401073335d3f3c | def decode_str(obj_: Any) -> Any:
'Inner function to decode JSON strings to anything.'
if (not isinstance(obj_, str)):
return obj_
try:
bytes_ = base64.b64decode(obj_.encode(), validate=True)
decoded_obj = pickle.loads(bytes_)
except (binascii.Error, pickle.UnpicklingError, EOFEr... | Inner function to decode JSON strings to anything. | flanautils/models/bases.py | decode_str | AlberLC/flanautils | 0 | python | def decode_str(obj_: Any) -> Any:
if (not isinstance(obj_, str)):
return obj_
try:
bytes_ = base64.b64decode(obj_.encode(), validate=True)
decoded_obj = pickle.loads(bytes_)
except (binascii.Error, pickle.UnpicklingError, EOFError):
return obj_
return decoded_obj | def decode_str(obj_: Any) -> Any:
if (not isinstance(obj_, str)):
return obj_
try:
bytes_ = base64.b64decode(obj_.encode(), validate=True)
decoded_obj = pickle.loads(bytes_)
except (binascii.Error, pickle.UnpicklingError, EOFError):
return obj_
return decoded_obj<|do... |
819380ca14724af62f4ef4bf7be1dd3e9d32206351716ddf08df46b7b66be162 | def decode_list(obj_: Any) -> Any:
'Inner function to decode JSON lists to anything.'
return [decode_str(e) for e in obj_] | Inner function to decode JSON lists to anything. | flanautils/models/bases.py | decode_list | AlberLC/flanautils | 0 | python | def decode_list(obj_: Any) -> Any:
return [decode_str(e) for e in obj_] | def decode_list(obj_: Any) -> Any:
return [decode_str(e) for e in obj_]<|docstring|>Inner function to decode JSON lists to anything.<|endoftext|> |
9e59bcff3d15e2b1d9eea655a85d8efb80c3bba67c09ad4aef41e0221df77faf | def decode_dict(cls_: Any, dict_: dict) -> Any:
'Inner function to decode JSON dictionaries to anything.'
kwargs = {}
for (k, v) in dict_.items():
k = decode_str(k)
v = decode_str(v)
if isinstance(v, dict):
try:
v = decode_dict(typing.get_type_hints(cls_)[... | Inner function to decode JSON dictionaries to anything. | flanautils/models/bases.py | decode_dict | AlberLC/flanautils | 0 | python | def decode_dict(cls_: Any, dict_: dict) -> Any:
kwargs = {}
for (k, v) in dict_.items():
k = decode_str(k)
v = decode_str(v)
if isinstance(v, dict):
try:
v = decode_dict(typing.get_type_hints(cls_)[k], v)
except KeyError:
pass
... | def decode_dict(cls_: Any, dict_: dict) -> Any:
kwargs = {}
for (k, v) in dict_.items():
k = decode_str(k)
v = decode_str(v)
if isinstance(v, dict):
try:
v = decode_dict(typing.get_type_hints(cls_)[k], v)
except KeyError:
pass
... |
8de36190932efa4cd286b4a94028a78b18fe49369a19a3dd7d62bb3924836488 | @scope.define
def hyperopt_param(label, obj):
'A graph node primarily for annotating - VectorizeHelper looks out\n for these guys, and optimizes subgraphs of the form:\n\n hyperopt_param(<stochastic_expression>(...))\n\n '
return obj | A graph node primarily for annotating - VectorizeHelper looks out
for these guys, and optimizes subgraphs of the form:
hyperopt_param(<stochastic_expression>(...)) | hyperopt/pyll_utils.py | hyperopt_param | hamidelmaazouz/hyperopt | 6,071 | python | @scope.define
def hyperopt_param(label, obj):
'A graph node primarily for annotating - VectorizeHelper looks out\n for these guys, and optimizes subgraphs of the form:\n\n hyperopt_param(<stochastic_expression>(...))\n\n '
return obj | @scope.define
def hyperopt_param(label, obj):
'A graph node primarily for annotating - VectorizeHelper looks out\n for these guys, and optimizes subgraphs of the form:\n\n hyperopt_param(<stochastic_expression>(...))\n\n '
return obj<|docstring|>A graph node primarily for annotating - VectorizeHelp... |
4c7952e6687f1cb8f3928ba6e3540ffe451bfd6b64ec5eceaa26563b4a2ad339 | @validate_label
def hp_pchoice(label, p_options):
'\n label: string\n p_options: list of (probability, option) pairs\n '
(p, options) = list(zip(*p_options))
ch = scope.hyperopt_param(label, scope.categorical(p))
return scope.switch(ch, *options) | label: string
p_options: list of (probability, option) pairs | hyperopt/pyll_utils.py | hp_pchoice | hamidelmaazouz/hyperopt | 6,071 | python | @validate_label
def hp_pchoice(label, p_options):
'\n label: string\n p_options: list of (probability, option) pairs\n '
(p, options) = list(zip(*p_options))
ch = scope.hyperopt_param(label, scope.categorical(p))
return scope.switch(ch, *options) | @validate_label
def hp_pchoice(label, p_options):
'\n label: string\n p_options: list of (probability, option) pairs\n '
(p, options) = list(zip(*p_options))
ch = scope.hyperopt_param(label, scope.categorical(p))
return scope.switch(ch, *options)<|docstring|>label: string
p_options: list of (pr... |
f6b2d47e4fb8f190fbdc371afb2a3cc3762af7e7c018d89c33d2bd7c6ebd2aca | def expr_to_config(expr, conditions, hps):
"\n Populate dictionary `hps` with the hyperparameters in pyll graph `expr`\n and conditions for participation in the evaluation of `expr`.\n\n Arguments:\n expr - a pyll expression root.\n conditions - a tuple of conditions (`Cond`) that must be True ... | Populate dictionary `hps` with the hyperparameters in pyll graph `expr`
and conditions for participation in the evaluation of `expr`.
Arguments:
expr - a pyll expression root.
conditions - a tuple of conditions (`Cond`) that must be True for
`expr` to be evaluated.
hps - dictionary to populat... | hyperopt/pyll_utils.py | expr_to_config | hamidelmaazouz/hyperopt | 6,071 | python | def expr_to_config(expr, conditions, hps):
"\n Populate dictionary `hps` with the hyperparameters in pyll graph `expr`\n and conditions for participation in the evaluation of `expr`.\n\n Arguments:\n expr - a pyll expression root.\n conditions - a tuple of conditions (`Cond`) that must be True ... | def expr_to_config(expr, conditions, hps):
"\n Populate dictionary `hps` with the hyperparameters in pyll graph `expr`\n and conditions for participation in the evaluation of `expr`.\n\n Arguments:\n expr - a pyll expression root.\n conditions - a tuple of conditions (`Cond`) that must be True ... |
57ab7b6af9f73f7451a224825c1828693b2df11f800cbfe13a85fe79578975a4 | def _remove_allpaths(hps, conditions):
'Hacky way to recognize some kinds of false dependencies\n Better would be logic programming.\n '
potential_conds = {}
for (k, v) in list(hps.items()):
if (v['node'].name == 'randint'):
low = v['node'].arg['low'].obj
domain_size = ... | Hacky way to recognize some kinds of false dependencies
Better would be logic programming. | hyperopt/pyll_utils.py | _remove_allpaths | hamidelmaazouz/hyperopt | 6,071 | python | def _remove_allpaths(hps, conditions):
'Hacky way to recognize some kinds of false dependencies\n Better would be logic programming.\n '
potential_conds = {}
for (k, v) in list(hps.items()):
if (v['node'].name == 'randint'):
low = v['node'].arg['low'].obj
domain_size = ... | def _remove_allpaths(hps, conditions):
'Hacky way to recognize some kinds of false dependencies\n Better would be logic programming.\n '
potential_conds = {}
for (k, v) in list(hps.items()):
if (v['node'].name == 'randint'):
low = v['node'].arg['low'].obj
domain_size = ... |
0acc8293ae430d45b58e029fc06ef7fe51785b9ef6823b66cf74f680cbf0c8c5 | @pytest.fixture
def repository_under_test():
'\n Create database resource and mock table\n '
with moto.mock_dynamodb2():
job_repository_under_test = JobRepository()
JobRepository().create_table_if_not_exists()
(yield job_repository_under_test)
JobRepository().delete_table() | Create database resource and mock table | pipeline_control/tests/offline/adapters/job_repository/job_repository_fixtures.py | repository_under_test | aws-samples/financial-crimes-discovery-using-graph-database | 0 | python | @pytest.fixture
def repository_under_test():
'\n \n '
with moto.mock_dynamodb2():
job_repository_under_test = JobRepository()
JobRepository().create_table_if_not_exists()
(yield job_repository_under_test)
JobRepository().delete_table() | @pytest.fixture
def repository_under_test():
'\n \n '
with moto.mock_dynamodb2():
job_repository_under_test = JobRepository()
JobRepository().create_table_if_not_exists()
(yield job_repository_under_test)
JobRepository().delete_table()<|docstring|>Create database resource a... |
5607a2b1122691e441177424da9b73aaeec78b8eed18b1aa1ddf42ec9ec320f9 | @moto.mock_dynamodb2
@pytest.fixture
def small_test_job(repository_under_test, create_test_job):
'\n Create database resource and mock table\n '
job_repository_under_test = repository_under_test
job_id = create_test_job
yield_val = job_id
(yield yield_val)
job_repository_under_test.delete_... | Create database resource and mock table | pipeline_control/tests/offline/adapters/job_repository/job_repository_fixtures.py | small_test_job | aws-samples/financial-crimes-discovery-using-graph-database | 0 | python | @moto.mock_dynamodb2
@pytest.fixture
def small_test_job(repository_under_test, create_test_job):
'\n \n '
job_repository_under_test = repository_under_test
job_id = create_test_job
yield_val = job_id
(yield yield_val)
job_repository_under_test.delete_job_by_id(job_id) | @moto.mock_dynamodb2
@pytest.fixture
def small_test_job(repository_under_test, create_test_job):
'\n \n '
job_repository_under_test = repository_under_test
job_id = create_test_job
yield_val = job_id
(yield yield_val)
job_repository_under_test.delete_job_by_id(job_id)<|docstring|>Create da... |
789eb1214bbba9928724adff3fe55f4084521d1a1788c21690a3e537f4c98061 | def work(self, Task, input_q, output_q, meta_q):
'\n The main processing loop for `task`.\n '
task = Task(num_workers=self.num_workers, task_id=self.task_id)
input_job = input_q._link_mem()
output_job = output_q._link_mem()
meta_buffer = meta_q._link_mem()
id_buffer = meta_buffer['... | The main processing loop for `task`. | src/ptlib/core/worker.py | work | jfw225/ptlib | 1 | python | def work(self, Task, input_q, output_q, meta_q):
'\n \n '
task = Task(num_workers=self.num_workers, task_id=self.task_id)
input_job = input_q._link_mem()
output_job = output_q._link_mem()
meta_buffer = meta_q._link_mem()
id_buffer = meta_buffer['id']
data_buffer = meta_buffer['... | def work(self, Task, input_q, output_q, meta_q):
'\n \n '
task = Task(num_workers=self.num_workers, task_id=self.task_id)
input_job = input_q._link_mem()
output_job = output_q._link_mem()
meta_buffer = meta_q._link_mem()
id_buffer = meta_buffer['id']
data_buffer = meta_buffer['... |
bc753c7bfe8333095fe494857991e7269f4135687ebd8b6c0f9535f24ad6c34d | def _get_arc_wcs_center(arc: DXFGraphic) -> Vector:
' Returns the center of an ARC or CIRCLE as WCS coordinates. '
center = arc.dxf.center
if arc.dxf.hasattr('extrusion'):
ocs = arc.ocs()
return ocs.to_wcs(center)
else:
return center | Returns the center of an ARC or CIRCLE as WCS coordinates. | src/ezdxf/addons/drawing/frontend.py | _get_arc_wcs_center | George-Jiang/ezdxf | 0 | python | def _get_arc_wcs_center(arc: DXFGraphic) -> Vector:
' '
center = arc.dxf.center
if arc.dxf.hasattr('extrusion'):
ocs = arc.ocs()
return ocs.to_wcs(center)
else:
return center | def _get_arc_wcs_center(arc: DXFGraphic) -> Vector:
' '
center = arc.dxf.center
if arc.dxf.hasattr('extrusion'):
ocs = arc.ocs()
return ocs.to_wcs(center)
else:
return center<|docstring|>Returns the center of an ARC or CIRCLE as WCS coordinates.<|endoftext|> |
fd0c1ac69c36dca37d7f5daf22a3b1e18963bcbb463489803785e88a83427f6b | def decode_batch(self, window, location):
"\n Resizing each output image window in the batch as an image volume\n location specifies the original input image (so that the\n interpolation order, original shape information retained in the\n\n generated outputs).For the fields that have the... | Resizing each output image window in the batch as an image volume
location specifies the original input image (so that the
interpolation order, original shape information retained in the
generated outputs).For the fields that have the keyword 'window' in the
dictionary key, it will be saved as image. The rest will be ... | niftynet/engine/windows_aggregator_resize.py | decode_batch | tdml13/NiftyNet | 1,403 | python | def decode_batch(self, window, location):
"\n Resizing each output image window in the batch as an image volume\n location specifies the original input image (so that the\n interpolation order, original shape information retained in the\n\n generated outputs).For the fields that have the... | def decode_batch(self, window, location):
"\n Resizing each output image window in the batch as an image volume\n location specifies the original input image (so that the\n interpolation order, original shape information retained in the\n\n generated outputs).For the fields that have the... |
4d8de853c0bf1ce722b6845edca4930eae5edf655dfb504b396e081776c33522 | def _initialise_image_shape(self, image_id, n_channels):
'\n Return the shape of the empty image to be saved\n :param image_id: index to find the appropriate input image from the\n reader\n :param n_channels: number of channels of the image\n :return: shape of the empty image\n ... | Return the shape of the empty image to be saved
:param image_id: index to find the appropriate input image from the
reader
:param n_channels: number of channels of the image
:return: shape of the empty image | niftynet/engine/windows_aggregator_resize.py | _initialise_image_shape | tdml13/NiftyNet | 1,403 | python | def _initialise_image_shape(self, image_id, n_channels):
'\n Return the shape of the empty image to be saved\n :param image_id: index to find the appropriate input image from the\n reader\n :param n_channels: number of channels of the image\n :return: shape of the empty image\n ... | def _initialise_image_shape(self, image_id, n_channels):
'\n Return the shape of the empty image to be saved\n :param image_id: index to find the appropriate input image from the\n reader\n :param n_channels: number of channels of the image\n :return: shape of the empty image\n ... |
eaae58ae11d8b10d11537dedf5ebc481ba151a07bb0e91dba20dee545348852f | def _save_current_image(self):
'\n Loop through the dictionary of images output and resize and reverse\n the preprocessing prior to saving\n :return:\n '
if (self.input_image is None):
return
self.current_out = {}
for i in self.image_out:
resize_to_shape = sel... | Loop through the dictionary of images output and resize and reverse
the preprocessing prior to saving
:return: | niftynet/engine/windows_aggregator_resize.py | _save_current_image | tdml13/NiftyNet | 1,403 | python | def _save_current_image(self):
'\n Loop through the dictionary of images output and resize and reverse\n the preprocessing prior to saving\n :return:\n '
if (self.input_image is None):
return
self.current_out = {}
for i in self.image_out:
resize_to_shape = sel... | def _save_current_image(self):
'\n Loop through the dictionary of images output and resize and reverse\n the preprocessing prior to saving\n :return:\n '
if (self.input_image is None):
return
self.current_out = {}
for i in self.image_out:
resize_to_shape = sel... |
76b107f9ad040fe71d0db30d9d156df138ef48eff9de6ade5002043f2b1201b4 | def _save_current_csv(self):
'\n Save all csv output present in the dictionary of csv_output.\n :return:\n '
if (self.input_image is None):
return
subject_name = self.reader.get_subject_id(self.image_id)
for i in self.csv_out:
filename = '{}_{}_{}.csv'.format(i, subj... | Save all csv output present in the dictionary of csv_output.
:return: | niftynet/engine/windows_aggregator_resize.py | _save_current_csv | tdml13/NiftyNet | 1,403 | python | def _save_current_csv(self):
'\n Save all csv output present in the dictionary of csv_output.\n :return:\n '
if (self.input_image is None):
return
subject_name = self.reader.get_subject_id(self.image_id)
for i in self.csv_out:
filename = '{}_{}_{}.csv'.format(i, subj... | def _save_current_csv(self):
'\n Save all csv output present in the dictionary of csv_output.\n :return:\n '
if (self.input_image is None):
return
subject_name = self.reader.get_subject_id(self.image_id)
for i in self.csv_out:
filename = '{}_{}_{}.csv'.format(i, subj... |
2040bd978444c28e290456023f799fe4636e2eff378b5934a972e537df5b2226 | def _initialise_empty_csv(self, key_names):
'\n Initialise the array to be saved as csv as a line of zeros according\n to the number of elements to be saved\n :param n_channel:\n :return:\n '
return pd.DataFrame(columns=key_names) | Initialise the array to be saved as csv as a line of zeros according
to the number of elements to be saved
:param n_channel:
:return: | niftynet/engine/windows_aggregator_resize.py | _initialise_empty_csv | tdml13/NiftyNet | 1,403 | python | def _initialise_empty_csv(self, key_names):
'\n Initialise the array to be saved as csv as a line of zeros according\n to the number of elements to be saved\n :param n_channel:\n :return:\n '
return pd.DataFrame(columns=key_names) | def _initialise_empty_csv(self, key_names):
'\n Initialise the array to be saved as csv as a line of zeros according\n to the number of elements to be saved\n :param n_channel:\n :return:\n '
return pd.DataFrame(columns=key_names)<|docstring|>Initialise the array to be saved a... |
4d975713eab09dc6fc4ffe1f1d05b403d18576cadc8e03fb35650cbd2748d54e | def get_language_for_file(filename: str) -> str:
'\n Get the language for a file based on its extension or suffix.\n :param filename: the filename of the file\n :return: the language of the file\n '
for (suffix, language) in SUFFIX_TO_LANGUAGE.items():
if filename.endswith(suffix):
... | Get the language for a file based on its extension or suffix.
:param filename: the filename of the file
:return: the language of the file | codiga/utils/file_utils.py | get_language_for_file | codiga/clitool | 2 | python | def get_language_for_file(filename: str) -> str:
'\n Get the language for a file based on its extension or suffix.\n :param filename: the filename of the file\n :return: the language of the file\n '
for (suffix, language) in SUFFIX_TO_LANGUAGE.items():
if filename.endswith(suffix):
... | def get_language_for_file(filename: str) -> str:
'\n Get the language for a file based on its extension or suffix.\n :param filename: the filename of the file\n :return: the language of the file\n '
for (suffix, language) in SUFFIX_TO_LANGUAGE.items():
if filename.endswith(suffix):
... |
de4591ed62b4c365bb84e7451a79902eb604fa49a6620d5aaf696803e1d9f300 | def associate_files_with_language(filenames: Set[str]) -> Dict[(str, str)]:
'\n For a list of filenames, check the language associated with them and returns a dictionary that associate\n the filename and the language. If the filename does not have a matching language, just return.\n :param filenames: the l... | For a list of filenames, check the language associated with them and returns a dictionary that associate
the filename and the language. If the filename does not have a matching language, just return.
:param filenames: the list of filenames
:return: a dictionary that associates the filenames with their languages. | codiga/utils/file_utils.py | associate_files_with_language | codiga/clitool | 2 | python | def associate_files_with_language(filenames: Set[str]) -> Dict[(str, str)]:
'\n For a list of filenames, check the language associated with them and returns a dictionary that associate\n the filename and the language. If the filename does not have a matching language, just return.\n :param filenames: the l... | def associate_files_with_language(filenames: Set[str]) -> Dict[(str, str)]:
'\n For a list of filenames, check the language associated with them and returns a dictionary that associate\n the filename and the language. If the filename does not have a matching language, just return.\n :param filenames: the l... |
14bc4a65c3ed73cbee9eec67ebcb12afc394412879e2d634110b61d7b55acb66 | def assertShapeCorrect(self, batcher, name):
'\n interval should be 2D, with shape [batch_size, input_length]\n signal should be 3d, with shape [batch_size, input_length, input_channel]\n label should be 3d, wish shape [batch_size, output_length, out_channel]\n '
batch_size = (int((n... | interval should be 2D, with shape [batch_size, input_length]
signal should be 3d, with shape [batch_size, input_length, input_channel]
label should be 3d, wish shape [batch_size, output_length, out_channel] | Data/batcher_unittest.py | assertShapeCorrect | shihui2010/continuous_cnn | 0 | python | def assertShapeCorrect(self, batcher, name):
'\n interval should be 2D, with shape [batch_size, input_length]\n signal should be 3d, with shape [batch_size, input_length, input_channel]\n label should be 3d, wish shape [batch_size, output_length, out_channel]\n '
batch_size = (int((n... | def assertShapeCorrect(self, batcher, name):
'\n interval should be 2D, with shape [batch_size, input_length]\n signal should be 3d, with shape [batch_size, input_length, input_channel]\n label should be 3d, wish shape [batch_size, output_length, out_channel]\n '
batch_size = (int((n... |
5576c16958e02a44f4d9a24e8aa2bc6b8f62dd52686a83adfec6681b505f2e57 | def DoTasksForSimulation(snaps=[], tasks=[], task_params=[], interp_fac=1, nproc=1, nthreads=1):
'\n Main CrunchSnaps routine, performs a list of tasks using (possibly interpolated) time series simulation data\n snaps - list of paths of simulation snapshots\n tasks - list of tasks to perform at each simula... | Main CrunchSnaps routine, performs a list of tasks using (possibly interpolated) time series simulation data
snaps - list of paths of simulation snapshots
tasks - list of tasks to perform at each simulation time
task_params - shape [N_tasks,N_params] list of dictionaries containing the parameters for each task - if onl... | src/CrunchSnaps/CrunchSnaps.py | DoTasksForSimulation | mikegrudic/CrunchSnaps | 2 | python | def DoTasksForSimulation(snaps=[], tasks=[], task_params=[], interp_fac=1, nproc=1, nthreads=1):
'\n Main CrunchSnaps routine, performs a list of tasks using (possibly interpolated) time series simulation data\n snaps - list of paths of simulation snapshots\n tasks - list of tasks to perform at each simula... | def DoTasksForSimulation(snaps=[], tasks=[], task_params=[], interp_fac=1, nproc=1, nthreads=1):
'\n Main CrunchSnaps routine, performs a list of tasks using (possibly interpolated) time series simulation data\n snaps - list of paths of simulation snapshots\n tasks - list of tasks to perform at each simula... |
44273c0844eeace9cbbe7d904e69d28744e7bb6ceed6dfdd3ab44c3a5400d22c | def hermitian(A):
'Returns the Hermitian transpose of an array\n\n Args:\n A (jax.numpy.ndarray): An array\n\n Returns:\n (jax.numpy.ndarray): An array: :math:`A^H`\n '
return jnp.conjugate(A.T) | Returns the Hermitian transpose of an array
Args:
A (jax.numpy.ndarray): An array
Returns:
(jax.numpy.ndarray): An array: :math:`A^H` | src/cr/nimble/_src/array.py | hermitian | carnotresearch/cr-nimble | 2 | python | def hermitian(A):
'Returns the Hermitian transpose of an array\n\n Args:\n A (jax.numpy.ndarray): An array\n\n Returns:\n (jax.numpy.ndarray): An array: :math:`A^H`\n '
return jnp.conjugate(A.T) | def hermitian(A):
'Returns the Hermitian transpose of an array\n\n Args:\n A (jax.numpy.ndarray): An array\n\n Returns:\n (jax.numpy.ndarray): An array: :math:`A^H`\n '
return jnp.conjugate(A.T)<|docstring|>Returns the Hermitian transpose of an array
Args:
A (jax.numpy.ndarray): An a... |
24870817433e03a8a75e31e4c993976fbb1fe92950e71e639e894e347004073c | def check_shapes_are_equal(array1, array2):
'Raise an error if the shapes of the two arrays do not match.\n \n Raises:\n ValueError: if the shape of two arrays is not same\n '
if (not (array1.shape == array2.shape)):
raise ValueError('Input arrays must have the same shape.')
return | Raise an error if the shapes of the two arrays do not match.
Raises:
ValueError: if the shape of two arrays is not same | src/cr/nimble/_src/array.py | check_shapes_are_equal | carnotresearch/cr-nimble | 2 | python | def check_shapes_are_equal(array1, array2):
'Raise an error if the shapes of the two arrays do not match.\n \n Raises:\n ValueError: if the shape of two arrays is not same\n '
if (not (array1.shape == array2.shape)):
raise ValueError('Input arrays must have the same shape.')
return | def check_shapes_are_equal(array1, array2):
'Raise an error if the shapes of the two arrays do not match.\n \n Raises:\n ValueError: if the shape of two arrays is not same\n '
if (not (array1.shape == array2.shape)):
raise ValueError('Input arrays must have the same shape.')
return<|... |
7b43ee2553a1e2ac63a4be9ccb1bd166efe4a18d4b8d2ee67faf9ebe0f284487 | def destroy_database(pathname: str) -> None:
'if you can, delete the whole database file. If not, show an error message.'
try:
if (not os.path.exists(pathname)):
messagebox.showerror('Error al eliminar', f'''Parece que no se puede eliminar '{pathname}' porque este archivo no existe.
¿No ha e... | if you can, delete the whole database file. If not, show an error message. | delete-db.py | destroy_database | ControlDeAgua/ControlDeAgua | 2 | python | def destroy_database(pathname: str) -> None:
try:
if (not os.path.exists(pathname)):
messagebox.showerror('Error al eliminar', f'Parece que no se puede eliminar '{pathname}' porque este archivo no existe.
¿No ha eliminado previamente esta base de datos? Verifique o intente de nuevo.')
... | def destroy_database(pathname: str) -> None:
try:
if (not os.path.exists(pathname)):
messagebox.showerror('Error al eliminar', f'Parece que no se puede eliminar '{pathname}' porque este archivo no existe.
¿No ha eliminado previamente esta base de datos? Verifique o intente de nuevo.')
... |
5e3750ff157db40d3c949958d73c6cd40fab92ddeea78e1ad44283fdbb31b81a | def __init__(self, root: Optional[Tk]=None) -> None:
'generate the interface.'
if (not isinstance(root, Tk)):
self.root = Tk()
else:
self.root = root
windowmanager.windowTitle(self.root, 'Opciones para Eliminar la base de datos')
self.build() | generate the interface. | delete-db.py | __init__ | ControlDeAgua/ControlDeAgua | 2 | python | def __init__(self, root: Optional[Tk]=None) -> None:
if (not isinstance(root, Tk)):
self.root = Tk()
else:
self.root = root
windowmanager.windowTitle(self.root, 'Opciones para Eliminar la base de datos')
self.build() | def __init__(self, root: Optional[Tk]=None) -> None:
if (not isinstance(root, Tk)):
self.root = Tk()
else:
self.root = root
windowmanager.windowTitle(self.root, 'Opciones para Eliminar la base de datos')
self.build()<|docstring|>generate the interface.<|endoftext|> |
9081c856b12e6e4b8349447a2778796119414bc31fbaa52d8d1430d3ce48bec0 | def loop(self) -> None:
'use this if the Tk root was generated inside.'
self.root.mainloop() | use this if the Tk root was generated inside. | delete-db.py | loop | ControlDeAgua/ControlDeAgua | 2 | python | def loop(self) -> None:
self.root.mainloop() | def loop(self) -> None:
self.root.mainloop()<|docstring|>use this if the Tk root was generated inside.<|endoftext|> |
94fab186424c2fbbbce674287ffb91a780b0a8b34012978b5692ba7616ddabb6 | def build(self) -> None:
'create the GUI'
self.frame = Frame(self.root)
self.frame.grid()
destroy_label = Label(self.frame, text=self.__doc__, bg='whitesmoke', fg='black', font=('Calibri', '15', 'bold')).grid(row=0, column=0, sticky='ew')
destroy_b = Button(self.frame, text='Eliminar base de datos',... | create the GUI | delete-db.py | build | ControlDeAgua/ControlDeAgua | 2 | python | def build(self) -> None:
self.frame = Frame(self.root)
self.frame.grid()
destroy_label = Label(self.frame, text=self.__doc__, bg='whitesmoke', fg='black', font=('Calibri', '15', 'bold')).grid(row=0, column=0, sticky='ew')
destroy_b = Button(self.frame, text='Eliminar base de datos', bg='red', fg='w... | def build(self) -> None:
self.frame = Frame(self.root)
self.frame.grid()
destroy_label = Label(self.frame, text=self.__doc__, bg='whitesmoke', fg='black', font=('Calibri', '15', 'bold')).grid(row=0, column=0, sticky='ew')
destroy_b = Button(self.frame, text='Eliminar base de datos', bg='red', fg='w... |
de8c6b0e8e7101e165eb31f4dad28a8400186fc346427562aed94db6c48a1b57 | def destroy(self) -> None:
'just... destroy the whole database! This is a danger zone, ok? be careful'
if messagebox.askyesno('¿Proceder?', f'''¿Eliminar la base de datos?
(Este proceso no se puede deshacer)'''):
destroy_database(PathName)
else:
messagebox.showinfo('Proceso cancelado', 'No s... | just... destroy the whole database! This is a danger zone, ok? be careful | delete-db.py | destroy | ControlDeAgua/ControlDeAgua | 2 | python | def destroy(self) -> None:
if messagebox.askyesno('¿Proceder?', f'¿Eliminar la base de datos?
(Este proceso no se puede deshacer)'):
destroy_database(PathName)
else:
messagebox.showinfo('Proceso cancelado', 'No se ha eliminado el archivo.') | def destroy(self) -> None:
if messagebox.askyesno('¿Proceder?', f'¿Eliminar la base de datos?
(Este proceso no se puede deshacer)'):
destroy_database(PathName)
else:
messagebox.showinfo('Proceso cancelado', 'No se ha eliminado el archivo.')<|docstring|>just... destroy the whole database! Th... |
da1e2d1b3b2b81d4b2a07e22d32b01bae39b0551c6f20d59f44d65b6dd983fff | def gotoDB(self) -> None:
'go to the database'
try:
os.startfile(PathName)
except:
messagebox.showerror('No se pudo abrir', 'Verifique e intente de nuevo') | go to the database | delete-db.py | gotoDB | ControlDeAgua/ControlDeAgua | 2 | python | def gotoDB(self) -> None:
try:
os.startfile(PathName)
except:
messagebox.showerror('No se pudo abrir', 'Verifique e intente de nuevo') | def gotoDB(self) -> None:
try:
os.startfile(PathName)
except:
messagebox.showerror('No se pudo abrir', 'Verifique e intente de nuevo')<|docstring|>go to the database<|endoftext|> |
f1540e4ccf0b132e8a2177a45d1c7d88b8c1035c4bbb6118135e446d38d3d4af | def __init__(self, root=None):
'\n Construct a BinaryTree, possibly with a single element in it.\n but for the BST (and other tree types) we can.\n '
if root:
self.root = Node(root)
else:
self.root = None | Construct a BinaryTree, possibly with a single element in it.
but for the BST (and other tree types) we can. | containers/BinaryTree.py | __init__ | vbopardi/Week8Containers | 0 | python | def __init__(self, root=None):
'\n Construct a BinaryTree, possibly with a single element in it.\n but for the BST (and other tree types) we can.\n '
if root:
self.root = Node(root)
else:
self.root = None | def __init__(self, root=None):
'\n Construct a BinaryTree, possibly with a single element in it.\n but for the BST (and other tree types) we can.\n '
if root:
self.root = Node(root)
else:
self.root = None<|docstring|>Construct a BinaryTree, possibly with a single element... |
91cfae51df82eec03440e9d88048ad24de16e0694580f1b08b9f5575ee3bb9c5 | def __str__(self):
'\n We can visualize a tree by visualizing its root node.\n '
return str(self.root) | We can visualize a tree by visualizing its root node. | containers/BinaryTree.py | __str__ | vbopardi/Week8Containers | 0 | python | def __str__(self):
'\n \n '
return str(self.root) | def __str__(self):
'\n \n '
return str(self.root)<|docstring|>We can visualize a tree by visualizing its root node.<|endoftext|> |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.