partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
train
Image.download
Download the image. :param path: The image will be downloaded to the folder specified at path, if path is None (default) then the current working directory will be used. :param name: The name the image will be stored as (not including file extension). If name is None...
pyimgur/__init__.py
def download(self, path='', name=None, overwrite=False, size=None): """ Download the image. :param path: The image will be downloaded to the folder specified at path, if path is None (default) then the current working directory will be used. :param name: The name...
def download(self, path='', name=None, overwrite=False, size=None): """ Download the image. :param path: The image will be downloaded to the folder specified at path, if path is None (default) then the current working directory will be used. :param name: The name...
[ "Download", "the", "image", "." ]
Damgaard/PyImgur
python
https://github.com/Damgaard/PyImgur/blob/606f17078d24158632f807430f8d0b9b3cd8b312/pyimgur/__init__.py#L554-L600
[ "def", "download", "(", "self", ",", "path", "=", "''", ",", "name", "=", "None", ",", "overwrite", "=", "False", ",", "size", "=", "None", ")", ":", "def", "save_as", "(", "filename", ")", ":", "local_path", "=", "os", ".", "path", ".", "join", ...
606f17078d24158632f807430f8d0b9b3cd8b312
train
Image.update
Update the image with a new title and/or description.
pyimgur/__init__.py
def update(self, title=None, description=None): """Update the image with a new title and/or description.""" url = (self._imgur._base_url + "/3/image/" "{0}".format(self._delete_or_id_hash)) is_updated = self._imgur._send_request(url, params=locals(), ...
def update(self, title=None, description=None): """Update the image with a new title and/or description.""" url = (self._imgur._base_url + "/3/image/" "{0}".format(self._delete_or_id_hash)) is_updated = self._imgur._send_request(url, params=locals(), ...
[ "Update", "the", "image", "with", "a", "new", "title", "and", "/", "or", "description", "." ]
Damgaard/PyImgur
python
https://github.com/Damgaard/PyImgur/blob/606f17078d24158632f807430f8d0b9b3cd8b312/pyimgur/__init__.py#L631-L640
[ "def", "update", "(", "self", ",", "title", "=", "None", ",", "description", "=", "None", ")", ":", "url", "=", "(", "self", ".", "_imgur", ".", "_base_url", "+", "\"/3/image/\"", "\"{0}\"", ".", "format", "(", "self", ".", "_delete_or_id_hash", ")", "...
606f17078d24158632f807430f8d0b9b3cd8b312
train
Imgur._send_request
Handles top level functionality for sending requests to Imgur. This mean - Raising client-side error if insufficient authentication. - Adding authentication information to the request. - Split the request into multiple request for pagination. - Retry calls for ce...
pyimgur/__init__.py
def _send_request(self, url, needs_auth=False, **kwargs): """ Handles top level functionality for sending requests to Imgur. This mean - Raising client-side error if insufficient authentication. - Adding authentication information to the request. - Split the ...
def _send_request(self, url, needs_auth=False, **kwargs): """ Handles top level functionality for sending requests to Imgur. This mean - Raising client-side error if insufficient authentication. - Adding authentication information to the request. - Split the ...
[ "Handles", "top", "level", "functionality", "for", "sending", "requests", "to", "Imgur", "." ]
Damgaard/PyImgur
python
https://github.com/Damgaard/PyImgur/blob/606f17078d24158632f807430f8d0b9b3cd8b312/pyimgur/__init__.py#L692-L748
[ "def", "_send_request", "(", "self", ",", "url", ",", "needs_auth", "=", "False", ",", "*", "*", "kwargs", ")", ":", "# TODO: Add automatic test for timed_out access_tokens and", "# automatically refresh it before carrying out the request.", "if", "self", ".", "access_token...
606f17078d24158632f807430f8d0b9b3cd8b312
train
Imgur.authorization_url
Return the authorization url that's needed to authorize as a user. :param response: Can be either code or pin. If it's code the user will be redirected to your redirect url with the code as a get parameter after authorizing your application. If it's pin then after authorizin...
pyimgur/__init__.py
def authorization_url(self, response, state=""): """ Return the authorization url that's needed to authorize as a user. :param response: Can be either code or pin. If it's code the user will be redirected to your redirect url with the code as a get parameter after author...
def authorization_url(self, response, state=""): """ Return the authorization url that's needed to authorize as a user. :param response: Can be either code or pin. If it's code the user will be redirected to your redirect url with the code as a get parameter after author...
[ "Return", "the", "authorization", "url", "that", "s", "needed", "to", "authorize", "as", "a", "user", "." ]
Damgaard/PyImgur
python
https://github.com/Damgaard/PyImgur/blob/606f17078d24158632f807430f8d0b9b3cd8b312/pyimgur/__init__.py#L750-L768
[ "def", "authorization_url", "(", "self", ",", "response", ",", "state", "=", "\"\"", ")", ":", "return", "AUTHORIZE_URL", ".", "format", "(", "self", ".", "_base_url", ",", "self", ".", "client_id", ",", "response", ",", "state", ")" ]
606f17078d24158632f807430f8d0b9b3cd8b312
train
Imgur.change_authentication
Change the current authentication.
pyimgur/__init__.py
def change_authentication(self, client_id=None, client_secret=None, access_token=None, refresh_token=None): """Change the current authentication.""" # TODO: Add error checking so you cannot change client_id and retain # access_token. Because that doesn't make sense....
def change_authentication(self, client_id=None, client_secret=None, access_token=None, refresh_token=None): """Change the current authentication.""" # TODO: Add error checking so you cannot change client_id and retain # access_token. Because that doesn't make sense....
[ "Change", "the", "current", "authentication", "." ]
Damgaard/PyImgur
python
https://github.com/Damgaard/PyImgur/blob/606f17078d24158632f807430f8d0b9b3cd8b312/pyimgur/__init__.py#L770-L778
[ "def", "change_authentication", "(", "self", ",", "client_id", "=", "None", ",", "client_secret", "=", "None", ",", "access_token", "=", "None", ",", "refresh_token", "=", "None", ")", ":", "# TODO: Add error checking so you cannot change client_id and retain", "# acces...
606f17078d24158632f807430f8d0b9b3cd8b312
train
Imgur.create_album
Create a new Album. :param title: The title of the album. :param description: The albums description. :param images: A list of the images that will be added to the album after it's created. Can be Image objects, ids or a combination of the two. Images that you cannot a...
pyimgur/__init__.py
def create_album(self, title=None, description=None, images=None, cover=None): """ Create a new Album. :param title: The title of the album. :param description: The albums description. :param images: A list of the images that will be added to the album ...
def create_album(self, title=None, description=None, images=None, cover=None): """ Create a new Album. :param title: The title of the album. :param description: The albums description. :param images: A list of the images that will be added to the album ...
[ "Create", "a", "new", "Album", "." ]
Damgaard/PyImgur
python
https://github.com/Damgaard/PyImgur/blob/606f17078d24158632f807430f8d0b9b3cd8b312/pyimgur/__init__.py#L780-L799
[ "def", "create_album", "(", "self", ",", "title", "=", "None", ",", "description", "=", "None", ",", "images", "=", "None", ",", "cover", "=", "None", ")", ":", "url", "=", "self", ".", "_base_url", "+", "\"/3/album/\"", "payload", "=", "{", "'ids'", ...
606f17078d24158632f807430f8d0b9b3cd8b312
train
Imgur.exchange_code
Exchange one-use code for an access_token and request_token.
pyimgur/__init__.py
def exchange_code(self, code): """Exchange one-use code for an access_token and request_token.""" params = {'client_id': self.client_id, 'client_secret': self.client_secret, 'grant_type': 'authorization_code', 'code': code} result = self._sen...
def exchange_code(self, code): """Exchange one-use code for an access_token and request_token.""" params = {'client_id': self.client_id, 'client_secret': self.client_secret, 'grant_type': 'authorization_code', 'code': code} result = self._sen...
[ "Exchange", "one", "-", "use", "code", "for", "an", "access_token", "and", "request_token", "." ]
Damgaard/PyImgur
python
https://github.com/Damgaard/PyImgur/blob/606f17078d24158632f807430f8d0b9b3cd8b312/pyimgur/__init__.py#L813-L824
[ "def", "exchange_code", "(", "self", ",", "code", ")", ":", "params", "=", "{", "'client_id'", ":", "self", ".", "client_id", ",", "'client_secret'", ":", "self", ".", "client_secret", ",", "'grant_type'", ":", "'authorization_code'", ",", "'code'", ":", "co...
606f17078d24158632f807430f8d0b9b3cd8b312
train
Imgur.exchange_pin
Exchange one-use pin for an access_token and request_token.
pyimgur/__init__.py
def exchange_pin(self, pin): """Exchange one-use pin for an access_token and request_token.""" params = {'client_id': self.client_id, 'client_secret': self.client_secret, 'grant_type': 'pin', 'pin': pin} result = self._send_request(EXCHANGE_U...
def exchange_pin(self, pin): """Exchange one-use pin for an access_token and request_token.""" params = {'client_id': self.client_id, 'client_secret': self.client_secret, 'grant_type': 'pin', 'pin': pin} result = self._send_request(EXCHANGE_U...
[ "Exchange", "one", "-", "use", "pin", "for", "an", "access_token", "and", "request_token", "." ]
Damgaard/PyImgur
python
https://github.com/Damgaard/PyImgur/blob/606f17078d24158632f807430f8d0b9b3cd8b312/pyimgur/__init__.py#L826-L837
[ "def", "exchange_pin", "(", "self", ",", "pin", ")", ":", "params", "=", "{", "'client_id'", ":", "self", ".", "client_id", ",", "'client_secret'", ":", "self", ".", "client_secret", ",", "'grant_type'", ":", "'pin'", ",", "'pin'", ":", "pin", "}", "resu...
606f17078d24158632f807430f8d0b9b3cd8b312
train
Imgur.get_album
Return information about this album.
pyimgur/__init__.py
def get_album(self, id): """Return information about this album.""" url = self._base_url + "/3/album/{0}".format(id) json = self._send_request(url) return Album(json, self)
def get_album(self, id): """Return information about this album.""" url = self._base_url + "/3/album/{0}".format(id) json = self._send_request(url) return Album(json, self)
[ "Return", "information", "about", "this", "album", "." ]
Damgaard/PyImgur
python
https://github.com/Damgaard/PyImgur/blob/606f17078d24158632f807430f8d0b9b3cd8b312/pyimgur/__init__.py#L839-L843
[ "def", "get_album", "(", "self", ",", "id", ")", ":", "url", "=", "self", ".", "_base_url", "+", "\"/3/album/{0}\"", ".", "format", "(", "id", ")", "json", "=", "self", ".", "_send_request", "(", "url", ")", "return", "Album", "(", "json", ",", "self...
606f17078d24158632f807430f8d0b9b3cd8b312
train
Imgur.get_at_url
Return a object representing the content at url. Returns None if no object could be matched with the id. Works for Album, Comment, Gallery_album, Gallery_image, Image and User. NOTE: Imgur's documentation does not cover what urls are available. Some urls, such as imgur.com/<ID> can be...
pyimgur/__init__.py
def get_at_url(self, url): """ Return a object representing the content at url. Returns None if no object could be matched with the id. Works for Album, Comment, Gallery_album, Gallery_image, Image and User. NOTE: Imgur's documentation does not cover what urls are available. ...
def get_at_url(self, url): """ Return a object representing the content at url. Returns None if no object could be matched with the id. Works for Album, Comment, Gallery_album, Gallery_image, Image and User. NOTE: Imgur's documentation does not cover what urls are available. ...
[ "Return", "a", "object", "representing", "the", "content", "at", "url", "." ]
Damgaard/PyImgur
python
https://github.com/Damgaard/PyImgur/blob/606f17078d24158632f807430f8d0b9b3cd8b312/pyimgur/__init__.py#L845-L939
[ "def", "get_at_url", "(", "self", ",", "url", ")", ":", "class", "NullDevice", "(", ")", ":", "def", "write", "(", "self", ",", "string", ")", ":", "pass", "def", "get_gallery_item", "(", "id", ")", ":", "\"\"\"\n Special helper method to get galler...
606f17078d24158632f807430f8d0b9b3cd8b312
train
Imgur.get_comment
Return information about this comment.
pyimgur/__init__.py
def get_comment(self, id): """Return information about this comment.""" url = self._base_url + "/3/comment/{0}".format(id) json = self._send_request(url) return Comment(json, self)
def get_comment(self, id): """Return information about this comment.""" url = self._base_url + "/3/comment/{0}".format(id) json = self._send_request(url) return Comment(json, self)
[ "Return", "information", "about", "this", "comment", "." ]
Damgaard/PyImgur
python
https://github.com/Damgaard/PyImgur/blob/606f17078d24158632f807430f8d0b9b3cd8b312/pyimgur/__init__.py#L941-L945
[ "def", "get_comment", "(", "self", ",", "id", ")", ":", "url", "=", "self", ".", "_base_url", "+", "\"/3/comment/{0}\"", ".", "format", "(", "id", ")", "json", "=", "self", ".", "_send_request", "(", "url", ")", "return", "Comment", "(", "json", ",", ...
606f17078d24158632f807430f8d0b9b3cd8b312
train
Imgur.get_gallery
Return a list of gallery albums and gallery images. :param section: hot | top | user - defaults to hot. :param sort: viral | time - defaults to viral. :param window: Change the date range of the request if the section is "top", day | week | month | year | all, defaults to day. ...
pyimgur/__init__.py
def get_gallery(self, section='hot', sort='viral', window='day', show_viral=True, limit=None): """ Return a list of gallery albums and gallery images. :param section: hot | top | user - defaults to hot. :param sort: viral | time - defaults to viral. :param wi...
def get_gallery(self, section='hot', sort='viral', window='day', show_viral=True, limit=None): """ Return a list of gallery albums and gallery images. :param section: hot | top | user - defaults to hot. :param sort: viral | time - defaults to viral. :param wi...
[ "Return", "a", "list", "of", "gallery", "albums", "and", "gallery", "images", "." ]
Damgaard/PyImgur
python
https://github.com/Damgaard/PyImgur/blob/606f17078d24158632f807430f8d0b9b3cd8b312/pyimgur/__init__.py#L947-L963
[ "def", "get_gallery", "(", "self", ",", "section", "=", "'hot'", ",", "sort", "=", "'viral'", ",", "window", "=", "'day'", ",", "show_viral", "=", "True", ",", "limit", "=", "None", ")", ":", "url", "=", "(", "self", ".", "_base_url", "+", "\"/3/gall...
606f17078d24158632f807430f8d0b9b3cd8b312
train
Imgur.get_gallery_album
Return the gallery album matching the id. Note that an album's id is different from it's id as a gallery album. This makes it possible to remove an album from the gallery and setting it's privacy setting as secret, without compromising it's secrecy.
pyimgur/__init__.py
def get_gallery_album(self, id): """ Return the gallery album matching the id. Note that an album's id is different from it's id as a gallery album. This makes it possible to remove an album from the gallery and setting it's privacy setting as secret, without compromising it's s...
def get_gallery_album(self, id): """ Return the gallery album matching the id. Note that an album's id is different from it's id as a gallery album. This makes it possible to remove an album from the gallery and setting it's privacy setting as secret, without compromising it's s...
[ "Return", "the", "gallery", "album", "matching", "the", "id", "." ]
Damgaard/PyImgur
python
https://github.com/Damgaard/PyImgur/blob/606f17078d24158632f807430f8d0b9b3cd8b312/pyimgur/__init__.py#L965-L975
[ "def", "get_gallery_album", "(", "self", ",", "id", ")", ":", "url", "=", "self", ".", "_base_url", "+", "\"/3/gallery/album/{0}\"", ".", "format", "(", "id", ")", "resp", "=", "self", ".", "_send_request", "(", "url", ")", "return", "Gallery_album", "(", ...
606f17078d24158632f807430f8d0b9b3cd8b312
train
Imgur.get_gallery_image
Return the gallery image matching the id. Note that an image's id is different from it's id as a gallery image. This makes it possible to remove an image from the gallery and setting it's privacy setting as secret, without compromising it's secrecy.
pyimgur/__init__.py
def get_gallery_image(self, id): """ Return the gallery image matching the id. Note that an image's id is different from it's id as a gallery image. This makes it possible to remove an image from the gallery and setting it's privacy setting as secret, without compromising it's s...
def get_gallery_image(self, id): """ Return the gallery image matching the id. Note that an image's id is different from it's id as a gallery image. This makes it possible to remove an image from the gallery and setting it's privacy setting as secret, without compromising it's s...
[ "Return", "the", "gallery", "image", "matching", "the", "id", "." ]
Damgaard/PyImgur
python
https://github.com/Damgaard/PyImgur/blob/606f17078d24158632f807430f8d0b9b3cd8b312/pyimgur/__init__.py#L977-L987
[ "def", "get_gallery_image", "(", "self", ",", "id", ")", ":", "url", "=", "self", ".", "_base_url", "+", "\"/3/gallery/image/{0}\"", ".", "format", "(", "id", ")", "resp", "=", "self", ".", "_send_request", "(", "url", ")", "return", "Gallery_image", "(", ...
606f17078d24158632f807430f8d0b9b3cd8b312
train
Imgur.get_image
Return a Image object representing the image with the given id.
pyimgur/__init__.py
def get_image(self, id): """Return a Image object representing the image with the given id.""" url = self._base_url + "/3/image/{0}".format(id) resp = self._send_request(url) return Image(resp, self)
def get_image(self, id): """Return a Image object representing the image with the given id.""" url = self._base_url + "/3/image/{0}".format(id) resp = self._send_request(url) return Image(resp, self)
[ "Return", "a", "Image", "object", "representing", "the", "image", "with", "the", "given", "id", "." ]
Damgaard/PyImgur
python
https://github.com/Damgaard/PyImgur/blob/606f17078d24158632f807430f8d0b9b3cd8b312/pyimgur/__init__.py#L989-L993
[ "def", "get_image", "(", "self", ",", "id", ")", ":", "url", "=", "self", ".", "_base_url", "+", "\"/3/image/{0}\"", ".", "format", "(", "id", ")", "resp", "=", "self", ".", "_send_request", "(", "url", ")", "return", "Image", "(", "resp", ",", "self...
606f17078d24158632f807430f8d0b9b3cd8b312
train
Imgur.get_message
Return a Message object for given id. :param id: The id of the message object to return.
pyimgur/__init__.py
def get_message(self, id): """ Return a Message object for given id. :param id: The id of the message object to return. """ url = self._base_url + "/3/message/{0}".format(id) resp = self._send_request(url) return Message(resp, self)
def get_message(self, id): """ Return a Message object for given id. :param id: The id of the message object to return. """ url = self._base_url + "/3/message/{0}".format(id) resp = self._send_request(url) return Message(resp, self)
[ "Return", "a", "Message", "object", "for", "given", "id", "." ]
Damgaard/PyImgur
python
https://github.com/Damgaard/PyImgur/blob/606f17078d24158632f807430f8d0b9b3cd8b312/pyimgur/__init__.py#L995-L1003
[ "def", "get_message", "(", "self", ",", "id", ")", ":", "url", "=", "self", ".", "_base_url", "+", "\"/3/message/{0}\"", ".", "format", "(", "id", ")", "resp", "=", "self", ".", "_send_request", "(", "url", ")", "return", "Message", "(", "resp", ",", ...
606f17078d24158632f807430f8d0b9b3cd8b312
train
Imgur.get_notification
Return a Notification object. :param id: The id of the notification object to return.
pyimgur/__init__.py
def get_notification(self, id): """ Return a Notification object. :param id: The id of the notification object to return. """ url = self._base_url + "/3/notification/{0}".format(id) resp = self._send_request(url) return Notification(resp, self)
def get_notification(self, id): """ Return a Notification object. :param id: The id of the notification object to return. """ url = self._base_url + "/3/notification/{0}".format(id) resp = self._send_request(url) return Notification(resp, self)
[ "Return", "a", "Notification", "object", "." ]
Damgaard/PyImgur
python
https://github.com/Damgaard/PyImgur/blob/606f17078d24158632f807430f8d0b9b3cd8b312/pyimgur/__init__.py#L1005-L1013
[ "def", "get_notification", "(", "self", ",", "id", ")", ":", "url", "=", "self", ".", "_base_url", "+", "\"/3/notification/{0}\"", ".", "format", "(", "id", ")", "resp", "=", "self", ".", "_send_request", "(", "url", ")", "return", "Notification", "(", "...
606f17078d24158632f807430f8d0b9b3cd8b312
train
Imgur.get_memes_gallery
Return a list of gallery albums/images submitted to the memes gallery The url for the memes gallery is: http://imgur.com/g/memes :param sort: viral | time | top - defaults to viral :param window: Change the date range of the request if the section is "top", day | week | month | yea...
pyimgur/__init__.py
def get_memes_gallery(self, sort='viral', window='week', limit=None): """ Return a list of gallery albums/images submitted to the memes gallery The url for the memes gallery is: http://imgur.com/g/memes :param sort: viral | time | top - defaults to viral :param window: Change t...
def get_memes_gallery(self, sort='viral', window='week', limit=None): """ Return a list of gallery albums/images submitted to the memes gallery The url for the memes gallery is: http://imgur.com/g/memes :param sort: viral | time | top - defaults to viral :param window: Change t...
[ "Return", "a", "list", "of", "gallery", "albums", "/", "images", "submitted", "to", "the", "memes", "gallery" ]
Damgaard/PyImgur
python
https://github.com/Damgaard/PyImgur/blob/606f17078d24158632f807430f8d0b9b3cd8b312/pyimgur/__init__.py#L1015-L1029
[ "def", "get_memes_gallery", "(", "self", ",", "sort", "=", "'viral'", ",", "window", "=", "'week'", ",", "limit", "=", "None", ")", ":", "url", "=", "(", "self", ".", "_base_url", "+", "\"/3/gallery/g/memes/{0}/{1}/{2}\"", ".", "format", "(", "sort", ",", ...
606f17078d24158632f807430f8d0b9b3cd8b312
train
Imgur.get_subreddit_gallery
Return a list of gallery albums/images submitted to a subreddit. A subreddit is a subsection of the website www.reddit.com, where users can, among other things, post images. :param subreddit: A valid subreddit name. :param sort: time | top - defaults to top. :param window: Chan...
pyimgur/__init__.py
def get_subreddit_gallery(self, subreddit, sort='time', window='top', limit=None): """ Return a list of gallery albums/images submitted to a subreddit. A subreddit is a subsection of the website www.reddit.com, where users can, among other things, post imag...
def get_subreddit_gallery(self, subreddit, sort='time', window='top', limit=None): """ Return a list of gallery albums/images submitted to a subreddit. A subreddit is a subsection of the website www.reddit.com, where users can, among other things, post imag...
[ "Return", "a", "list", "of", "gallery", "albums", "/", "images", "submitted", "to", "a", "subreddit", "." ]
Damgaard/PyImgur
python
https://github.com/Damgaard/PyImgur/blob/606f17078d24158632f807430f8d0b9b3cd8b312/pyimgur/__init__.py#L1048-L1065
[ "def", "get_subreddit_gallery", "(", "self", ",", "subreddit", ",", "sort", "=", "'time'", ",", "window", "=", "'top'", ",", "limit", "=", "None", ")", ":", "url", "=", "(", "self", ".", "_base_url", "+", "\"/3/gallery/r/{0}/{1}/{2}/{3}\"", ".", "format", ...
606f17078d24158632f807430f8d0b9b3cd8b312
train
Imgur.get_subreddit_image
Return the Gallery_image with the id submitted to subreddit gallery :param subreddit: The subreddit the image has been submitted to. :param id: The id of the image we want.
pyimgur/__init__.py
def get_subreddit_image(self, subreddit, id): """ Return the Gallery_image with the id submitted to subreddit gallery :param subreddit: The subreddit the image has been submitted to. :param id: The id of the image we want. """ url = self._base_url + "/3/gallery/r/{0}/{1}...
def get_subreddit_image(self, subreddit, id): """ Return the Gallery_image with the id submitted to subreddit gallery :param subreddit: The subreddit the image has been submitted to. :param id: The id of the image we want. """ url = self._base_url + "/3/gallery/r/{0}/{1}...
[ "Return", "the", "Gallery_image", "with", "the", "id", "submitted", "to", "subreddit", "gallery" ]
Damgaard/PyImgur
python
https://github.com/Damgaard/PyImgur/blob/606f17078d24158632f807430f8d0b9b3cd8b312/pyimgur/__init__.py#L1067-L1076
[ "def", "get_subreddit_image", "(", "self", ",", "subreddit", ",", "id", ")", ":", "url", "=", "self", ".", "_base_url", "+", "\"/3/gallery/r/{0}/{1}\"", ".", "format", "(", "subreddit", ",", "id", ")", "resp", "=", "self", ".", "_send_request", "(", "url",...
606f17078d24158632f807430f8d0b9b3cd8b312
train
Imgur.get_user
Return a User object for this username. :param username: The name of the user we want more information about.
pyimgur/__init__.py
def get_user(self, username): """ Return a User object for this username. :param username: The name of the user we want more information about. """ url = self._base_url + "/3/account/{0}".format(username) json = self._send_request(url) return User(json, self)
def get_user(self, username): """ Return a User object for this username. :param username: The name of the user we want more information about. """ url = self._base_url + "/3/account/{0}".format(username) json = self._send_request(url) return User(json, self)
[ "Return", "a", "User", "object", "for", "this", "username", "." ]
Damgaard/PyImgur
python
https://github.com/Damgaard/PyImgur/blob/606f17078d24158632f807430f8d0b9b3cd8b312/pyimgur/__init__.py#L1078-L1086
[ "def", "get_user", "(", "self", ",", "username", ")", ":", "url", "=", "self", ".", "_base_url", "+", "\"/3/account/{0}\"", ".", "format", "(", "username", ")", "json", "=", "self", ".", "_send_request", "(", "url", ")", "return", "User", "(", "json", ...
606f17078d24158632f807430f8d0b9b3cd8b312
train
Imgur.refresh_access_token
Refresh the access_token. The self.access_token attribute will be updated with the value of the new access_token which will also be returned.
pyimgur/__init__.py
def refresh_access_token(self): """ Refresh the access_token. The self.access_token attribute will be updated with the value of the new access_token which will also be returned. """ if self.client_secret is None: raise Exception("client_secret must be set to ...
def refresh_access_token(self): """ Refresh the access_token. The self.access_token attribute will be updated with the value of the new access_token which will also be returned. """ if self.client_secret is None: raise Exception("client_secret must be set to ...
[ "Refresh", "the", "access_token", "." ]
Damgaard/PyImgur
python
https://github.com/Damgaard/PyImgur/blob/606f17078d24158632f807430f8d0b9b3cd8b312/pyimgur/__init__.py#L1092-L1113
[ "def", "refresh_access_token", "(", "self", ")", ":", "if", "self", ".", "client_secret", "is", "None", ":", "raise", "Exception", "(", "\"client_secret must be set to execute \"", "\"refresh_access_token.\"", ")", "if", "self", ".", "refresh_token", "is", "None", "...
606f17078d24158632f807430f8d0b9b3cd8b312
train
Imgur.search_gallery
Search the gallery with the given query string.
pyimgur/__init__.py
def search_gallery(self, q): """Search the gallery with the given query string.""" url = self._base_url + "/3/gallery/search?q={0}".format(q) resp = self._send_request(url) return [_get_album_or_image(thing, self) for thing in resp]
def search_gallery(self, q): """Search the gallery with the given query string.""" url = self._base_url + "/3/gallery/search?q={0}".format(q) resp = self._send_request(url) return [_get_album_or_image(thing, self) for thing in resp]
[ "Search", "the", "gallery", "with", "the", "given", "query", "string", "." ]
Damgaard/PyImgur
python
https://github.com/Damgaard/PyImgur/blob/606f17078d24158632f807430f8d0b9b3cd8b312/pyimgur/__init__.py#L1115-L1119
[ "def", "search_gallery", "(", "self", ",", "q", ")", ":", "url", "=", "self", ".", "_base_url", "+", "\"/3/gallery/search?q={0}\"", ".", "format", "(", "q", ")", "resp", "=", "self", ".", "_send_request", "(", "url", ")", "return", "[", "_get_album_or_imag...
606f17078d24158632f807430f8d0b9b3cd8b312
train
Imgur.upload_image
Upload the image at either path or url. :param path: The path to the image you want to upload. :param url: The url to the image you want to upload. :param title: The title the image will have when uploaded. :param description: The description the image will have when uploaded. :...
pyimgur/__init__.py
def upload_image(self, path=None, url=None, title=None, description=None, album=None): """ Upload the image at either path or url. :param path: The path to the image you want to upload. :param url: The url to the image you want to upload. :param title: The t...
def upload_image(self, path=None, url=None, title=None, description=None, album=None): """ Upload the image at either path or url. :param path: The path to the image you want to upload. :param url: The url to the image you want to upload. :param title: The t...
[ "Upload", "the", "image", "at", "either", "path", "or", "url", "." ]
Damgaard/PyImgur
python
https://github.com/Damgaard/PyImgur/blob/606f17078d24158632f807430f8d0b9b3cd8b312/pyimgur/__init__.py#L1121-L1162
[ "def", "upload_image", "(", "self", ",", "path", "=", "None", ",", "url", "=", "None", ",", "title", "=", "None", ",", "description", "=", "None", ",", "album", "=", "None", ")", ":", "if", "bool", "(", "path", ")", "==", "bool", "(", "url", ")",...
606f17078d24158632f807430f8d0b9b3cd8b312
train
Message.delete
Delete the message.
pyimgur/__init__.py
def delete(self): """Delete the message.""" url = self._imgur._base_url + "/3/message/{0}".format(self.id) return self._imgur._send_request(url, method='DELETE')
def delete(self): """Delete the message.""" url = self._imgur._base_url + "/3/message/{0}".format(self.id) return self._imgur._send_request(url, method='DELETE')
[ "Delete", "the", "message", "." ]
Damgaard/PyImgur
python
https://github.com/Damgaard/PyImgur/blob/606f17078d24158632f807430f8d0b9b3cd8b312/pyimgur/__init__.py#L1182-L1185
[ "def", "delete", "(", "self", ")", ":", "url", "=", "self", ".", "_imgur", ".", "_base_url", "+", "\"/3/message/{0}\"", ".", "format", "(", "self", ".", "id", ")", "return", "self", ".", "_imgur", ".", "_send_request", "(", "url", ",", "method", "=", ...
606f17078d24158632f807430f8d0b9b3cd8b312
train
Message.get_thread
Return the message thread this Message is in.
pyimgur/__init__.py
def get_thread(self): """Return the message thread this Message is in.""" url = (self._imgur._base_url + "/3/message/{0}/thread".format( self.first_message.id)) resp = self._imgur._send_request(url) return [Message(msg, self._imgur) for msg in resp]
def get_thread(self): """Return the message thread this Message is in.""" url = (self._imgur._base_url + "/3/message/{0}/thread".format( self.first_message.id)) resp = self._imgur._send_request(url) return [Message(msg, self._imgur) for msg in resp]
[ "Return", "the", "message", "thread", "this", "Message", "is", "in", "." ]
Damgaard/PyImgur
python
https://github.com/Damgaard/PyImgur/blob/606f17078d24158632f807430f8d0b9b3cd8b312/pyimgur/__init__.py#L1187-L1192
[ "def", "get_thread", "(", "self", ")", ":", "url", "=", "(", "self", ".", "_imgur", ".", "_base_url", "+", "\"/3/message/{0}/thread\"", ".", "format", "(", "self", ".", "first_message", ".", "id", ")", ")", "resp", "=", "self", ".", "_imgur", ".", "_se...
606f17078d24158632f807430f8d0b9b3cd8b312
train
Message.reply
Reply to this message. This is a convenience method calling User.send_message. See it for more information on usage. Note that both recipient and reply_to are given by using this convenience method. :param body: The body of the message.
pyimgur/__init__.py
def reply(self, body): """ Reply to this message. This is a convenience method calling User.send_message. See it for more information on usage. Note that both recipient and reply_to are given by using this convenience method. :param body: The body of the message. ...
def reply(self, body): """ Reply to this message. This is a convenience method calling User.send_message. See it for more information on usage. Note that both recipient and reply_to are given by using this convenience method. :param body: The body of the message. ...
[ "Reply", "to", "this", "message", "." ]
Damgaard/PyImgur
python
https://github.com/Damgaard/PyImgur/blob/606f17078d24158632f807430f8d0b9b3cd8b312/pyimgur/__init__.py#L1194-L1204
[ "def", "reply", "(", "self", ",", "body", ")", ":", "return", "self", ".", "author", ".", "send_message", "(", "body", "=", "body", ",", "reply_to", "=", "self", ".", "id", ")" ]
606f17078d24158632f807430f8d0b9b3cd8b312
train
User.change_settings
Update the settings for the user. :param bio: A basic description filled out by the user, is displayed in the gallery profile page. :param public_images: Set the default privacy setting of the users images. If True images are public, if False private. :param messaging_en...
pyimgur/__init__.py
def change_settings(self, bio=None, public_images=None, messaging_enabled=None, album_privacy=None, accepted_gallery_terms=None): """ Update the settings for the user. :param bio: A basic description filled out by the user, is displayed in ...
def change_settings(self, bio=None, public_images=None, messaging_enabled=None, album_privacy=None, accepted_gallery_terms=None): """ Update the settings for the user. :param bio: A basic description filled out by the user, is displayed in ...
[ "Update", "the", "settings", "for", "the", "user", "." ]
Damgaard/PyImgur
python
https://github.com/Damgaard/PyImgur/blob/606f17078d24158632f807430f8d0b9b3cd8b312/pyimgur/__init__.py#L1265-L1287
[ "def", "change_settings", "(", "self", ",", "bio", "=", "None", ",", "public_images", "=", "None", ",", "messaging_enabled", "=", "None", ",", "album_privacy", "=", "None", ",", "accepted_gallery_terms", "=", "None", ")", ":", "# NOTE: album_privacy should maybe b...
606f17078d24158632f807430f8d0b9b3cd8b312
train
User.get_albums
Return a list of the user's albums. Secret and hidden albums are only returned if this is the logged-in user.
pyimgur/__init__.py
def get_albums(self, limit=None): """ Return a list of the user's albums. Secret and hidden albums are only returned if this is the logged-in user. """ url = (self._imgur._base_url + "/3/account/{0}/albums/{1}".format(self.name, ...
def get_albums(self, limit=None): """ Return a list of the user's albums. Secret and hidden albums are only returned if this is the logged-in user. """ url = (self._imgur._base_url + "/3/account/{0}/albums/{1}".format(self.name, ...
[ "Return", "a", "list", "of", "the", "user", "s", "albums", "." ]
Damgaard/PyImgur
python
https://github.com/Damgaard/PyImgur/blob/606f17078d24158632f807430f8d0b9b3cd8b312/pyimgur/__init__.py#L1294-L1304
[ "def", "get_albums", "(", "self", ",", "limit", "=", "None", ")", ":", "url", "=", "(", "self", ".", "_imgur", ".", "_base_url", "+", "\"/3/account/{0}/albums/{1}\"", ".", "format", "(", "self", ".", "name", ",", "'{}'", ")", ")", "resp", "=", "self", ...
606f17078d24158632f807430f8d0b9b3cd8b312
train
User.get_favorites
Return the users favorited images.
pyimgur/__init__.py
def get_favorites(self): """Return the users favorited images.""" url = self._imgur._base_url + "/3/account/{0}/favorites".format(self.name) resp = self._imgur._send_request(url, needs_auth=True) return [_get_album_or_image(thing, self._imgur) for thing in resp]
def get_favorites(self): """Return the users favorited images.""" url = self._imgur._base_url + "/3/account/{0}/favorites".format(self.name) resp = self._imgur._send_request(url, needs_auth=True) return [_get_album_or_image(thing, self._imgur) for thing in resp]
[ "Return", "the", "users", "favorited", "images", "." ]
Damgaard/PyImgur
python
https://github.com/Damgaard/PyImgur/blob/606f17078d24158632f807430f8d0b9b3cd8b312/pyimgur/__init__.py#L1312-L1316
[ "def", "get_favorites", "(", "self", ")", ":", "url", "=", "self", ".", "_imgur", ".", "_base_url", "+", "\"/3/account/{0}/favorites\"", ".", "format", "(", "self", ".", "name", ")", "resp", "=", "self", ".", "_imgur", ".", "_send_request", "(", "url", "...
606f17078d24158632f807430f8d0b9b3cd8b312
train
User.get_gallery_favorites
Get a list of the images in the gallery this user has favorited.
pyimgur/__init__.py
def get_gallery_favorites(self): """Get a list of the images in the gallery this user has favorited.""" url = (self._imgur._base_url + "/3/account/{0}/gallery_favorites".format( self.name)) resp = self._imgur._send_request(url) return [Image(img, self._imgur) for img in re...
def get_gallery_favorites(self): """Get a list of the images in the gallery this user has favorited.""" url = (self._imgur._base_url + "/3/account/{0}/gallery_favorites".format( self.name)) resp = self._imgur._send_request(url) return [Image(img, self._imgur) for img in re...
[ "Get", "a", "list", "of", "the", "images", "in", "the", "gallery", "this", "user", "has", "favorited", "." ]
Damgaard/PyImgur
python
https://github.com/Damgaard/PyImgur/blob/606f17078d24158632f807430f8d0b9b3cd8b312/pyimgur/__init__.py#L1318-L1323
[ "def", "get_gallery_favorites", "(", "self", ")", ":", "url", "=", "(", "self", ".", "_imgur", ".", "_base_url", "+", "\"/3/account/{0}/gallery_favorites\"", ".", "format", "(", "self", ".", "name", ")", ")", "resp", "=", "self", ".", "_imgur", ".", "_send...
606f17078d24158632f807430f8d0b9b3cd8b312
train
User.get_gallery_profile
Return the users gallery profile.
pyimgur/__init__.py
def get_gallery_profile(self): """Return the users gallery profile.""" url = (self._imgur._base_url + "/3/account/{0}/" "gallery_profile".format(self.name)) return self._imgur._send_request(url)
def get_gallery_profile(self): """Return the users gallery profile.""" url = (self._imgur._base_url + "/3/account/{0}/" "gallery_profile".format(self.name)) return self._imgur._send_request(url)
[ "Return", "the", "users", "gallery", "profile", "." ]
Damgaard/PyImgur
python
https://github.com/Damgaard/PyImgur/blob/606f17078d24158632f807430f8d0b9b3cd8b312/pyimgur/__init__.py#L1325-L1329
[ "def", "get_gallery_profile", "(", "self", ")", ":", "url", "=", "(", "self", ".", "_imgur", ".", "_base_url", "+", "\"/3/account/{0}/\"", "\"gallery_profile\"", ".", "format", "(", "self", ".", "name", ")", ")", "return", "self", ".", "_imgur", ".", "_sen...
606f17078d24158632f807430f8d0b9b3cd8b312
train
User.has_verified_email
Has the user verified that the email he has given is legit? Verified e-mail is required to the gallery. Confirmation happens by sending an email to the user and the owner of the email user verifying that he is the same as the Imgur user.
pyimgur/__init__.py
def has_verified_email(self): """ Has the user verified that the email he has given is legit? Verified e-mail is required to the gallery. Confirmation happens by sending an email to the user and the owner of the email user verifying that he is the same as the Imgur user. ...
def has_verified_email(self): """ Has the user verified that the email he has given is legit? Verified e-mail is required to the gallery. Confirmation happens by sending an email to the user and the owner of the email user verifying that he is the same as the Imgur user. ...
[ "Has", "the", "user", "verified", "that", "the", "email", "he", "has", "given", "is", "legit?" ]
Damgaard/PyImgur
python
https://github.com/Damgaard/PyImgur/blob/606f17078d24158632f807430f8d0b9b3cd8b312/pyimgur/__init__.py#L1331-L1341
[ "def", "has_verified_email", "(", "self", ")", ":", "url", "=", "(", "self", ".", "_imgur", ".", "_base_url", "+", "\"/3/account/{0}/\"", "\"verifyemail\"", ".", "format", "(", "self", ".", "name", ")", ")", "return", "self", ".", "_imgur", ".", "_send_req...
606f17078d24158632f807430f8d0b9b3cd8b312
train
User.get_images
Return all of the images associated with the user.
pyimgur/__init__.py
def get_images(self, limit=None): """Return all of the images associated with the user.""" url = (self._imgur._base_url + "/3/account/{0}/" "images/{1}".format(self.name, '{}')) resp = self._imgur._send_request(url, limit=limit) return [Image(img, self._imgur) for img in r...
def get_images(self, limit=None): """Return all of the images associated with the user.""" url = (self._imgur._base_url + "/3/account/{0}/" "images/{1}".format(self.name, '{}')) resp = self._imgur._send_request(url, limit=limit) return [Image(img, self._imgur) for img in r...
[ "Return", "all", "of", "the", "images", "associated", "with", "the", "user", "." ]
Damgaard/PyImgur
python
https://github.com/Damgaard/PyImgur/blob/606f17078d24158632f807430f8d0b9b3cd8b312/pyimgur/__init__.py#L1343-L1348
[ "def", "get_images", "(", "self", ",", "limit", "=", "None", ")", ":", "url", "=", "(", "self", ".", "_imgur", ".", "_base_url", "+", "\"/3/account/{0}/\"", "\"images/{1}\"", ".", "format", "(", "self", ".", "name", ",", "'{}'", ")", ")", "resp", "=", ...
606f17078d24158632f807430f8d0b9b3cd8b312
train
User.get_messages
Return all messages sent to this user, formatted as a notification. :param new: False for all notifications, True for only non-viewed notifications.
pyimgur/__init__.py
def get_messages(self, new=True): """ Return all messages sent to this user, formatted as a notification. :param new: False for all notifications, True for only non-viewed notifications. """ url = (self._imgur._base_url + "/3/account/{0}/notifications/" ...
def get_messages(self, new=True): """ Return all messages sent to this user, formatted as a notification. :param new: False for all notifications, True for only non-viewed notifications. """ url = (self._imgur._base_url + "/3/account/{0}/notifications/" ...
[ "Return", "all", "messages", "sent", "to", "this", "user", "formatted", "as", "a", "notification", "." ]
Damgaard/PyImgur
python
https://github.com/Damgaard/PyImgur/blob/606f17078d24158632f807430f8d0b9b3cd8b312/pyimgur/__init__.py#L1350-L1362
[ "def", "get_messages", "(", "self", ",", "new", "=", "True", ")", ":", "url", "=", "(", "self", ".", "_imgur", ".", "_base_url", "+", "\"/3/account/{0}/notifications/\"", "\"messages\"", ".", "format", "(", "self", ".", "name", ")", ")", "result", "=", "...
606f17078d24158632f807430f8d0b9b3cd8b312
train
User.get_notifications
Return all the notifications for this user.
pyimgur/__init__.py
def get_notifications(self, new=True): """Return all the notifications for this user.""" url = (self._imgur._base_url + "/3/account/{0}/" "notifications".format(self.name)) resp = self._imgur._send_request(url, params=locals(), needs_auth=True) msgs = [Message(msg_dict, se...
def get_notifications(self, new=True): """Return all the notifications for this user.""" url = (self._imgur._base_url + "/3/account/{0}/" "notifications".format(self.name)) resp = self._imgur._send_request(url, params=locals(), needs_auth=True) msgs = [Message(msg_dict, se...
[ "Return", "all", "the", "notifications", "for", "this", "user", "." ]
Damgaard/PyImgur
python
https://github.com/Damgaard/PyImgur/blob/606f17078d24158632f807430f8d0b9b3cd8b312/pyimgur/__init__.py#L1364-L1373
[ "def", "get_notifications", "(", "self", ",", "new", "=", "True", ")", ":", "url", "=", "(", "self", ".", "_imgur", ".", "_base_url", "+", "\"/3/account/{0}/\"", "\"notifications\"", ".", "format", "(", "self", ".", "name", ")", ")", "resp", "=", "self",...
606f17078d24158632f807430f8d0b9b3cd8b312
train
User.get_replies
Return all reply notifications for this user. :param new: False for all notifications, True for only non-viewed notifications.
pyimgur/__init__.py
def get_replies(self, new=True): """ Return all reply notifications for this user. :param new: False for all notifications, True for only non-viewed notifications. """ url = (self._imgur._base_url + "/3/account/{0}/" "notifications/replies".format(self...
def get_replies(self, new=True): """ Return all reply notifications for this user. :param new: False for all notifications, True for only non-viewed notifications. """ url = (self._imgur._base_url + "/3/account/{0}/" "notifications/replies".format(self...
[ "Return", "all", "reply", "notifications", "for", "this", "user", "." ]
Damgaard/PyImgur
python
https://github.com/Damgaard/PyImgur/blob/606f17078d24158632f807430f8d0b9b3cd8b312/pyimgur/__init__.py#L1375-L1384
[ "def", "get_replies", "(", "self", ",", "new", "=", "True", ")", ":", "url", "=", "(", "self", ".", "_imgur", ".", "_base_url", "+", "\"/3/account/{0}/\"", "\"notifications/replies\"", ".", "format", "(", "self", ".", "name", ")", ")", "return", "self", ...
606f17078d24158632f807430f8d0b9b3cd8b312
train
User.get_settings
Returns current settings. Only accessible if authenticated as the user.
pyimgur/__init__.py
def get_settings(self): """ Returns current settings. Only accessible if authenticated as the user. """ url = self._imgur._base_url + "/3/account/{0}/settings".format(self.name) return self._imgur._send_request(url)
def get_settings(self): """ Returns current settings. Only accessible if authenticated as the user. """ url = self._imgur._base_url + "/3/account/{0}/settings".format(self.name) return self._imgur._send_request(url)
[ "Returns", "current", "settings", "." ]
Damgaard/PyImgur
python
https://github.com/Damgaard/PyImgur/blob/606f17078d24158632f807430f8d0b9b3cd8b312/pyimgur/__init__.py#L1386-L1393
[ "def", "get_settings", "(", "self", ")", ":", "url", "=", "self", ".", "_imgur", ".", "_base_url", "+", "\"/3/account/{0}/settings\"", ".", "format", "(", "self", ".", "name", ")", "return", "self", ".", "_imgur", ".", "_send_request", "(", "url", ")" ]
606f17078d24158632f807430f8d0b9b3cd8b312
train
User.get_submissions
Return a list of the images a user has submitted to the gallery.
pyimgur/__init__.py
def get_submissions(self, limit=None): """Return a list of the images a user has submitted to the gallery.""" url = (self._imgur._base_url + "/3/account/{0}/submissions/" "{1}".format(self.name, '{}')) resp = self._imgur._send_request(url, limit=limit) return [_get_album_o...
def get_submissions(self, limit=None): """Return a list of the images a user has submitted to the gallery.""" url = (self._imgur._base_url + "/3/account/{0}/submissions/" "{1}".format(self.name, '{}')) resp = self._imgur._send_request(url, limit=limit) return [_get_album_o...
[ "Return", "a", "list", "of", "the", "images", "a", "user", "has", "submitted", "to", "the", "gallery", "." ]
Damgaard/PyImgur
python
https://github.com/Damgaard/PyImgur/blob/606f17078d24158632f807430f8d0b9b3cd8b312/pyimgur/__init__.py#L1400-L1405
[ "def", "get_submissions", "(", "self", ",", "limit", "=", "None", ")", ":", "url", "=", "(", "self", ".", "_imgur", ".", "_base_url", "+", "\"/3/account/{0}/submissions/\"", "\"{1}\"", ".", "format", "(", "self", ".", "name", ",", "'{}'", ")", ")", "resp...
606f17078d24158632f807430f8d0b9b3cd8b312
train
User.send_message
Send a message to this user from the logged in user. :param body: The body of the message. :param subject: The subject of the message. Note that if the this message is a reply, then the subject of the first message will be used instead. :param reply_to: Messages can eith...
pyimgur/__init__.py
def send_message(self, body, subject=None, reply_to=None): """ Send a message to this user from the logged in user. :param body: The body of the message. :param subject: The subject of the message. Note that if the this message is a reply, then the subject of the first messa...
def send_message(self, body, subject=None, reply_to=None): """ Send a message to this user from the logged in user. :param body: The body of the message. :param subject: The subject of the message. Note that if the this message is a reply, then the subject of the first messa...
[ "Send", "a", "message", "to", "this", "user", "from", "the", "logged", "in", "user", "." ]
Damgaard/PyImgur
python
https://github.com/Damgaard/PyImgur/blob/606f17078d24158632f807430f8d0b9b3cd8b312/pyimgur/__init__.py#L1407-L1425
[ "def", "send_message", "(", "self", ",", "body", ",", "subject", "=", "None", ",", "reply_to", "=", "None", ")", ":", "url", "=", "self", ".", "_imgur", ".", "_base_url", "+", "\"/3/message\"", "parent_id", "=", "reply_to", ".", "id", "if", "isinstance",...
606f17078d24158632f807430f8d0b9b3cd8b312
train
User.send_verification_email
Send verification email to this users email address. Remember that the verification email may end up in the users spam folder.
pyimgur/__init__.py
def send_verification_email(self): """ Send verification email to this users email address. Remember that the verification email may end up in the users spam folder. """ url = (self._imgur._base_url + "/3/account/{0}" "/verifyemail".format(self.name)) ...
def send_verification_email(self): """ Send verification email to this users email address. Remember that the verification email may end up in the users spam folder. """ url = (self._imgur._base_url + "/3/account/{0}" "/verifyemail".format(self.name)) ...
[ "Send", "verification", "email", "to", "this", "users", "email", "address", "." ]
Damgaard/PyImgur
python
https://github.com/Damgaard/PyImgur/blob/606f17078d24158632f807430f8d0b9b3cd8b312/pyimgur/__init__.py#L1427-L1436
[ "def", "send_verification_email", "(", "self", ")", ":", "url", "=", "(", "self", ".", "_imgur", ".", "_base_url", "+", "\"/3/account/{0}\"", "\"/verifyemail\"", ".", "format", "(", "self", ".", "name", ")", ")", "self", ".", "_imgur", ".", "_send_request", ...
606f17078d24158632f807430f8d0b9b3cd8b312
train
hook
Hook the current excepthook to the backtrace. If `align` is True, all parts (line numbers, file names, etc..) will be aligned to the left according to the longest entry. If `strip_path` is True, only the file name will be shown, not its full path. If `enable_on_envvar_only` is True, only if the e...
backtrace.py
def hook(reverse=False, align=False, strip_path=False, enable_on_envvar_only=False, on_tty=False, conservative=False, styles=None, tb=None, tpe=None, value=None): """Hook the current excepthook to the backtrace. If `align` is True...
def hook(reverse=False, align=False, strip_path=False, enable_on_envvar_only=False, on_tty=False, conservative=False, styles=None, tb=None, tpe=None, value=None): """Hook the current excepthook to the backtrace. If `align` is True...
[ "Hook", "the", "current", "excepthook", "to", "the", "backtrace", "." ]
nir0s/backtrace
python
https://github.com/nir0s/backtrace/blob/a1f75c956f669a6175088693802d5392e6bd7e51/backtrace.py#L108-L186
[ "def", "hook", "(", "reverse", "=", "False", ",", "align", "=", "False", ",", "strip_path", "=", "False", ",", "enable_on_envvar_only", "=", "False", ",", "on_tty", "=", "False", ",", "conservative", "=", "False", ",", "styles", "=", "None", ",", "tb", ...
a1f75c956f669a6175088693802d5392e6bd7e51
train
_extract_traceback
Receive a list of strings representing the input from stdin and return the restructured backtrace. This iterates over the output and once it identifies a hopefully genuine identifier, it will start parsing output. In the case the input includes a reraise (a Python 3 case), the primary traceback isn...
backtrace.py
def _extract_traceback(text): """Receive a list of strings representing the input from stdin and return the restructured backtrace. This iterates over the output and once it identifies a hopefully genuine identifier, it will start parsing output. In the case the input includes a reraise (a Python 3...
def _extract_traceback(text): """Receive a list of strings representing the input from stdin and return the restructured backtrace. This iterates over the output and once it identifies a hopefully genuine identifier, it will start parsing output. In the case the input includes a reraise (a Python 3...
[ "Receive", "a", "list", "of", "strings", "representing", "the", "input", "from", "stdin", "and", "return", "the", "restructured", "backtrace", "." ]
nir0s/backtrace
python
https://github.com/nir0s/backtrace/blob/a1f75c956f669a6175088693802d5392e6bd7e51/backtrace.py#L195-L254
[ "def", "_extract_traceback", "(", "text", ")", ":", "capture", "=", "False", "entries", "=", "[", "]", "all_else", "=", "[", "]", "ignore_trace", "=", "False", "# In python 3, a traceback may includes output from a reraise.", "# e.g, an exception is captured and reraised wi...
a1f75c956f669a6175088693802d5392e6bd7e51
train
_Hook.generate_backtrace
Return the (potentially) aligned, rebuit traceback Yes, we iterate over the entries thrice. We sacrifice performance for code readability. I mean.. come on, how long can your traceback be that it matters?
backtrace.py
def generate_backtrace(self, styles): """Return the (potentially) aligned, rebuit traceback Yes, we iterate over the entries thrice. We sacrifice performance for code readability. I mean.. come on, how long can your traceback be that it matters? """ backtrace = [] ...
def generate_backtrace(self, styles): """Return the (potentially) aligned, rebuit traceback Yes, we iterate over the entries thrice. We sacrifice performance for code readability. I mean.. come on, how long can your traceback be that it matters? """ backtrace = [] ...
[ "Return", "the", "(", "potentially", ")", "aligned", "rebuit", "traceback" ]
nir0s/backtrace
python
https://github.com/nir0s/backtrace/blob/a1f75c956f669a6175088693802d5392e6bd7e51/backtrace.py#L88-L105
[ "def", "generate_backtrace", "(", "self", ",", "styles", ")", ":", "backtrace", "=", "[", "]", "for", "entry", "in", "self", ".", "entries", ":", "backtrace", ".", "append", "(", "self", ".", "rebuild_entry", "(", "entry", ",", "styles", ")", ")", "# G...
a1f75c956f669a6175088693802d5392e6bd7e51
train
classify_catalog
Look at a list of sources and split them according to their class. Parameters ---------- catalog : iterable A list or iterable object of {SimpleSource, IslandSource, OutputSource} objects, possibly mixed. Any other objects will be silently ignored. Returns ------- components : ...
AegeanTools/models.py
def classify_catalog(catalog): """ Look at a list of sources and split them according to their class. Parameters ---------- catalog : iterable A list or iterable object of {SimpleSource, IslandSource, OutputSource} objects, possibly mixed. Any other objects will be silently ignored....
def classify_catalog(catalog): """ Look at a list of sources and split them according to their class. Parameters ---------- catalog : iterable A list or iterable object of {SimpleSource, IslandSource, OutputSource} objects, possibly mixed. Any other objects will be silently ignored....
[ "Look", "at", "a", "list", "of", "sources", "and", "split", "them", "according", "to", "their", "class", "." ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/models.py#L520-L551
[ "def", "classify_catalog", "(", "catalog", ")", ":", "components", "=", "[", "]", "islands", "=", "[", "]", "simples", "=", "[", "]", "for", "source", "in", "catalog", ":", "if", "isinstance", "(", "source", ",", "OutputSource", ")", ":", "components", ...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
island_itergen
Iterate over a catalog of sources, and return an island worth of sources at a time. Yields a list of components, one island at a time Parameters ---------- catalog : iterable A list or iterable of :class:`AegeanTools.models.OutputSource` objects. Yields ------ group : list ...
AegeanTools/models.py
def island_itergen(catalog): """ Iterate over a catalog of sources, and return an island worth of sources at a time. Yields a list of components, one island at a time Parameters ---------- catalog : iterable A list or iterable of :class:`AegeanTools.models.OutputSource` objects. Yi...
def island_itergen(catalog): """ Iterate over a catalog of sources, and return an island worth of sources at a time. Yields a list of components, one island at a time Parameters ---------- catalog : iterable A list or iterable of :class:`AegeanTools.models.OutputSource` objects. Yi...
[ "Iterate", "over", "a", "catalog", "of", "sources", "and", "return", "an", "island", "worth", "of", "sources", "at", "a", "time", ".", "Yields", "a", "list", "of", "components", "one", "island", "at", "a", "time" ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/models.py#L554-L597
[ "def", "island_itergen", "(", "catalog", ")", ":", "# reverse sort so that we can pop the last elements and get an increasing island number", "catalog", "=", "sorted", "(", "catalog", ")", "catalog", ".", "reverse", "(", ")", "group", "=", "[", "]", "# using pop and keepi...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
SimpleSource._sanitise
Convert attributes of type npumpy.float32 to numpy.float64 so that they will print properly.
AegeanTools/models.py
def _sanitise(self): """ Convert attributes of type npumpy.float32 to numpy.float64 so that they will print properly. """ for k in self.__dict__: if isinstance(self.__dict__[k], np.float32): # np.float32 has a broken __str__ method self.__dict__[k] = np.float...
def _sanitise(self): """ Convert attributes of type npumpy.float32 to numpy.float64 so that they will print properly. """ for k in self.__dict__: if isinstance(self.__dict__[k], np.float32): # np.float32 has a broken __str__ method self.__dict__[k] = np.float...
[ "Convert", "attributes", "of", "type", "npumpy", ".", "float32", "to", "numpy", ".", "float64", "so", "that", "they", "will", "print", "properly", "." ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/models.py#L74-L80
[ "def", "_sanitise", "(", "self", ")", ":", "for", "k", "in", "self", ".", "__dict__", ":", "if", "isinstance", "(", "self", ".", "__dict__", "[", "k", "]", ",", "np", ".", "float32", ")", ":", "# np.float32 has a broken __str__ method", "self", ".", "__d...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
SimpleSource.as_list
Return an *ordered* list of the source attributes
AegeanTools/models.py
def as_list(self): """ Return an *ordered* list of the source attributes """ self._sanitise() l = [] for name in self.names: l.append(getattr(self, name)) return l
def as_list(self): """ Return an *ordered* list of the source attributes """ self._sanitise() l = [] for name in self.names: l.append(getattr(self, name)) return l
[ "Return", "an", "*", "ordered", "*", "list", "of", "the", "source", "attributes" ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/models.py#L89-L97
[ "def", "as_list", "(", "self", ")", ":", "self", ".", "_sanitise", "(", ")", "l", "=", "[", "]", "for", "name", "in", "self", ".", "names", ":", "l", ".", "append", "(", "getattr", "(", "self", ",", "name", ")", ")", "return", "l" ]
185d2b4a51b48441a1df747efc9a5271c79399fd
train
Region.add_circles
Add one or more circles to this region Parameters ---------- ra_cen, dec_cen, radius : float or list The center and radius of the circle or circles to add to this region. depth : int The depth at which the given circles will be inserted.
AegeanTools/regions.py
def add_circles(self, ra_cen, dec_cen, radius, depth=None): """ Add one or more circles to this region Parameters ---------- ra_cen, dec_cen, radius : float or list The center and radius of the circle or circles to add to this region. depth : int ...
def add_circles(self, ra_cen, dec_cen, radius, depth=None): """ Add one or more circles to this region Parameters ---------- ra_cen, dec_cen, radius : float or list The center and radius of the circle or circles to add to this region. depth : int ...
[ "Add", "one", "or", "more", "circles", "to", "this", "region" ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/regions.py#L83-L111
[ "def", "add_circles", "(", "self", ",", "ra_cen", ",", "dec_cen", ",", "radius", ",", "depth", "=", "None", ")", ":", "if", "depth", "is", "None", "or", "depth", ">", "self", ".", "maxdepth", ":", "depth", "=", "self", ".", "maxdepth", "try", ":", ...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
Region.add_poly
Add a single polygon to this region. Parameters ---------- positions : [[ra, dec], ...] Positions for the vertices of the polygon. The polygon needs to be convex and non-intersecting. depth : int The deepth at which the polygon will be inserted.
AegeanTools/regions.py
def add_poly(self, positions, depth=None): """ Add a single polygon to this region. Parameters ---------- positions : [[ra, dec], ...] Positions for the vertices of the polygon. The polygon needs to be convex and non-intersecting. depth : int The...
def add_poly(self, positions, depth=None): """ Add a single polygon to this region. Parameters ---------- positions : [[ra, dec], ...] Positions for the vertices of the polygon. The polygon needs to be convex and non-intersecting. depth : int The...
[ "Add", "a", "single", "polygon", "to", "this", "region", "." ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/regions.py#L113-L135
[ "def", "add_poly", "(", "self", ",", "positions", ",", "depth", "=", "None", ")", ":", "if", "not", "(", "len", "(", "positions", ")", ">=", "3", ")", ":", "raise", "AssertionError", "(", "\"A minimum of three coordinate pairs are required\"", ")", "if", "de...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
Region.add_pixels
Add one or more HEALPix pixels to this region. Parameters ---------- pix : int or iterable The pixels to be added depth : int The depth at which the pixels are added.
AegeanTools/regions.py
def add_pixels(self, pix, depth): """ Add one or more HEALPix pixels to this region. Parameters ---------- pix : int or iterable The pixels to be added depth : int The depth at which the pixels are added. """ if depth not in self....
def add_pixels(self, pix, depth): """ Add one or more HEALPix pixels to this region. Parameters ---------- pix : int or iterable The pixels to be added depth : int The depth at which the pixels are added. """ if depth not in self....
[ "Add", "one", "or", "more", "HEALPix", "pixels", "to", "this", "region", "." ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/regions.py#L137-L151
[ "def", "add_pixels", "(", "self", ",", "pix", ",", "depth", ")", ":", "if", "depth", "not", "in", "self", ".", "pixeldict", ":", "self", ".", "pixeldict", "[", "depth", "]", "=", "set", "(", ")", "self", ".", "pixeldict", "[", "depth", "]", ".", ...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
Region.get_area
Calculate the total area represented by this region. Parameters ---------- degrees : bool If True then return the area in square degrees, otherwise use steradians. Default = True. Returns ------- area : float The area of the region.
AegeanTools/regions.py
def get_area(self, degrees=True): """ Calculate the total area represented by this region. Parameters ---------- degrees : bool If True then return the area in square degrees, otherwise use steradians. Default = True. Returns ------- ...
def get_area(self, degrees=True): """ Calculate the total area represented by this region. Parameters ---------- degrees : bool If True then return the area in square degrees, otherwise use steradians. Default = True. Returns ------- ...
[ "Calculate", "the", "total", "area", "represented", "by", "this", "region", "." ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/regions.py#L153-L171
[ "def", "get_area", "(", "self", ",", "degrees", "=", "True", ")", ":", "area", "=", "0", "for", "d", "in", "range", "(", "1", ",", "self", ".", "maxdepth", "+", "1", ")", ":", "area", "+=", "len", "(", "self", ".", "pixeldict", "[", "d", "]", ...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
Region._demote_all
Convert the multi-depth pixeldict into a single set of pixels at the deepest layer. The result is cached, and reset when any changes are made to this region.
AegeanTools/regions.py
def _demote_all(self): """ Convert the multi-depth pixeldict into a single set of pixels at the deepest layer. The result is cached, and reset when any changes are made to this region. """ # only do the calculations if the demoted list is empty if len(self.demoted) == 0:...
def _demote_all(self): """ Convert the multi-depth pixeldict into a single set of pixels at the deepest layer. The result is cached, and reset when any changes are made to this region. """ # only do the calculations if the demoted list is empty if len(self.demoted) == 0:...
[ "Convert", "the", "multi", "-", "depth", "pixeldict", "into", "a", "single", "set", "of", "pixels", "at", "the", "deepest", "layer", "." ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/regions.py#L185-L199
[ "def", "_demote_all", "(", "self", ")", ":", "# only do the calculations if the demoted list is empty", "if", "len", "(", "self", ".", "demoted", ")", "==", "0", ":", "pd", "=", "self", ".", "pixeldict", "for", "d", "in", "range", "(", "1", ",", "self", "....
185d2b4a51b48441a1df747efc9a5271c79399fd
train
Region._renorm
Remake the pixel dictionary, merging groups of pixels at level N into a single pixel at level N-1
AegeanTools/regions.py
def _renorm(self): """ Remake the pixel dictionary, merging groups of pixels at level N into a single pixel at level N-1 """ self.demoted = set() # convert all to lowest level self._demote_all() # now promote as needed for d in range(self.maxdepth,...
def _renorm(self): """ Remake the pixel dictionary, merging groups of pixels at level N into a single pixel at level N-1 """ self.demoted = set() # convert all to lowest level self._demote_all() # now promote as needed for d in range(self.maxdepth,...
[ "Remake", "the", "pixel", "dictionary", "merging", "groups", "of", "pixels", "at", "level", "N", "into", "a", "single", "pixel", "at", "level", "N", "-", "1" ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/regions.py#L201-L221
[ "def", "_renorm", "(", "self", ")", ":", "self", ".", "demoted", "=", "set", "(", ")", "# convert all to lowest level", "self", ".", "_demote_all", "(", ")", "# now promote as needed", "for", "d", "in", "range", "(", "self", ".", "maxdepth", ",", "2", ",",...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
Region.sky_within
Test whether a sky position is within this region Parameters ---------- ra, dec : float Sky position. degin : bool If True the ra/dec is interpreted as degrees, otherwise as radians. Default = False. Returns ------- within : ...
AegeanTools/regions.py
def sky_within(self, ra, dec, degin=False): """ Test whether a sky position is within this region Parameters ---------- ra, dec : float Sky position. degin : bool If True the ra/dec is interpreted as degrees, otherwise as radians. Def...
def sky_within(self, ra, dec, degin=False): """ Test whether a sky position is within this region Parameters ---------- ra, dec : float Sky position. degin : bool If True the ra/dec is interpreted as degrees, otherwise as radians. Def...
[ "Test", "whether", "a", "sky", "position", "is", "within", "this", "region" ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/regions.py#L223-L257
[ "def", "sky_within", "(", "self", ",", "ra", ",", "dec", ",", "degin", "=", "False", ")", ":", "sky", "=", "self", ".", "radec2sky", "(", "ra", ",", "dec", ")", "if", "degin", ":", "sky", "=", "np", ".", "radians", "(", "sky", ")", "theta_phi", ...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
Region.union
Add another Region by performing union on their pixlists. Parameters ---------- other : :class:`AegeanTools.regions.Region` The region to be combined. renorm : bool Perform renormalisation after the operation? Default = True.
AegeanTools/regions.py
def union(self, other, renorm=True): """ Add another Region by performing union on their pixlists. Parameters ---------- other : :class:`AegeanTools.regions.Region` The region to be combined. renorm : bool Perform renormalisation after the operat...
def union(self, other, renorm=True): """ Add another Region by performing union on their pixlists. Parameters ---------- other : :class:`AegeanTools.regions.Region` The region to be combined. renorm : bool Perform renormalisation after the operat...
[ "Add", "another", "Region", "by", "performing", "union", "on", "their", "pixlists", "." ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/regions.py#L259-L285
[ "def", "union", "(", "self", ",", "other", ",", "renorm", "=", "True", ")", ":", "# merge the pixels that are common to both", "for", "d", "in", "range", "(", "1", ",", "min", "(", "self", ".", "maxdepth", ",", "other", ".", "maxdepth", ")", "+", "1", ...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
Region.without
Subtract another Region by performing a difference operation on their pixlists. Requires both regions to have the same maxdepth. Parameters ---------- other : :class:`AegeanTools.regions.Region` The region to be combined.
AegeanTools/regions.py
def without(self, other): """ Subtract another Region by performing a difference operation on their pixlists. Requires both regions to have the same maxdepth. Parameters ---------- other : :class:`AegeanTools.regions.Region` The region to be combined. ...
def without(self, other): """ Subtract another Region by performing a difference operation on their pixlists. Requires both regions to have the same maxdepth. Parameters ---------- other : :class:`AegeanTools.regions.Region` The region to be combined. ...
[ "Subtract", "another", "Region", "by", "performing", "a", "difference", "operation", "on", "their", "pixlists", "." ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/regions.py#L287-L305
[ "def", "without", "(", "self", ",", "other", ")", ":", "# work only on the lowest level", "# TODO: Allow this to be done for regions with different depths.", "if", "not", "(", "self", ".", "maxdepth", "==", "other", ".", "maxdepth", ")", ":", "raise", "AssertionError", ...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
Region.intersect
Combine with another Region by performing intersection on their pixlists. Requires both regions to have the same maxdepth. Parameters ---------- other : :class:`AegeanTools.regions.Region` The region to be combined.
AegeanTools/regions.py
def intersect(self, other): """ Combine with another Region by performing intersection on their pixlists. Requires both regions to have the same maxdepth. Parameters ---------- other : :class:`AegeanTools.regions.Region` The region to be combined. ""...
def intersect(self, other): """ Combine with another Region by performing intersection on their pixlists. Requires both regions to have the same maxdepth. Parameters ---------- other : :class:`AegeanTools.regions.Region` The region to be combined. ""...
[ "Combine", "with", "another", "Region", "by", "performing", "intersection", "on", "their", "pixlists", "." ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/regions.py#L307-L325
[ "def", "intersect", "(", "self", ",", "other", ")", ":", "# work only on the lowest level", "# TODO: Allow this to be done for regions with different depths.", "if", "not", "(", "self", ".", "maxdepth", "==", "other", ".", "maxdepth", ")", ":", "raise", "AssertionError"...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
Region.symmetric_difference
Combine with another Region by performing the symmetric difference of their pixlists. Requires both regions to have the same maxdepth. Parameters ---------- other : :class:`AegeanTools.regions.Region` The region to be combined.
AegeanTools/regions.py
def symmetric_difference(self, other): """ Combine with another Region by performing the symmetric difference of their pixlists. Requires both regions to have the same maxdepth. Parameters ---------- other : :class:`AegeanTools.regions.Region` The region to ...
def symmetric_difference(self, other): """ Combine with another Region by performing the symmetric difference of their pixlists. Requires both regions to have the same maxdepth. Parameters ---------- other : :class:`AegeanTools.regions.Region` The region to ...
[ "Combine", "with", "another", "Region", "by", "performing", "the", "symmetric", "difference", "of", "their", "pixlists", "." ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/regions.py#L327-L345
[ "def", "symmetric_difference", "(", "self", ",", "other", ")", ":", "# work only on the lowest level", "# TODO: Allow this to be done for regions with different depths.", "if", "not", "(", "self", ".", "maxdepth", "==", "other", ".", "maxdepth", ")", ":", "raise", "Asse...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
Region.write_reg
Write a ds9 region file that represents this region as a set of diamonds. Parameters ---------- filename : str File to write
AegeanTools/regions.py
def write_reg(self, filename): """ Write a ds9 region file that represents this region as a set of diamonds. Parameters ---------- filename : str File to write """ with open(filename, 'w') as out: for d in range(1, self.maxdepth+1): ...
def write_reg(self, filename): """ Write a ds9 region file that represents this region as a set of diamonds. Parameters ---------- filename : str File to write """ with open(filename, 'w') as out: for d in range(1, self.maxdepth+1): ...
[ "Write", "a", "ds9", "region", "file", "that", "represents", "this", "region", "as", "a", "set", "of", "diamonds", "." ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/regions.py#L347-L371
[ "def", "write_reg", "(", "self", ",", "filename", ")", ":", "with", "open", "(", "filename", ",", "'w'", ")", "as", "out", ":", "for", "d", "in", "range", "(", "1", ",", "self", ".", "maxdepth", "+", "1", ")", ":", "for", "p", "in", "self", "."...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
Region.write_fits
Write a fits file representing the MOC of this region. Parameters ---------- filename : str File to write moctool : str String to be written to fits header with key "MOCTOOL". Default = ''
AegeanTools/regions.py
def write_fits(self, filename, moctool=''): """ Write a fits file representing the MOC of this region. Parameters ---------- filename : str File to write moctool : str String to be written to fits header with key "MOCTOOL". Default = ...
def write_fits(self, filename, moctool=''): """ Write a fits file representing the MOC of this region. Parameters ---------- filename : str File to write moctool : str String to be written to fits header with key "MOCTOOL". Default = ...
[ "Write", "a", "fits", "file", "representing", "the", "MOC", "of", "this", "region", "." ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/regions.py#L373-L402
[ "def", "write_fits", "(", "self", ",", "filename", ",", "moctool", "=", "''", ")", ":", "datafile", "=", "os", ".", "path", ".", "join", "(", "os", ".", "path", ".", "dirname", "(", "os", ".", "path", ".", "abspath", "(", "__file__", ")", ")", ",...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
Region._uniq
Create a list of all the pixels that cover this region. This list contains overlapping pixels of different orders. Returns ------- pix : list A list of HEALPix pixel numbers.
AegeanTools/regions.py
def _uniq(self): """ Create a list of all the pixels that cover this region. This list contains overlapping pixels of different orders. Returns ------- pix : list A list of HEALPix pixel numbers. """ pd = [] for d in range(1, self.maxd...
def _uniq(self): """ Create a list of all the pixels that cover this region. This list contains overlapping pixels of different orders. Returns ------- pix : list A list of HEALPix pixel numbers. """ pd = [] for d in range(1, self.maxd...
[ "Create", "a", "list", "of", "all", "the", "pixels", "that", "cover", "this", "region", ".", "This", "list", "contains", "overlapping", "pixels", "of", "different", "orders", "." ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/regions.py#L404-L417
[ "def", "_uniq", "(", "self", ")", ":", "pd", "=", "[", "]", "for", "d", "in", "range", "(", "1", ",", "self", ".", "maxdepth", ")", ":", "pd", ".", "extend", "(", "map", "(", "lambda", "x", ":", "int", "(", "4", "**", "(", "d", "+", "1", ...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
Region.radec2sky
Convert [ra], [dec] to [(ra[0], dec[0]),....] and also ra,dec to [(ra,dec)] if ra/dec are not iterable Parameters ---------- ra, dec : float or iterable Sky coordinates Returns ------- sky : numpy.array array of (ra,dec) coordinates.
AegeanTools/regions.py
def radec2sky(ra, dec): """ Convert [ra], [dec] to [(ra[0], dec[0]),....] and also ra,dec to [(ra,dec)] if ra/dec are not iterable Parameters ---------- ra, dec : float or iterable Sky coordinates Returns ------- sky : numpy.array ...
def radec2sky(ra, dec): """ Convert [ra], [dec] to [(ra[0], dec[0]),....] and also ra,dec to [(ra,dec)] if ra/dec are not iterable Parameters ---------- ra, dec : float or iterable Sky coordinates Returns ------- sky : numpy.array ...
[ "Convert", "[", "ra", "]", "[", "dec", "]", "to", "[", "(", "ra", "[", "0", "]", "dec", "[", "0", "]", ")", "....", "]", "and", "also", "ra", "dec", "to", "[", "(", "ra", "dec", ")", "]", "if", "ra", "/", "dec", "are", "not", "iterable" ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/regions.py#L420-L439
[ "def", "radec2sky", "(", "ra", ",", "dec", ")", ":", "try", ":", "sky", "=", "np", ".", "array", "(", "list", "(", "zip", "(", "ra", ",", "dec", ")", ")", ")", "except", "TypeError", ":", "sky", "=", "np", ".", "array", "(", "[", "(", "ra", ...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
Region.sky2ang
Convert ra,dec coordinates to theta,phi coordinates ra -> phi dec -> theta Parameters ---------- sky : numpy.array Array of (ra,dec) coordinates. See :func:`AegeanTools.regions.Region.radec2sky` Returns ------- theta_phi : numpy.a...
AegeanTools/regions.py
def sky2ang(sky): """ Convert ra,dec coordinates to theta,phi coordinates ra -> phi dec -> theta Parameters ---------- sky : numpy.array Array of (ra,dec) coordinates. See :func:`AegeanTools.regions.Region.radec2sky` Returns ...
def sky2ang(sky): """ Convert ra,dec coordinates to theta,phi coordinates ra -> phi dec -> theta Parameters ---------- sky : numpy.array Array of (ra,dec) coordinates. See :func:`AegeanTools.regions.Region.radec2sky` Returns ...
[ "Convert", "ra", "dec", "coordinates", "to", "theta", "phi", "coordinates", "ra", "-", ">", "phi", "dec", "-", ">", "theta" ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/regions.py#L442-L469
[ "def", "sky2ang", "(", "sky", ")", ":", "try", ":", "theta_phi", "=", "sky", ".", "copy", "(", ")", "except", "AttributeError", "as", "_", ":", "theta_phi", "=", "np", ".", "array", "(", "sky", ")", "theta_phi", "[", ":", ",", "[", "1", ",", "0",...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
Region.sky2vec
Convert sky positions in to 3d-vectors on the unit sphere. Parameters ---------- sky : numpy.array Sky coordinates as an array of (ra,dec) Returns ------- vec : numpy.array Unit vectors as an array of (x,y,z) See Also -------- ...
AegeanTools/regions.py
def sky2vec(cls, sky): """ Convert sky positions in to 3d-vectors on the unit sphere. Parameters ---------- sky : numpy.array Sky coordinates as an array of (ra,dec) Returns ------- vec : numpy.array Unit vectors as an array of (x...
def sky2vec(cls, sky): """ Convert sky positions in to 3d-vectors on the unit sphere. Parameters ---------- sky : numpy.array Sky coordinates as an array of (ra,dec) Returns ------- vec : numpy.array Unit vectors as an array of (x...
[ "Convert", "sky", "positions", "in", "to", "3d", "-", "vectors", "on", "the", "unit", "sphere", "." ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/regions.py#L472-L493
[ "def", "sky2vec", "(", "cls", ",", "sky", ")", ":", "theta_phi", "=", "cls", ".", "sky2ang", "(", "sky", ")", "theta", ",", "phi", "=", "map", "(", "np", ".", "array", ",", "list", "(", "zip", "(", "*", "theta_phi", ")", ")", ")", "vec", "=", ...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
Region.vec2sky
Convert [x,y,z] vectors into sky coordinates ra,dec Parameters ---------- vec : numpy.array Unit vectors as an array of (x,y,z) degrees Returns ------- sky : numpy.array Sky coordinates as an array of (ra,dec) See Also -...
AegeanTools/regions.py
def vec2sky(cls, vec, degrees=False): """ Convert [x,y,z] vectors into sky coordinates ra,dec Parameters ---------- vec : numpy.array Unit vectors as an array of (x,y,z) degrees Returns ------- sky : numpy.array Sky coord...
def vec2sky(cls, vec, degrees=False): """ Convert [x,y,z] vectors into sky coordinates ra,dec Parameters ---------- vec : numpy.array Unit vectors as an array of (x,y,z) degrees Returns ------- sky : numpy.array Sky coord...
[ "Convert", "[", "x", "y", "z", "]", "vectors", "into", "sky", "coordinates", "ra", "dec" ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/regions.py#L496-L523
[ "def", "vec2sky", "(", "cls", ",", "vec", ",", "degrees", "=", "False", ")", ":", "theta", ",", "phi", "=", "hp", ".", "vec2ang", "(", "vec", ")", "ra", "=", "phi", "dec", "=", "np", ".", "pi", "/", "2", "-", "theta", "if", "degrees", ":", "r...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
WCSHelper.from_header
Create a new WCSHelper class from the given header. Parameters ---------- header : `astropy.fits.HDUHeader` or string The header to be used to create the WCS helper beam : :class:`AegeanTools.fits_image.Beam` or None The synthesized beam. If the supplied beam is...
AegeanTools/wcs_helpers.py
def from_header(cls, header, beam=None, lat=None): """ Create a new WCSHelper class from the given header. Parameters ---------- header : `astropy.fits.HDUHeader` or string The header to be used to create the WCS helper beam : :class:`AegeanTools.fits_image....
def from_header(cls, header, beam=None, lat=None): """ Create a new WCSHelper class from the given header. Parameters ---------- header : `astropy.fits.HDUHeader` or string The header to be used to create the WCS helper beam : :class:`AegeanTools.fits_image....
[ "Create", "a", "new", "WCSHelper", "class", "from", "the", "given", "header", "." ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/wcs_helpers.py#L62-L97
[ "def", "from_header", "(", "cls", ",", "header", ",", "beam", "=", "None", ",", "lat", "=", "None", ")", ":", "try", ":", "wcs", "=", "pywcs", ".", "WCS", "(", "header", ",", "naxis", "=", "2", ")", "except", ":", "# TODO: figure out what error is bein...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
WCSHelper.from_file
Create a new WCSHelper class from a given fits file. Parameters ---------- filename : string The file to be read beam : :class:`AegeanTools.fits_image.Beam` or None The synthesized beam. If the supplied beam is None then one is constructed form the header. ...
AegeanTools/wcs_helpers.py
def from_file(cls, filename, beam=None): """ Create a new WCSHelper class from a given fits file. Parameters ---------- filename : string The file to be read beam : :class:`AegeanTools.fits_image.Beam` or None The synthesized beam. If the supplie...
def from_file(cls, filename, beam=None): """ Create a new WCSHelper class from a given fits file. Parameters ---------- filename : string The file to be read beam : :class:`AegeanTools.fits_image.Beam` or None The synthesized beam. If the supplie...
[ "Create", "a", "new", "WCSHelper", "class", "from", "a", "given", "fits", "file", "." ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/wcs_helpers.py#L100-L118
[ "def", "from_file", "(", "cls", ",", "filename", ",", "beam", "=", "None", ")", ":", "header", "=", "fits", ".", "getheader", "(", "filename", ")", "return", "cls", ".", "from_header", "(", "header", ",", "beam", ")" ]
185d2b4a51b48441a1df747efc9a5271c79399fd
train
WCSHelper.pix2sky
Convert pixel coordinates into sky coordinates. Parameters ---------- pixel : (float, float) The (x,y) pixel coordinates Returns ------- sky : (float, float) The (ra,dec) sky coordinates in degrees
AegeanTools/wcs_helpers.py
def pix2sky(self, pixel): """ Convert pixel coordinates into sky coordinates. Parameters ---------- pixel : (float, float) The (x,y) pixel coordinates Returns ------- sky : (float, float) The (ra,dec) sky coordinates in degrees ...
def pix2sky(self, pixel): """ Convert pixel coordinates into sky coordinates. Parameters ---------- pixel : (float, float) The (x,y) pixel coordinates Returns ------- sky : (float, float) The (ra,dec) sky coordinates in degrees ...
[ "Convert", "pixel", "coordinates", "into", "sky", "coordinates", "." ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/wcs_helpers.py#L120-L137
[ "def", "pix2sky", "(", "self", ",", "pixel", ")", ":", "x", ",", "y", "=", "pixel", "# wcs and pyfits have oposite ideas of x/y", "return", "self", ".", "wcs", ".", "wcs_pix2world", "(", "[", "[", "y", ",", "x", "]", "]", ",", "1", ")", "[", "0", "]"...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
WCSHelper.sky2pix
Convert sky coordinates into pixel coordinates. Parameters ---------- pos : (float, float) The (ra, dec) sky coordinates (degrees) Returns ------- pixel : (float, float) The (x,y) pixel coordinates
AegeanTools/wcs_helpers.py
def sky2pix(self, pos): """ Convert sky coordinates into pixel coordinates. Parameters ---------- pos : (float, float) The (ra, dec) sky coordinates (degrees) Returns ------- pixel : (float, float) The (x,y) pixel coordinates ...
def sky2pix(self, pos): """ Convert sky coordinates into pixel coordinates. Parameters ---------- pos : (float, float) The (ra, dec) sky coordinates (degrees) Returns ------- pixel : (float, float) The (x,y) pixel coordinates ...
[ "Convert", "sky", "coordinates", "into", "pixel", "coordinates", "." ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/wcs_helpers.py#L139-L156
[ "def", "sky2pix", "(", "self", ",", "pos", ")", ":", "pixel", "=", "self", ".", "wcs", ".", "wcs_world2pix", "(", "[", "pos", "]", ",", "1", ")", "# wcs and pyfits have oposite ideas of x/y", "return", "[", "pixel", "[", "0", "]", "[", "1", "]", ",", ...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
WCSHelper.sky2pix_vec
Convert a vector from sky to pixel coords. The vector has a magnitude, angle, and an origin on the sky. Parameters ---------- pos : (float, float) The (ra, dec) of the origin of the vector (degrees). r : float The magnitude or length of the vector (degre...
AegeanTools/wcs_helpers.py
def sky2pix_vec(self, pos, r, pa): """ Convert a vector from sky to pixel coords. The vector has a magnitude, angle, and an origin on the sky. Parameters ---------- pos : (float, float) The (ra, dec) of the origin of the vector (degrees). r : float ...
def sky2pix_vec(self, pos, r, pa): """ Convert a vector from sky to pixel coords. The vector has a magnitude, angle, and an origin on the sky. Parameters ---------- pos : (float, float) The (ra, dec) of the origin of the vector (degrees). r : float ...
[ "Convert", "a", "vector", "from", "sky", "to", "pixel", "coords", ".", "The", "vector", "has", "a", "magnitude", "angle", "and", "an", "origin", "on", "the", "sky", "." ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/wcs_helpers.py#L158-L189
[ "def", "sky2pix_vec", "(", "self", ",", "pos", ",", "r", ",", "pa", ")", ":", "ra", ",", "dec", "=", "pos", "x", ",", "y", "=", "self", ".", "sky2pix", "(", "pos", ")", "a", "=", "translate", "(", "ra", ",", "dec", ",", "r", ",", "pa", ")",...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
WCSHelper.pix2sky_vec
Given and input position and vector in pixel coordinates, calculate the equivalent position and vector in sky coordinates. Parameters ---------- pixel : (int,int) origin of vector in pixel coordinates r : float magnitude of vector in pixels theta ...
AegeanTools/wcs_helpers.py
def pix2sky_vec(self, pixel, r, theta): """ Given and input position and vector in pixel coordinates, calculate the equivalent position and vector in sky coordinates. Parameters ---------- pixel : (int,int) origin of vector in pixel coordinates r : fl...
def pix2sky_vec(self, pixel, r, theta): """ Given and input position and vector in pixel coordinates, calculate the equivalent position and vector in sky coordinates. Parameters ---------- pixel : (int,int) origin of vector in pixel coordinates r : fl...
[ "Given", "and", "input", "position", "and", "vector", "in", "pixel", "coordinates", "calculate", "the", "equivalent", "position", "and", "vector", "in", "sky", "coordinates", "." ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/wcs_helpers.py#L191-L220
[ "def", "pix2sky_vec", "(", "self", ",", "pixel", ",", "r", ",", "theta", ")", ":", "ra1", ",", "dec1", "=", "self", ".", "pix2sky", "(", "pixel", ")", "x", ",", "y", "=", "pixel", "a", "=", "[", "x", "+", "r", "*", "np", ".", "cos", "(", "n...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
WCSHelper.sky2pix_ellipse
Convert an ellipse from sky to pixel coordinates. Parameters ---------- pos : (float, float) The (ra, dec) of the ellipse center (degrees). a, b, pa: float The semi-major axis, semi-minor axis and position angle of the ellipse (degrees). Returns ...
AegeanTools/wcs_helpers.py
def sky2pix_ellipse(self, pos, a, b, pa): """ Convert an ellipse from sky to pixel coordinates. Parameters ---------- pos : (float, float) The (ra, dec) of the ellipse center (degrees). a, b, pa: float The semi-major axis, semi-minor axis and posi...
def sky2pix_ellipse(self, pos, a, b, pa): """ Convert an ellipse from sky to pixel coordinates. Parameters ---------- pos : (float, float) The (ra, dec) of the ellipse center (degrees). a, b, pa: float The semi-major axis, semi-minor axis and posi...
[ "Convert", "an", "ellipse", "from", "sky", "to", "pixel", "coordinates", "." ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/wcs_helpers.py#L222-L261
[ "def", "sky2pix_ellipse", "(", "self", ",", "pos", ",", "a", ",", "b", ",", "pa", ")", ":", "ra", ",", "dec", "=", "pos", "x", ",", "y", "=", "self", ".", "sky2pix", "(", "pos", ")", "x_off", ",", "y_off", "=", "self", ".", "sky2pix", "(", "t...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
WCSHelper.pix2sky_ellipse
Convert an ellipse from pixel to sky coordinates. Parameters ---------- pixel : (float, float) The (x, y) coordinates of the center of the ellipse. sx, sy : float The major and minor axes (FHWM) of the ellipse, in pixels. theta : float The rot...
AegeanTools/wcs_helpers.py
def pix2sky_ellipse(self, pixel, sx, sy, theta): """ Convert an ellipse from pixel to sky coordinates. Parameters ---------- pixel : (float, float) The (x, y) coordinates of the center of the ellipse. sx, sy : float The major and minor axes (FHWM)...
def pix2sky_ellipse(self, pixel, sx, sy, theta): """ Convert an ellipse from pixel to sky coordinates. Parameters ---------- pixel : (float, float) The (x, y) coordinates of the center of the ellipse. sx, sy : float The major and minor axes (FHWM)...
[ "Convert", "an", "ellipse", "from", "pixel", "to", "sky", "coordinates", "." ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/wcs_helpers.py#L263-L307
[ "def", "pix2sky_ellipse", "(", "self", ",", "pixel", ",", "sx", ",", "sy", ",", "theta", ")", ":", "ra", ",", "dec", "=", "self", ".", "pix2sky", "(", "pixel", ")", "x", ",", "y", "=", "pixel", "v_sx", "=", "[", "x", "+", "sx", "*", "np", "."...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
WCSHelper.get_pixbeam_pixel
Determine the beam in pixels at the given location in pixel coordinates. Parameters ---------- x , y : float The pixel coordinates at which the beam is determined. Returns ------- beam : :class:`AegeanTools.fits_image.Beam` A beam object, with a/...
AegeanTools/wcs_helpers.py
def get_pixbeam_pixel(self, x, y): """ Determine the beam in pixels at the given location in pixel coordinates. Parameters ---------- x , y : float The pixel coordinates at which the beam is determined. Returns ------- beam : :class:`AegeanTo...
def get_pixbeam_pixel(self, x, y): """ Determine the beam in pixels at the given location in pixel coordinates. Parameters ---------- x , y : float The pixel coordinates at which the beam is determined. Returns ------- beam : :class:`AegeanTo...
[ "Determine", "the", "beam", "in", "pixels", "at", "the", "given", "location", "in", "pixel", "coordinates", "." ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/wcs_helpers.py#L309-L324
[ "def", "get_pixbeam_pixel", "(", "self", ",", "x", ",", "y", ")", ":", "ra", ",", "dec", "=", "self", ".", "pix2sky", "(", "(", "x", ",", "y", ")", ")", "return", "self", ".", "get_pixbeam", "(", "ra", ",", "dec", ")" ]
185d2b4a51b48441a1df747efc9a5271c79399fd
train
WCSHelper.get_beam
Determine the beam at the given sky location. Parameters ---------- ra, dec : float The sky coordinates at which the beam is determined. Returns ------- beam : :class:`AegeanTools.fits_image.Beam` A beam object, with a/b/pa in sky coordinates
AegeanTools/wcs_helpers.py
def get_beam(self, ra, dec): """ Determine the beam at the given sky location. Parameters ---------- ra, dec : float The sky coordinates at which the beam is determined. Returns ------- beam : :class:`AegeanTools.fits_image.Beam` ...
def get_beam(self, ra, dec): """ Determine the beam at the given sky location. Parameters ---------- ra, dec : float The sky coordinates at which the beam is determined. Returns ------- beam : :class:`AegeanTools.fits_image.Beam` ...
[ "Determine", "the", "beam", "at", "the", "given", "sky", "location", "." ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/wcs_helpers.py#L326-L346
[ "def", "get_beam", "(", "self", ",", "ra", ",", "dec", ")", ":", "# check to see if we need to scale the major axis based on the declination", "if", "self", ".", "lat", "is", "None", ":", "factor", "=", "1", "else", ":", "# this works if the pa is zero. For non-zero pa ...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
WCSHelper.get_pixbeam
Determine the beam in pixels at the given location in sky coordinates. Parameters ---------- ra , dec : float The sly coordinates at which the beam is determined. Returns ------- beam : :class:`AegeanTools.fits_image.Beam` A beam object, with a/b...
AegeanTools/wcs_helpers.py
def get_pixbeam(self, ra, dec): """ Determine the beam in pixels at the given location in sky coordinates. Parameters ---------- ra , dec : float The sly coordinates at which the beam is determined. Returns ------- beam : :class:`AegeanTools....
def get_pixbeam(self, ra, dec): """ Determine the beam in pixels at the given location in sky coordinates. Parameters ---------- ra , dec : float The sly coordinates at which the beam is determined. Returns ------- beam : :class:`AegeanTools....
[ "Determine", "the", "beam", "in", "pixels", "at", "the", "given", "location", "in", "sky", "coordinates", "." ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/wcs_helpers.py#L348-L381
[ "def", "get_pixbeam", "(", "self", ",", "ra", ",", "dec", ")", ":", "if", "ra", "is", "None", ":", "ra", ",", "dec", "=", "self", ".", "pix2sky", "(", "self", ".", "refpix", ")", "pos", "=", "[", "ra", ",", "dec", "]", "beam", "=", "self", "....
185d2b4a51b48441a1df747efc9a5271c79399fd
train
WCSHelper.get_beamarea_deg2
Calculate the area of the synthesized beam in square degrees. Parameters ---------- ra, dec : float The sky coordinates at which the calculation is made. Returns ------- area : float The beam area in square degrees.
AegeanTools/wcs_helpers.py
def get_beamarea_deg2(self, ra, dec): """ Calculate the area of the synthesized beam in square degrees. Parameters ---------- ra, dec : float The sky coordinates at which the calculation is made. Returns ------- area : float The b...
def get_beamarea_deg2(self, ra, dec): """ Calculate the area of the synthesized beam in square degrees. Parameters ---------- ra, dec : float The sky coordinates at which the calculation is made. Returns ------- area : float The b...
[ "Calculate", "the", "area", "of", "the", "synthesized", "beam", "in", "square", "degrees", "." ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/wcs_helpers.py#L383-L400
[ "def", "get_beamarea_deg2", "(", "self", ",", "ra", ",", "dec", ")", ":", "barea", "=", "abs", "(", "self", ".", "beam", ".", "a", "*", "self", ".", "beam", ".", "b", "*", "np", ".", "pi", ")", "# in deg**2 at reference coords", "if", "self", ".", ...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
WCSHelper.get_beamarea_pix
Calculate the beam area in square pixels. Parameters ---------- ra, dec : float The sky coordinates at which the calculation is made dec Returns ------- area : float The beam area in square pixels.
AegeanTools/wcs_helpers.py
def get_beamarea_pix(self, ra, dec): """ Calculate the beam area in square pixels. Parameters ---------- ra, dec : float The sky coordinates at which the calculation is made dec Returns ------- area : float The beam area i...
def get_beamarea_pix(self, ra, dec): """ Calculate the beam area in square pixels. Parameters ---------- ra, dec : float The sky coordinates at which the calculation is made dec Returns ------- area : float The beam area i...
[ "Calculate", "the", "beam", "area", "in", "square", "pixels", "." ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/wcs_helpers.py#L402-L419
[ "def", "get_beamarea_pix", "(", "self", ",", "ra", ",", "dec", ")", ":", "parea", "=", "abs", "(", "self", ".", "pixscale", "[", "0", "]", "*", "self", ".", "pixscale", "[", "1", "]", ")", "# in deg**2 at reference coords", "barea", "=", "self", ".", ...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
WCSHelper.sky_sep
calculate the GCD sky separation (degrees) between two pixels. Parameters ---------- pix1, pix2 : (float, float) The (x,y) pixel coordinates for the two positions. Returns ------- dist : float The distance between the two points (degrees).
AegeanTools/wcs_helpers.py
def sky_sep(self, pix1, pix2): """ calculate the GCD sky separation (degrees) between two pixels. Parameters ---------- pix1, pix2 : (float, float) The (x,y) pixel coordinates for the two positions. Returns ------- dist : float Th...
def sky_sep(self, pix1, pix2): """ calculate the GCD sky separation (degrees) between two pixels. Parameters ---------- pix1, pix2 : (float, float) The (x,y) pixel coordinates for the two positions. Returns ------- dist : float Th...
[ "calculate", "the", "GCD", "sky", "separation", "(", "degrees", ")", "between", "two", "pixels", "." ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/wcs_helpers.py#L421-L438
[ "def", "sky_sep", "(", "self", ",", "pix1", ",", "pix2", ")", ":", "pos1", "=", "self", ".", "pix2sky", "(", "pix1", ")", "pos2", "=", "self", ".", "pix2sky", "(", "pix2", ")", "sep", "=", "gcd", "(", "pos1", "[", "0", "]", ",", "pos1", "[", ...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
PSFHelper.get_psf_sky
Determine the local psf at a given sky location. The psf is returned in degrees. Parameters ---------- ra, dec : float The sky position (degrees). Returns ------- a, b, pa : float The psf semi-major axis, semi-minor axis, and position an...
AegeanTools/wcs_helpers.py
def get_psf_sky(self, ra, dec): """ Determine the local psf at a given sky location. The psf is returned in degrees. Parameters ---------- ra, dec : float The sky position (degrees). Returns ------- a, b, pa : float The p...
def get_psf_sky(self, ra, dec): """ Determine the local psf at a given sky location. The psf is returned in degrees. Parameters ---------- ra, dec : float The sky position (degrees). Returns ------- a, b, pa : float The p...
[ "Determine", "the", "local", "psf", "at", "a", "given", "sky", "location", ".", "The", "psf", "is", "returned", "in", "degrees", "." ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/wcs_helpers.py#L474-L504
[ "def", "get_psf_sky", "(", "self", ",", "ra", ",", "dec", ")", ":", "# If we don't have a psf map then we just fall back to using the beam", "# from the fits header (including ZA scaling)", "if", "self", ".", "data", "is", "None", ":", "beam", "=", "self", ".", "wcshelp...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
PSFHelper.get_psf_pix
Determine the local psf (a,b,pa) at a given sky location. The psf is in pixel coordinates. Parameters ---------- ra, dec : float The sky position (degrees). Returns ------- a, b, pa : float The psf semi-major axis (pixels), semi-minor ax...
AegeanTools/wcs_helpers.py
def get_psf_pix(self, ra, dec): """ Determine the local psf (a,b,pa) at a given sky location. The psf is in pixel coordinates. Parameters ---------- ra, dec : float The sky position (degrees). Returns ------- a, b, pa : float ...
def get_psf_pix(self, ra, dec): """ Determine the local psf (a,b,pa) at a given sky location. The psf is in pixel coordinates. Parameters ---------- ra, dec : float The sky position (degrees). Returns ------- a, b, pa : float ...
[ "Determine", "the", "local", "psf", "(", "a", "b", "pa", ")", "at", "a", "given", "sky", "location", ".", "The", "psf", "is", "in", "pixel", "coordinates", "." ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/wcs_helpers.py#L506-L527
[ "def", "get_psf_pix", "(", "self", ",", "ra", ",", "dec", ")", ":", "psf_sky", "=", "self", ".", "get_psf_sky", "(", "ra", ",", "dec", ")", "psf_pix", "=", "self", ".", "wcshelper", ".", "sky2pix_ellipse", "(", "[", "ra", ",", "dec", "]", ",", "psf...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
PSFHelper.get_pixbeam
Get the psf at the location specified in pixel coordinates. The psf is also in pixel coordinates. Parameters ---------- ra, dec : float The sky position (degrees). Returns ------- a, b, pa : float The psf semi-major axis (pixels), semi-mi...
AegeanTools/wcs_helpers.py
def get_pixbeam(self, ra, dec): """ Get the psf at the location specified in pixel coordinates. The psf is also in pixel coordinates. Parameters ---------- ra, dec : float The sky position (degrees). Returns ------- a, b, pa : float ...
def get_pixbeam(self, ra, dec): """ Get the psf at the location specified in pixel coordinates. The psf is also in pixel coordinates. Parameters ---------- ra, dec : float The sky position (degrees). Returns ------- a, b, pa : float ...
[ "Get", "the", "psf", "at", "the", "location", "specified", "in", "pixel", "coordinates", ".", "The", "psf", "is", "also", "in", "pixel", "coordinates", "." ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/wcs_helpers.py#L552-L578
[ "def", "get_pixbeam", "(", "self", ",", "ra", ",", "dec", ")", ":", "# If there is no psf image then just use the fits header (plus lat scaling) from the wcshelper", "if", "self", ".", "data", "is", "None", ":", "return", "self", ".", "wcshelper", ".", "get_pixbeam", ...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
PSFHelper.get_beam
Get the psf as a :class:`AegeanTools.fits_image.Beam` object. Parameters ---------- ra, dec : float The sky position (degrees). Returns ------- beam : :class:`AegeanTools.fits_image.Beam` The psf at the given location.
AegeanTools/wcs_helpers.py
def get_beam(self, ra, dec): """ Get the psf as a :class:`AegeanTools.fits_image.Beam` object. Parameters ---------- ra, dec : float The sky position (degrees). Returns ------- beam : :class:`AegeanTools.fits_image.Beam` The psf a...
def get_beam(self, ra, dec): """ Get the psf as a :class:`AegeanTools.fits_image.Beam` object. Parameters ---------- ra, dec : float The sky position (degrees). Returns ------- beam : :class:`AegeanTools.fits_image.Beam` The psf a...
[ "Get", "the", "psf", "as", "a", ":", "class", ":", "AegeanTools", ".", "fits_image", ".", "Beam", "object", "." ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/wcs_helpers.py#L580-L600
[ "def", "get_beam", "(", "self", ",", "ra", ",", "dec", ")", ":", "if", "self", ".", "data", "is", "None", ":", "return", "self", ".", "wcshelper", ".", "beam", "else", ":", "psf", "=", "self", ".", "get_psf_sky", "(", "ra", ",", "dec", ")", "if",...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
PSFHelper.get_beamarea_pix
Calculate the area of the beam in square pixels. Parameters ---------- ra, dec : float The sky position (degrees). Returns ------- area : float The area of the beam in square pixels.
AegeanTools/wcs_helpers.py
def get_beamarea_pix(self, ra, dec): """ Calculate the area of the beam in square pixels. Parameters ---------- ra, dec : float The sky position (degrees). Returns ------- area : float The area of the beam in square pixels. ...
def get_beamarea_pix(self, ra, dec): """ Calculate the area of the beam in square pixels. Parameters ---------- ra, dec : float The sky position (degrees). Returns ------- area : float The area of the beam in square pixels. ...
[ "Calculate", "the", "area", "of", "the", "beam", "in", "square", "pixels", "." ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/wcs_helpers.py#L602-L619
[ "def", "get_beamarea_pix", "(", "self", ",", "ra", ",", "dec", ")", ":", "beam", "=", "self", ".", "get_pixbeam", "(", "ra", ",", "dec", ")", "if", "beam", "is", "None", ":", "return", "0", "return", "beam", ".", "a", "*", "beam", ".", "b", "*", ...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
PSFHelper.get_beamarea_deg2
Calculate the area of the beam in square degrees. Parameters ---------- ra, dec : float The sky position (degrees). Returns ------- area : float The area of the beam in square degrees.
AegeanTools/wcs_helpers.py
def get_beamarea_deg2(self, ra, dec): """ Calculate the area of the beam in square degrees. Parameters ---------- ra, dec : float The sky position (degrees). Returns ------- area : float The area of the beam in square degrees. ...
def get_beamarea_deg2(self, ra, dec): """ Calculate the area of the beam in square degrees. Parameters ---------- ra, dec : float The sky position (degrees). Returns ------- area : float The area of the beam in square degrees. ...
[ "Calculate", "the", "area", "of", "the", "beam", "in", "square", "degrees", "." ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/wcs_helpers.py#L621-L639
[ "def", "get_beamarea_deg2", "(", "self", ",", "ra", ",", "dec", ")", ":", "beam", "=", "self", ".", "get_beam", "(", "ra", ",", "dec", ")", "if", "beam", "is", "None", ":", "return", "0", "return", "beam", ".", "a", "*", "beam", ".", "b", "*", ...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
MarchingSquares.find_start_point
Find the first location in our array that is not empty
AegeanTools/msq2.py
def find_start_point(self): """ Find the first location in our array that is not empty """ for i, row in enumerate(self.data): for j, _ in enumerate(row): if self.data[i, j] != 0: # or not np.isfinite(self.data[i,j]): return i, j
def find_start_point(self): """ Find the first location in our array that is not empty """ for i, row in enumerate(self.data): for j, _ in enumerate(row): if self.data[i, j] != 0: # or not np.isfinite(self.data[i,j]): return i, j
[ "Find", "the", "first", "location", "in", "our", "array", "that", "is", "not", "empty" ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/msq2.py#L36-L43
[ "def", "find_start_point", "(", "self", ")", ":", "for", "i", ",", "row", "in", "enumerate", "(", "self", ".", "data", ")", ":", "for", "j", ",", "_", "in", "enumerate", "(", "row", ")", ":", "if", "self", ".", "data", "[", "i", ",", "j", "]", ...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
MarchingSquares.step
Move from the current location to the next Parameters ---------- x, y : int The current location
AegeanTools/msq2.py
def step(self, x, y): """ Move from the current location to the next Parameters ---------- x, y : int The current location """ up_left = self.solid(x - 1, y - 1) up_right = self.solid(x, y - 1) down_left = self.solid(x - 1, y) ...
def step(self, x, y): """ Move from the current location to the next Parameters ---------- x, y : int The current location """ up_left = self.solid(x - 1, y - 1) up_right = self.solid(x, y - 1) down_left = self.solid(x - 1, y) ...
[ "Move", "from", "the", "current", "location", "to", "the", "next" ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/msq2.py#L45-L92
[ "def", "step", "(", "self", ",", "x", ",", "y", ")", ":", "up_left", "=", "self", ".", "solid", "(", "x", "-", "1", ",", "y", "-", "1", ")", "up_right", "=", "self", ".", "solid", "(", "x", ",", "y", "-", "1", ")", "down_left", "=", "self",...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
MarchingSquares.solid
Determine whether the pixel x,y is nonzero Parameters ---------- x, y : int The pixel of interest. Returns ------- solid : bool True if the pixel is not zero.
AegeanTools/msq2.py
def solid(self, x, y): """ Determine whether the pixel x,y is nonzero Parameters ---------- x, y : int The pixel of interest. Returns ------- solid : bool True if the pixel is not zero. """ if not(0 <= x < self.xsi...
def solid(self, x, y): """ Determine whether the pixel x,y is nonzero Parameters ---------- x, y : int The pixel of interest. Returns ------- solid : bool True if the pixel is not zero. """ if not(0 <= x < self.xsi...
[ "Determine", "whether", "the", "pixel", "x", "y", "is", "nonzero" ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/msq2.py#L94-L112
[ "def", "solid", "(", "self", ",", "x", ",", "y", ")", ":", "if", "not", "(", "0", "<=", "x", "<", "self", ".", "xsize", ")", "or", "not", "(", "0", "<=", "y", "<", "self", ".", "ysize", ")", ":", "return", "False", "if", "self", ".", "data"...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
MarchingSquares.walk_perimeter
Starting at a point on the perimeter of a region, 'walk' the perimeter to return to the starting point. Record the path taken. Parameters ---------- startx, starty : int The starting location. Assumed to be on the perimeter of a region. Returns ------- ...
AegeanTools/msq2.py
def walk_perimeter(self, startx, starty): """ Starting at a point on the perimeter of a region, 'walk' the perimeter to return to the starting point. Record the path taken. Parameters ---------- startx, starty : int The starting location. Assumed to be on the...
def walk_perimeter(self, startx, starty): """ Starting at a point on the perimeter of a region, 'walk' the perimeter to return to the starting point. Record the path taken. Parameters ---------- startx, starty : int The starting location. Assumed to be on the...
[ "Starting", "at", "a", "point", "on", "the", "perimeter", "of", "a", "region", "walk", "the", "perimeter", "to", "return", "to", "the", "starting", "point", ".", "Record", "the", "path", "taken", "." ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/msq2.py#L114-L157
[ "def", "walk_perimeter", "(", "self", ",", "startx", ",", "starty", ")", ":", "# checks", "startx", "=", "max", "(", "startx", ",", "0", ")", "startx", "=", "min", "(", "startx", ",", "self", ".", "xsize", ")", "starty", "=", "max", "(", "starty", ...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
MarchingSquares.do_march
March about and trace the outline of our object Returns ------- perimeter : list The pixels on the perimeter of the region [[x1, y1], ...]
AegeanTools/msq2.py
def do_march(self): """ March about and trace the outline of our object Returns ------- perimeter : list The pixels on the perimeter of the region [[x1, y1], ...] """ x, y = self.find_start_point() perimeter = self.walk_perimeter(x, y) ...
def do_march(self): """ March about and trace the outline of our object Returns ------- perimeter : list The pixels on the perimeter of the region [[x1, y1], ...] """ x, y = self.find_start_point() perimeter = self.walk_perimeter(x, y) ...
[ "March", "about", "and", "trace", "the", "outline", "of", "our", "object" ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/msq2.py#L159-L170
[ "def", "do_march", "(", "self", ")", ":", "x", ",", "y", "=", "self", ".", "find_start_point", "(", ")", "perimeter", "=", "self", ".", "walk_perimeter", "(", "x", ",", "y", ")", "return", "perimeter" ]
185d2b4a51b48441a1df747efc9a5271c79399fd
train
MarchingSquares._blank_within
Blank all the pixels within the given perimeter. Parameters ---------- perimeter : list The perimeter of the region.
AegeanTools/msq2.py
def _blank_within(self, perimeter): """ Blank all the pixels within the given perimeter. Parameters ---------- perimeter : list The perimeter of the region. """ # Method: # scan around the perimeter filling 'up' from each pixel # stop...
def _blank_within(self, perimeter): """ Blank all the pixels within the given perimeter. Parameters ---------- perimeter : list The perimeter of the region. """ # Method: # scan around the perimeter filling 'up' from each pixel # stop...
[ "Blank", "all", "the", "pixels", "within", "the", "given", "perimeter", "." ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/msq2.py#L172-L205
[ "def", "_blank_within", "(", "self", ",", "perimeter", ")", ":", "# Method:", "# scan around the perimeter filling 'up' from each pixel", "# stopping when we reach the other boundary", "for", "p", "in", "perimeter", ":", "# if we are on the edge of the data then there is nothing to f...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
MarchingSquares.do_march_all
Recursive march in the case that we have a fragmented shape. Returns ------- perimeters : [perimeter1, ...] The perimeters of all the regions in the image. See Also -------- :func:`AegeanTools.msq2.MarchingSquares.do_march`
AegeanTools/msq2.py
def do_march_all(self): """ Recursive march in the case that we have a fragmented shape. Returns ------- perimeters : [perimeter1, ...] The perimeters of all the regions in the image. See Also -------- :func:`AegeanTools.msq2.MarchingSquares.d...
def do_march_all(self): """ Recursive march in the case that we have a fragmented shape. Returns ------- perimeters : [perimeter1, ...] The perimeters of all the regions in the image. See Also -------- :func:`AegeanTools.msq2.MarchingSquares.d...
[ "Recursive", "march", "in", "the", "case", "that", "we", "have", "a", "fragmented", "shape", "." ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/msq2.py#L207-L236
[ "def", "do_march_all", "(", "self", ")", ":", "# copy the data since we are going to be modifying it", "data_copy", "=", "copy", "(", "self", ".", "data", ")", "# iterate through finding an island, creating a perimeter,", "# and then blanking the island", "perimeters", "=", "["...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
elliptical_gaussian
Generate a model 2d Gaussian with the given parameters. Evaluate this model at the given locations x,y. Parameters ---------- x, y : numeric or array-like locations at which to evaluate the gaussian amp : float Peak value. xo, yo : float Center of the gaussian. sx, s...
AegeanTools/fitting.py
def elliptical_gaussian(x, y, amp, xo, yo, sx, sy, theta): """ Generate a model 2d Gaussian with the given parameters. Evaluate this model at the given locations x,y. Parameters ---------- x, y : numeric or array-like locations at which to evaluate the gaussian amp : float P...
def elliptical_gaussian(x, y, amp, xo, yo, sx, sy, theta): """ Generate a model 2d Gaussian with the given parameters. Evaluate this model at the given locations x,y. Parameters ---------- x, y : numeric or array-like locations at which to evaluate the gaussian amp : float P...
[ "Generate", "a", "model", "2d", "Gaussian", "with", "the", "given", "parameters", ".", "Evaluate", "this", "model", "at", "the", "given", "locations", "x", "y", "." ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/fitting.py#L30-L63
[ "def", "elliptical_gaussian", "(", "x", ",", "y", ",", "amp", ",", "xo", ",", "yo", ",", "sx", ",", "sy", ",", "theta", ")", ":", "try", ":", "sint", ",", "cost", "=", "math", ".", "sin", "(", "np", ".", "radians", "(", "theta", ")", ")", ","...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
Cmatrix
Construct a correlation matrix corresponding to the data. The matrix assumes a gaussian correlation function. Parameters ---------- x, y : array-like locations at which to evaluate the correlation matirx sx, sy : float major/minor axes of the gaussian correlation function (sigmas) ...
AegeanTools/fitting.py
def Cmatrix(x, y, sx, sy, theta): """ Construct a correlation matrix corresponding to the data. The matrix assumes a gaussian correlation function. Parameters ---------- x, y : array-like locations at which to evaluate the correlation matirx sx, sy : float major/minor axes o...
def Cmatrix(x, y, sx, sy, theta): """ Construct a correlation matrix corresponding to the data. The matrix assumes a gaussian correlation function. Parameters ---------- x, y : array-like locations at which to evaluate the correlation matirx sx, sy : float major/minor axes o...
[ "Construct", "a", "correlation", "matrix", "corresponding", "to", "the", "data", ".", "The", "matrix", "assumes", "a", "gaussian", "correlation", "function", "." ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/fitting.py#L66-L87
[ "def", "Cmatrix", "(", "x", ",", "y", ",", "sx", ",", "sy", ",", "theta", ")", ":", "C", "=", "np", ".", "vstack", "(", "[", "elliptical_gaussian", "(", "x", ",", "y", ",", "1", ",", "i", ",", "j", ",", "sx", ",", "sy", ",", "theta", ")", ...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
Bmatrix
Calculate a matrix which is effectively the square root of the correlation matrix C Parameters ---------- C : 2d array A covariance matrix Returns ------- B : 2d array A matrix B such the B.dot(B') = inv(C)
AegeanTools/fitting.py
def Bmatrix(C): """ Calculate a matrix which is effectively the square root of the correlation matrix C Parameters ---------- C : 2d array A covariance matrix Returns ------- B : 2d array A matrix B such the B.dot(B') = inv(C) """ # this version of finding the ...
def Bmatrix(C): """ Calculate a matrix which is effectively the square root of the correlation matrix C Parameters ---------- C : 2d array A covariance matrix Returns ------- B : 2d array A matrix B such the B.dot(B') = inv(C) """ # this version of finding the ...
[ "Calculate", "a", "matrix", "which", "is", "effectively", "the", "square", "root", "of", "the", "correlation", "matrix", "C" ]
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/fitting.py#L90-L113
[ "def", "Bmatrix", "(", "C", ")", ":", "# this version of finding the square root of the inverse matrix", "# suggested by Cath Trott", "L", ",", "Q", "=", "eigh", "(", "C", ")", "# force very small eigenvalues to have some minimum non-zero value", "minL", "=", "1e-9", "*", "...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
jacobian
Analytical calculation of the Jacobian for an elliptical gaussian Will work for a model that contains multiple Gaussians, and for which some components are not being fit (don't vary). Parameters ---------- pars : lmfit.Model The model parameters x, y : list Locations at which th...
AegeanTools/fitting.py
def jacobian(pars, x, y): """ Analytical calculation of the Jacobian for an elliptical gaussian Will work for a model that contains multiple Gaussians, and for which some components are not being fit (don't vary). Parameters ---------- pars : lmfit.Model The model parameters x, ...
def jacobian(pars, x, y): """ Analytical calculation of the Jacobian for an elliptical gaussian Will work for a model that contains multiple Gaussians, and for which some components are not being fit (don't vary). Parameters ---------- pars : lmfit.Model The model parameters x, ...
[ "Analytical", "calculation", "of", "the", "Jacobian", "for", "an", "elliptical", "gaussian", "Will", "work", "for", "a", "model", "that", "contains", "multiple", "Gaussians", "and", "for", "which", "some", "components", "are", "not", "being", "fit", "(", "don"...
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/fitting.py#L116-L188
[ "def", "jacobian", "(", "pars", ",", "x", ",", "y", ")", ":", "matrix", "=", "[", "]", "for", "i", "in", "range", "(", "pars", "[", "'components'", "]", ".", "value", ")", ":", "prefix", "=", "\"c{0}_\"", ".", "format", "(", "i", ")", "amp", "=...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
lmfit_jacobian
Wrapper around :func:`AegeanTools.fitting.jacobian` and :func:`AegeanTools.fitting.emp_jacobian` which gives the output in a format that is required for lmfit. Parameters ---------- pars : lmfit.Model The model parameters x, y : list Locations at which the jacobian is being evaluat...
AegeanTools/fitting.py
def lmfit_jacobian(pars, x, y, errs=None, B=None, emp=False): """ Wrapper around :func:`AegeanTools.fitting.jacobian` and :func:`AegeanTools.fitting.emp_jacobian` which gives the output in a format that is required for lmfit. Parameters ---------- pars : lmfit.Model The model parameters...
def lmfit_jacobian(pars, x, y, errs=None, B=None, emp=False): """ Wrapper around :func:`AegeanTools.fitting.jacobian` and :func:`AegeanTools.fitting.emp_jacobian` which gives the output in a format that is required for lmfit. Parameters ---------- pars : lmfit.Model The model parameters...
[ "Wrapper", "around", ":", "func", ":", "AegeanTools", ".", "fitting", ".", "jacobian", "and", ":", "func", ":", "AegeanTools", ".", "fitting", ".", "emp_jacobian", "which", "gives", "the", "output", "in", "a", "format", "that", "is", "required", "for", "lm...
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/fitting.py#L228-L279
[ "def", "lmfit_jacobian", "(", "pars", ",", "x", ",", "y", ",", "errs", "=", "None", ",", "B", "=", "None", ",", "emp", "=", "False", ")", ":", "if", "emp", ":", "matrix", "=", "emp_jacobian", "(", "pars", ",", "x", ",", "y", ")", "else", ":", ...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
hessian
Create a hessian matrix corresponding to the source model 'pars' Only parameters that vary will contribute to the hessian. Thus there will be a total of nvar x nvar entries, each of which is a len(x) x len(y) array. Parameters ---------- pars : lmfit.Parameters The model x, y : list...
AegeanTools/fitting.py
def hessian(pars, x, y): """ Create a hessian matrix corresponding to the source model 'pars' Only parameters that vary will contribute to the hessian. Thus there will be a total of nvar x nvar entries, each of which is a len(x) x len(y) array. Parameters ---------- pars : lmfit.Paramet...
def hessian(pars, x, y): """ Create a hessian matrix corresponding to the source model 'pars' Only parameters that vary will contribute to the hessian. Thus there will be a total of nvar x nvar entries, each of which is a len(x) x len(y) array. Parameters ---------- pars : lmfit.Paramet...
[ "Create", "a", "hessian", "matrix", "corresponding", "to", "the", "source", "model", "pars", "Only", "parameters", "that", "vary", "will", "contribute", "to", "the", "hessian", ".", "Thus", "there", "will", "be", "a", "total", "of", "nvar", "x", "nvar", "e...
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/fitting.py#L282-L572
[ "def", "hessian", "(", "pars", ",", "x", ",", "y", ")", ":", "j", "=", "0", "# keeping track of the number of variable parameters", "# total number of variable parameters", "ntvar", "=", "np", ".", "sum", "(", "[", "pars", "[", "k", "]", ".", "vary", "for", ...
185d2b4a51b48441a1df747efc9a5271c79399fd
train
emp_hessian
Calculate the hessian matrix empirically. Create a hessian matrix corresponding to the source model 'pars' Only parameters that vary will contribute to the hessian. Thus there will be a total of nvar x nvar entries, each of which is a len(x) x len(y) array. Parameters ---------- pars : lmfi...
AegeanTools/fitting.py
def emp_hessian(pars, x, y): """ Calculate the hessian matrix empirically. Create a hessian matrix corresponding to the source model 'pars' Only parameters that vary will contribute to the hessian. Thus there will be a total of nvar x nvar entries, each of which is a len(x) x len(y) array. ...
def emp_hessian(pars, x, y): """ Calculate the hessian matrix empirically. Create a hessian matrix corresponding to the source model 'pars' Only parameters that vary will contribute to the hessian. Thus there will be a total of nvar x nvar entries, each of which is a len(x) x len(y) array. ...
[ "Calculate", "the", "hessian", "matrix", "empirically", ".", "Create", "a", "hessian", "matrix", "corresponding", "to", "the", "source", "model", "pars", "Only", "parameters", "that", "vary", "will", "contribute", "to", "the", "hessian", ".", "Thus", "there", ...
PaulHancock/Aegean
python
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/fitting.py#L575-L615
[ "def", "emp_hessian", "(", "pars", ",", "x", ",", "y", ")", ":", "eps", "=", "1e-5", "matrix", "=", "[", "]", "for", "i", "in", "range", "(", "pars", "[", "'components'", "]", ".", "value", ")", ":", "model", "=", "emp_jacobian", "(", "pars", ","...
185d2b4a51b48441a1df747efc9a5271c79399fd