repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
listlengths
20
707
docstring
stringlengths
3
17.3k
docstring_tokens
listlengths
3
222
sha
stringlengths
40
40
url
stringlengths
87
242
partition
stringclasses
1 value
idx
int64
0
252k
troeger/opensubmit
web/opensubmit/models/submission.py
Submission.can_reupload
def can_reupload(self, user=None): """Determines whether a submission can be re-uploaded. Returns a boolean value. Requires: can_modify. Re-uploads are allowed only when test executions have failed.""" # Re-uploads are allowed only when test executions have failed. if ...
python
def can_reupload(self, user=None): """Determines whether a submission can be re-uploaded. Returns a boolean value. Requires: can_modify. Re-uploads are allowed only when test executions have failed.""" # Re-uploads are allowed only when test executions have failed. if ...
[ "def", "can_reupload", "(", "self", ",", "user", "=", "None", ")", ":", "# Re-uploads are allowed only when test executions have failed.", "if", "self", ".", "state", "not", "in", "(", "self", ".", "TEST_VALIDITY_FAILED", ",", "self", ".", "TEST_FULL_FAILED", ")", ...
Determines whether a submission can be re-uploaded. Returns a boolean value. Requires: can_modify. Re-uploads are allowed only when test executions have failed.
[ "Determines", "whether", "a", "submission", "can", "be", "re", "-", "uploaded", ".", "Returns", "a", "boolean", "value", "." ]
384a95b7c6fa41e3f949a129d25dafd9a1c54859
https://github.com/troeger/opensubmit/blob/384a95b7c6fa41e3f949a129d25dafd9a1c54859/web/opensubmit/models/submission.py#L431-L447
train
64,200
troeger/opensubmit
web/opensubmit/models/submission.py
Submission.get_initial_state
def get_initial_state(self): ''' Return first state for this submission after upload, which depends on the kind of assignment. ''' if not self.assignment.attachment_is_tested(): return Submission.SUBMITTED else: if self.assignment.attachmen...
python
def get_initial_state(self): ''' Return first state for this submission after upload, which depends on the kind of assignment. ''' if not self.assignment.attachment_is_tested(): return Submission.SUBMITTED else: if self.assignment.attachmen...
[ "def", "get_initial_state", "(", "self", ")", ":", "if", "not", "self", ".", "assignment", ".", "attachment_is_tested", "(", ")", ":", "return", "Submission", ".", "SUBMITTED", "else", ":", "if", "self", ".", "assignment", ".", "attachment_test_validity", ":",...
Return first state for this submission after upload, which depends on the kind of assignment.
[ "Return", "first", "state", "for", "this", "submission", "after", "upload", "which", "depends", "on", "the", "kind", "of", "assignment", "." ]
384a95b7c6fa41e3f949a129d25dafd9a1c54859
https://github.com/troeger/opensubmit/blob/384a95b7c6fa41e3f949a129d25dafd9a1c54859/web/opensubmit/models/submission.py#L473-L484
train
64,201
troeger/opensubmit
web/opensubmit/models/submission.py
Submission.info_file
def info_file(self, delete=True): ''' Prepares an open temporary file with information about the submission. Closing it will delete it, which must be considered by the caller. This file is not readable, since the tempfile library wants either readable or writable files. ...
python
def info_file(self, delete=True): ''' Prepares an open temporary file with information about the submission. Closing it will delete it, which must be considered by the caller. This file is not readable, since the tempfile library wants either readable or writable files. ...
[ "def", "info_file", "(", "self", ",", "delete", "=", "True", ")", ":", "info", "=", "tempfile", ".", "NamedTemporaryFile", "(", "mode", "=", "'wt'", ",", "encoding", "=", "'utf-8'", ",", "delete", "=", "delete", ")", "info", ".", "write", "(", "\"Submi...
Prepares an open temporary file with information about the submission. Closing it will delete it, which must be considered by the caller. This file is not readable, since the tempfile library wants either readable or writable files.
[ "Prepares", "an", "open", "temporary", "file", "with", "information", "about", "the", "submission", ".", "Closing", "it", "will", "delete", "it", "which", "must", "be", "considered", "by", "the", "caller", ".", "This", "file", "is", "not", "readable", "since...
384a95b7c6fa41e3f949a129d25dafd9a1c54859
https://github.com/troeger/opensubmit/blob/384a95b7c6fa41e3f949a129d25dafd9a1c54859/web/opensubmit/models/submission.py#L561-L588
train
64,202
troeger/opensubmit
web/opensubmit/models/submission.py
Submission.copy_file_upload
def copy_file_upload(self, targetdir): ''' Copies the currently valid file upload into the given directory. If possible, the content is un-archived in the target directory. ''' assert(self.file_upload) # unpack student data to temporary directory # os.chro...
python
def copy_file_upload(self, targetdir): ''' Copies the currently valid file upload into the given directory. If possible, the content is un-archived in the target directory. ''' assert(self.file_upload) # unpack student data to temporary directory # os.chro...
[ "def", "copy_file_upload", "(", "self", ",", "targetdir", ")", ":", "assert", "(", "self", ".", "file_upload", ")", "# unpack student data to temporary directory", "# os.chroot is not working with tarfile support", "tempdir", "=", "tempfile", ".", "mkdtemp", "(", ")", "...
Copies the currently valid file upload into the given directory. If possible, the content is un-archived in the target directory.
[ "Copies", "the", "currently", "valid", "file", "upload", "into", "the", "given", "directory", ".", "If", "possible", "the", "content", "is", "un", "-", "archived", "in", "the", "target", "directory", "." ]
384a95b7c6fa41e3f949a129d25dafd9a1c54859
https://github.com/troeger/opensubmit/blob/384a95b7c6fa41e3f949a129d25dafd9a1c54859/web/opensubmit/models/submission.py#L590-L619
train
64,203
idlesign/django-sitemessage
sitemessage/messengers/telegram.py
TelegramMessenger._send_command
def _send_command(self, method_name, data=None): """Sends a command to API. :param str method_name: :param dict data: :return: """ try: response = self.lib.post(self._tpl_url % {'token': self.auth_token, 'method': method_name}, data=data) json = r...
python
def _send_command(self, method_name, data=None): """Sends a command to API. :param str method_name: :param dict data: :return: """ try: response = self.lib.post(self._tpl_url % {'token': self.auth_token, 'method': method_name}, data=data) json = r...
[ "def", "_send_command", "(", "self", ",", "method_name", ",", "data", "=", "None", ")", ":", "try", ":", "response", "=", "self", ".", "lib", ".", "post", "(", "self", ".", "_tpl_url", "%", "{", "'token'", ":", "self", ".", "auth_token", ",", "'metho...
Sends a command to API. :param str method_name: :param dict data: :return:
[ "Sends", "a", "command", "to", "API", "." ]
25b179b798370354c5988042ec209e255d23793f
https://github.com/idlesign/django-sitemessage/blob/25b179b798370354c5988042ec209e255d23793f/sitemessage/messengers/telegram.py#L85-L102
train
64,204
troeger/opensubmit
web/opensubmit/admin/submissionfile.py
SubmissionFileAdmin.get_queryset
def get_queryset(self, request): ''' Restrict the listed submission files for the current user.''' qs = super(SubmissionFileAdmin, self).get_queryset(request) if request.user.is_superuser: return qs else: return qs.filter(Q(submissions__assignment__course__tutors_...
python
def get_queryset(self, request): ''' Restrict the listed submission files for the current user.''' qs = super(SubmissionFileAdmin, self).get_queryset(request) if request.user.is_superuser: return qs else: return qs.filter(Q(submissions__assignment__course__tutors_...
[ "def", "get_queryset", "(", "self", ",", "request", ")", ":", "qs", "=", "super", "(", "SubmissionFileAdmin", ",", "self", ")", ".", "get_queryset", "(", "request", ")", "if", "request", ".", "user", ".", "is_superuser", ":", "return", "qs", "else", ":",...
Restrict the listed submission files for the current user.
[ "Restrict", "the", "listed", "submission", "files", "for", "the", "current", "user", "." ]
384a95b7c6fa41e3f949a129d25dafd9a1c54859
https://github.com/troeger/opensubmit/blob/384a95b7c6fa41e3f949a129d25dafd9a1c54859/web/opensubmit/admin/submissionfile.py#L22-L28
train
64,205
idlesign/django-sitemessage
sitemessage/messages/__init__.py
register_builtin_message_types
def register_builtin_message_types(): """Registers the built-in message types.""" from .plain import PlainTextMessage from .email import EmailTextMessage, EmailHtmlMessage register_message_types(PlainTextMessage, EmailTextMessage, EmailHtmlMessage)
python
def register_builtin_message_types(): """Registers the built-in message types.""" from .plain import PlainTextMessage from .email import EmailTextMessage, EmailHtmlMessage register_message_types(PlainTextMessage, EmailTextMessage, EmailHtmlMessage)
[ "def", "register_builtin_message_types", "(", ")", ":", "from", ".", "plain", "import", "PlainTextMessage", "from", ".", "email", "import", "EmailTextMessage", ",", "EmailHtmlMessage", "register_message_types", "(", "PlainTextMessage", ",", "EmailTextMessage", ",", "Ema...
Registers the built-in message types.
[ "Registers", "the", "built", "-", "in", "message", "types", "." ]
25b179b798370354c5988042ec209e255d23793f
https://github.com/idlesign/django-sitemessage/blob/25b179b798370354c5988042ec209e255d23793f/sitemessage/messages/__init__.py#L4-L8
train
64,206
troeger/opensubmit
web/opensubmit/admin/assignment.py
view_links
def view_links(obj): ''' Link to performance data and duplicate overview.''' result=format_html('') result+=format_html('<a href="%s" style="white-space: nowrap">Show duplicates</a><br/>'%reverse('duplicates', args=(obj.pk,))) result+=format_html('<a href="%s" style="white-space: nowrap">Show submission...
python
def view_links(obj): ''' Link to performance data and duplicate overview.''' result=format_html('') result+=format_html('<a href="%s" style="white-space: nowrap">Show duplicates</a><br/>'%reverse('duplicates', args=(obj.pk,))) result+=format_html('<a href="%s" style="white-space: nowrap">Show submission...
[ "def", "view_links", "(", "obj", ")", ":", "result", "=", "format_html", "(", "''", ")", "result", "+=", "format_html", "(", "'<a href=\"%s\" style=\"white-space: nowrap\">Show duplicates</a><br/>'", "%", "reverse", "(", "'duplicates'", ",", "args", "=", "(", "obj",...
Link to performance data and duplicate overview.
[ "Link", "to", "performance", "data", "and", "duplicate", "overview", "." ]
384a95b7c6fa41e3f949a129d25dafd9a1c54859
https://github.com/troeger/opensubmit/blob/384a95b7c6fa41e3f949a129d25dafd9a1c54859/web/opensubmit/admin/assignment.py#L117-L123
train
64,207
troeger/opensubmit
web/opensubmit/admin/assignment.py
AssignmentAdminForm.clean
def clean(self): ''' Check if such an assignment configuration makes sense, and reject it otherwise. This mainly relates to interdependencies between the different fields, since single field constraints are already clatified by the Django model configuration. ''' ...
python
def clean(self): ''' Check if such an assignment configuration makes sense, and reject it otherwise. This mainly relates to interdependencies between the different fields, since single field constraints are already clatified by the Django model configuration. ''' ...
[ "def", "clean", "(", "self", ")", ":", "super", "(", "AssignmentAdminForm", ",", "self", ")", ".", "clean", "(", ")", "d", "=", "defaultdict", "(", "lambda", ":", "False", ")", "d", ".", "update", "(", "self", ".", "cleaned_data", ")", "# Having valida...
Check if such an assignment configuration makes sense, and reject it otherwise. This mainly relates to interdependencies between the different fields, since single field constraints are already clatified by the Django model configuration.
[ "Check", "if", "such", "an", "assignment", "configuration", "makes", "sense", "and", "reject", "it", "otherwise", ".", "This", "mainly", "relates", "to", "interdependencies", "between", "the", "different", "fields", "since", "single", "field", "constraints", "are"...
384a95b7c6fa41e3f949a129d25dafd9a1c54859
https://github.com/troeger/opensubmit/blob/384a95b7c6fa41e3f949a129d25dafd9a1c54859/web/opensubmit/admin/assignment.py#L66-L93
train
64,208
troeger/opensubmit
web/opensubmit/admin/assignment.py
AssignmentAdmin.get_queryset
def get_queryset(self, request): ''' Restrict the listed assignments for the current user.''' qs = super(AssignmentAdmin, self).get_queryset(request) if not request.user.is_superuser: qs = qs.filter(course__active=True).filter(Q(course__tutors__pk=request.user.pk) | Q(course__owner=r...
python
def get_queryset(self, request): ''' Restrict the listed assignments for the current user.''' qs = super(AssignmentAdmin, self).get_queryset(request) if not request.user.is_superuser: qs = qs.filter(course__active=True).filter(Q(course__tutors__pk=request.user.pk) | Q(course__owner=r...
[ "def", "get_queryset", "(", "self", ",", "request", ")", ":", "qs", "=", "super", "(", "AssignmentAdmin", ",", "self", ")", ".", "get_queryset", "(", "request", ")", "if", "not", "request", ".", "user", ".", "is_superuser", ":", "qs", "=", "qs", ".", ...
Restrict the listed assignments for the current user.
[ "Restrict", "the", "listed", "assignments", "for", "the", "current", "user", "." ]
384a95b7c6fa41e3f949a129d25dafd9a1c54859
https://github.com/troeger/opensubmit/blob/384a95b7c6fa41e3f949a129d25dafd9a1c54859/web/opensubmit/admin/assignment.py#L150-L155
train
64,209
troeger/opensubmit
web/opensubmit/social/env.py
ServerEnvAuth.get_user_details
def get_user_details(self, response): """ Complete with additional information from environment, as available. """ result = { 'username': response[self.ENV_USERNAME], 'email': response.get(self.ENV_EMAIL, None), 'first_name': response.get(self.ENV_FIRST_NAME, None), ...
python
def get_user_details(self, response): """ Complete with additional information from environment, as available. """ result = { 'username': response[self.ENV_USERNAME], 'email': response.get(self.ENV_EMAIL, None), 'first_name': response.get(self.ENV_FIRST_NAME, None), ...
[ "def", "get_user_details", "(", "self", ",", "response", ")", ":", "result", "=", "{", "'username'", ":", "response", "[", "self", ".", "ENV_USERNAME", "]", ",", "'email'", ":", "response", ".", "get", "(", "self", ".", "ENV_EMAIL", ",", "None", ")", "...
Complete with additional information from environment, as available.
[ "Complete", "with", "additional", "information", "from", "environment", "as", "available", "." ]
384a95b7c6fa41e3f949a129d25dafd9a1c54859
https://github.com/troeger/opensubmit/blob/384a95b7c6fa41e3f949a129d25dafd9a1c54859/web/opensubmit/social/env.py#L47-L58
train
64,210
troeger/opensubmit
web/opensubmit/admin/submission.py
SubmissionAdmin.file_link
def file_link(self, instance): ''' Renders the link to the student upload file. ''' sfile = instance.file_upload if not sfile: return mark_safe('No file submitted by student.') else: return mark_safe('<a href="%s">%s</a><br/>(<a href="%s" targe...
python
def file_link(self, instance): ''' Renders the link to the student upload file. ''' sfile = instance.file_upload if not sfile: return mark_safe('No file submitted by student.') else: return mark_safe('<a href="%s">%s</a><br/>(<a href="%s" targe...
[ "def", "file_link", "(", "self", ",", "instance", ")", ":", "sfile", "=", "instance", ".", "file_upload", "if", "not", "sfile", ":", "return", "mark_safe", "(", "'No file submitted by student.'", ")", "else", ":", "return", "mark_safe", "(", "'<a href=\"%s\">%s<...
Renders the link to the student upload file.
[ "Renders", "the", "link", "to", "the", "student", "upload", "file", "." ]
384a95b7c6fa41e3f949a129d25dafd9a1c54859
https://github.com/troeger/opensubmit/blob/384a95b7c6fa41e3f949a129d25dafd9a1c54859/web/opensubmit/admin/submission.py#L153-L161
train
64,211
troeger/opensubmit
web/opensubmit/admin/submission.py
SubmissionAdmin.get_queryset
def get_queryset(self, request): ''' Restrict the listed submission for the current user.''' qs = super(SubmissionAdmin, self).get_queryset(request) if request.user.is_superuser: return qs else: return qs.filter(Q(assignment__course__tutors__pk=request.user.pk) | ...
python
def get_queryset(self, request): ''' Restrict the listed submission for the current user.''' qs = super(SubmissionAdmin, self).get_queryset(request) if request.user.is_superuser: return qs else: return qs.filter(Q(assignment__course__tutors__pk=request.user.pk) | ...
[ "def", "get_queryset", "(", "self", ",", "request", ")", ":", "qs", "=", "super", "(", "SubmissionAdmin", ",", "self", ")", ".", "get_queryset", "(", "request", ")", "if", "request", ".", "user", ".", "is_superuser", ":", "return", "qs", "else", ":", "...
Restrict the listed submission for the current user.
[ "Restrict", "the", "listed", "submission", "for", "the", "current", "user", "." ]
384a95b7c6fa41e3f949a129d25dafd9a1c54859
https://github.com/troeger/opensubmit/blob/384a95b7c6fa41e3f949a129d25dafd9a1c54859/web/opensubmit/admin/submission.py#L202-L208
train
64,212
troeger/opensubmit
web/opensubmit/admin/submission.py
SubmissionAdmin.formfield_for_dbfield
def formfield_for_dbfield(self, db_field, **kwargs): ''' Offer grading choices from the assignment definition as potential form field values for 'grading'. When no object is given in the form, the this is a new manual submission ''' if db_field.name == "grading": ...
python
def formfield_for_dbfield(self, db_field, **kwargs): ''' Offer grading choices from the assignment definition as potential form field values for 'grading'. When no object is given in the form, the this is a new manual submission ''' if db_field.name == "grading": ...
[ "def", "formfield_for_dbfield", "(", "self", ",", "db_field", ",", "*", "*", "kwargs", ")", ":", "if", "db_field", ".", "name", "==", "\"grading\"", ":", "submurl", "=", "kwargs", "[", "'request'", "]", ".", "path", "try", ":", "# Does not work on new submis...
Offer grading choices from the assignment definition as potential form field values for 'grading'. When no object is given in the form, the this is a new manual submission
[ "Offer", "grading", "choices", "from", "the", "assignment", "definition", "as", "potential", "form", "field", "values", "for", "grading", ".", "When", "no", "object", "is", "given", "in", "the", "form", "the", "this", "is", "a", "new", "manual", "submission"...
384a95b7c6fa41e3f949a129d25dafd9a1c54859
https://github.com/troeger/opensubmit/blob/384a95b7c6fa41e3f949a129d25dafd9a1c54859/web/opensubmit/admin/submission.py#L224-L238
train
64,213
troeger/opensubmit
web/opensubmit/admin/submission.py
SubmissionAdmin.save_model
def save_model(self, request, obj, form, change): ''' Our custom addition to the view adds an easy radio button choice for the new state. This is meant to be for tutors. We need to peel this choice from the form data and set the state accordingly. The radio buttons have no de...
python
def save_model(self, request, obj, form, change): ''' Our custom addition to the view adds an easy radio button choice for the new state. This is meant to be for tutors. We need to peel this choice from the form data and set the state accordingly. The radio buttons have no de...
[ "def", "save_model", "(", "self", ",", "request", ",", "obj", ",", "form", ",", "change", ")", ":", "if", "'newstate'", "in", "request", ".", "POST", ":", "if", "request", ".", "POST", "[", "'newstate'", "]", "==", "'finished'", ":", "obj", ".", "sta...
Our custom addition to the view adds an easy radio button choice for the new state. This is meant to be for tutors. We need to peel this choice from the form data and set the state accordingly. The radio buttons have no default, so that we can keep the existing state if t...
[ "Our", "custom", "addition", "to", "the", "view", "adds", "an", "easy", "radio", "button", "choice", "for", "the", "new", "state", ".", "This", "is", "meant", "to", "be", "for", "tutors", ".", "We", "need", "to", "peel", "this", "choice", "from", "the"...
384a95b7c6fa41e3f949a129d25dafd9a1c54859
https://github.com/troeger/opensubmit/blob/384a95b7c6fa41e3f949a129d25dafd9a1c54859/web/opensubmit/admin/submission.py#L240-L253
train
64,214
troeger/opensubmit
web/opensubmit/admin/submission.py
SubmissionAdmin.setGradingNotFinishedStateAction
def setGradingNotFinishedStateAction(self, request, queryset): ''' Set all marked submissions to "grading not finished". This is intended to support grading corrections on a larger scale. ''' for subm in queryset: subm.state = Submission.GRADING_IN_PROGRESS ...
python
def setGradingNotFinishedStateAction(self, request, queryset): ''' Set all marked submissions to "grading not finished". This is intended to support grading corrections on a larger scale. ''' for subm in queryset: subm.state = Submission.GRADING_IN_PROGRESS ...
[ "def", "setGradingNotFinishedStateAction", "(", "self", ",", "request", ",", "queryset", ")", ":", "for", "subm", "in", "queryset", ":", "subm", ".", "state", "=", "Submission", ".", "GRADING_IN_PROGRESS", "subm", ".", "save", "(", ")" ]
Set all marked submissions to "grading not finished". This is intended to support grading corrections on a larger scale.
[ "Set", "all", "marked", "submissions", "to", "grading", "not", "finished", ".", "This", "is", "intended", "to", "support", "grading", "corrections", "on", "a", "larger", "scale", "." ]
384a95b7c6fa41e3f949a129d25dafd9a1c54859
https://github.com/troeger/opensubmit/blob/384a95b7c6fa41e3f949a129d25dafd9a1c54859/web/opensubmit/admin/submission.py#L261-L268
train
64,215
troeger/opensubmit
web/opensubmit/admin/submission.py
SubmissionAdmin.setGradingFinishedStateAction
def setGradingFinishedStateAction(self, request, queryset): ''' Set all marked submissions to "grading finished". This is intended to support grading corrections on a larger scale. ''' for subm in queryset: subm.state = Submission.GRADED subm.save(...
python
def setGradingFinishedStateAction(self, request, queryset): ''' Set all marked submissions to "grading finished". This is intended to support grading corrections on a larger scale. ''' for subm in queryset: subm.state = Submission.GRADED subm.save(...
[ "def", "setGradingFinishedStateAction", "(", "self", ",", "request", ",", "queryset", ")", ":", "for", "subm", "in", "queryset", ":", "subm", ".", "state", "=", "Submission", ".", "GRADED", "subm", ".", "save", "(", ")" ]
Set all marked submissions to "grading finished". This is intended to support grading corrections on a larger scale.
[ "Set", "all", "marked", "submissions", "to", "grading", "finished", ".", "This", "is", "intended", "to", "support", "grading", "corrections", "on", "a", "larger", "scale", "." ]
384a95b7c6fa41e3f949a129d25dafd9a1c54859
https://github.com/troeger/opensubmit/blob/384a95b7c6fa41e3f949a129d25dafd9a1c54859/web/opensubmit/admin/submission.py#L271-L278
train
64,216
troeger/opensubmit
web/opensubmit/admin/submission.py
SubmissionAdmin.closeAndNotifyAction
def closeAndNotifyAction(self, request, queryset): ''' Close all submissions were the tutor sayed that the grading is finished, and inform the student. CLosing only graded submissions is a safeguard, since backend users tend to checkbox-mark all submissions without thinking. ''' ...
python
def closeAndNotifyAction(self, request, queryset): ''' Close all submissions were the tutor sayed that the grading is finished, and inform the student. CLosing only graded submissions is a safeguard, since backend users tend to checkbox-mark all submissions without thinking. ''' ...
[ "def", "closeAndNotifyAction", "(", "self", ",", "request", ",", "queryset", ")", ":", "mails", "=", "[", "]", "qs", "=", "queryset", ".", "filter", "(", "Q", "(", "state", "=", "Submission", ".", "GRADED", ")", ")", "for", "subm", "in", "qs", ":", ...
Close all submissions were the tutor sayed that the grading is finished, and inform the student. CLosing only graded submissions is a safeguard, since backend users tend to checkbox-mark all submissions without thinking.
[ "Close", "all", "submissions", "were", "the", "tutor", "sayed", "that", "the", "grading", "is", "finished", "and", "inform", "the", "student", ".", "CLosing", "only", "graded", "submissions", "is", "a", "safeguard", "since", "backend", "users", "tend", "to", ...
384a95b7c6fa41e3f949a129d25dafd9a1c54859
https://github.com/troeger/opensubmit/blob/384a95b7c6fa41e3f949a129d25dafd9a1c54859/web/opensubmit/admin/submission.py#L304-L320
train
64,217
troeger/opensubmit
web/opensubmit/admin/submission.py
SubmissionAdmin.downloadArchiveAction
def downloadArchiveAction(self, request, queryset): ''' Download selected submissions as archive, for targeted correction. ''' output = io.BytesIO() z = zipfile.ZipFile(output, 'w') for sub in queryset: sub.add_to_zipfile(z) z.close() # go ba...
python
def downloadArchiveAction(self, request, queryset): ''' Download selected submissions as archive, for targeted correction. ''' output = io.BytesIO() z = zipfile.ZipFile(output, 'w') for sub in queryset: sub.add_to_zipfile(z) z.close() # go ba...
[ "def", "downloadArchiveAction", "(", "self", ",", "request", ",", "queryset", ")", ":", "output", "=", "io", ".", "BytesIO", "(", ")", "z", "=", "zipfile", ".", "ZipFile", "(", "output", ",", "'w'", ")", "for", "sub", "in", "queryset", ":", "sub", "....
Download selected submissions as archive, for targeted correction.
[ "Download", "selected", "submissions", "as", "archive", "for", "targeted", "correction", "." ]
384a95b7c6fa41e3f949a129d25dafd9a1c54859
https://github.com/troeger/opensubmit/blob/384a95b7c6fa41e3f949a129d25dafd9a1c54859/web/opensubmit/admin/submission.py#L332-L348
train
64,218
troeger/opensubmit
web/opensubmit/models/assignment.py
Assignment.directory_name_with_course
def directory_name_with_course(self): ''' The assignment name in a format that is suitable for a directory name. ''' coursename = self.course.directory_name() assignmentname = self.title.replace(" ", "_").replace("\\", "_").replace(",","").lower() return coursename + os.sep + assignment...
python
def directory_name_with_course(self): ''' The assignment name in a format that is suitable for a directory name. ''' coursename = self.course.directory_name() assignmentname = self.title.replace(" ", "_").replace("\\", "_").replace(",","").lower() return coursename + os.sep + assignment...
[ "def", "directory_name_with_course", "(", "self", ")", ":", "coursename", "=", "self", ".", "course", ".", "directory_name", "(", ")", "assignmentname", "=", "self", ".", "title", ".", "replace", "(", "\" \"", ",", "\"_\"", ")", ".", "replace", "(", "\"\\\...
The assignment name in a format that is suitable for a directory name.
[ "The", "assignment", "name", "in", "a", "format", "that", "is", "suitable", "for", "a", "directory", "name", "." ]
384a95b7c6fa41e3f949a129d25dafd9a1c54859
https://github.com/troeger/opensubmit/blob/384a95b7c6fa41e3f949a129d25dafd9a1c54859/web/opensubmit/models/assignment.py#L49-L53
train
64,219
troeger/opensubmit
web/opensubmit/models/assignment.py
Assignment.grading_url
def grading_url(self): ''' Determines the teacher backend link to the filtered list of gradable submissions for this assignment. ''' grading_url="%s?coursefilter=%u&assignmentfilter=%u&statefilter=tobegraded"%( reverse('teacher:opensubmit_submission_change...
python
def grading_url(self): ''' Determines the teacher backend link to the filtered list of gradable submissions for this assignment. ''' grading_url="%s?coursefilter=%u&assignmentfilter=%u&statefilter=tobegraded"%( reverse('teacher:opensubmit_submission_change...
[ "def", "grading_url", "(", "self", ")", ":", "grading_url", "=", "\"%s?coursefilter=%u&assignmentfilter=%u&statefilter=tobegraded\"", "%", "(", "reverse", "(", "'teacher:opensubmit_submission_changelist'", ")", ",", "self", ".", "course", ".", "pk", ",", "self", ".", ...
Determines the teacher backend link to the filtered list of gradable submissions for this assignment.
[ "Determines", "the", "teacher", "backend", "link", "to", "the", "filtered", "list", "of", "gradable", "submissions", "for", "this", "assignment", "." ]
384a95b7c6fa41e3f949a129d25dafd9a1c54859
https://github.com/troeger/opensubmit/blob/384a95b7c6fa41e3f949a129d25dafd9a1c54859/web/opensubmit/models/assignment.py#L69-L77
train
64,220
troeger/opensubmit
web/opensubmit/models/assignment.py
Assignment.has_perf_results
def has_perf_results(self): ''' Figure out if any submission for this assignment has performance data being available. ''' num_results = SubmissionTestResult.objects.filter(perf_data__isnull=False).filter(submission_file__submissions__assignment=self).count() return num_resul...
python
def has_perf_results(self): ''' Figure out if any submission for this assignment has performance data being available. ''' num_results = SubmissionTestResult.objects.filter(perf_data__isnull=False).filter(submission_file__submissions__assignment=self).count() return num_resul...
[ "def", "has_perf_results", "(", "self", ")", ":", "num_results", "=", "SubmissionTestResult", ".", "objects", ".", "filter", "(", "perf_data__isnull", "=", "False", ")", ".", "filter", "(", "submission_file__submissions__assignment", "=", "self", ")", ".", "count"...
Figure out if any submission for this assignment has performance data being available.
[ "Figure", "out", "if", "any", "submission", "for", "this", "assignment", "has", "performance", "data", "being", "available", "." ]
384a95b7c6fa41e3f949a129d25dafd9a1c54859
https://github.com/troeger/opensubmit/blob/384a95b7c6fa41e3f949a129d25dafd9a1c54859/web/opensubmit/models/assignment.py#L87-L92
train
64,221
troeger/opensubmit
web/opensubmit/models/assignment.py
Assignment.url
def url(self, request): ''' Return absolute URL for assignment description. ''' if self.pk: if self.has_description(): return request.build_absolute_uri(reverse('assignment_description_file', args=[self.pk])) else: return self.d...
python
def url(self, request): ''' Return absolute URL for assignment description. ''' if self.pk: if self.has_description(): return request.build_absolute_uri(reverse('assignment_description_file', args=[self.pk])) else: return self.d...
[ "def", "url", "(", "self", ",", "request", ")", ":", "if", "self", ".", "pk", ":", "if", "self", ".", "has_description", "(", ")", ":", "return", "request", ".", "build_absolute_uri", "(", "reverse", "(", "'assignment_description_file'", ",", "args", "=", ...
Return absolute URL for assignment description.
[ "Return", "absolute", "URL", "for", "assignment", "description", "." ]
384a95b7c6fa41e3f949a129d25dafd9a1c54859
https://github.com/troeger/opensubmit/blob/384a95b7c6fa41e3f949a129d25dafd9a1c54859/web/opensubmit/models/assignment.py#L118-L128
train
64,222
troeger/opensubmit
web/opensubmit/models/assignment.py
Assignment.can_create_submission
def can_create_submission(self, user=None): ''' Central access control for submitting things related to assignments. ''' if user: # Super users, course owners and tutors should be able to test their validations # before the submission is officially possible. ...
python
def can_create_submission(self, user=None): ''' Central access control for submitting things related to assignments. ''' if user: # Super users, course owners and tutors should be able to test their validations # before the submission is officially possible. ...
[ "def", "can_create_submission", "(", "self", ",", "user", "=", "None", ")", ":", "if", "user", ":", "# Super users, course owners and tutors should be able to test their validations", "# before the submission is officially possible.", "# They should also be able to submit after the dea...
Central access control for submitting things related to assignments.
[ "Central", "access", "control", "for", "submitting", "things", "related", "to", "assignments", "." ]
384a95b7c6fa41e3f949a129d25dafd9a1c54859
https://github.com/troeger/opensubmit/blob/384a95b7c6fa41e3f949a129d25dafd9a1c54859/web/opensubmit/models/assignment.py#L142-L172
train
64,223
troeger/opensubmit
web/opensubmit/models/assignment.py
Assignment.duplicate_files
def duplicate_files(self): ''' Search for duplicates of submission file uploads for this assignment. This includes the search in other course, whether inactive or not. Returns a list of lists, where each latter is a set of duplicate submissions with at least on of them for this a...
python
def duplicate_files(self): ''' Search for duplicates of submission file uploads for this assignment. This includes the search in other course, whether inactive or not. Returns a list of lists, where each latter is a set of duplicate submissions with at least on of them for this a...
[ "def", "duplicate_files", "(", "self", ")", ":", "result", "=", "list", "(", ")", "files", "=", "SubmissionFile", ".", "valid_ones", ".", "order_by", "(", "'md5'", ")", "for", "key", ",", "dup_group", "in", "groupby", "(", "files", ",", "lambda", "f", ...
Search for duplicates of submission file uploads for this assignment. This includes the search in other course, whether inactive or not. Returns a list of lists, where each latter is a set of duplicate submissions with at least on of them for this assignment
[ "Search", "for", "duplicates", "of", "submission", "file", "uploads", "for", "this", "assignment", ".", "This", "includes", "the", "search", "in", "other", "course", "whether", "inactive", "or", "not", ".", "Returns", "a", "list", "of", "lists", "where", "ea...
384a95b7c6fa41e3f949a129d25dafd9a1c54859
https://github.com/troeger/opensubmit/blob/384a95b7c6fa41e3f949a129d25dafd9a1c54859/web/opensubmit/models/assignment.py#L181-L198
train
64,224
troeger/opensubmit
executor/opensubmitexec/cmdline.py
download_and_run
def download_and_run(config): ''' Main operation of the executor. Returns True when a job was downloaded and executed. Returns False when no job could be downloaded. ''' job = fetch_job(config) if job: job._run_validate() return True else: return False
python
def download_and_run(config): ''' Main operation of the executor. Returns True when a job was downloaded and executed. Returns False when no job could be downloaded. ''' job = fetch_job(config) if job: job._run_validate() return True else: return False
[ "def", "download_and_run", "(", "config", ")", ":", "job", "=", "fetch_job", "(", "config", ")", "if", "job", ":", "job", ".", "_run_validate", "(", ")", "return", "True", "else", ":", "return", "False" ]
Main operation of the executor. Returns True when a job was downloaded and executed. Returns False when no job could be downloaded.
[ "Main", "operation", "of", "the", "executor", "." ]
384a95b7c6fa41e3f949a129d25dafd9a1c54859
https://github.com/troeger/opensubmit/blob/384a95b7c6fa41e3f949a129d25dafd9a1c54859/executor/opensubmitexec/cmdline.py#L12-L24
train
64,225
troeger/opensubmit
executor/opensubmitexec/cmdline.py
copy_and_run
def copy_and_run(config, src_dir): ''' Local-only operation of the executor. Intended for validation script developers, and the test suite. Please not that this function only works correctly if the validator has one of the following names: - validator.py - validator.zip Ret...
python
def copy_and_run(config, src_dir): ''' Local-only operation of the executor. Intended for validation script developers, and the test suite. Please not that this function only works correctly if the validator has one of the following names: - validator.py - validator.zip Ret...
[ "def", "copy_and_run", "(", "config", ",", "src_dir", ")", ":", "job", "=", "fake_fetch_job", "(", "config", ",", "src_dir", ")", "if", "job", ":", "job", ".", "_run_validate", "(", ")", "return", "True", "else", ":", "return", "False" ]
Local-only operation of the executor. Intended for validation script developers, and the test suite. Please not that this function only works correctly if the validator has one of the following names: - validator.py - validator.zip Returns True when a job was prepared and executed....
[ "Local", "-", "only", "operation", "of", "the", "executor", ".", "Intended", "for", "validation", "script", "developers", "and", "the", "test", "suite", "." ]
384a95b7c6fa41e3f949a129d25dafd9a1c54859
https://github.com/troeger/opensubmit/blob/384a95b7c6fa41e3f949a129d25dafd9a1c54859/executor/opensubmitexec/cmdline.py#L27-L46
train
64,226
troeger/opensubmit
executor/opensubmitexec/cmdline.py
console_script
def console_script(): ''' The main entry point for the production administration script 'opensubmit-exec', installed by setuptools. ''' if len(sys.argv) == 1: print("opensubmit-exec [configcreate <server_url>|configtest|run|test <dir>|unlock|help] [-c config_file]") r...
python
def console_script(): ''' The main entry point for the production administration script 'opensubmit-exec', installed by setuptools. ''' if len(sys.argv) == 1: print("opensubmit-exec [configcreate <server_url>|configtest|run|test <dir>|unlock|help] [-c config_file]") r...
[ "def", "console_script", "(", ")", ":", "if", "len", "(", "sys", ".", "argv", ")", "==", "1", ":", "print", "(", "\"opensubmit-exec [configcreate <server_url>|configtest|run|test <dir>|unlock|help] [-c config_file]\"", ")", "return", "0", "if", "\"help\"", "in", "sys"...
The main entry point for the production administration script 'opensubmit-exec', installed by setuptools.
[ "The", "main", "entry", "point", "for", "the", "production", "administration", "script", "opensubmit", "-", "exec", "installed", "by", "setuptools", "." ]
384a95b7c6fa41e3f949a129d25dafd9a1c54859
https://github.com/troeger/opensubmit/blob/384a95b7c6fa41e3f949a129d25dafd9a1c54859/executor/opensubmitexec/cmdline.py#L56-L126
train
64,227
timothydmorton/VESPA
vespa/hashutils.py
hashdict
def hashdict(d): """Hash a dictionary """ k = 0 for key,val in d.items(): k ^= hash(key) ^ hash(val) return k
python
def hashdict(d): """Hash a dictionary """ k = 0 for key,val in d.items(): k ^= hash(key) ^ hash(val) return k
[ "def", "hashdict", "(", "d", ")", ":", "k", "=", "0", "for", "key", ",", "val", "in", "d", ".", "items", "(", ")", ":", "k", "^=", "hash", "(", "key", ")", "^", "hash", "(", "val", ")", "return", "k" ]
Hash a dictionary
[ "Hash", "a", "dictionary" ]
0446b54d48009f3655cfd1a3957ceea21d3adcaa
https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/hashutils.py#L82-L88
train
64,228
timothydmorton/VESPA
vespa/orbits/populations.py
TripleOrbitPopulation.from_df
def from_df(cls, df_long, df_short): """ Builds TripleOrbitPopulation from DataFrame ``DataFrame`` objects must be of appropriate form to pass to :func:`OrbitPopulation.from_df`. :param df_long, df_short: :class:`pandas.DataFrame` objects to pass to :fun...
python
def from_df(cls, df_long, df_short): """ Builds TripleOrbitPopulation from DataFrame ``DataFrame`` objects must be of appropriate form to pass to :func:`OrbitPopulation.from_df`. :param df_long, df_short: :class:`pandas.DataFrame` objects to pass to :fun...
[ "def", "from_df", "(", "cls", ",", "df_long", ",", "df_short", ")", ":", "pop", "=", "cls", "(", "1", ",", "1", ",", "1", ",", "1", ",", "1", ")", "#dummy population", "pop", ".", "orbpop_long", "=", "OrbitPopulation", ".", "from_df", "(", "df_long",...
Builds TripleOrbitPopulation from DataFrame ``DataFrame`` objects must be of appropriate form to pass to :func:`OrbitPopulation.from_df`. :param df_long, df_short: :class:`pandas.DataFrame` objects to pass to :func:`OrbitPopulation.from_df`.
[ "Builds", "TripleOrbitPopulation", "from", "DataFrame" ]
0446b54d48009f3655cfd1a3957ceea21d3adcaa
https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/orbits/populations.py#L220-L235
train
64,229
timothydmorton/VESPA
vespa/orbits/populations.py
TripleOrbitPopulation.load_hdf
def load_hdf(cls, filename, path=''): """ Load TripleOrbitPopulation from saved .h5 file. :param filename: HDF file name. :param path: Path within HDF file where data is stored. """ df_long = pd.read_hdf(filename,'{}/long/df'.format(path)) ...
python
def load_hdf(cls, filename, path=''): """ Load TripleOrbitPopulation from saved .h5 file. :param filename: HDF file name. :param path: Path within HDF file where data is stored. """ df_long = pd.read_hdf(filename,'{}/long/df'.format(path)) ...
[ "def", "load_hdf", "(", "cls", ",", "filename", ",", "path", "=", "''", ")", ":", "df_long", "=", "pd", ".", "read_hdf", "(", "filename", ",", "'{}/long/df'", ".", "format", "(", "path", ")", ")", "df_short", "=", "pd", ".", "read_hdf", "(", "filenam...
Load TripleOrbitPopulation from saved .h5 file. :param filename: HDF file name. :param path: Path within HDF file where data is stored.
[ "Load", "TripleOrbitPopulation", "from", "saved", ".", "h5", "file", "." ]
0446b54d48009f3655cfd1a3957ceea21d3adcaa
https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/orbits/populations.py#L238-L251
train
64,230
timothydmorton/VESPA
vespa/orbits/populations.py
OrbitPopulation.RV_timeseries
def RV_timeseries(self,ts,recalc=False): """ Radial Velocity time series for star 1 at given times ts. :param ts: Times. If not ``Quantity``, assumed to be in days. :type ts: array-like or ``Quantity`` :param recalc: (optional) If ``False``,...
python
def RV_timeseries(self,ts,recalc=False): """ Radial Velocity time series for star 1 at given times ts. :param ts: Times. If not ``Quantity``, assumed to be in days. :type ts: array-like or ``Quantity`` :param recalc: (optional) If ``False``,...
[ "def", "RV_timeseries", "(", "self", ",", "ts", ",", "recalc", "=", "False", ")", ":", "if", "type", "(", "ts", ")", "!=", "Quantity", ":", "ts", "*=", "u", ".", "day", "if", "not", "recalc", "and", "hasattr", "(", "self", ",", "'RV_measurements'", ...
Radial Velocity time series for star 1 at given times ts. :param ts: Times. If not ``Quantity``, assumed to be in days. :type ts: array-like or ``Quantity`` :param recalc: (optional) If ``False``, then if called with the exact same ``ts`` as las...
[ "Radial", "Velocity", "time", "series", "for", "star", "1", "at", "given", "times", "ts", "." ]
0446b54d48009f3655cfd1a3957ceea21d3adcaa
https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/orbits/populations.py#L419-L447
train
64,231
timothydmorton/VESPA
vespa/orbits/populations.py
OrbitPopulation.from_df
def from_df(cls, df): """Creates an OrbitPopulation from a DataFrame. :param df: :class:`pandas.DataFrame` object. Must contain the following columns: ``['M1','M2','P','ecc','mean_anomaly','obsx','obsy','obsz']``, i.e., as what is accessed via :attr:`OrbitPopulation...
python
def from_df(cls, df): """Creates an OrbitPopulation from a DataFrame. :param df: :class:`pandas.DataFrame` object. Must contain the following columns: ``['M1','M2','P','ecc','mean_anomaly','obsx','obsy','obsz']``, i.e., as what is accessed via :attr:`OrbitPopulation...
[ "def", "from_df", "(", "cls", ",", "df", ")", ":", "return", "cls", "(", "df", "[", "'M1'", "]", ",", "df", "[", "'M2'", "]", ",", "df", "[", "'P'", "]", ",", "ecc", "=", "df", "[", "'ecc'", "]", ",", "mean_anomaly", "=", "df", "[", "'mean_an...
Creates an OrbitPopulation from a DataFrame. :param df: :class:`pandas.DataFrame` object. Must contain the following columns: ``['M1','M2','P','ecc','mean_anomaly','obsx','obsy','obsz']``, i.e., as what is accessed via :attr:`OrbitPopulation.dataframe`. :return: ...
[ "Creates", "an", "OrbitPopulation", "from", "a", "DataFrame", "." ]
0446b54d48009f3655cfd1a3957ceea21d3adcaa
https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/orbits/populations.py#L513-L526
train
64,232
timothydmorton/VESPA
vespa/orbits/populations.py
OrbitPopulation.load_hdf
def load_hdf(cls, filename, path=''): """Loads OrbitPopulation from HDF file. :param filename: HDF file :param path: Path within HDF file store where :class:`OrbitPopulation` is saved. """ df = pd.read_hdf(filename,'{}/df'.format(path)) return cl...
python
def load_hdf(cls, filename, path=''): """Loads OrbitPopulation from HDF file. :param filename: HDF file :param path: Path within HDF file store where :class:`OrbitPopulation` is saved. """ df = pd.read_hdf(filename,'{}/df'.format(path)) return cl...
[ "def", "load_hdf", "(", "cls", ",", "filename", ",", "path", "=", "''", ")", ":", "df", "=", "pd", ".", "read_hdf", "(", "filename", ",", "'{}/df'", ".", "format", "(", "path", ")", ")", "return", "cls", ".", "from_df", "(", "df", ")" ]
Loads OrbitPopulation from HDF file. :param filename: HDF file :param path: Path within HDF file store where :class:`OrbitPopulation` is saved.
[ "Loads", "OrbitPopulation", "from", "HDF", "file", "." ]
0446b54d48009f3655cfd1a3957ceea21d3adcaa
https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/orbits/populations.py#L529-L539
train
64,233
timothydmorton/VESPA
vespa/stars/utils.py
draw_pers_eccs
def draw_pers_eccs(n,**kwargs): """ Draw random periods and eccentricities according to empirical survey data. """ pers = draw_raghavan_periods(n) eccs = draw_eccs(n,pers,**kwargs) return pers,eccs
python
def draw_pers_eccs(n,**kwargs): """ Draw random periods and eccentricities according to empirical survey data. """ pers = draw_raghavan_periods(n) eccs = draw_eccs(n,pers,**kwargs) return pers,eccs
[ "def", "draw_pers_eccs", "(", "n", ",", "*", "*", "kwargs", ")", ":", "pers", "=", "draw_raghavan_periods", "(", "n", ")", "eccs", "=", "draw_eccs", "(", "n", ",", "pers", ",", "*", "*", "kwargs", ")", "return", "pers", ",", "eccs" ]
Draw random periods and eccentricities according to empirical survey data.
[ "Draw", "random", "periods", "and", "eccentricities", "according", "to", "empirical", "survey", "data", "." ]
0446b54d48009f3655cfd1a3957ceea21d3adcaa
https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/stars/utils.py#L65-L71
train
64,234
timothydmorton/VESPA
vespa/stars/utils.py
draw_eccs
def draw_eccs(n,per=10,binsize=0.1,fuzz=0.05,maxecc=0.97): """draws eccentricities appropriate to given periods, generated according to empirical data from Multiple Star Catalog """ if np.size(per) == 1 or np.std(np.atleast_1d(per))==0: if np.size(per)>1: per = per[0] if per==0: ...
python
def draw_eccs(n,per=10,binsize=0.1,fuzz=0.05,maxecc=0.97): """draws eccentricities appropriate to given periods, generated according to empirical data from Multiple Star Catalog """ if np.size(per) == 1 or np.std(np.atleast_1d(per))==0: if np.size(per)>1: per = per[0] if per==0: ...
[ "def", "draw_eccs", "(", "n", ",", "per", "=", "10", ",", "binsize", "=", "0.1", ",", "fuzz", "=", "0.05", ",", "maxecc", "=", "0.97", ")", ":", "if", "np", ".", "size", "(", "per", ")", "==", "1", "or", "np", ".", "std", "(", "np", ".", "a...
draws eccentricities appropriate to given periods, generated according to empirical data from Multiple Star Catalog
[ "draws", "eccentricities", "appropriate", "to", "given", "periods", "generated", "according", "to", "empirical", "data", "from", "Multiple", "Star", "Catalog" ]
0446b54d48009f3655cfd1a3957ceea21d3adcaa
https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/stars/utils.py#L95-L134
train
64,235
timothydmorton/VESPA
vespa/stars/utils.py
withinroche
def withinroche(semimajors,M1,R1,M2,R2): """ Returns boolean array that is True where two stars are within Roche lobe """ q = M1/M2 return ((R1+R2)*RSUN) > (rochelobe(q)*semimajors*AU)
python
def withinroche(semimajors,M1,R1,M2,R2): """ Returns boolean array that is True where two stars are within Roche lobe """ q = M1/M2 return ((R1+R2)*RSUN) > (rochelobe(q)*semimajors*AU)
[ "def", "withinroche", "(", "semimajors", ",", "M1", ",", "R1", ",", "M2", ",", "R2", ")", ":", "q", "=", "M1", "/", "M2", "return", "(", "(", "R1", "+", "R2", ")", "*", "RSUN", ")", ">", "(", "rochelobe", "(", "q", ")", "*", "semimajors", "*"...
Returns boolean array that is True where two stars are within Roche lobe
[ "Returns", "boolean", "array", "that", "is", "True", "where", "two", "stars", "are", "within", "Roche", "lobe" ]
0446b54d48009f3655cfd1a3957ceea21d3adcaa
https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/stars/utils.py#L152-L157
train
64,236
timothydmorton/VESPA
vespa/stars/utils.py
semimajor
def semimajor(P,mstar=1): """Returns semimajor axis in AU given P in days, mstar in solar masses. """ return ((P*DAY/2/np.pi)**2*G*mstar*MSUN)**(1./3)/AU
python
def semimajor(P,mstar=1): """Returns semimajor axis in AU given P in days, mstar in solar masses. """ return ((P*DAY/2/np.pi)**2*G*mstar*MSUN)**(1./3)/AU
[ "def", "semimajor", "(", "P", ",", "mstar", "=", "1", ")", ":", "return", "(", "(", "P", "*", "DAY", "/", "2", "/", "np", ".", "pi", ")", "**", "2", "*", "G", "*", "mstar", "*", "MSUN", ")", "**", "(", "1.", "/", "3", ")", "/", "AU" ]
Returns semimajor axis in AU given P in days, mstar in solar masses.
[ "Returns", "semimajor", "axis", "in", "AU", "given", "P", "in", "days", "mstar", "in", "solar", "masses", "." ]
0446b54d48009f3655cfd1a3957ceea21d3adcaa
https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/stars/utils.py#L159-L162
train
64,237
timothydmorton/VESPA
vespa/stars/utils.py
fluxfrac
def fluxfrac(*mags): """Returns fraction of total flux in first argument, assuming all are magnitudes. """ Ftot = 0 for mag in mags: Ftot += 10**(-0.4*mag) F1 = 10**(-0.4*mags[0]) return F1/Ftot
python
def fluxfrac(*mags): """Returns fraction of total flux in first argument, assuming all are magnitudes. """ Ftot = 0 for mag in mags: Ftot += 10**(-0.4*mag) F1 = 10**(-0.4*mags[0]) return F1/Ftot
[ "def", "fluxfrac", "(", "*", "mags", ")", ":", "Ftot", "=", "0", "for", "mag", "in", "mags", ":", "Ftot", "+=", "10", "**", "(", "-", "0.4", "*", "mag", ")", "F1", "=", "10", "**", "(", "-", "0.4", "*", "mags", "[", "0", "]", ")", "return",...
Returns fraction of total flux in first argument, assuming all are magnitudes.
[ "Returns", "fraction", "of", "total", "flux", "in", "first", "argument", "assuming", "all", "are", "magnitudes", "." ]
0446b54d48009f3655cfd1a3957ceea21d3adcaa
https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/stars/utils.py#L176-L183
train
64,238
timothydmorton/VESPA
vespa/stars/utils.py
dfromdm
def dfromdm(dm): """Returns distance given distance modulus. """ if np.size(dm)>1: dm = np.atleast_1d(dm) return 10**(1+dm/5)
python
def dfromdm(dm): """Returns distance given distance modulus. """ if np.size(dm)>1: dm = np.atleast_1d(dm) return 10**(1+dm/5)
[ "def", "dfromdm", "(", "dm", ")", ":", "if", "np", ".", "size", "(", "dm", ")", ">", "1", ":", "dm", "=", "np", ".", "atleast_1d", "(", "dm", ")", "return", "10", "**", "(", "1", "+", "dm", "/", "5", ")" ]
Returns distance given distance modulus.
[ "Returns", "distance", "given", "distance", "modulus", "." ]
0446b54d48009f3655cfd1a3957ceea21d3adcaa
https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/stars/utils.py#L185-L190
train
64,239
timothydmorton/VESPA
vespa/stars/utils.py
distancemodulus
def distancemodulus(d): """Returns distance modulus given d in parsec. """ if type(d)==Quantity: x = d.to('pc').value else: x = d #assumed to be pc if np.size(x)>1: d = np.atleast_1d(x) return 5*np.log10(x/10)
python
def distancemodulus(d): """Returns distance modulus given d in parsec. """ if type(d)==Quantity: x = d.to('pc').value else: x = d #assumed to be pc if np.size(x)>1: d = np.atleast_1d(x) return 5*np.log10(x/10)
[ "def", "distancemodulus", "(", "d", ")", ":", "if", "type", "(", "d", ")", "==", "Quantity", ":", "x", "=", "d", ".", "to", "(", "'pc'", ")", ".", "value", "else", ":", "x", "=", "d", "#assumed to be pc", "if", "np", ".", "size", "(", "x", ")",...
Returns distance modulus given d in parsec.
[ "Returns", "distance", "modulus", "given", "d", "in", "parsec", "." ]
0446b54d48009f3655cfd1a3957ceea21d3adcaa
https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/stars/utils.py#L192-L202
train
64,240
dellis23/ansible-toolkit
ansible_toolkit/utils.py
get_files
def get_files(path): """ Returns a recursive list of all non-hidden files in and below the current directory. """ return_files = [] for root, dirs, files in os.walk(path): # Skip hidden files files = [f for f in files if not f[0] == '.'] dirs[:] = [d for d in dirs if not...
python
def get_files(path): """ Returns a recursive list of all non-hidden files in and below the current directory. """ return_files = [] for root, dirs, files in os.walk(path): # Skip hidden files files = [f for f in files if not f[0] == '.'] dirs[:] = [d for d in dirs if not...
[ "def", "get_files", "(", "path", ")", ":", "return_files", "=", "[", "]", "for", "root", ",", "dirs", ",", "files", "in", "os", ".", "walk", "(", "path", ")", ":", "# Skip hidden files", "files", "=", "[", "f", "for", "f", "in", "files", "if", "not...
Returns a recursive list of all non-hidden files in and below the current directory.
[ "Returns", "a", "recursive", "list", "of", "all", "non", "-", "hidden", "files", "in", "and", "below", "the", "current", "directory", "." ]
7eb5198e1f68c9a3ca1d129d9e2a52fb3f0e65c5
https://github.com/dellis23/ansible-toolkit/blob/7eb5198e1f68c9a3ca1d129d9e2a52fb3f0e65c5/ansible_toolkit/utils.py#L99-L113
train
64,241
timothydmorton/VESPA
vespa/transitsignal.py
TransitSignal.save_pkl
def save_pkl(self, filename): """ Pickles TransitSignal. """ with open(filename, 'wb') as fout: pickle.dump(self, fout)
python
def save_pkl(self, filename): """ Pickles TransitSignal. """ with open(filename, 'wb') as fout: pickle.dump(self, fout)
[ "def", "save_pkl", "(", "self", ",", "filename", ")", ":", "with", "open", "(", "filename", ",", "'wb'", ")", "as", "fout", ":", "pickle", ".", "dump", "(", "self", ",", "fout", ")" ]
Pickles TransitSignal.
[ "Pickles", "TransitSignal", "." ]
0446b54d48009f3655cfd1a3957ceea21d3adcaa
https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/transitsignal.py#L138-L143
train
64,242
timothydmorton/VESPA
vespa/transitsignal.py
TransitSignal.plot
def plot(self, fig=None, plot_trap=False, name=False, trap_color='g', trap_kwargs=None, **kwargs): """ Makes a simple plot of signal :param fig: (optional) Argument for :func:`plotutils.setfig`. :param plot_trap: (optional) Whether to plot the (best...
python
def plot(self, fig=None, plot_trap=False, name=False, trap_color='g', trap_kwargs=None, **kwargs): """ Makes a simple plot of signal :param fig: (optional) Argument for :func:`plotutils.setfig`. :param plot_trap: (optional) Whether to plot the (best...
[ "def", "plot", "(", "self", ",", "fig", "=", "None", ",", "plot_trap", "=", "False", ",", "name", "=", "False", ",", "trap_color", "=", "'g'", ",", "trap_kwargs", "=", "None", ",", "*", "*", "kwargs", ")", ":", "setfig", "(", "fig", ")", "plt", "...
Makes a simple plot of signal :param fig: (optional) Argument for :func:`plotutils.setfig`. :param plot_trap: (optional) Whether to plot the (best-fit least-sq) trapezoid fit. :param name: (optional) Whether to annotate plot with the name of the signal; ...
[ "Makes", "a", "simple", "plot", "of", "signal" ]
0446b54d48009f3655cfd1a3957ceea21d3adcaa
https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/transitsignal.py#L166-L224
train
64,243
timothydmorton/VESPA
vespa/statutils.py
kdeconf
def kdeconf(kde,conf=0.683,xmin=None,xmax=None,npts=500, shortest=True,conftol=0.001,return_max=False): """ Returns desired confidence interval for provided KDE object """ if xmin is None: xmin = kde.dataset.min() if xmax is None: xmax = kde.dataset.max() x = np.linsp...
python
def kdeconf(kde,conf=0.683,xmin=None,xmax=None,npts=500, shortest=True,conftol=0.001,return_max=False): """ Returns desired confidence interval for provided KDE object """ if xmin is None: xmin = kde.dataset.min() if xmax is None: xmax = kde.dataset.max() x = np.linsp...
[ "def", "kdeconf", "(", "kde", ",", "conf", "=", "0.683", ",", "xmin", "=", "None", ",", "xmax", "=", "None", ",", "npts", "=", "500", ",", "shortest", "=", "True", ",", "conftol", "=", "0.001", ",", "return_max", "=", "False", ")", ":", "if", "xm...
Returns desired confidence interval for provided KDE object
[ "Returns", "desired", "confidence", "interval", "for", "provided", "KDE", "object" ]
0446b54d48009f3655cfd1a3957ceea21d3adcaa
https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/statutils.py#L8-L19
train
64,244
timothydmorton/VESPA
vespa/statutils.py
qstd
def qstd(x,quant=0.05,top=False,bottom=False): """returns std, ignoring outer 'quant' pctiles """ s = np.sort(x) n = np.size(x) lo = s[int(n*quant)] hi = s[int(n*(1-quant))] if top: w = np.where(x>=lo) elif bottom: w = np.where(x<=hi) else: w = np.where((x>=lo...
python
def qstd(x,quant=0.05,top=False,bottom=False): """returns std, ignoring outer 'quant' pctiles """ s = np.sort(x) n = np.size(x) lo = s[int(n*quant)] hi = s[int(n*(1-quant))] if top: w = np.where(x>=lo) elif bottom: w = np.where(x<=hi) else: w = np.where((x>=lo...
[ "def", "qstd", "(", "x", ",", "quant", "=", "0.05", ",", "top", "=", "False", ",", "bottom", "=", "False", ")", ":", "s", "=", "np", ".", "sort", "(", "x", ")", "n", "=", "np", ".", "size", "(", "x", ")", "lo", "=", "s", "[", "int", "(", ...
returns std, ignoring outer 'quant' pctiles
[ "returns", "std", "ignoring", "outer", "quant", "pctiles" ]
0446b54d48009f3655cfd1a3957ceea21d3adcaa
https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/statutils.py#L22-L35
train
64,245
timothydmorton/VESPA
vespa/plotutils.py
plot2dhist
def plot2dhist(xdata,ydata,cmap='binary',interpolation='nearest', fig=None,logscale=True,xbins=None,ybins=None, nbins=50,pts_only=False,**kwargs): """Plots a 2d density histogram of provided data :param xdata,ydata: (array-like) Data to plot. :param cmap: (optional) ...
python
def plot2dhist(xdata,ydata,cmap='binary',interpolation='nearest', fig=None,logscale=True,xbins=None,ybins=None, nbins=50,pts_only=False,**kwargs): """Plots a 2d density histogram of provided data :param xdata,ydata: (array-like) Data to plot. :param cmap: (optional) ...
[ "def", "plot2dhist", "(", "xdata", ",", "ydata", ",", "cmap", "=", "'binary'", ",", "interpolation", "=", "'nearest'", ",", "fig", "=", "None", ",", "logscale", "=", "True", ",", "xbins", "=", "None", ",", "ybins", "=", "None", ",", "nbins", "=", "50...
Plots a 2d density histogram of provided data :param xdata,ydata: (array-like) Data to plot. :param cmap: (optional) Colormap to use for density plot. :param interpolation: (optional) Interpolation scheme for display (passed to ``plt.imshow``). :param fig: (optional) ...
[ "Plots", "a", "2d", "density", "histogram", "of", "provided", "data" ]
0446b54d48009f3655cfd1a3957ceea21d3adcaa
https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/plotutils.py#L37-L100
train
64,246
timothydmorton/VESPA
vespa/transit_basic.py
ldcoeffs
def ldcoeffs(teff,logg=4.5,feh=0): """ Returns limb-darkening coefficients in Kepler band. """ teffs = np.atleast_1d(teff) loggs = np.atleast_1d(logg) Tmin,Tmax = (LDPOINTS[:,0].min(),LDPOINTS[:,0].max()) gmin,gmax = (LDPOINTS[:,1].min(),LDPOINTS[:,1].max()) teffs[(teffs < Tmin)] = Tmi...
python
def ldcoeffs(teff,logg=4.5,feh=0): """ Returns limb-darkening coefficients in Kepler band. """ teffs = np.atleast_1d(teff) loggs = np.atleast_1d(logg) Tmin,Tmax = (LDPOINTS[:,0].min(),LDPOINTS[:,0].max()) gmin,gmax = (LDPOINTS[:,1].min(),LDPOINTS[:,1].max()) teffs[(teffs < Tmin)] = Tmi...
[ "def", "ldcoeffs", "(", "teff", ",", "logg", "=", "4.5", ",", "feh", "=", "0", ")", ":", "teffs", "=", "np", ".", "atleast_1d", "(", "teff", ")", "loggs", "=", "np", ".", "atleast_1d", "(", "logg", ")", "Tmin", ",", "Tmax", "=", "(", "LDPOINTS", ...
Returns limb-darkening coefficients in Kepler band.
[ "Returns", "limb", "-", "darkening", "coefficients", "in", "Kepler", "band", "." ]
0446b54d48009f3655cfd1a3957ceea21d3adcaa
https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/transit_basic.py#L81-L97
train
64,247
timothydmorton/VESPA
vespa/transit_basic.py
impact_parameter
def impact_parameter(a, R, inc, ecc=0, w=0, return_occ=False): """a in AU, R in Rsun, inc & w in radians """ b_tra = a*AU*np.cos(inc)/(R*RSUN) * (1-ecc**2)/(1 + ecc*np.sin(w)) if return_occ: b_tra = a*AU*np.cos(inc)/(R*RSUN) * (1-ecc**2)/(1 - ecc*np.sin(w)) return b_tra, b_occ else:...
python
def impact_parameter(a, R, inc, ecc=0, w=0, return_occ=False): """a in AU, R in Rsun, inc & w in radians """ b_tra = a*AU*np.cos(inc)/(R*RSUN) * (1-ecc**2)/(1 + ecc*np.sin(w)) if return_occ: b_tra = a*AU*np.cos(inc)/(R*RSUN) * (1-ecc**2)/(1 - ecc*np.sin(w)) return b_tra, b_occ else:...
[ "def", "impact_parameter", "(", "a", ",", "R", ",", "inc", ",", "ecc", "=", "0", ",", "w", "=", "0", ",", "return_occ", "=", "False", ")", ":", "b_tra", "=", "a", "*", "AU", "*", "np", ".", "cos", "(", "inc", ")", "/", "(", "R", "*", "RSUN"...
a in AU, R in Rsun, inc & w in radians
[ "a", "in", "AU", "R", "in", "Rsun", "inc", "&", "w", "in", "radians" ]
0446b54d48009f3655cfd1a3957ceea21d3adcaa
https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/transit_basic.py#L239-L248
train
64,248
timothydmorton/VESPA
vespa/transit_basic.py
minimum_inclination
def minimum_inclination(P,M1,M2,R1,R2): """ Returns the minimum inclination at which two bodies from two given sets eclipse Only counts systems not within each other's Roche radius :param P: Orbital periods. :param M1,M2,R1,R2: Masses and radii of primary and secondary stars. ...
python
def minimum_inclination(P,M1,M2,R1,R2): """ Returns the minimum inclination at which two bodies from two given sets eclipse Only counts systems not within each other's Roche radius :param P: Orbital periods. :param M1,M2,R1,R2: Masses and radii of primary and secondary stars. ...
[ "def", "minimum_inclination", "(", "P", ",", "M1", ",", "M2", ",", "R1", ",", "R2", ")", ":", "P", ",", "M1", ",", "M2", ",", "R1", ",", "R2", "=", "(", "np", ".", "atleast_1d", "(", "P", ")", ",", "np", ".", "atleast_1d", "(", "M1", ")", "...
Returns the minimum inclination at which two bodies from two given sets eclipse Only counts systems not within each other's Roche radius :param P: Orbital periods. :param M1,M2,R1,R2: Masses and radii of primary and secondary stars.
[ "Returns", "the", "minimum", "inclination", "at", "which", "two", "bodies", "from", "two", "given", "sets", "eclipse" ]
0446b54d48009f3655cfd1a3957ceea21d3adcaa
https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/transit_basic.py#L297-L328
train
64,249
timothydmorton/VESPA
vespa/transit_basic.py
eclipse_pars
def eclipse_pars(P,M1,M2,R1,R2,ecc=0,inc=90,w=0,sec=False): """retuns p,b,aR from P,M1,M2,R1,R2,ecc,inc,w""" a = semimajor(P,M1+M2) if sec: b = a*AU*np.cos(inc*np.pi/180)/(R1*RSUN) * (1-ecc**2)/(1 - ecc*np.sin(w*np.pi/180)) #aR = a*AU/(R2*RSUN) #I feel like this was to correct a bug, but thi...
python
def eclipse_pars(P,M1,M2,R1,R2,ecc=0,inc=90,w=0,sec=False): """retuns p,b,aR from P,M1,M2,R1,R2,ecc,inc,w""" a = semimajor(P,M1+M2) if sec: b = a*AU*np.cos(inc*np.pi/180)/(R1*RSUN) * (1-ecc**2)/(1 - ecc*np.sin(w*np.pi/180)) #aR = a*AU/(R2*RSUN) #I feel like this was to correct a bug, but thi...
[ "def", "eclipse_pars", "(", "P", ",", "M1", ",", "M2", ",", "R1", ",", "R2", ",", "ecc", "=", "0", ",", "inc", "=", "90", ",", "w", "=", "0", ",", "sec", "=", "False", ")", ":", "a", "=", "semimajor", "(", "P", ",", "M1", "+", "M2", ")", ...
retuns p,b,aR from P,M1,M2,R1,R2,ecc,inc,w
[ "retuns", "p", "b", "aR", "from", "P", "M1", "M2", "R1", "R2", "ecc", "inc", "w" ]
0446b54d48009f3655cfd1a3957ceea21d3adcaa
https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/transit_basic.py#L389-L402
train
64,250
timothydmorton/VESPA
vespa/transit_basic.py
fit_traptransit
def fit_traptransit(ts,fs,p0): """ Fits trapezoid model to provided ts,fs """ pfit,success = leastsq(traptransit_resid,p0,args=(ts,fs)) if success not in [1,2,3,4]: raise NoFitError #logging.debug('success = {}'.format(success)) return pfit
python
def fit_traptransit(ts,fs,p0): """ Fits trapezoid model to provided ts,fs """ pfit,success = leastsq(traptransit_resid,p0,args=(ts,fs)) if success not in [1,2,3,4]: raise NoFitError #logging.debug('success = {}'.format(success)) return pfit
[ "def", "fit_traptransit", "(", "ts", ",", "fs", ",", "p0", ")", ":", "pfit", ",", "success", "=", "leastsq", "(", "traptransit_resid", ",", "p0", ",", "args", "=", "(", "ts", ",", "fs", ")", ")", "if", "success", "not", "in", "[", "1", ",", "2", ...
Fits trapezoid model to provided ts,fs
[ "Fits", "trapezoid", "model", "to", "provided", "ts", "fs" ]
0446b54d48009f3655cfd1a3957ceea21d3adcaa
https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/transit_basic.py#L745-L753
train
64,251
dellis23/ansible-toolkit
ansible_toolkit/vault.py
backup
def backup(path, password_file=None): """ Replaces the contents of a file with its decrypted counterpart, storing the original encrypted version and a hash of the file contents for later retrieval. """ vault = VaultLib(get_vault_password(password_file)) with open(path, 'r') as f: enc...
python
def backup(path, password_file=None): """ Replaces the contents of a file with its decrypted counterpart, storing the original encrypted version and a hash of the file contents for later retrieval. """ vault = VaultLib(get_vault_password(password_file)) with open(path, 'r') as f: enc...
[ "def", "backup", "(", "path", ",", "password_file", "=", "None", ")", ":", "vault", "=", "VaultLib", "(", "get_vault_password", "(", "password_file", ")", ")", "with", "open", "(", "path", ",", "'r'", ")", "as", "f", ":", "encrypted_data", "=", "f", "....
Replaces the contents of a file with its decrypted counterpart, storing the original encrypted version and a hash of the file contents for later retrieval.
[ "Replaces", "the", "contents", "of", "a", "file", "with", "its", "decrypted", "counterpart", "storing", "the", "original", "encrypted", "version", "and", "a", "hash", "of", "the", "file", "contents", "for", "later", "retrieval", "." ]
7eb5198e1f68c9a3ca1d129d9e2a52fb3f0e65c5
https://github.com/dellis23/ansible-toolkit/blob/7eb5198e1f68c9a3ca1d129d9e2a52fb3f0e65c5/ansible_toolkit/vault.py#L15-L44
train
64,252
dellis23/ansible-toolkit
ansible_toolkit/vault.py
restore
def restore(path, password_file=None): """ Retrieves a file from the atk vault and restores it to its original location, re-encrypting it if it has changed. :param path: path to original file """ vault = VaultLib(get_vault_password(password_file)) atk_path = os.path.join(ATK_VAULT, path) ...
python
def restore(path, password_file=None): """ Retrieves a file from the atk vault and restores it to its original location, re-encrypting it if it has changed. :param path: path to original file """ vault = VaultLib(get_vault_password(password_file)) atk_path = os.path.join(ATK_VAULT, path) ...
[ "def", "restore", "(", "path", ",", "password_file", "=", "None", ")", ":", "vault", "=", "VaultLib", "(", "get_vault_password", "(", "password_file", ")", ")", "atk_path", "=", "os", ".", "path", ".", "join", "(", "ATK_VAULT", ",", "path", ")", "# Load ...
Retrieves a file from the atk vault and restores it to its original location, re-encrypting it if it has changed. :param path: path to original file
[ "Retrieves", "a", "file", "from", "the", "atk", "vault", "and", "restores", "it", "to", "its", "original", "location", "re", "-", "encrypting", "it", "if", "it", "has", "changed", "." ]
7eb5198e1f68c9a3ca1d129d9e2a52fb3f0e65c5
https://github.com/dellis23/ansible-toolkit/blob/7eb5198e1f68c9a3ca1d129d9e2a52fb3f0e65c5/ansible_toolkit/vault.py#L52-L85
train
64,253
timothydmorton/VESPA
vespa/stars/populations.py
StarPopulation.append
def append(self, other): """Appends stars from another StarPopulations, in place. :param other: Another :class:`StarPopulation`; must have same columns as ``self``. """ if not isinstance(other,StarPopulation): raise TypeError('Only StarPopulation objects can be ...
python
def append(self, other): """Appends stars from another StarPopulations, in place. :param other: Another :class:`StarPopulation`; must have same columns as ``self``. """ if not isinstance(other,StarPopulation): raise TypeError('Only StarPopulation objects can be ...
[ "def", "append", "(", "self", ",", "other", ")", ":", "if", "not", "isinstance", "(", "other", ",", "StarPopulation", ")", ":", "raise", "TypeError", "(", "'Only StarPopulation objects can be appended to a StarPopulation.'", ")", "if", "not", "np", ".", "all", "...
Appends stars from another StarPopulations, in place. :param other: Another :class:`StarPopulation`; must have same columns as ``self``.
[ "Appends", "stars", "from", "another", "StarPopulations", "in", "place", "." ]
0446b54d48009f3655cfd1a3957ceea21d3adcaa
https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/stars/populations.py#L249-L267
train
64,254
timothydmorton/VESPA
vespa/stars/populations.py
StarPopulation.bands
def bands(self): """ Bandpasses for which StarPopulation has magnitude data """ bands = [] for c in self.stars.columns: if re.search('_mag',c): bands.append(c) return bands
python
def bands(self): """ Bandpasses for which StarPopulation has magnitude data """ bands = [] for c in self.stars.columns: if re.search('_mag',c): bands.append(c) return bands
[ "def", "bands", "(", "self", ")", ":", "bands", "=", "[", "]", "for", "c", "in", "self", ".", "stars", ".", "columns", ":", "if", "re", ".", "search", "(", "'_mag'", ",", "c", ")", ":", "bands", ".", "append", "(", "c", ")", "return", "bands" ]
Bandpasses for which StarPopulation has magnitude data
[ "Bandpasses", "for", "which", "StarPopulation", "has", "magnitude", "data" ]
0446b54d48009f3655cfd1a3957ceea21d3adcaa
https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/stars/populations.py#L297-L305
train
64,255
timothydmorton/VESPA
vespa/stars/populations.py
StarPopulation.distance
def distance(self,value): """New distance value must be a ``Quantity`` object """ self.stars['distance'] = value.to('pc').value old_distmod = self.stars['distmod'].copy() new_distmod = distancemodulus(self.stars['distance']) for m in self.bands: self.stars[m...
python
def distance(self,value): """New distance value must be a ``Quantity`` object """ self.stars['distance'] = value.to('pc').value old_distmod = self.stars['distmod'].copy() new_distmod = distancemodulus(self.stars['distance']) for m in self.bands: self.stars[m...
[ "def", "distance", "(", "self", ",", "value", ")", ":", "self", ".", "stars", "[", "'distance'", "]", "=", "value", ".", "to", "(", "'pc'", ")", ".", "value", "old_distmod", "=", "self", ".", "stars", "[", "'distmod'", "]", ".", "copy", "(", ")", ...
New distance value must be a ``Quantity`` object
[ "New", "distance", "value", "must", "be", "a", "Quantity", "object" ]
0446b54d48009f3655cfd1a3957ceea21d3adcaa
https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/stars/populations.py#L315-L328
train
64,256
timothydmorton/VESPA
vespa/stars/populations.py
StarPopulation.distok
def distok(self): """ Boolean array showing which stars pass all distribution constraints. A "distribution constraint" is a constraint that affects the distribution of stars, rather than just the number. """ ok = np.ones(len(self.stars)).astype(bool) for name in ...
python
def distok(self): """ Boolean array showing which stars pass all distribution constraints. A "distribution constraint" is a constraint that affects the distribution of stars, rather than just the number. """ ok = np.ones(len(self.stars)).astype(bool) for name in ...
[ "def", "distok", "(", "self", ")", ":", "ok", "=", "np", ".", "ones", "(", "len", "(", "self", ".", "stars", ")", ")", ".", "astype", "(", "bool", ")", "for", "name", "in", "self", ".", "constraints", ":", "c", "=", "self", ".", "constraints", ...
Boolean array showing which stars pass all distribution constraints. A "distribution constraint" is a constraint that affects the distribution of stars, rather than just the number.
[ "Boolean", "array", "showing", "which", "stars", "pass", "all", "distribution", "constraints", "." ]
0446b54d48009f3655cfd1a3957ceea21d3adcaa
https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/stars/populations.py#L333-L345
train
64,257
timothydmorton/VESPA
vespa/stars/populations.py
StarPopulation.countok
def countok(self): """ Boolean array showing which stars pass all count constraints. A "count constraint" is a constraint that affects the number of stars. """ ok = np.ones(len(self.stars)).astype(bool) for name in self.constraints: c = self.constraints[name]...
python
def countok(self): """ Boolean array showing which stars pass all count constraints. A "count constraint" is a constraint that affects the number of stars. """ ok = np.ones(len(self.stars)).astype(bool) for name in self.constraints: c = self.constraints[name]...
[ "def", "countok", "(", "self", ")", ":", "ok", "=", "np", ".", "ones", "(", "len", "(", "self", ".", "stars", ")", ")", ".", "astype", "(", "bool", ")", "for", "name", "in", "self", ".", "constraints", ":", "c", "=", "self", ".", "constraints", ...
Boolean array showing which stars pass all count constraints. A "count constraint" is a constraint that affects the number of stars.
[ "Boolean", "array", "showing", "which", "stars", "pass", "all", "count", "constraints", "." ]
0446b54d48009f3655cfd1a3957ceea21d3adcaa
https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/stars/populations.py#L348-L359
train
64,258
timothydmorton/VESPA
vespa/stars/populations.py
StarPopulation.prophist2d
def prophist2d(self,propx,propy, mask=None, logx=False,logy=False, fig=None,selected=False,**kwargs): """Makes a 2d density histogram of two given properties :param propx,propy: Names of properties to histogram. Must be names of columns in ...
python
def prophist2d(self,propx,propy, mask=None, logx=False,logy=False, fig=None,selected=False,**kwargs): """Makes a 2d density histogram of two given properties :param propx,propy: Names of properties to histogram. Must be names of columns in ...
[ "def", "prophist2d", "(", "self", ",", "propx", ",", "propy", ",", "mask", "=", "None", ",", "logx", "=", "False", ",", "logy", "=", "False", ",", "fig", "=", "None", ",", "selected", "=", "False", ",", "*", "*", "kwargs", ")", ":", "if", "mask",...
Makes a 2d density histogram of two given properties :param propx,propy: Names of properties to histogram. Must be names of columns in ``self.stars`` table. :param mask: (optional) Boolean mask (``True`` is good) to say which indices to plot. Must be sa...
[ "Makes", "a", "2d", "density", "histogram", "of", "two", "given", "properties" ]
0446b54d48009f3655cfd1a3957ceea21d3adcaa
https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/stars/populations.py#L376-L436
train
64,259
timothydmorton/VESPA
vespa/stars/populations.py
StarPopulation.prophist
def prophist(self,prop,fig=None,log=False, mask=None, selected=False,**kwargs): """Plots a 1-d histogram of desired property. :param prop: Name of property to plot. Must be column of ``self.stars``. :param fig: (optional) Argument for :func:`plotutils....
python
def prophist(self,prop,fig=None,log=False, mask=None, selected=False,**kwargs): """Plots a 1-d histogram of desired property. :param prop: Name of property to plot. Must be column of ``self.stars``. :param fig: (optional) Argument for :func:`plotutils....
[ "def", "prophist", "(", "self", ",", "prop", ",", "fig", "=", "None", ",", "log", "=", "False", ",", "mask", "=", "None", ",", "selected", "=", "False", ",", "*", "*", "kwargs", ")", ":", "setfig", "(", "fig", ")", "inds", "=", "None", "if", "m...
Plots a 1-d histogram of desired property. :param prop: Name of property to plot. Must be column of ``self.stars``. :param fig: (optional) Argument for :func:`plotutils.setfig` :param log: (optional) Whether to plot the histogram of log10 of the property. ...
[ "Plots", "a", "1", "-", "d", "histogram", "of", "desired", "property", "." ]
0446b54d48009f3655cfd1a3957ceea21d3adcaa
https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/stars/populations.py#L439-L492
train
64,260
timothydmorton/VESPA
vespa/stars/populations.py
StarPopulation.constraint_stats
def constraint_stats(self,primarylist=None): """Returns information about effect of constraints on population. :param primarylist: List of constraint names that you want specific information on (i.e., not blended within "multiple constraints".) :return: ``dict`...
python
def constraint_stats(self,primarylist=None): """Returns information about effect of constraints on population. :param primarylist: List of constraint names that you want specific information on (i.e., not blended within "multiple constraints".) :return: ``dict`...
[ "def", "constraint_stats", "(", "self", ",", "primarylist", "=", "None", ")", ":", "if", "primarylist", "is", "None", ":", "primarylist", "=", "[", "]", "n", "=", "len", "(", "self", ".", "stars", ")", "primaryOK", "=", "np", ".", "ones", "(", "n", ...
Returns information about effect of constraints on population. :param primarylist: List of constraint names that you want specific information on (i.e., not blended within "multiple constraints".) :return: ``dict`` of what percentage of population is ruled out by ...
[ "Returns", "information", "about", "effect", "of", "constraints", "on", "population", "." ]
0446b54d48009f3655cfd1a3957ceea21d3adcaa
https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/stars/populations.py#L494-L547
train
64,261
timothydmorton/VESPA
vespa/stars/populations.py
StarPopulation.constraint_piechart
def constraint_piechart(self,primarylist=None, fig=None,title='',colordict=None, legend=True,nolabels=False): """Makes piechart illustrating constraints on population :param primarylist: (optional) List of most import constraints to sh...
python
def constraint_piechart(self,primarylist=None, fig=None,title='',colordict=None, legend=True,nolabels=False): """Makes piechart illustrating constraints on population :param primarylist: (optional) List of most import constraints to sh...
[ "def", "constraint_piechart", "(", "self", ",", "primarylist", "=", "None", ",", "fig", "=", "None", ",", "title", "=", "''", ",", "colordict", "=", "None", ",", "legend", "=", "True", ",", "nolabels", "=", "False", ")", ":", "setfig", "(", "fig", ",...
Makes piechart illustrating constraints on population :param primarylist: (optional) List of most import constraints to show (see :func:`StarPopulation.constraint_stats`) :param fig: (optional) Passed to :func:`plotutils.setfig`. :param title: (optional) ...
[ "Makes", "piechart", "illustrating", "constraints", "on", "population" ]
0446b54d48009f3655cfd1a3957ceea21d3adcaa
https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/stars/populations.py#L550-L637
train
64,262
timothydmorton/VESPA
vespa/stars/populations.py
StarPopulation.constraints
def constraints(self): """ Constraints applied to the population. """ try: return self._constraints except AttributeError: self._constraints = ConstraintDict() return self._constraints
python
def constraints(self): """ Constraints applied to the population. """ try: return self._constraints except AttributeError: self._constraints = ConstraintDict() return self._constraints
[ "def", "constraints", "(", "self", ")", ":", "try", ":", "return", "self", ".", "_constraints", "except", "AttributeError", ":", "self", ".", "_constraints", "=", "ConstraintDict", "(", ")", "return", "self", ".", "_constraints" ]
Constraints applied to the population.
[ "Constraints", "applied", "to", "the", "population", "." ]
0446b54d48009f3655cfd1a3957ceea21d3adcaa
https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/stars/populations.py#L670-L678
train
64,263
timothydmorton/VESPA
vespa/stars/populations.py
StarPopulation.hidden_constraints
def hidden_constraints(self): """ Constraints applied to the population, but temporarily removed. """ try: return self._hidden_constraints except AttributeError: self._hidden_constraints = ConstraintDict() return self._hidden_constraints
python
def hidden_constraints(self): """ Constraints applied to the population, but temporarily removed. """ try: return self._hidden_constraints except AttributeError: self._hidden_constraints = ConstraintDict() return self._hidden_constraints
[ "def", "hidden_constraints", "(", "self", ")", ":", "try", ":", "return", "self", ".", "_hidden_constraints", "except", "AttributeError", ":", "self", ".", "_hidden_constraints", "=", "ConstraintDict", "(", ")", "return", "self", ".", "_hidden_constraints" ]
Constraints applied to the population, but temporarily removed.
[ "Constraints", "applied", "to", "the", "population", "but", "temporarily", "removed", "." ]
0446b54d48009f3655cfd1a3957ceea21d3adcaa
https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/stars/populations.py#L685-L693
train
64,264
timothydmorton/VESPA
vespa/stars/populations.py
StarPopulation.apply_constraint
def apply_constraint(self,constraint,selectfrac_skip=False, distribution_skip=False,overwrite=False): """Apply a constraint to the population :param constraint: Constraint to apply. :type constraint: :class:`Constraint` :param selectfrac...
python
def apply_constraint(self,constraint,selectfrac_skip=False, distribution_skip=False,overwrite=False): """Apply a constraint to the population :param constraint: Constraint to apply. :type constraint: :class:`Constraint` :param selectfrac...
[ "def", "apply_constraint", "(", "self", ",", "constraint", ",", "selectfrac_skip", "=", "False", ",", "distribution_skip", "=", "False", ",", "overwrite", "=", "False", ")", ":", "#grab properties", "constraints", "=", "self", ".", "constraints", "my_selectfrac_sk...
Apply a constraint to the population :param constraint: Constraint to apply. :type constraint: :class:`Constraint` :param selectfrac_skip: (optional) If ``True``, then this constraint will not be considered towards diminishing the
[ "Apply", "a", "constraint", "to", "the", "population" ]
0446b54d48009f3655cfd1a3957ceea21d3adcaa
https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/stars/populations.py#L699-L732
train
64,265
timothydmorton/VESPA
vespa/stars/populations.py
StarPopulation.replace_constraint
def replace_constraint(self,name,selectfrac_skip=False,distribution_skip=False): """ Re-apply constraint that had been removed :param name: Name of constraint to replace :param selectfrac_skip,distribution_skip: (optional) Same as :func:`StarPopulation.apply_con...
python
def replace_constraint(self,name,selectfrac_skip=False,distribution_skip=False): """ Re-apply constraint that had been removed :param name: Name of constraint to replace :param selectfrac_skip,distribution_skip: (optional) Same as :func:`StarPopulation.apply_con...
[ "def", "replace_constraint", "(", "self", ",", "name", ",", "selectfrac_skip", "=", "False", ",", "distribution_skip", "=", "False", ")", ":", "hidden_constraints", "=", "self", ".", "hidden_constraints", "if", "name", "in", "hidden_constraints", ":", "c", "=", ...
Re-apply constraint that had been removed :param name: Name of constraint to replace :param selectfrac_skip,distribution_skip: (optional) Same as :func:`StarPopulation.apply_constraint`
[ "Re", "-", "apply", "constraint", "that", "had", "been", "removed" ]
0446b54d48009f3655cfd1a3957ceea21d3adcaa
https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/stars/populations.py#L736-L756
train
64,266
timothydmorton/VESPA
vespa/stars/populations.py
StarPopulation.constrain_property
def constrain_property(self,prop,lo=-np.inf,hi=np.inf, measurement=None,thresh=3, selectfrac_skip=False,distribution_skip=False): """Apply constraint that constrains property. :param prop: Name of property. Must be column in ``self.star...
python
def constrain_property(self,prop,lo=-np.inf,hi=np.inf, measurement=None,thresh=3, selectfrac_skip=False,distribution_skip=False): """Apply constraint that constrains property. :param prop: Name of property. Must be column in ``self.star...
[ "def", "constrain_property", "(", "self", ",", "prop", ",", "lo", "=", "-", "np", ".", "inf", ",", "hi", "=", "np", ".", "inf", ",", "measurement", "=", "None", ",", "thresh", "=", "3", ",", "selectfrac_skip", "=", "False", ",", "distribution_skip", ...
Apply constraint that constrains property. :param prop: Name of property. Must be column in ``self.stars``. :type prop: ``str`` :param lo,hi: (optional) Low and high allowed values for ``prop``. Defaults to ``-np.inf`` and ``np.inf`` to allow f...
[ "Apply", "constraint", "that", "constrains", "property", "." ]
0446b54d48009f3655cfd1a3957ceea21d3adcaa
https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/stars/populations.py#L786-L825
train
64,267
timothydmorton/VESPA
vespa/stars/populations.py
StarPopulation.apply_trend_constraint
def apply_trend_constraint(self, limit, dt, distribution_skip=False, **kwargs): """ Constrains change in RV to be less than limit over time dt. Only works if ``dRV`` and ``Plong`` attributes are defined for population. :param limit: Ra...
python
def apply_trend_constraint(self, limit, dt, distribution_skip=False, **kwargs): """ Constrains change in RV to be less than limit over time dt. Only works if ``dRV`` and ``Plong`` attributes are defined for population. :param limit: Ra...
[ "def", "apply_trend_constraint", "(", "self", ",", "limit", ",", "dt", ",", "distribution_skip", "=", "False", ",", "*", "*", "kwargs", ")", ":", "if", "type", "(", "limit", ")", "!=", "Quantity", ":", "limit", "=", "limit", "*", "u", ".", "m", "/", ...
Constrains change in RV to be less than limit over time dt. Only works if ``dRV`` and ``Plong`` attributes are defined for population. :param limit: Radial velocity limit on trend. Must be :class:`astropy.units.Quantity` object, or else interpreted as m/s. ...
[ "Constrains", "change", "in", "RV", "to", "be", "less", "than", "limit", "over", "time", "dt", "." ]
0446b54d48009f3655cfd1a3957ceea21d3adcaa
https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/stars/populations.py#L827-L866
train
64,268
timothydmorton/VESPA
vespa/stars/populations.py
StarPopulation.apply_cc
def apply_cc(self, cc, distribution_skip=False, **kwargs): """ Apply contrast-curve constraint to population. Only works if object has ``Rsky``, ``dmag`` attributes :param cc: Contrast curve. :type cc: :class:`ContrastCurveConstraint` ...
python
def apply_cc(self, cc, distribution_skip=False, **kwargs): """ Apply contrast-curve constraint to population. Only works if object has ``Rsky``, ``dmag`` attributes :param cc: Contrast curve. :type cc: :class:`ContrastCurveConstraint` ...
[ "def", "apply_cc", "(", "self", ",", "cc", ",", "distribution_skip", "=", "False", ",", "*", "*", "kwargs", ")", ":", "rs", "=", "self", ".", "Rsky", ".", "to", "(", "'arcsec'", ")", ".", "value", "dmags", "=", "self", ".", "dmag", "(", "cc", "."...
Apply contrast-curve constraint to population. Only works if object has ``Rsky``, ``dmag`` attributes :param cc: Contrast curve. :type cc: :class:`ContrastCurveConstraint` :param distribution_skip: This is by default ``True``. *To be honest, I'm no...
[ "Apply", "contrast", "-", "curve", "constraint", "to", "population", "." ]
0446b54d48009f3655cfd1a3957ceea21d3adcaa
https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/stars/populations.py#L868-L893
train
64,269
timothydmorton/VESPA
vespa/stars/populations.py
StarPopulation.apply_vcc
def apply_vcc(self, vcc, distribution_skip=False, **kwargs): """ Applies "velocity contrast curve" to population. That is, the constraint that comes from not seeing two sets of spectral lines in a high resolution spectrum. Only works if population has ``dmag``...
python
def apply_vcc(self, vcc, distribution_skip=False, **kwargs): """ Applies "velocity contrast curve" to population. That is, the constraint that comes from not seeing two sets of spectral lines in a high resolution spectrum. Only works if population has ``dmag``...
[ "def", "apply_vcc", "(", "self", ",", "vcc", ",", "distribution_skip", "=", "False", ",", "*", "*", "kwargs", ")", ":", "rvs", "=", "self", ".", "RV", ".", "value", "dmags", "=", "self", ".", "dmag", "(", "vcc", ".", "band", ")", "self", ".", "ap...
Applies "velocity contrast curve" to population. That is, the constraint that comes from not seeing two sets of spectral lines in a high resolution spectrum. Only works if population has ``dmag`` and ``RV`` attributes. :param vcc: Velocity contrast curve; dmag vs. delta-RV...
[ "Applies", "velocity", "contrast", "curve", "to", "population", "." ]
0446b54d48009f3655cfd1a3957ceea21d3adcaa
https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/stars/populations.py#L895-L924
train
64,270
timothydmorton/VESPA
vespa/stars/populations.py
StarPopulation.set_maxrad
def set_maxrad(self,maxrad, distribution_skip=True): """ Adds a constraint that rejects everything with Rsky > maxrad Requires ``Rsky`` attribute, which should always have units. :param maxrad: The maximum angular value of Rsky. :type maxrad: :class:`ast...
python
def set_maxrad(self,maxrad, distribution_skip=True): """ Adds a constraint that rejects everything with Rsky > maxrad Requires ``Rsky`` attribute, which should always have units. :param maxrad: The maximum angular value of Rsky. :type maxrad: :class:`ast...
[ "def", "set_maxrad", "(", "self", ",", "maxrad", ",", "distribution_skip", "=", "True", ")", ":", "self", ".", "maxrad", "=", "maxrad", "self", ".", "apply_constraint", "(", "UpperLimit", "(", "self", ".", "Rsky", ",", "maxrad", ",", "name", "=", "'Max R...
Adds a constraint that rejects everything with Rsky > maxrad Requires ``Rsky`` attribute, which should always have units. :param maxrad: The maximum angular value of Rsky. :type maxrad: :class:`astropy.units.Quantity` :param distribution_skip: This ...
[ "Adds", "a", "constraint", "that", "rejects", "everything", "with", "Rsky", ">", "maxrad" ]
0446b54d48009f3655cfd1a3957ceea21d3adcaa
https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/stars/populations.py#L926-L947
train
64,271
timothydmorton/VESPA
vespa/stars/populations.py
StarPopulation.constraint_df
def constraint_df(self): """ A DataFrame representing all constraints, hidden or not """ df = pd.DataFrame() for name,c in self.constraints.items(): df[name] = c.ok for name,c in self.hidden_constraints.items(): df[name] = c.ok return df
python
def constraint_df(self): """ A DataFrame representing all constraints, hidden or not """ df = pd.DataFrame() for name,c in self.constraints.items(): df[name] = c.ok for name,c in self.hidden_constraints.items(): df[name] = c.ok return df
[ "def", "constraint_df", "(", "self", ")", ":", "df", "=", "pd", ".", "DataFrame", "(", ")", "for", "name", ",", "c", "in", "self", ".", "constraints", ".", "items", "(", ")", ":", "df", "[", "name", "]", "=", "c", ".", "ok", "for", "name", ",",...
A DataFrame representing all constraints, hidden or not
[ "A", "DataFrame", "representing", "all", "constraints", "hidden", "or", "not" ]
0446b54d48009f3655cfd1a3957ceea21d3adcaa
https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/stars/populations.py#L952-L961
train
64,272
timothydmorton/VESPA
vespa/stars/populations.py
StarPopulation.save_hdf
def save_hdf(self,filename,path='',properties=None, overwrite=False, append=False): """Saves to HDF5 file. Subclasses should be sure to define ``_properties`` attribute to ensure that all correct attributes get saved. Load a saved population with :func:`StarPop...
python
def save_hdf(self,filename,path='',properties=None, overwrite=False, append=False): """Saves to HDF5 file. Subclasses should be sure to define ``_properties`` attribute to ensure that all correct attributes get saved. Load a saved population with :func:`StarPop...
[ "def", "save_hdf", "(", "self", ",", "filename", ",", "path", "=", "''", ",", "properties", "=", "None", ",", "overwrite", "=", "False", ",", "append", "=", "False", ")", ":", "if", "os", ".", "path", ".", "exists", "(", "filename", ")", ":", "with...
Saves to HDF5 file. Subclasses should be sure to define ``_properties`` attribute to ensure that all correct attributes get saved. Load a saved population with :func:`StarPopulation.load_hdf`. Example usage:: >>> from vespa.stars import Raghavan_BinaryPopulation, ...
[ "Saves", "to", "HDF5", "file", "." ]
0446b54d48009f3655cfd1a3957ceea21d3adcaa
https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/stars/populations.py#L967-L1044
train
64,273
timothydmorton/VESPA
vespa/stars/populations.py
StarPopulation.load_hdf
def load_hdf(cls, filename, path=''): """Loads StarPopulation from .h5 file Correct properties should be restored to object, and object will be original type that was saved. Complement to :func:`StarPopulation.save_hdf`. Example usage:: >>> from vespa.stars import...
python
def load_hdf(cls, filename, path=''): """Loads StarPopulation from .h5 file Correct properties should be restored to object, and object will be original type that was saved. Complement to :func:`StarPopulation.save_hdf`. Example usage:: >>> from vespa.stars import...
[ "def", "load_hdf", "(", "cls", ",", "filename", ",", "path", "=", "''", ")", ":", "stars", "=", "pd", ".", "read_hdf", "(", "filename", ",", "path", "+", "'/stars'", ")", "constraint_df", "=", "pd", ".", "read_hdf", "(", "filename", ",", "path", "+",...
Loads StarPopulation from .h5 file Correct properties should be restored to object, and object will be original type that was saved. Complement to :func:`StarPopulation.save_hdf`. Example usage:: >>> from vespa.stars import Raghavan_BinaryPopulation, StarPopulation ...
[ "Loads", "StarPopulation", "from", ".", "h5", "file" ]
0446b54d48009f3655cfd1a3957ceea21d3adcaa
https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/stars/populations.py#L1047-L1119
train
64,274
timothydmorton/VESPA
vespa/stars/populations.py
BinaryPopulation.binary_fraction
def binary_fraction(self,query='mass_A >= 0'): """ Binary fraction of stars passing given query :param query: Query to pass to stars ``DataFrame``. """ subdf = self.stars.query(query) nbinaries = (subdf['mass_B'] > 0).sum() frac = nbinaries/len(subdf...
python
def binary_fraction(self,query='mass_A >= 0'): """ Binary fraction of stars passing given query :param query: Query to pass to stars ``DataFrame``. """ subdf = self.stars.query(query) nbinaries = (subdf['mass_B'] > 0).sum() frac = nbinaries/len(subdf...
[ "def", "binary_fraction", "(", "self", ",", "query", "=", "'mass_A >= 0'", ")", ":", "subdf", "=", "self", ".", "stars", ".", "query", "(", "query", ")", "nbinaries", "=", "(", "subdf", "[", "'mass_B'", "]", ">", "0", ")", ".", "sum", "(", ")", "fr...
Binary fraction of stars passing given query :param query: Query to pass to stars ``DataFrame``.
[ "Binary", "fraction", "of", "stars", "passing", "given", "query" ]
0446b54d48009f3655cfd1a3957ceea21d3adcaa
https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/stars/populations.py#L1203-L1214
train
64,275
timothydmorton/VESPA
vespa/stars/populations.py
BinaryPopulation.dmag
def dmag(self,band): """ Difference in magnitude between primary and secondary stars :param band: Photometric bandpass. """ mag2 = self.stars['{}_mag_B'.format(band)] mag1 = self.stars['{}_mag_A'.format(band)] return mag2-mag1
python
def dmag(self,band): """ Difference in magnitude between primary and secondary stars :param band: Photometric bandpass. """ mag2 = self.stars['{}_mag_B'.format(band)] mag1 = self.stars['{}_mag_A'.format(band)] return mag2-mag1
[ "def", "dmag", "(", "self", ",", "band", ")", ":", "mag2", "=", "self", ".", "stars", "[", "'{}_mag_B'", ".", "format", "(", "band", ")", "]", "mag1", "=", "self", ".", "stars", "[", "'{}_mag_A'", ".", "format", "(", "band", ")", "]", "return", "...
Difference in magnitude between primary and secondary stars :param band: Photometric bandpass.
[ "Difference", "in", "magnitude", "between", "primary", "and", "secondary", "stars" ]
0446b54d48009f3655cfd1a3957ceea21d3adcaa
https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/stars/populations.py#L1227-L1237
train
64,276
timothydmorton/VESPA
vespa/stars/populations.py
BinaryPopulation.rsky_distribution
def rsky_distribution(self,rmax=None,smooth=0.1,nbins=100): """ Distribution of projected separations Returns a :class:`simpledists.Hist_Distribution` object. :param rmax: (optional) Maximum radius to calculate distribution. :param dr: (optional) Bin wi...
python
def rsky_distribution(self,rmax=None,smooth=0.1,nbins=100): """ Distribution of projected separations Returns a :class:`simpledists.Hist_Distribution` object. :param rmax: (optional) Maximum radius to calculate distribution. :param dr: (optional) Bin wi...
[ "def", "rsky_distribution", "(", "self", ",", "rmax", "=", "None", ",", "smooth", "=", "0.1", ",", "nbins", "=", "100", ")", ":", "if", "rmax", "is", "None", ":", "if", "hasattr", "(", "self", ",", "'maxrad'", ")", ":", "rmax", "=", "self", ".", ...
Distribution of projected separations Returns a :class:`simpledists.Hist_Distribution` object. :param rmax: (optional) Maximum radius to calculate distribution. :param dr: (optional) Bin width for histogram :param smooth: (optional) Smoothing param...
[ "Distribution", "of", "projected", "separations" ]
0446b54d48009f3655cfd1a3957ceea21d3adcaa
https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/stars/populations.py#L1239-L1267
train
64,277
timothydmorton/VESPA
vespa/stars/populations.py
Simulated_BinaryPopulation.generate
def generate(self, M, age=9.6, feh=0.0, ichrone='mist', n=1e4, bands=None, **kwargs): """ Function that generates population. Called by ``__init__`` if ``M`` is passed. """ ichrone = get_ichrone(ichrone, bands=bands) if np.size(M) > 1: n = np...
python
def generate(self, M, age=9.6, feh=0.0, ichrone='mist', n=1e4, bands=None, **kwargs): """ Function that generates population. Called by ``__init__`` if ``M`` is passed. """ ichrone = get_ichrone(ichrone, bands=bands) if np.size(M) > 1: n = np...
[ "def", "generate", "(", "self", ",", "M", ",", "age", "=", "9.6", ",", "feh", "=", "0.0", ",", "ichrone", "=", "'mist'", ",", "n", "=", "1e4", ",", "bands", "=", "None", ",", "*", "*", "kwargs", ")", ":", "ichrone", "=", "get_ichrone", "(", "ic...
Function that generates population. Called by ``__init__`` if ``M`` is passed.
[ "Function", "that", "generates", "population", "." ]
0446b54d48009f3655cfd1a3957ceea21d3adcaa
https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/stars/populations.py#L1358-L1384
train
64,278
timothydmorton/VESPA
vespa/stars/populations.py
TriplePopulation.dmag
def dmag(self, band): """ Difference in magnitudes between fainter and brighter components in band. :param band: Photometric bandpass. """ m1 = self.stars['{}_mag_A'.format(band)] m2 = addmags(self.stars['{}_mag_B'.format(band)], self.st...
python
def dmag(self, band): """ Difference in magnitudes between fainter and brighter components in band. :param band: Photometric bandpass. """ m1 = self.stars['{}_mag_A'.format(band)] m2 = addmags(self.stars['{}_mag_B'.format(band)], self.st...
[ "def", "dmag", "(", "self", ",", "band", ")", ":", "m1", "=", "self", ".", "stars", "[", "'{}_mag_A'", ".", "format", "(", "band", ")", "]", "m2", "=", "addmags", "(", "self", ".", "stars", "[", "'{}_mag_B'", ".", "format", "(", "band", ")", "]",...
Difference in magnitudes between fainter and brighter components in band. :param band: Photometric bandpass.
[ "Difference", "in", "magnitudes", "between", "fainter", "and", "brighter", "components", "in", "band", "." ]
0446b54d48009f3655cfd1a3957ceea21d3adcaa
https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/stars/populations.py#L1530-L1541
train
64,279
timothydmorton/VESPA
vespa/stars/populations.py
TriplePopulation.dRV
def dRV(self, dt, band='g'): """Returns dRV of star A, if A is brighter than B+C, or of star B if B+C is brighter """ return (self.orbpop.dRV_1(dt)*self.A_brighter(band) + self.orbpop.dRV_2(dt)*self.BC_brighter(band))
python
def dRV(self, dt, band='g'): """Returns dRV of star A, if A is brighter than B+C, or of star B if B+C is brighter """ return (self.orbpop.dRV_1(dt)*self.A_brighter(band) + self.orbpop.dRV_2(dt)*self.BC_brighter(band))
[ "def", "dRV", "(", "self", ",", "dt", ",", "band", "=", "'g'", ")", ":", "return", "(", "self", ".", "orbpop", ".", "dRV_1", "(", "dt", ")", "*", "self", ".", "A_brighter", "(", "band", ")", "+", "self", ".", "orbpop", ".", "dRV_2", "(", "dt", ...
Returns dRV of star A, if A is brighter than B+C, or of star B if B+C is brighter
[ "Returns", "dRV", "of", "star", "A", "if", "A", "is", "brighter", "than", "B", "+", "C", "or", "of", "star", "B", "if", "B", "+", "C", "is", "brighter" ]
0446b54d48009f3655cfd1a3957ceea21d3adcaa
https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/stars/populations.py#L1558-L1562
train
64,280
timothydmorton/VESPA
vespa/stars/populations.py
TriplePopulation.triple_fraction
def triple_fraction(self,query='mass_A > 0', unc=False): """ Triple fraction of stars following given query """ subdf = self.stars.query(query) ntriples = ((subdf['mass_B'] > 0) & (subdf['mass_C'] > 0)).sum() frac = ntriples/len(subdf) if unc: return f...
python
def triple_fraction(self,query='mass_A > 0', unc=False): """ Triple fraction of stars following given query """ subdf = self.stars.query(query) ntriples = ((subdf['mass_B'] > 0) & (subdf['mass_C'] > 0)).sum() frac = ntriples/len(subdf) if unc: return f...
[ "def", "triple_fraction", "(", "self", ",", "query", "=", "'mass_A > 0'", ",", "unc", "=", "False", ")", ":", "subdf", "=", "self", ".", "stars", ".", "query", "(", "query", ")", "ntriples", "=", "(", "(", "subdf", "[", "'mass_B'", "]", ">", "0", "...
Triple fraction of stars following given query
[ "Triple", "fraction", "of", "stars", "following", "given", "query" ]
0446b54d48009f3655cfd1a3957ceea21d3adcaa
https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/stars/populations.py#L1595-L1605
train
64,281
timothydmorton/VESPA
vespa/stars/populations.py
Observed_BinaryPopulation.starmodel_props
def starmodel_props(self): """Default mag_err is 0.05, arbitrarily """ props = {} mags = self.mags mag_errs = self.mag_errs for b in mags.keys(): if np.size(mags[b])==2: props[b] = mags[b] elif np.size(mags[b])==1: m...
python
def starmodel_props(self): """Default mag_err is 0.05, arbitrarily """ props = {} mags = self.mags mag_errs = self.mag_errs for b in mags.keys(): if np.size(mags[b])==2: props[b] = mags[b] elif np.size(mags[b])==1: m...
[ "def", "starmodel_props", "(", "self", ")", ":", "props", "=", "{", "}", "mags", "=", "self", ".", "mags", "mag_errs", "=", "self", ".", "mag_errs", "for", "b", "in", "mags", ".", "keys", "(", ")", ":", "if", "np", ".", "size", "(", "mags", "[", ...
Default mag_err is 0.05, arbitrarily
[ "Default", "mag_err", "is", "0", ".", "05", "arbitrarily" ]
0446b54d48009f3655cfd1a3957ceea21d3adcaa
https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/stars/populations.py#L1657-L1681
train
64,282
timothydmorton/VESPA
vespa/stars/populations.py
BGStarPopulation.dmag
def dmag(self,band): """ Magnitude difference between primary star and BG stars """ if self.mags is None: raise ValueError('dmag is not defined because primary mags are not defined for this population.') return self.stars['{}_mag'.format(band)] - self.mags[band]
python
def dmag(self,band): """ Magnitude difference between primary star and BG stars """ if self.mags is None: raise ValueError('dmag is not defined because primary mags are not defined for this population.') return self.stars['{}_mag'.format(band)] - self.mags[band]
[ "def", "dmag", "(", "self", ",", "band", ")", ":", "if", "self", ".", "mags", "is", "None", ":", "raise", "ValueError", "(", "'dmag is not defined because primary mags are not defined for this population.'", ")", "return", "self", ".", "stars", "[", "'{}_mag'", "....
Magnitude difference between primary star and BG stars
[ "Magnitude", "difference", "between", "primary", "star", "and", "BG", "stars" ]
0446b54d48009f3655cfd1a3957ceea21d3adcaa
https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/stars/populations.py#L2127-L2134
train
64,283
rxcomm/pyaxo
examples/wh.py
WHMgr.receive
def receive(self): """I receive data+hash, check for a match, confirm or not confirm to the sender, and return the data payload. """ def _receive(input_message): self.data = input_message[:-64] _hash = input_message[-64:] if h.sha256(self.data).hexdige...
python
def receive(self): """I receive data+hash, check for a match, confirm or not confirm to the sender, and return the data payload. """ def _receive(input_message): self.data = input_message[:-64] _hash = input_message[-64:] if h.sha256(self.data).hexdige...
[ "def", "receive", "(", "self", ")", ":", "def", "_receive", "(", "input_message", ")", ":", "self", ".", "data", "=", "input_message", "[", ":", "-", "64", "]", "_hash", "=", "input_message", "[", "-", "64", ":", "]", "if", "h", ".", "sha256", "(",...
I receive data+hash, check for a match, confirm or not confirm to the sender, and return the data payload.
[ "I", "receive", "data", "+", "hash", "check", "for", "a", "match", "confirm", "or", "not", "confirm", "to", "the", "sender", "and", "return", "the", "data", "payload", "." ]
1e34cfa4c4826fb2e024812d1ce71a979d9e0370
https://github.com/rxcomm/pyaxo/blob/1e34cfa4c4826fb2e024812d1ce71a979d9e0370/examples/wh.py#L49-L68
train
64,284
rxcomm/pyaxo
examples/axotor.py
validator
def validator(ch): """ Update screen if necessary and release the lock so receiveThread can run """ global screen_needs_update try: if screen_needs_update: curses.doupdate() screen_needs_update = False return ch finally: winlock.release() s...
python
def validator(ch): """ Update screen if necessary and release the lock so receiveThread can run """ global screen_needs_update try: if screen_needs_update: curses.doupdate() screen_needs_update = False return ch finally: winlock.release() s...
[ "def", "validator", "(", "ch", ")", ":", "global", "screen_needs_update", "try", ":", "if", "screen_needs_update", ":", "curses", ".", "doupdate", "(", ")", "screen_needs_update", "=", "False", "return", "ch", "finally", ":", "winlock", ".", "release", "(", ...
Update screen if necessary and release the lock so receiveThread can run
[ "Update", "screen", "if", "necessary", "and", "release", "the", "lock", "so", "receiveThread", "can", "run" ]
1e34cfa4c4826fb2e024812d1ce71a979d9e0370
https://github.com/rxcomm/pyaxo/blob/1e34cfa4c4826fb2e024812d1ce71a979d9e0370/examples/axotor.py#L165-L178
train
64,285
timothydmorton/VESPA
vespa/stars/constraints.py
Constraint.resample
def resample(self, inds): """Returns copy of constraint, with mask rearranged according to indices """ new = copy.deepcopy(self) for arr in self.arrays: x = getattr(new, arr) setattr(new, arr, x[inds]) return new
python
def resample(self, inds): """Returns copy of constraint, with mask rearranged according to indices """ new = copy.deepcopy(self) for arr in self.arrays: x = getattr(new, arr) setattr(new, arr, x[inds]) return new
[ "def", "resample", "(", "self", ",", "inds", ")", ":", "new", "=", "copy", ".", "deepcopy", "(", "self", ")", "for", "arr", "in", "self", ".", "arrays", ":", "x", "=", "getattr", "(", "new", ",", "arr", ")", "setattr", "(", "new", ",", "arr", "...
Returns copy of constraint, with mask rearranged according to indices
[ "Returns", "copy", "of", "constraint", "with", "mask", "rearranged", "according", "to", "indices" ]
0446b54d48009f3655cfd1a3957ceea21d3adcaa
https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/stars/constraints.py#L52-L59
train
64,286
timothydmorton/VESPA
vespa/fpp.py
save
def save(self, overwrite=True): """ Saves PopulationSet and TransitSignal. Shouldn't need to use this if you're using :func:`FPPCalculation.from_ini`. Saves :class`PopulationSet` to ``[folder]/popset.h5]`` and :class:`TransitSignal` to ``[folder]/trsig.pkl``. :...
python
def save(self, overwrite=True): """ Saves PopulationSet and TransitSignal. Shouldn't need to use this if you're using :func:`FPPCalculation.from_ini`. Saves :class`PopulationSet` to ``[folder]/popset.h5]`` and :class:`TransitSignal` to ``[folder]/trsig.pkl``. :...
[ "def", "save", "(", "self", ",", "overwrite", "=", "True", ")", ":", "self", ".", "save_popset", "(", "overwrite", "=", "overwrite", ")", "self", ".", "save_signal", "(", ")" ]
Saves PopulationSet and TransitSignal. Shouldn't need to use this if you're using :func:`FPPCalculation.from_ini`. Saves :class`PopulationSet` to ``[folder]/popset.h5]`` and :class:`TransitSignal` to ``[folder]/trsig.pkl``. :param overwrite: (optional) Whether to o...
[ "Saves", "PopulationSet", "and", "TransitSignal", "." ]
0446b54d48009f3655cfd1a3957ceea21d3adcaa
https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/fpp.py#L342-L357
train
64,287
timothydmorton/VESPA
vespa/fpp.py
load
def load(cls, folder): """ Loads PopulationSet from folder ``popset.h5`` and ``trsig.pkl`` must exist in folder. :param folder: Folder from which to load. """ popset = PopulationSet.load_hdf(os.path.join(folder,'popset.h5')) sigfile = os.path.join(fo...
python
def load(cls, folder): """ Loads PopulationSet from folder ``popset.h5`` and ``trsig.pkl`` must exist in folder. :param folder: Folder from which to load. """ popset = PopulationSet.load_hdf(os.path.join(folder,'popset.h5')) sigfile = os.path.join(fo...
[ "def", "load", "(", "cls", ",", "folder", ")", ":", "popset", "=", "PopulationSet", ".", "load_hdf", "(", "os", ".", "path", ".", "join", "(", "folder", ",", "'popset.h5'", ")", ")", "sigfile", "=", "os", ".", "path", ".", "join", "(", "folder", ",...
Loads PopulationSet from folder ``popset.h5`` and ``trsig.pkl`` must exist in folder. :param folder: Folder from which to load.
[ "Loads", "PopulationSet", "from", "folder" ]
0446b54d48009f3655cfd1a3957ceea21d3adcaa
https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/fpp.py#L360-L373
train
64,288
timothydmorton/VESPA
vespa/fpp.py
FPPplots
def FPPplots(self, folder=None, format='png', tag=None, **kwargs): """ Make FPP diagnostic plots Makes likelihood "fuzz plot" for each model, a FPP summary figure, a plot of the :class:`TransitSignal`, and writes a ``results.txt`` file. :param folder: (optional) ...
python
def FPPplots(self, folder=None, format='png', tag=None, **kwargs): """ Make FPP diagnostic plots Makes likelihood "fuzz plot" for each model, a FPP summary figure, a plot of the :class:`TransitSignal`, and writes a ``results.txt`` file. :param folder: (optional) ...
[ "def", "FPPplots", "(", "self", ",", "folder", "=", "None", ",", "format", "=", "'png'", ",", "tag", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "folder", "is", "None", ":", "folder", "=", "self", ".", "folder", "self", ".", "write_result...
Make FPP diagnostic plots Makes likelihood "fuzz plot" for each model, a FPP summary figure, a plot of the :class:`TransitSignal`, and writes a ``results.txt`` file. :param folder: (optional) Destination folder for plots/``results.txt``. Default is ``self.folde...
[ "Make", "FPP", "diagnostic", "plots" ]
0446b54d48009f3655cfd1a3957ceea21d3adcaa
https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/fpp.py#L375-L404
train
64,289
timothydmorton/VESPA
vespa/fpp.py
write_results
def write_results(self,folder=None, filename='results.txt', to_file=True): """ Writes text file of calculation summary. :param folder: (optional) Folder to which to write ``results.txt``. :param filename: Filename to write. Default=``results.txt``. :pa...
python
def write_results(self,folder=None, filename='results.txt', to_file=True): """ Writes text file of calculation summary. :param folder: (optional) Folder to which to write ``results.txt``. :param filename: Filename to write. Default=``results.txt``. :pa...
[ "def", "write_results", "(", "self", ",", "folder", "=", "None", ",", "filename", "=", "'results.txt'", ",", "to_file", "=", "True", ")", ":", "if", "folder", "is", "None", ":", "folder", "=", "self", ".", "folder", "if", "to_file", ":", "fout", "=", ...
Writes text file of calculation summary. :param folder: (optional) Folder to which to write ``results.txt``. :param filename: Filename to write. Default=``results.txt``. :param to_file: If True, then writes file. Otherwise just return header, line. ...
[ "Writes", "text", "file", "of", "calculation", "summary", "." ]
0446b54d48009f3655cfd1a3957ceea21d3adcaa
https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/fpp.py#L435-L478
train
64,290
timothydmorton/VESPA
vespa/fpp.py
save_popset
def save_popset(self,filename='popset.h5',**kwargs): """Saves the PopulationSet Calls :func:`PopulationSet.save_hdf`. """ self.popset.save_hdf(os.path.join(self.folder,filename))
python
def save_popset(self,filename='popset.h5',**kwargs): """Saves the PopulationSet Calls :func:`PopulationSet.save_hdf`. """ self.popset.save_hdf(os.path.join(self.folder,filename))
[ "def", "save_popset", "(", "self", ",", "filename", "=", "'popset.h5'", ",", "*", "*", "kwargs", ")", ":", "self", ".", "popset", ".", "save_hdf", "(", "os", ".", "path", ".", "join", "(", "self", ".", "folder", ",", "filename", ")", ")" ]
Saves the PopulationSet Calls :func:`PopulationSet.save_hdf`.
[ "Saves", "the", "PopulationSet" ]
0446b54d48009f3655cfd1a3957ceea21d3adcaa
https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/fpp.py#L480-L485
train
64,291
timothydmorton/VESPA
vespa/fpp.py
save_signal
def save_signal(self,filename=None): """ Saves TransitSignal. Calls :func:`TransitSignal.save`; default filename is ``trsig.pkl`` in ``self.folder``. """ if filename is None: filename = os.path.join(self.folder,'trsig.pkl') self.trsig.save(filename)
python
def save_signal(self,filename=None): """ Saves TransitSignal. Calls :func:`TransitSignal.save`; default filename is ``trsig.pkl`` in ``self.folder``. """ if filename is None: filename = os.path.join(self.folder,'trsig.pkl') self.trsig.save(filename)
[ "def", "save_signal", "(", "self", ",", "filename", "=", "None", ")", ":", "if", "filename", "is", "None", ":", "filename", "=", "os", ".", "path", ".", "join", "(", "self", ".", "folder", ",", "'trsig.pkl'", ")", "self", ".", "trsig", ".", "save", ...
Saves TransitSignal. Calls :func:`TransitSignal.save`; default filename is ``trsig.pkl`` in ``self.folder``.
[ "Saves", "TransitSignal", "." ]
0446b54d48009f3655cfd1a3957ceea21d3adcaa
https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/fpp.py#L487-L496
train
64,292
timothydmorton/VESPA
vespa/kepler.py
modelshift_weaksec
def modelshift_weaksec(koi): """ Max secondary depth based on model-shift secondary test from Jeff Coughlin secondary metric: mod_depth_sec_dv * (1 + 3*mod_fred_dv / mod_sig_sec_dv) """ num = KOIDATA.ix[ku.koiname(koi), 'koi_tce_plnt_num'] if np.isnan(num): num = 1 kid = KOIDATA.ix[...
python
def modelshift_weaksec(koi): """ Max secondary depth based on model-shift secondary test from Jeff Coughlin secondary metric: mod_depth_sec_dv * (1 + 3*mod_fred_dv / mod_sig_sec_dv) """ num = KOIDATA.ix[ku.koiname(koi), 'koi_tce_plnt_num'] if np.isnan(num): num = 1 kid = KOIDATA.ix[...
[ "def", "modelshift_weaksec", "(", "koi", ")", ":", "num", "=", "KOIDATA", ".", "ix", "[", "ku", ".", "koiname", "(", "koi", ")", ",", "'koi_tce_plnt_num'", "]", "if", "np", ".", "isnan", "(", "num", ")", ":", "num", "=", "1", "kid", "=", "KOIDATA",...
Max secondary depth based on model-shift secondary test from Jeff Coughlin secondary metric: mod_depth_sec_dv * (1 + 3*mod_fred_dv / mod_sig_sec_dv)
[ "Max", "secondary", "depth", "based", "on", "model", "-", "shift", "secondary", "test", "from", "Jeff", "Coughlin" ]
0446b54d48009f3655cfd1a3957ceea21d3adcaa
https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/kepler.py#L114-L146
train
64,293
timothydmorton/VESPA
vespa/kepler.py
use_property
def use_property(kepid, prop): """Returns true if provenance of property is SPE or AST """ try: prov = kicu.DATA.ix[kepid, '{}_prov'.format(prop)] return any([prov.startswith(s) for s in ['SPE', 'AST']]) except KeyError: raise MissingStellarError('{} not in stellar table?'.format...
python
def use_property(kepid, prop): """Returns true if provenance of property is SPE or AST """ try: prov = kicu.DATA.ix[kepid, '{}_prov'.format(prop)] return any([prov.startswith(s) for s in ['SPE', 'AST']]) except KeyError: raise MissingStellarError('{} not in stellar table?'.format...
[ "def", "use_property", "(", "kepid", ",", "prop", ")", ":", "try", ":", "prov", "=", "kicu", ".", "DATA", ".", "ix", "[", "kepid", ",", "'{}_prov'", ".", "format", "(", "prop", ")", "]", "return", "any", "(", "[", "prov", ".", "startswith", "(", ...
Returns true if provenance of property is SPE or AST
[ "Returns", "true", "if", "provenance", "of", "property", "is", "SPE", "or", "AST" ]
0446b54d48009f3655cfd1a3957ceea21d3adcaa
https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/kepler.py#L573-L580
train
64,294
timothydmorton/VESPA
vespa/kepler.py
star_config
def star_config(koi, bands=['g','r','i','z','J','H','K'], unc=dict(g=0.05, r=0.05, i=0.05, z=0.05, J=0.02, H=0.02, K=0.02), **kwargs): """returns star config object for given KOI """ folder = os.path.join(KOI_FPPDIR, ku.koiname(koi)) if not os.path.exists(folder...
python
def star_config(koi, bands=['g','r','i','z','J','H','K'], unc=dict(g=0.05, r=0.05, i=0.05, z=0.05, J=0.02, H=0.02, K=0.02), **kwargs): """returns star config object for given KOI """ folder = os.path.join(KOI_FPPDIR, ku.koiname(koi)) if not os.path.exists(folder...
[ "def", "star_config", "(", "koi", ",", "bands", "=", "[", "'g'", ",", "'r'", ",", "'i'", ",", "'z'", ",", "'J'", ",", "'H'", ",", "'K'", "]", ",", "unc", "=", "dict", "(", "g", "=", "0.05", ",", "r", "=", "0.05", ",", "i", "=", "0.05", ",",...
returns star config object for given KOI
[ "returns", "star", "config", "object", "for", "given", "KOI" ]
0446b54d48009f3655cfd1a3957ceea21d3adcaa
https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/kepler.py#L583-L629
train
64,295
timothydmorton/VESPA
vespa/kepler.py
fpp_config
def fpp_config(koi, **kwargs): """returns config object for given KOI """ folder = os.path.join(KOI_FPPDIR, ku.koiname(koi)) if not os.path.exists(folder): os.makedirs(folder) config = ConfigObj(os.path.join(folder,'fpp.ini')) koi = ku.koiname(koi) rowefit = jrowe_fit(koi) con...
python
def fpp_config(koi, **kwargs): """returns config object for given KOI """ folder = os.path.join(KOI_FPPDIR, ku.koiname(koi)) if not os.path.exists(folder): os.makedirs(folder) config = ConfigObj(os.path.join(folder,'fpp.ini')) koi = ku.koiname(koi) rowefit = jrowe_fit(koi) con...
[ "def", "fpp_config", "(", "koi", ",", "*", "*", "kwargs", ")", ":", "folder", "=", "os", ".", "path", ".", "join", "(", "KOI_FPPDIR", ",", "ku", ".", "koiname", "(", "koi", ")", ")", "if", "not", "os", ".", "path", ".", "exists", "(", "folder", ...
returns config object for given KOI
[ "returns", "config", "object", "for", "given", "KOI" ]
0446b54d48009f3655cfd1a3957ceea21d3adcaa
https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/kepler.py#L631-L662
train
64,296
timothydmorton/VESPA
vespa/kepler.py
KOI_FPPCalculation.apply_default_constraints
def apply_default_constraints(self): """Applies default secthresh & exclusion radius constraints """ try: self.apply_secthresh(pipeline_weaksec(self.koi)) except NoWeakSecondaryError: logging.warning('No secondary eclipse threshold set for {}'.format(self.koi)) ...
python
def apply_default_constraints(self): """Applies default secthresh & exclusion radius constraints """ try: self.apply_secthresh(pipeline_weaksec(self.koi)) except NoWeakSecondaryError: logging.warning('No secondary eclipse threshold set for {}'.format(self.koi)) ...
[ "def", "apply_default_constraints", "(", "self", ")", ":", "try", ":", "self", ".", "apply_secthresh", "(", "pipeline_weaksec", "(", "self", ".", "koi", ")", ")", "except", "NoWeakSecondaryError", ":", "logging", ".", "warning", "(", "'No secondary eclipse thresho...
Applies default secthresh & exclusion radius constraints
[ "Applies", "default", "secthresh", "&", "exclusion", "radius", "constraints" ]
0446b54d48009f3655cfd1a3957ceea21d3adcaa
https://github.com/timothydmorton/VESPA/blob/0446b54d48009f3655cfd1a3957ceea21d3adcaa/vespa/kepler.py#L361-L368
train
64,297
dellis23/ansible-toolkit
ansible_toolkit/git_diff.py
get_old_sha
def get_old_sha(diff_part): """ Returns the SHA for the original file that was changed in a diff part. """ r = re.compile(r'index ([a-fA-F\d]*)') return r.search(diff_part).groups()[0]
python
def get_old_sha(diff_part): """ Returns the SHA for the original file that was changed in a diff part. """ r = re.compile(r'index ([a-fA-F\d]*)') return r.search(diff_part).groups()[0]
[ "def", "get_old_sha", "(", "diff_part", ")", ":", "r", "=", "re", ".", "compile", "(", "r'index ([a-fA-F\\d]*)'", ")", "return", "r", ".", "search", "(", "diff_part", ")", ".", "groups", "(", ")", "[", "0", "]" ]
Returns the SHA for the original file that was changed in a diff part.
[ "Returns", "the", "SHA", "for", "the", "original", "file", "that", "was", "changed", "in", "a", "diff", "part", "." ]
7eb5198e1f68c9a3ca1d129d9e2a52fb3f0e65c5
https://github.com/dellis23/ansible-toolkit/blob/7eb5198e1f68c9a3ca1d129d9e2a52fb3f0e65c5/ansible_toolkit/git_diff.py#L27-L32
train
64,298
dellis23/ansible-toolkit
ansible_toolkit/git_diff.py
get_old_filename
def get_old_filename(diff_part): """ Returns the filename for the original file that was changed in a diff part. """ regexps = ( # e.g. "+++ a/foo/bar" r'^--- a/(.*)', # e.g. "+++ /dev/null" r'^\-\-\- (.*)', ) for regexp in regexps: r = re.compile(regexp, ...
python
def get_old_filename(diff_part): """ Returns the filename for the original file that was changed in a diff part. """ regexps = ( # e.g. "+++ a/foo/bar" r'^--- a/(.*)', # e.g. "+++ /dev/null" r'^\-\-\- (.*)', ) for regexp in regexps: r = re.compile(regexp, ...
[ "def", "get_old_filename", "(", "diff_part", ")", ":", "regexps", "=", "(", "# e.g. \"+++ a/foo/bar\"", "r'^--- a/(.*)'", ",", "# e.g. \"+++ /dev/null\"", "r'^\\-\\-\\- (.*)'", ",", ")", "for", "regexp", "in", "regexps", ":", "r", "=", "re", ".", "compile", "(", ...
Returns the filename for the original file that was changed in a diff part.
[ "Returns", "the", "filename", "for", "the", "original", "file", "that", "was", "changed", "in", "a", "diff", "part", "." ]
7eb5198e1f68c9a3ca1d129d9e2a52fb3f0e65c5
https://github.com/dellis23/ansible-toolkit/blob/7eb5198e1f68c9a3ca1d129d9e2a52fb3f0e65c5/ansible_toolkit/git_diff.py#L35-L51
train
64,299