partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
test | get_next_event | Returns the next occurrence of a given event, relative to 'now'.
The 'event' arg should be an iterable containing one element,
namely the event we'd like to find the occurrence of.
The reason for this is b/c the get_count() function of CountHandler,
which this func makes use of, expects an iterable.
... | happenings/utils/next_event.py | def get_next_event(event, now):
"""
Returns the next occurrence of a given event, relative to 'now'.
The 'event' arg should be an iterable containing one element,
namely the event we'd like to find the occurrence of.
The reason for this is b/c the get_count() function of CountHandler,
which this... | def get_next_event(event, now):
"""
Returns the next occurrence of a given event, relative to 'now'.
The 'event' arg should be an iterable containing one element,
namely the event we'd like to find the occurrence of.
The reason for this is b/c the get_count() function of CountHandler,
which this... | [
"Returns",
"the",
"next",
"occurrence",
"of",
"a",
"given",
"event",
"relative",
"to",
"now",
".",
"The",
"event",
"arg",
"should",
"be",
"an",
"iterable",
"containing",
"one",
"element",
"namely",
"the",
"event",
"we",
"d",
"like",
"to",
"find",
"the",
... | wreckage/django-happenings | python | https://github.com/wreckage/django-happenings/blob/7bca5576efa6cd4c4e87356bf9e5b8cd538ae91d/happenings/utils/next_event.py#L9-L63 | [
"def",
"get_next_event",
"(",
"event",
",",
"now",
")",
":",
"year",
"=",
"now",
".",
"year",
"month",
"=",
"now",
".",
"month",
"day",
"=",
"now",
".",
"day",
"e_day",
"=",
"event",
"[",
"0",
"]",
".",
"l_start_date",
".",
"day",
"e_end_day",
"=",... | 7bca5576efa6cd4c4e87356bf9e5b8cd538ae91d |
test | get_dashboard_info | Returns cases with phenotype
If phenotypes are provided search for only those
Args:
adapter(adapter.MongoAdapter)
institute_id(str): an institute _id
slice_query(str): query to filter cases to obtain statistics for.
Returns:
data(dict): Dictionary with relevant inform... | scout/server/blueprints/dashboard/controllers.py | def get_dashboard_info(adapter, institute_id=None, slice_query=None):
"""Returns cases with phenotype
If phenotypes are provided search for only those
Args:
adapter(adapter.MongoAdapter)
institute_id(str): an institute _id
slice_query(str): query to filter cases to obtain stat... | def get_dashboard_info(adapter, institute_id=None, slice_query=None):
"""Returns cases with phenotype
If phenotypes are provided search for only those
Args:
adapter(adapter.MongoAdapter)
institute_id(str): an institute _id
slice_query(str): query to filter cases to obtain stat... | [
"Returns",
"cases",
"with",
"phenotype"
] | Clinical-Genomics/scout | python | https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/server/blueprints/dashboard/controllers.py#L6-L163 | [
"def",
"get_dashboard_info",
"(",
"adapter",
",",
"institute_id",
"=",
"None",
",",
"slice_query",
"=",
"None",
")",
":",
"LOG",
".",
"debug",
"(",
"\"General query with institute_id {}.\"",
".",
"format",
"(",
"institute_id",
")",
")",
"# if institute_id == 'None' ... | 90a551e2e1653a319e654c2405c2866f93d0ebb9 |
test | get_general_case_info | Return general information about cases
Args:
adapter(adapter.MongoAdapter)
institute_id(str)
slice_query(str): Query to filter cases to obtain statistics for.
Returns:
general(dict) | scout/server/blueprints/dashboard/controllers.py | def get_general_case_info(adapter, institute_id=None, slice_query=None):
"""Return general information about cases
Args:
adapter(adapter.MongoAdapter)
institute_id(str)
slice_query(str): Query to filter cases to obtain statistics for.
Returns:
general(dict)
"""
g... | def get_general_case_info(adapter, institute_id=None, slice_query=None):
"""Return general information about cases
Args:
adapter(adapter.MongoAdapter)
institute_id(str)
slice_query(str): Query to filter cases to obtain statistics for.
Returns:
general(dict)
"""
g... | [
"Return",
"general",
"information",
"about",
"cases"
] | Clinical-Genomics/scout | python | https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/server/blueprints/dashboard/controllers.py#L165-L240 | [
"def",
"get_general_case_info",
"(",
"adapter",
",",
"institute_id",
"=",
"None",
",",
"slice_query",
"=",
"None",
")",
":",
"general",
"=",
"{",
"}",
"# Potentially sensitive slice queries are assumed allowed if we have got this far",
"name_query",
"=",
"slice_query",
"c... | 90a551e2e1653a319e654c2405c2866f93d0ebb9 |
test | get_case_groups | Return the information about case groups
Args:
store(adapter.MongoAdapter)
total_cases(int): Total number of cases
slice_query(str): Query to filter cases to obtain statistics for.
Returns:
cases(dict): | scout/server/blueprints/dashboard/controllers.py | def get_case_groups(adapter, total_cases, institute_id=None, slice_query=None):
"""Return the information about case groups
Args:
store(adapter.MongoAdapter)
total_cases(int): Total number of cases
slice_query(str): Query to filter cases to obtain statistics for.
Returns:
c... | def get_case_groups(adapter, total_cases, institute_id=None, slice_query=None):
"""Return the information about case groups
Args:
store(adapter.MongoAdapter)
total_cases(int): Total number of cases
slice_query(str): Query to filter cases to obtain statistics for.
Returns:
c... | [
"Return",
"the",
"information",
"about",
"case",
"groups"
] | Clinical-Genomics/scout | python | https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/server/blueprints/dashboard/controllers.py#L243-L282 | [
"def",
"get_case_groups",
"(",
"adapter",
",",
"total_cases",
",",
"institute_id",
"=",
"None",
",",
"slice_query",
"=",
"None",
")",
":",
"# Create a group with all cases in the database",
"cases",
"=",
"[",
"{",
"'status'",
":",
"'all'",
",",
"'count'",
":",
"... | 90a551e2e1653a319e654c2405c2866f93d0ebb9 |
test | get_analysis_types | Return information about analysis types.
Group cases based on analysis type for the individuals.
Args:
adapter(adapter.MongoAdapter)
total_cases(int): Total number of cases
institute_id(str)
slice_query(str): Query to filter cases to obtain statistics for.
Returns:
... | scout/server/blueprints/dashboard/controllers.py | def get_analysis_types(adapter, total_cases, institute_id=None, slice_query=None):
""" Return information about analysis types.
Group cases based on analysis type for the individuals.
Args:
adapter(adapter.MongoAdapter)
total_cases(int): Total number of cases
institute_id(str)
... | def get_analysis_types(adapter, total_cases, institute_id=None, slice_query=None):
""" Return information about analysis types.
Group cases based on analysis type for the individuals.
Args:
adapter(adapter.MongoAdapter)
total_cases(int): Total number of cases
institute_id(str)
... | [
"Return",
"information",
"about",
"analysis",
"types",
".",
"Group",
"cases",
"based",
"on",
"analysis",
"type",
"for",
"the",
"individuals",
".",
"Args",
":",
"adapter",
"(",
"adapter",
".",
"MongoAdapter",
")",
"total_cases",
"(",
"int",
")",
":",
"Total",... | Clinical-Genomics/scout | python | https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/server/blueprints/dashboard/controllers.py#L284-L319 | [
"def",
"get_analysis_types",
"(",
"adapter",
",",
"total_cases",
",",
"institute_id",
"=",
"None",
",",
"slice_query",
"=",
"None",
")",
":",
"# Group cases based on analysis type of the individuals",
"query",
"=",
"{",
"}",
"subquery",
"=",
"{",
"}",
"if",
"insti... | 90a551e2e1653a319e654c2405c2866f93d0ebb9 |
test | JSONResponseMixin.render_to_json_response | Returns a JSON response, transforming 'context' to make the payload. | happenings/utils/mixins.py | def render_to_json_response(self, context, **kwargs):
"""
Returns a JSON response, transforming 'context' to make the payload.
"""
return HttpResponse(
self.convert_context_to_json(context),
content_type='application/json',
**kwargs
) | def render_to_json_response(self, context, **kwargs):
"""
Returns a JSON response, transforming 'context' to make the payload.
"""
return HttpResponse(
self.convert_context_to_json(context),
content_type='application/json',
**kwargs
) | [
"Returns",
"a",
"JSON",
"response",
"transforming",
"context",
"to",
"make",
"the",
"payload",
"."
] | wreckage/django-happenings | python | https://github.com/wreckage/django-happenings/blob/7bca5576efa6cd4c4e87356bf9e5b8cd538ae91d/happenings/utils/mixins.py#L17-L25 | [
"def",
"render_to_json_response",
"(",
"self",
",",
"context",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"HttpResponse",
"(",
"self",
".",
"convert_context_to_json",
"(",
"context",
")",
",",
"content_type",
"=",
"'application/json'",
",",
"*",
"*",
"kwargs... | 7bca5576efa6cd4c4e87356bf9e5b8cd538ae91d |
test | JSONResponseMixin.convert_context_to_json | Get what we want out of the context dict and convert that to a JSON
object. Note that this does no object serialization b/c we're
not sending any objects. | happenings/utils/mixins.py | def convert_context_to_json(self, context):
"""
Get what we want out of the context dict and convert that to a JSON
object. Note that this does no object serialization b/c we're
not sending any objects.
"""
if 'month/shift' in self.request.path: # month calendar
... | def convert_context_to_json(self, context):
"""
Get what we want out of the context dict and convert that to a JSON
object. Note that this does no object serialization b/c we're
not sending any objects.
"""
if 'month/shift' in self.request.path: # month calendar
... | [
"Get",
"what",
"we",
"want",
"out",
"of",
"the",
"context",
"dict",
"and",
"convert",
"that",
"to",
"a",
"JSON",
"object",
".",
"Note",
"that",
"this",
"does",
"no",
"object",
"serialization",
"b",
"/",
"c",
"we",
"re",
"not",
"sending",
"any",
"object... | wreckage/django-happenings | python | https://github.com/wreckage/django-happenings/blob/7bca5576efa6cd4c4e87356bf9e5b8cd538ae91d/happenings/utils/mixins.py#L27-L47 | [
"def",
"convert_context_to_json",
"(",
"self",
",",
"context",
")",
":",
"if",
"'month/shift'",
"in",
"self",
".",
"request",
".",
"path",
":",
"# month calendar",
"return",
"dumps",
"(",
"self",
".",
"get_month_calendar_dict",
"(",
"context",
")",
")",
"elif"... | 7bca5576efa6cd4c4e87356bf9e5b8cd538ae91d |
test | EventMonthView.get_year_and_month | Get the year and month. First tries from kwargs, then from
querystrings. If none, or if cal_ignore qs is specified,
sets year and month to this year and this month. | happenings/views.py | def get_year_and_month(self, net, qs, **kwargs):
"""
Get the year and month. First tries from kwargs, then from
querystrings. If none, or if cal_ignore qs is specified,
sets year and month to this year and this month.
"""
now = c.get_now()
year = now.year
... | def get_year_and_month(self, net, qs, **kwargs):
"""
Get the year and month. First tries from kwargs, then from
querystrings. If none, or if cal_ignore qs is specified,
sets year and month to this year and this month.
"""
now = c.get_now()
year = now.year
... | [
"Get",
"the",
"year",
"and",
"month",
".",
"First",
"tries",
"from",
"kwargs",
"then",
"from",
"querystrings",
".",
"If",
"none",
"or",
"if",
"cal_ignore",
"qs",
"is",
"specified",
"sets",
"year",
"and",
"month",
"to",
"this",
"year",
"and",
"this",
"mon... | wreckage/django-happenings | python | https://github.com/wreckage/django-happenings/blob/7bca5576efa6cd4c4e87356bf9e5b8cd538ae91d/happenings/views.py#L54-L80 | [
"def",
"get_year_and_month",
"(",
"self",
",",
"net",
",",
"qs",
",",
"*",
"*",
"kwargs",
")",
":",
"now",
"=",
"c",
".",
"get_now",
"(",
")",
"year",
"=",
"now",
".",
"year",
"month",
"=",
"now",
".",
"month",
"+",
"net",
"month_orig",
"=",
"Non... | 7bca5576efa6cd4c4e87356bf9e5b8cd538ae91d |
test | EventDayView.check_for_cancelled_events | Check if any events are cancelled on the given date 'd'. | happenings/views.py | def check_for_cancelled_events(self, d):
"""Check if any events are cancelled on the given date 'd'."""
for event in self.events:
for cn in event.cancellations.all():
if cn.date == d:
event.title += ' (CANCELLED)' | def check_for_cancelled_events(self, d):
"""Check if any events are cancelled on the given date 'd'."""
for event in self.events:
for cn in event.cancellations.all():
if cn.date == d:
event.title += ' (CANCELLED)' | [
"Check",
"if",
"any",
"events",
"are",
"cancelled",
"on",
"the",
"given",
"date",
"d",
"."
] | wreckage/django-happenings | python | https://github.com/wreckage/django-happenings/blob/7bca5576efa6cd4c4e87356bf9e5b8cd538ae91d/happenings/views.py#L145-L150 | [
"def",
"check_for_cancelled_events",
"(",
"self",
",",
"d",
")",
":",
"for",
"event",
"in",
"self",
".",
"events",
":",
"for",
"cn",
"in",
"event",
".",
"cancellations",
".",
"all",
"(",
")",
":",
"if",
"cn",
".",
"date",
"==",
"d",
":",
"event",
"... | 7bca5576efa6cd4c4e87356bf9e5b8cd538ae91d |
test | HpoHandler.load_hpo_term | Add a hpo object
Arguments:
hpo_obj(dict) | scout/adapter/mongo/hpo.py | def load_hpo_term(self, hpo_obj):
"""Add a hpo object
Arguments:
hpo_obj(dict)
"""
LOG.debug("Loading hpo term %s into database", hpo_obj['_id'])
try:
self.hpo_term_collection.insert_one(hpo_obj)
except DuplicateKeyError as err:
raise... | def load_hpo_term(self, hpo_obj):
"""Add a hpo object
Arguments:
hpo_obj(dict)
"""
LOG.debug("Loading hpo term %s into database", hpo_obj['_id'])
try:
self.hpo_term_collection.insert_one(hpo_obj)
except DuplicateKeyError as err:
raise... | [
"Add",
"a",
"hpo",
"object"
] | Clinical-Genomics/scout | python | https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/adapter/mongo/hpo.py#L16-L28 | [
"def",
"load_hpo_term",
"(",
"self",
",",
"hpo_obj",
")",
":",
"LOG",
".",
"debug",
"(",
"\"Loading hpo term %s into database\"",
",",
"hpo_obj",
"[",
"'_id'",
"]",
")",
"try",
":",
"self",
".",
"hpo_term_collection",
".",
"insert_one",
"(",
"hpo_obj",
")",
... | 90a551e2e1653a319e654c2405c2866f93d0ebb9 |
test | HpoHandler.load_hpo_bulk | Add a hpo object
Arguments:
hpo_bulk(list(scout.models.HpoTerm))
Returns:
result: pymongo bulkwrite result | scout/adapter/mongo/hpo.py | def load_hpo_bulk(self, hpo_bulk):
"""Add a hpo object
Arguments:
hpo_bulk(list(scout.models.HpoTerm))
Returns:
result: pymongo bulkwrite result
"""
LOG.debug("Loading hpo bulk")
try:
result = self.hpo_term_collection.insert_many(hp... | def load_hpo_bulk(self, hpo_bulk):
"""Add a hpo object
Arguments:
hpo_bulk(list(scout.models.HpoTerm))
Returns:
result: pymongo bulkwrite result
"""
LOG.debug("Loading hpo bulk")
try:
result = self.hpo_term_collection.insert_many(hp... | [
"Add",
"a",
"hpo",
"object"
] | Clinical-Genomics/scout | python | https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/adapter/mongo/hpo.py#L30-L46 | [
"def",
"load_hpo_bulk",
"(",
"self",
",",
"hpo_bulk",
")",
":",
"LOG",
".",
"debug",
"(",
"\"Loading hpo bulk\"",
")",
"try",
":",
"result",
"=",
"self",
".",
"hpo_term_collection",
".",
"insert_many",
"(",
"hpo_bulk",
")",
"except",
"(",
"DuplicateKeyError",
... | 90a551e2e1653a319e654c2405c2866f93d0ebb9 |
test | HpoHandler.hpo_term | Fetch a hpo term
Args:
hpo_id(str)
Returns:
hpo_obj(dict) | scout/adapter/mongo/hpo.py | def hpo_term(self, hpo_id):
"""Fetch a hpo term
Args:
hpo_id(str)
Returns:
hpo_obj(dict)
"""
LOG.debug("Fetching hpo term %s", hpo_id)
return self.hpo_term_collection.find_one({'_id': hpo_id}) | def hpo_term(self, hpo_id):
"""Fetch a hpo term
Args:
hpo_id(str)
Returns:
hpo_obj(dict)
"""
LOG.debug("Fetching hpo term %s", hpo_id)
return self.hpo_term_collection.find_one({'_id': hpo_id}) | [
"Fetch",
"a",
"hpo",
"term"
] | Clinical-Genomics/scout | python | https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/adapter/mongo/hpo.py#L48-L59 | [
"def",
"hpo_term",
"(",
"self",
",",
"hpo_id",
")",
":",
"LOG",
".",
"debug",
"(",
"\"Fetching hpo term %s\"",
",",
"hpo_id",
")",
"return",
"self",
".",
"hpo_term_collection",
".",
"find_one",
"(",
"{",
"'_id'",
":",
"hpo_id",
"}",
")"
] | 90a551e2e1653a319e654c2405c2866f93d0ebb9 |
test | HpoHandler.hpo_terms | Return all HPO terms
If a query is sent hpo_terms will try to match with regex on term or
description.
Args:
query(str): Part of a hpoterm or description
hpo_term(str): Search for a specific hpo term
limit(int): the number of desired results
Returns... | scout/adapter/mongo/hpo.py | def hpo_terms(self, query=None, hpo_term=None, text=None, limit=None):
"""Return all HPO terms
If a query is sent hpo_terms will try to match with regex on term or
description.
Args:
query(str): Part of a hpoterm or description
hpo_term(str): Search for a specif... | def hpo_terms(self, query=None, hpo_term=None, text=None, limit=None):
"""Return all HPO terms
If a query is sent hpo_terms will try to match with regex on term or
description.
Args:
query(str): Part of a hpoterm or description
hpo_term(str): Search for a specif... | [
"Return",
"all",
"HPO",
"terms"
] | Clinical-Genomics/scout | python | https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/adapter/mongo/hpo.py#L61-L104 | [
"def",
"hpo_terms",
"(",
"self",
",",
"query",
"=",
"None",
",",
"hpo_term",
"=",
"None",
",",
"text",
"=",
"None",
",",
"limit",
"=",
"None",
")",
":",
"query_dict",
"=",
"{",
"}",
"search_term",
"=",
"None",
"if",
"query",
":",
"query_dict",
"=",
... | 90a551e2e1653a319e654c2405c2866f93d0ebb9 |
test | HpoHandler.disease_term | Return a disease term
Checks if the identifier is a disease number or a id
Args:
disease_identifier(str)
Returns:
disease_obj(dict) | scout/adapter/mongo/hpo.py | def disease_term(self, disease_identifier):
"""Return a disease term
Checks if the identifier is a disease number or a id
Args:
disease_identifier(str)
Returns:
disease_obj(dict)
"""
query = {}
try:
disease_identifier = int(d... | def disease_term(self, disease_identifier):
"""Return a disease term
Checks if the identifier is a disease number or a id
Args:
disease_identifier(str)
Returns:
disease_obj(dict)
"""
query = {}
try:
disease_identifier = int(d... | [
"Return",
"a",
"disease",
"term"
] | Clinical-Genomics/scout | python | https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/adapter/mongo/hpo.py#L106-L124 | [
"def",
"disease_term",
"(",
"self",
",",
"disease_identifier",
")",
":",
"query",
"=",
"{",
"}",
"try",
":",
"disease_identifier",
"=",
"int",
"(",
"disease_identifier",
")",
"query",
"[",
"'disease_nr'",
"]",
"=",
"disease_identifier",
"except",
"ValueError",
... | 90a551e2e1653a319e654c2405c2866f93d0ebb9 |
test | HpoHandler.disease_terms | Return all disease terms that overlaps a gene
If no gene, return all disease terms
Args:
hgnc_id(int)
Returns:
iterable(dict): A list with all disease terms that match | scout/adapter/mongo/hpo.py | def disease_terms(self, hgnc_id=None):
"""Return all disease terms that overlaps a gene
If no gene, return all disease terms
Args:
hgnc_id(int)
Returns:
iterable(dict): A list with all disease terms that match
"""
query = {}
if hgnc_... | def disease_terms(self, hgnc_id=None):
"""Return all disease terms that overlaps a gene
If no gene, return all disease terms
Args:
hgnc_id(int)
Returns:
iterable(dict): A list with all disease terms that match
"""
query = {}
if hgnc_... | [
"Return",
"all",
"disease",
"terms",
"that",
"overlaps",
"a",
"gene"
] | Clinical-Genomics/scout | python | https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/adapter/mongo/hpo.py#L126-L144 | [
"def",
"disease_terms",
"(",
"self",
",",
"hgnc_id",
"=",
"None",
")",
":",
"query",
"=",
"{",
"}",
"if",
"hgnc_id",
":",
"LOG",
".",
"debug",
"(",
"\"Fetching all diseases for gene %s\"",
",",
"hgnc_id",
")",
"query",
"[",
"'genes'",
"]",
"=",
"hgnc_id",
... | 90a551e2e1653a319e654c2405c2866f93d0ebb9 |
test | HpoHandler.load_disease_term | Load a disease term into the database
Args:
disease_obj(dict) | scout/adapter/mongo/hpo.py | def load_disease_term(self, disease_obj):
"""Load a disease term into the database
Args:
disease_obj(dict)
"""
LOG.debug("Loading disease term %s into database", disease_obj['_id'])
try:
self.disease_term_collection.insert_one(disease_obj)
except ... | def load_disease_term(self, disease_obj):
"""Load a disease term into the database
Args:
disease_obj(dict)
"""
LOG.debug("Loading disease term %s into database", disease_obj['_id'])
try:
self.disease_term_collection.insert_one(disease_obj)
except ... | [
"Load",
"a",
"disease",
"term",
"into",
"the",
"database"
] | Clinical-Genomics/scout | python | https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/adapter/mongo/hpo.py#L146-L158 | [
"def",
"load_disease_term",
"(",
"self",
",",
"disease_obj",
")",
":",
"LOG",
".",
"debug",
"(",
"\"Loading disease term %s into database\"",
",",
"disease_obj",
"[",
"'_id'",
"]",
")",
"try",
":",
"self",
".",
"disease_term_collection",
".",
"insert_one",
"(",
... | 90a551e2e1653a319e654c2405c2866f93d0ebb9 |
test | HpoHandler.generate_hpo_gene_list | Generate a sorted list with namedtuples of hpogenes
Each namedtuple of the list looks like (hgnc_id, count)
Args:
hpo_terms(iterable(str))
Returns:
hpo_genes(list(HpoGene)) | scout/adapter/mongo/hpo.py | def generate_hpo_gene_list(self, *hpo_terms):
"""Generate a sorted list with namedtuples of hpogenes
Each namedtuple of the list looks like (hgnc_id, count)
Args:
hpo_terms(iterable(str))
Returns:
hpo_genes(list(HpoGene))
"""
... | def generate_hpo_gene_list(self, *hpo_terms):
"""Generate a sorted list with namedtuples of hpogenes
Each namedtuple of the list looks like (hgnc_id, count)
Args:
hpo_terms(iterable(str))
Returns:
hpo_genes(list(HpoGene))
"""
... | [
"Generate",
"a",
"sorted",
"list",
"with",
"namedtuples",
"of",
"hpogenes"
] | Clinical-Genomics/scout | python | https://github.com/Clinical-Genomics/scout/blob/90a551e2e1653a319e654c2405c2866f93d0ebb9/scout/adapter/mongo/hpo.py#L160-L184 | [
"def",
"generate_hpo_gene_list",
"(",
"self",
",",
"*",
"hpo_terms",
")",
":",
"genes",
"=",
"{",
"}",
"for",
"term",
"in",
"hpo_terms",
":",
"hpo_obj",
"=",
"self",
".",
"hpo_term",
"(",
"term",
")",
"if",
"hpo_obj",
":",
"for",
"hgnc_id",
"in",
"hpo_... | 90a551e2e1653a319e654c2405c2866f93d0ebb9 |
test | cmd_tool | Command line tool for plotting and viewing info on filterbank files | blimpy/filterbank.py | def cmd_tool(args=None):
""" Command line tool for plotting and viewing info on filterbank files """
from argparse import ArgumentParser
parser = ArgumentParser(description="Command line utility for reading and plotting filterbank files.")
parser.add_argument('-p', action='store', default='ank', des... | def cmd_tool(args=None):
""" Command line tool for plotting and viewing info on filterbank files """
from argparse import ArgumentParser
parser = ArgumentParser(description="Command line utility for reading and plotting filterbank files.")
parser.add_argument('-p', action='store', default='ank', des... | [
"Command",
"line",
"tool",
"for",
"plotting",
"and",
"viewing",
"info",
"on",
"filterbank",
"files"
] | UCBerkeleySETI/blimpy | python | https://github.com/UCBerkeleySETI/blimpy/blob/b8822d3e3e911944370d84371a91fa0c29e9772e/blimpy/filterbank.py#L977-L1087 | [
"def",
"cmd_tool",
"(",
"args",
"=",
"None",
")",
":",
"from",
"argparse",
"import",
"ArgumentParser",
"parser",
"=",
"ArgumentParser",
"(",
"description",
"=",
"\"Command line utility for reading and plotting filterbank files.\"",
")",
"parser",
".",
"add_argument",
"(... | b8822d3e3e911944370d84371a91fa0c29e9772e |
test | Filterbank.read_hdf5 | Populate Filterbank instance with data from HDF5 file
Note:
This is to be deprecated in future, please use Waterfall() to open files. | blimpy/filterbank.py | def read_hdf5(self, filename, f_start=None, f_stop=None,
t_start=None, t_stop=None, load_data=True):
""" Populate Filterbank instance with data from HDF5 file
Note:
This is to be deprecated in future, please use Waterfall() to open files.
"""
print("W... | def read_hdf5(self, filename, f_start=None, f_stop=None,
t_start=None, t_stop=None, load_data=True):
""" Populate Filterbank instance with data from HDF5 file
Note:
This is to be deprecated in future, please use Waterfall() to open files.
"""
print("W... | [
"Populate",
"Filterbank",
"instance",
"with",
"data",
"from",
"HDF5",
"file"
] | UCBerkeleySETI/blimpy | python | https://github.com/UCBerkeleySETI/blimpy/blob/b8822d3e3e911944370d84371a91fa0c29e9772e/blimpy/filterbank.py#L144-L183 | [
"def",
"read_hdf5",
"(",
"self",
",",
"filename",
",",
"f_start",
"=",
"None",
",",
"f_stop",
"=",
"None",
",",
"t_start",
"=",
"None",
",",
"t_stop",
"=",
"None",
",",
"load_data",
"=",
"True",
")",
":",
"print",
"(",
"\"Warning: this function will be dep... | b8822d3e3e911944370d84371a91fa0c29e9772e |
test | Filterbank._setup_freqs | Setup frequency axis | blimpy/filterbank.py | def _setup_freqs(self, f_start=None, f_stop=None):
""" Setup frequency axis """
## Setup frequency axis
f0 = self.header[b'fch1']
f_delt = self.header[b'foff']
i_start, i_stop = 0, self.header[b'nchans']
if f_start:
i_start = int((f_start - f0) / f_delt)
... | def _setup_freqs(self, f_start=None, f_stop=None):
""" Setup frequency axis """
## Setup frequency axis
f0 = self.header[b'fch1']
f_delt = self.header[b'foff']
i_start, i_stop = 0, self.header[b'nchans']
if f_start:
i_start = int((f_start - f0) / f_delt)
... | [
"Setup",
"frequency",
"axis"
] | UCBerkeleySETI/blimpy | python | https://github.com/UCBerkeleySETI/blimpy/blob/b8822d3e3e911944370d84371a91fa0c29e9772e/blimpy/filterbank.py#L186-L216 | [
"def",
"_setup_freqs",
"(",
"self",
",",
"f_start",
"=",
"None",
",",
"f_stop",
"=",
"None",
")",
":",
"## Setup frequency axis",
"f0",
"=",
"self",
".",
"header",
"[",
"b'fch1'",
"]",
"f_delt",
"=",
"self",
".",
"header",
"[",
"b'foff'",
"]",
"i_start",... | b8822d3e3e911944370d84371a91fa0c29e9772e |
test | Filterbank._setup_time_axis | Setup time axis. | blimpy/filterbank.py | def _setup_time_axis(self, t_start=None, t_stop=None):
""" Setup time axis. """
# now check to see how many integrations requested
ii_start, ii_stop = 0, self.n_ints_in_file
if t_start:
ii_start = t_start
if t_stop:
ii_stop = t_stop
n_ints = ii_s... | def _setup_time_axis(self, t_start=None, t_stop=None):
""" Setup time axis. """
# now check to see how many integrations requested
ii_start, ii_stop = 0, self.n_ints_in_file
if t_start:
ii_start = t_start
if t_stop:
ii_stop = t_stop
n_ints = ii_s... | [
"Setup",
"time",
"axis",
"."
] | UCBerkeleySETI/blimpy | python | https://github.com/UCBerkeleySETI/blimpy/blob/b8822d3e3e911944370d84371a91fa0c29e9772e/blimpy/filterbank.py#L218-L235 | [
"def",
"_setup_time_axis",
"(",
"self",
",",
"t_start",
"=",
"None",
",",
"t_stop",
"=",
"None",
")",
":",
"# now check to see how many integrations requested",
"ii_start",
",",
"ii_stop",
"=",
"0",
",",
"self",
".",
"n_ints_in_file",
"if",
"t_start",
":",
"ii_s... | b8822d3e3e911944370d84371a91fa0c29e9772e |
test | Filterbank.read_filterbank | Populate Filterbank instance with data from Filterbank file
Note:
This is to be deprecated in future, please use Waterfall() to open files. | blimpy/filterbank.py | def read_filterbank(self, filename=None, f_start=None, f_stop=None,
t_start=None, t_stop=None, load_data=True):
""" Populate Filterbank instance with data from Filterbank file
Note:
This is to be deprecated in future, please use Waterfall() to open files.
"""... | def read_filterbank(self, filename=None, f_start=None, f_stop=None,
t_start=None, t_stop=None, load_data=True):
""" Populate Filterbank instance with data from Filterbank file
Note:
This is to be deprecated in future, please use Waterfall() to open files.
"""... | [
"Populate",
"Filterbank",
"instance",
"with",
"data",
"from",
"Filterbank",
"file"
] | UCBerkeleySETI/blimpy | python | https://github.com/UCBerkeleySETI/blimpy/blob/b8822d3e3e911944370d84371a91fa0c29e9772e/blimpy/filterbank.py#L237-L326 | [
"def",
"read_filterbank",
"(",
"self",
",",
"filename",
"=",
"None",
",",
"f_start",
"=",
"None",
",",
"f_stop",
"=",
"None",
",",
"t_start",
"=",
"None",
",",
"t_stop",
"=",
"None",
",",
"load_data",
"=",
"True",
")",
":",
"if",
"filename",
"is",
"N... | b8822d3e3e911944370d84371a91fa0c29e9772e |
test | Filterbank.compute_lst | Compute LST for observation | blimpy/filterbank.py | def compute_lst(self):
""" Compute LST for observation """
if self.header[b'telescope_id'] == 6:
self.coords = gbt_coords
elif self.header[b'telescope_id'] == 4:
self.coords = parkes_coords
else:
raise RuntimeError("Currently only Parkes and GBT suppor... | def compute_lst(self):
""" Compute LST for observation """
if self.header[b'telescope_id'] == 6:
self.coords = gbt_coords
elif self.header[b'telescope_id'] == 4:
self.coords = parkes_coords
else:
raise RuntimeError("Currently only Parkes and GBT suppor... | [
"Compute",
"LST",
"for",
"observation"
] | UCBerkeleySETI/blimpy | python | https://github.com/UCBerkeleySETI/blimpy/blob/b8822d3e3e911944370d84371a91fa0c29e9772e/blimpy/filterbank.py#L328-L346 | [
"def",
"compute_lst",
"(",
"self",
")",
":",
"if",
"self",
".",
"header",
"[",
"b'telescope_id'",
"]",
"==",
"6",
":",
"self",
".",
"coords",
"=",
"gbt_coords",
"elif",
"self",
".",
"header",
"[",
"b'telescope_id'",
"]",
"==",
"4",
":",
"self",
".",
... | b8822d3e3e911944370d84371a91fa0c29e9772e |
test | Filterbank.compute_lsrk | Computes the LSR in km/s
uses the MJD, RA and DEC of observation to compute
along with the telescope location. Requires pyslalib | blimpy/filterbank.py | def compute_lsrk(self):
""" Computes the LSR in km/s
uses the MJD, RA and DEC of observation to compute
along with the telescope location. Requires pyslalib
"""
ra = Angle(self.header[b'src_raj'], unit='hourangle')
dec = Angle(self.header[b'src_dej'], unit='degree')
... | def compute_lsrk(self):
""" Computes the LSR in km/s
uses the MJD, RA and DEC of observation to compute
along with the telescope location. Requires pyslalib
"""
ra = Angle(self.header[b'src_raj'], unit='hourangle')
dec = Angle(self.header[b'src_dej'], unit='degree')
... | [
"Computes",
"the",
"LSR",
"in",
"km",
"/",
"s"
] | UCBerkeleySETI/blimpy | python | https://github.com/UCBerkeleySETI/blimpy/blob/b8822d3e3e911944370d84371a91fa0c29e9772e/blimpy/filterbank.py#L348-L397 | [
"def",
"compute_lsrk",
"(",
"self",
")",
":",
"ra",
"=",
"Angle",
"(",
"self",
".",
"header",
"[",
"b'src_raj'",
"]",
",",
"unit",
"=",
"'hourangle'",
")",
"dec",
"=",
"Angle",
"(",
"self",
".",
"header",
"[",
"b'src_dej'",
"]",
",",
"unit",
"=",
"... | b8822d3e3e911944370d84371a91fa0c29e9772e |
test | Filterbank.blank_dc | Blank DC bins in coarse channels.
Note: currently only works if entire file is read | blimpy/filterbank.py | def blank_dc(self, n_coarse_chan):
""" Blank DC bins in coarse channels.
Note: currently only works if entire file is read
"""
if n_coarse_chan < 1:
logger.warning('Coarse channel number < 1, unable to blank DC bin.')
return None
if not n_coarse_chan % ... | def blank_dc(self, n_coarse_chan):
""" Blank DC bins in coarse channels.
Note: currently only works if entire file is read
"""
if n_coarse_chan < 1:
logger.warning('Coarse channel number < 1, unable to blank DC bin.')
return None
if not n_coarse_chan % ... | [
"Blank",
"DC",
"bins",
"in",
"coarse",
"channels",
"."
] | UCBerkeleySETI/blimpy | python | https://github.com/UCBerkeleySETI/blimpy/blob/b8822d3e3e911944370d84371a91fa0c29e9772e/blimpy/filterbank.py#L399-L422 | [
"def",
"blank_dc",
"(",
"self",
",",
"n_coarse_chan",
")",
":",
"if",
"n_coarse_chan",
"<",
"1",
":",
"logger",
".",
"warning",
"(",
"'Coarse channel number < 1, unable to blank DC bin.'",
")",
"return",
"None",
"if",
"not",
"n_coarse_chan",
"%",
"int",
"(",
"n_... | b8822d3e3e911944370d84371a91fa0c29e9772e |
test | Filterbank.info | Print header information | blimpy/filterbank.py | def info(self):
""" Print header information """
for key, val in self.header.items():
if key == b'src_raj':
val = val.to_string(unit=u.hour, sep=':')
if key == b'src_dej':
val = val.to_string(unit=u.deg, sep=':')
if key == b'tsamp':
... | def info(self):
""" Print header information """
for key, val in self.header.items():
if key == b'src_raj':
val = val.to_string(unit=u.hour, sep=':')
if key == b'src_dej':
val = val.to_string(unit=u.deg, sep=':')
if key == b'tsamp':
... | [
"Print",
"header",
"information"
] | UCBerkeleySETI/blimpy | python | https://github.com/UCBerkeleySETI/blimpy/blob/b8822d3e3e911944370d84371a91fa0c29e9772e/blimpy/filterbank.py#L424-L444 | [
"def",
"info",
"(",
"self",
")",
":",
"for",
"key",
",",
"val",
"in",
"self",
".",
"header",
".",
"items",
"(",
")",
":",
"if",
"key",
"==",
"b'src_raj'",
":",
"val",
"=",
"val",
".",
"to_string",
"(",
"unit",
"=",
"u",
".",
"hour",
",",
"sep",... | b8822d3e3e911944370d84371a91fa0c29e9772e |
test | Filterbank.generate_freqs | returns frequency array [f_start...f_stop] | blimpy/filterbank.py | def generate_freqs(self, f_start, f_stop):
"""
returns frequency array [f_start...f_stop]
"""
fch1 = self.header[b'fch1']
foff = self.header[b'foff']
#convert input frequencies into what their corresponding index would be
i_start = int((f_start - fch1) / foff)
... | def generate_freqs(self, f_start, f_stop):
"""
returns frequency array [f_start...f_stop]
"""
fch1 = self.header[b'fch1']
foff = self.header[b'foff']
#convert input frequencies into what their corresponding index would be
i_start = int((f_start - fch1) / foff)
... | [
"returns",
"frequency",
"array",
"[",
"f_start",
"...",
"f_stop",
"]"
] | UCBerkeleySETI/blimpy | python | https://github.com/UCBerkeleySETI/blimpy/blob/b8822d3e3e911944370d84371a91fa0c29e9772e/blimpy/filterbank.py#L446-L467 | [
"def",
"generate_freqs",
"(",
"self",
",",
"f_start",
",",
"f_stop",
")",
":",
"fch1",
"=",
"self",
".",
"header",
"[",
"b'fch1'",
"]",
"foff",
"=",
"self",
".",
"header",
"[",
"b'foff'",
"]",
"#convert input frequencies into what their corresponding index would b... | b8822d3e3e911944370d84371a91fa0c29e9772e |
test | Filterbank._calc_extent | Setup ploting edges. | blimpy/filterbank.py | def _calc_extent(self,plot_f=None,plot_t=None,MJD_time=False):
""" Setup ploting edges.
"""
plot_f_begin = plot_f[0]
plot_f_end = plot_f[-1] + (plot_f[1]-plot_f[0])
plot_t_begin = self.timestamps[0]
plot_t_end = self.timestamps[-1] + (self.timestamps[1] - self.timestam... | def _calc_extent(self,plot_f=None,plot_t=None,MJD_time=False):
""" Setup ploting edges.
"""
plot_f_begin = plot_f[0]
plot_f_end = plot_f[-1] + (plot_f[1]-plot_f[0])
plot_t_begin = self.timestamps[0]
plot_t_end = self.timestamps[-1] + (self.timestamps[1] - self.timestam... | [
"Setup",
"ploting",
"edges",
"."
] | UCBerkeleySETI/blimpy | python | https://github.com/UCBerkeleySETI/blimpy/blob/b8822d3e3e911944370d84371a91fa0c29e9772e/blimpy/filterbank.py#L498-L513 | [
"def",
"_calc_extent",
"(",
"self",
",",
"plot_f",
"=",
"None",
",",
"plot_t",
"=",
"None",
",",
"MJD_time",
"=",
"False",
")",
":",
"plot_f_begin",
"=",
"plot_f",
"[",
"0",
"]",
"plot_f_end",
"=",
"plot_f",
"[",
"-",
"1",
"]",
"+",
"(",
"plot_f",
... | b8822d3e3e911944370d84371a91fa0c29e9772e |
test | Filterbank.plot_spectrum | Plot frequency spectrum of a given file
Args:
t (int): integration number to plot (0 -> len(data))
logged (bool): Plot in linear (False) or dB units (True)
if_id (int): IF identification (if multiple IF signals in file)
c: color for line
kwargs: keywo... | blimpy/filterbank.py | def plot_spectrum(self, t=0, f_start=None, f_stop=None, logged=False, if_id=0, c=None, **kwargs):
""" Plot frequency spectrum of a given file
Args:
t (int): integration number to plot (0 -> len(data))
logged (bool): Plot in linear (False) or dB units (True)
if_id (in... | def plot_spectrum(self, t=0, f_start=None, f_stop=None, logged=False, if_id=0, c=None, **kwargs):
""" Plot frequency spectrum of a given file
Args:
t (int): integration number to plot (0 -> len(data))
logged (bool): Plot in linear (False) or dB units (True)
if_id (in... | [
"Plot",
"frequency",
"spectrum",
"of",
"a",
"given",
"file"
] | UCBerkeleySETI/blimpy | python | https://github.com/UCBerkeleySETI/blimpy/blob/b8822d3e3e911944370d84371a91fa0c29e9772e/blimpy/filterbank.py#L515-L576 | [
"def",
"plot_spectrum",
"(",
"self",
",",
"t",
"=",
"0",
",",
"f_start",
"=",
"None",
",",
"f_stop",
"=",
"None",
",",
"logged",
"=",
"False",
",",
"if_id",
"=",
"0",
",",
"c",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"self",
".",
... | b8822d3e3e911944370d84371a91fa0c29e9772e |
test | Filterbank.plot_spectrum_min_max | Plot frequency spectrum of a given file
Args:
logged (bool): Plot in linear (False) or dB units (True)
if_id (int): IF identification (if multiple IF signals in file)
c: color for line
kwargs: keyword args to be passed to matplotlib plot() | blimpy/filterbank.py | def plot_spectrum_min_max(self, t=0, f_start=None, f_stop=None, logged=False, if_id=0, c=None, **kwargs):
""" Plot frequency spectrum of a given file
Args:
logged (bool): Plot in linear (False) or dB units (True)
if_id (int): IF identification (if multiple IF signals in file)
... | def plot_spectrum_min_max(self, t=0, f_start=None, f_stop=None, logged=False, if_id=0, c=None, **kwargs):
""" Plot frequency spectrum of a given file
Args:
logged (bool): Plot in linear (False) or dB units (True)
if_id (int): IF identification (if multiple IF signals in file)
... | [
"Plot",
"frequency",
"spectrum",
"of",
"a",
"given",
"file"
] | UCBerkeleySETI/blimpy | python | https://github.com/UCBerkeleySETI/blimpy/blob/b8822d3e3e911944370d84371a91fa0c29e9772e/blimpy/filterbank.py#L578-L642 | [
"def",
"plot_spectrum_min_max",
"(",
"self",
",",
"t",
"=",
"0",
",",
"f_start",
"=",
"None",
",",
"f_stop",
"=",
"None",
",",
"logged",
"=",
"False",
",",
"if_id",
"=",
"0",
",",
"c",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"ax",
"=",
... | b8822d3e3e911944370d84371a91fa0c29e9772e |
test | Filterbank.plot_waterfall | Plot waterfall of data
Args:
f_start (float): start frequency, in MHz
f_stop (float): stop frequency, in MHz
logged (bool): Plot in linear (False) or dB units (True),
cb (bool): for plotting the colorbar
kwargs: keyword args to be passed to matplotlib... | blimpy/filterbank.py | def plot_waterfall(self, f_start=None, f_stop=None, if_id=0, logged=True, cb=True, MJD_time=False, **kwargs):
""" Plot waterfall of data
Args:
f_start (float): start frequency, in MHz
f_stop (float): stop frequency, in MHz
logged (bool): Plot in linear (False) or dB ... | def plot_waterfall(self, f_start=None, f_stop=None, if_id=0, logged=True, cb=True, MJD_time=False, **kwargs):
""" Plot waterfall of data
Args:
f_start (float): start frequency, in MHz
f_stop (float): stop frequency, in MHz
logged (bool): Plot in linear (False) or dB ... | [
"Plot",
"waterfall",
"of",
"data"
] | UCBerkeleySETI/blimpy | python | https://github.com/UCBerkeleySETI/blimpy/blob/b8822d3e3e911944370d84371a91fa0c29e9772e/blimpy/filterbank.py#L644-L697 | [
"def",
"plot_waterfall",
"(",
"self",
",",
"f_start",
"=",
"None",
",",
"f_stop",
"=",
"None",
",",
"if_id",
"=",
"0",
",",
"logged",
"=",
"True",
",",
"cb",
"=",
"True",
",",
"MJD_time",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"plot_f",
... | b8822d3e3e911944370d84371a91fa0c29e9772e |
test | Filterbank.plot_time_series | Plot the time series.
Args:
f_start (float): start frequency, in MHz
f_stop (float): stop frequency, in MHz
logged (bool): Plot in linear (False) or dB units (True),
kwargs: keyword args to be passed to matplotlib imshow() | blimpy/filterbank.py | def plot_time_series(self, f_start=None, f_stop=None, if_id=0, logged=True, orientation='h', MJD_time=False, **kwargs):
""" Plot the time series.
Args:
f_start (float): start frequency, in MHz
f_stop (float): stop frequency, in MHz
logged (bool): Plot in linear (Fal... | def plot_time_series(self, f_start=None, f_stop=None, if_id=0, logged=True, orientation='h', MJD_time=False, **kwargs):
""" Plot the time series.
Args:
f_start (float): start frequency, in MHz
f_stop (float): stop frequency, in MHz
logged (bool): Plot in linear (Fal... | [
"Plot",
"the",
"time",
"series",
"."
] | UCBerkeleySETI/blimpy | python | https://github.com/UCBerkeleySETI/blimpy/blob/b8822d3e3e911944370d84371a91fa0c29e9772e/blimpy/filterbank.py#L699-L745 | [
"def",
"plot_time_series",
"(",
"self",
",",
"f_start",
"=",
"None",
",",
"f_stop",
"=",
"None",
",",
"if_id",
"=",
"0",
",",
"logged",
"=",
"True",
",",
"orientation",
"=",
"'h'",
",",
"MJD_time",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"... | b8822d3e3e911944370d84371a91fa0c29e9772e |
test | Filterbank.plot_kurtosis | Plot kurtosis
Args:
f_start (float): start frequency, in MHz
f_stop (float): stop frequency, in MHz
kwargs: keyword args to be passed to matplotlib imshow() | blimpy/filterbank.py | def plot_kurtosis(self, f_start=None, f_stop=None, if_id=0, **kwargs):
""" Plot kurtosis
Args:
f_start (float): start frequency, in MHz
f_stop (float): stop frequency, in MHz
kwargs: keyword args to be passed to matplotlib imshow()
"""
ax = plt.gca()... | def plot_kurtosis(self, f_start=None, f_stop=None, if_id=0, **kwargs):
""" Plot kurtosis
Args:
f_start (float): start frequency, in MHz
f_stop (float): stop frequency, in MHz
kwargs: keyword args to be passed to matplotlib imshow()
"""
ax = plt.gca()... | [
"Plot",
"kurtosis"
] | UCBerkeleySETI/blimpy | python | https://github.com/UCBerkeleySETI/blimpy/blob/b8822d3e3e911944370d84371a91fa0c29e9772e/blimpy/filterbank.py#L747-L773 | [
"def",
"plot_kurtosis",
"(",
"self",
",",
"f_start",
"=",
"None",
",",
"f_stop",
"=",
"None",
",",
"if_id",
"=",
"0",
",",
"*",
"*",
"kwargs",
")",
":",
"ax",
"=",
"plt",
".",
"gca",
"(",
")",
"plot_f",
",",
"plot_data",
"=",
"self",
".",
"grab_d... | b8822d3e3e911944370d84371a91fa0c29e9772e |
test | Filterbank.plot_all | Plot waterfall of data as well as spectrum; also, placeholder to make even more complicated plots in the future.
Args:
f_start (float): start frequency, in MHz
f_stop (float): stop frequency, in MHz
logged (bool): Plot in linear (False) or dB units (True),
t (int... | blimpy/filterbank.py | def plot_all(self, t=0, f_start=None, f_stop=None, logged=False, if_id=0, kurtosis=True, **kwargs):
""" Plot waterfall of data as well as spectrum; also, placeholder to make even more complicated plots in the future.
Args:
f_start (float): start frequency, in MHz
f_stop (float):... | def plot_all(self, t=0, f_start=None, f_stop=None, logged=False, if_id=0, kurtosis=True, **kwargs):
""" Plot waterfall of data as well as spectrum; also, placeholder to make even more complicated plots in the future.
Args:
f_start (float): start frequency, in MHz
f_stop (float):... | [
"Plot",
"waterfall",
"of",
"data",
"as",
"well",
"as",
"spectrum",
";",
"also",
"placeholder",
"to",
"make",
"even",
"more",
"complicated",
"plots",
"in",
"the",
"future",
"."
] | UCBerkeleySETI/blimpy | python | https://github.com/UCBerkeleySETI/blimpy/blob/b8822d3e3e911944370d84371a91fa0c29e9772e/blimpy/filterbank.py#L775-L911 | [
"def",
"plot_all",
"(",
"self",
",",
"t",
"=",
"0",
",",
"f_start",
"=",
"None",
",",
"f_stop",
"=",
"None",
",",
"logged",
"=",
"False",
",",
"if_id",
"=",
"0",
",",
"kurtosis",
"=",
"True",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"self",
"."... | b8822d3e3e911944370d84371a91fa0c29e9772e |
test | Filterbank.write_to_filterbank | Write data to blimpy file.
Args:
filename_out (str): Name of output file | blimpy/filterbank.py | def write_to_filterbank(self, filename_out):
""" Write data to blimpy file.
Args:
filename_out (str): Name of output file
"""
print("[Filterbank] Warning: Non-standard function to write in filterbank (.fil) format. Please use Waterfall.")
n_bytes = int(self.header... | def write_to_filterbank(self, filename_out):
""" Write data to blimpy file.
Args:
filename_out (str): Name of output file
"""
print("[Filterbank] Warning: Non-standard function to write in filterbank (.fil) format. Please use Waterfall.")
n_bytes = int(self.header... | [
"Write",
"data",
"to",
"blimpy",
"file",
"."
] | UCBerkeleySETI/blimpy | python | https://github.com/UCBerkeleySETI/blimpy/blob/b8822d3e3e911944370d84371a91fa0c29e9772e/blimpy/filterbank.py#L913-L931 | [
"def",
"write_to_filterbank",
"(",
"self",
",",
"filename_out",
")",
":",
"print",
"(",
"\"[Filterbank] Warning: Non-standard function to write in filterbank (.fil) format. Please use Waterfall.\"",
")",
"n_bytes",
"=",
"int",
"(",
"self",
".",
"header",
"[",
"b'nbits'",
"]... | b8822d3e3e911944370d84371a91fa0c29e9772e |
test | Filterbank.write_to_hdf5 | Write data to HDF5 file.
Args:
filename_out (str): Name of output file | blimpy/filterbank.py | def write_to_hdf5(self, filename_out, *args, **kwargs):
""" Write data to HDF5 file.
Args:
filename_out (str): Name of output file
"""
print("[Filterbank] Warning: Non-standard function to write in HDF5 (.h5) format. Please use Waterfall.")
if not HAS_HDF5:
... | def write_to_hdf5(self, filename_out, *args, **kwargs):
""" Write data to HDF5 file.
Args:
filename_out (str): Name of output file
"""
print("[Filterbank] Warning: Non-standard function to write in HDF5 (.h5) format. Please use Waterfall.")
if not HAS_HDF5:
... | [
"Write",
"data",
"to",
"HDF5",
"file",
"."
] | UCBerkeleySETI/blimpy | python | https://github.com/UCBerkeleySETI/blimpy/blob/b8822d3e3e911944370d84371a91fa0c29e9772e/blimpy/filterbank.py#L933-L966 | [
"def",
"write_to_hdf5",
"(",
"self",
",",
"filename_out",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"print",
"(",
"\"[Filterbank] Warning: Non-standard function to write in HDF5 (.h5) format. Please use Waterfall.\"",
")",
"if",
"not",
"HAS_HDF5",
":",
"raise... | b8822d3e3e911944370d84371a91fa0c29e9772e |
test | Filterbank.calibrate_band_pass_N1 | One way to calibrate the band pass is to take the median value
for every frequency fine channel, and divide by it. | blimpy/filterbank.py | def calibrate_band_pass_N1(self):
""" One way to calibrate the band pass is to take the median value
for every frequency fine channel, and divide by it.
"""
band_pass = np.median(self.data.squeeze(),axis=0)
self.data = self.data/band_pass | def calibrate_band_pass_N1(self):
""" One way to calibrate the band pass is to take the median value
for every frequency fine channel, and divide by it.
"""
band_pass = np.median(self.data.squeeze(),axis=0)
self.data = self.data/band_pass | [
"One",
"way",
"to",
"calibrate",
"the",
"band",
"pass",
"is",
"to",
"take",
"the",
"median",
"value",
"for",
"every",
"frequency",
"fine",
"channel",
"and",
"divide",
"by",
"it",
"."
] | UCBerkeleySETI/blimpy | python | https://github.com/UCBerkeleySETI/blimpy/blob/b8822d3e3e911944370d84371a91fa0c29e9772e/blimpy/filterbank.py#L968-L974 | [
"def",
"calibrate_band_pass_N1",
"(",
"self",
")",
":",
"band_pass",
"=",
"np",
".",
"median",
"(",
"self",
".",
"data",
".",
"squeeze",
"(",
")",
",",
"axis",
"=",
"0",
")",
"self",
".",
"data",
"=",
"self",
".",
"data",
"/",
"band_pass"
] | b8822d3e3e911944370d84371a91fa0c29e9772e |
test | get_stokes | Output stokes parameters (I,Q,U,V) for a rawspec
cross polarization filterbank file | blimpy/calib_utils/stokescal.py | def get_stokes(cross_dat, feedtype='l'):
'''Output stokes parameters (I,Q,U,V) for a rawspec
cross polarization filterbank file'''
#Compute Stokes Parameters
if feedtype=='l':
#I = XX+YY
I = cross_dat[:,0,:]+cross_dat[:,1,:]
#Q = XX-YY
Q = cross_dat[:,0,:]-cross_dat[:,1,... | def get_stokes(cross_dat, feedtype='l'):
'''Output stokes parameters (I,Q,U,V) for a rawspec
cross polarization filterbank file'''
#Compute Stokes Parameters
if feedtype=='l':
#I = XX+YY
I = cross_dat[:,0,:]+cross_dat[:,1,:]
#Q = XX-YY
Q = cross_dat[:,0,:]-cross_dat[:,1,... | [
"Output",
"stokes",
"parameters",
"(",
"I",
"Q",
"U",
"V",
")",
"for",
"a",
"rawspec",
"cross",
"polarization",
"filterbank",
"file"
] | UCBerkeleySETI/blimpy | python | https://github.com/UCBerkeleySETI/blimpy/blob/b8822d3e3e911944370d84371a91fa0c29e9772e/blimpy/calib_utils/stokescal.py#L6-L42 | [
"def",
"get_stokes",
"(",
"cross_dat",
",",
"feedtype",
"=",
"'l'",
")",
":",
"#Compute Stokes Parameters",
"if",
"feedtype",
"==",
"'l'",
":",
"#I = XX+YY",
"I",
"=",
"cross_dat",
"[",
":",
",",
"0",
",",
":",
"]",
"+",
"cross_dat",
"[",
":",
",",
"1"... | b8822d3e3e911944370d84371a91fa0c29e9772e |
test | convert_to_coarse | Converts a data array with length n_chans to an array of length n_coarse_chans
by averaging over the coarse channels | blimpy/calib_utils/stokescal.py | def convert_to_coarse(data,chan_per_coarse):
'''
Converts a data array with length n_chans to an array of length n_coarse_chans
by averaging over the coarse channels
'''
#find number of coarse channels and reshape array
num_coarse = data.size/chan_per_coarse
data_shaped = np.array(np.reshape... | def convert_to_coarse(data,chan_per_coarse):
'''
Converts a data array with length n_chans to an array of length n_coarse_chans
by averaging over the coarse channels
'''
#find number of coarse channels and reshape array
num_coarse = data.size/chan_per_coarse
data_shaped = np.array(np.reshape... | [
"Converts",
"a",
"data",
"array",
"with",
"length",
"n_chans",
"to",
"an",
"array",
"of",
"length",
"n_coarse_chans",
"by",
"averaging",
"over",
"the",
"coarse",
"channels"
] | UCBerkeleySETI/blimpy | python | https://github.com/UCBerkeleySETI/blimpy/blob/b8822d3e3e911944370d84371a91fa0c29e9772e/blimpy/calib_utils/stokescal.py#L44-L54 | [
"def",
"convert_to_coarse",
"(",
"data",
",",
"chan_per_coarse",
")",
":",
"#find number of coarse channels and reshape array",
"num_coarse",
"=",
"data",
".",
"size",
"/",
"chan_per_coarse",
"data_shaped",
"=",
"np",
".",
"array",
"(",
"np",
".",
"reshape",
"(",
... | b8822d3e3e911944370d84371a91fa0c29e9772e |
test | phase_offsets | Calculates phase difference between X and Y feeds given U and V (U and Q for circular basis)
data from a noise diode measurement on the target | blimpy/calib_utils/stokescal.py | def phase_offsets(Idat,Qdat,Udat,Vdat,tsamp,chan_per_coarse,feedtype='l',**kwargs):
'''
Calculates phase difference between X and Y feeds given U and V (U and Q for circular basis)
data from a noise diode measurement on the target
'''
#Fold noise diode data and calculate ON OFF diferences for U and ... | def phase_offsets(Idat,Qdat,Udat,Vdat,tsamp,chan_per_coarse,feedtype='l',**kwargs):
'''
Calculates phase difference between X and Y feeds given U and V (U and Q for circular basis)
data from a noise diode measurement on the target
'''
#Fold noise diode data and calculate ON OFF diferences for U and ... | [
"Calculates",
"phase",
"difference",
"between",
"X",
"and",
"Y",
"feeds",
"given",
"U",
"and",
"V",
"(",
"U",
"and",
"Q",
"for",
"circular",
"basis",
")",
"data",
"from",
"a",
"noise",
"diode",
"measurement",
"on",
"the",
"target"
] | UCBerkeleySETI/blimpy | python | https://github.com/UCBerkeleySETI/blimpy/blob/b8822d3e3e911944370d84371a91fa0c29e9772e/blimpy/calib_utils/stokescal.py#L56-L88 | [
"def",
"phase_offsets",
"(",
"Idat",
",",
"Qdat",
",",
"Udat",
",",
"Vdat",
",",
"tsamp",
",",
"chan_per_coarse",
",",
"feedtype",
"=",
"'l'",
",",
"*",
"*",
"kwargs",
")",
":",
"#Fold noise diode data and calculate ON OFF diferences for U and V",
"if",
"feedtype"... | b8822d3e3e911944370d84371a91fa0c29e9772e |
test | gain_offsets | Determines relative gain error in the X and Y feeds for an
observation given I and Q (I and V for circular basis) noise diode data. | blimpy/calib_utils/stokescal.py | def gain_offsets(Idat,Qdat,Udat,Vdat,tsamp,chan_per_coarse,feedtype='l',**kwargs):
'''
Determines relative gain error in the X and Y feeds for an
observation given I and Q (I and V for circular basis) noise diode data.
'''
if feedtype=='l':
#Fold noise diode data and calculate ON OFF differe... | def gain_offsets(Idat,Qdat,Udat,Vdat,tsamp,chan_per_coarse,feedtype='l',**kwargs):
'''
Determines relative gain error in the X and Y feeds for an
observation given I and Q (I and V for circular basis) noise diode data.
'''
if feedtype=='l':
#Fold noise diode data and calculate ON OFF differe... | [
"Determines",
"relative",
"gain",
"error",
"in",
"the",
"X",
"and",
"Y",
"feeds",
"for",
"an",
"observation",
"given",
"I",
"and",
"Q",
"(",
"I",
"and",
"V",
"for",
"circular",
"basis",
")",
"noise",
"diode",
"data",
"."
] | UCBerkeleySETI/blimpy | python | https://github.com/UCBerkeleySETI/blimpy/blob/b8822d3e3e911944370d84371a91fa0c29e9772e/blimpy/calib_utils/stokescal.py#L90-L123 | [
"def",
"gain_offsets",
"(",
"Idat",
",",
"Qdat",
",",
"Udat",
",",
"Vdat",
",",
"tsamp",
",",
"chan_per_coarse",
",",
"feedtype",
"=",
"'l'",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"feedtype",
"==",
"'l'",
":",
"#Fold noise diode data and calculate ON OFF ... | b8822d3e3e911944370d84371a91fa0c29e9772e |
test | apply_Mueller | Returns calibrated Stokes parameters for an observation given an array
of differential gains and phase differences. | blimpy/calib_utils/stokescal.py | def apply_Mueller(I,Q,U,V, gain_offsets, phase_offsets, chan_per_coarse, feedtype='l'):
'''
Returns calibrated Stokes parameters for an observation given an array
of differential gains and phase differences.
'''
#Find shape of data arrays and calculate number of coarse channels
shape = I.shape
... | def apply_Mueller(I,Q,U,V, gain_offsets, phase_offsets, chan_per_coarse, feedtype='l'):
'''
Returns calibrated Stokes parameters for an observation given an array
of differential gains and phase differences.
'''
#Find shape of data arrays and calculate number of coarse channels
shape = I.shape
... | [
"Returns",
"calibrated",
"Stokes",
"parameters",
"for",
"an",
"observation",
"given",
"an",
"array",
"of",
"differential",
"gains",
"and",
"phase",
"differences",
"."
] | UCBerkeleySETI/blimpy | python | https://github.com/UCBerkeleySETI/blimpy/blob/b8822d3e3e911944370d84371a91fa0c29e9772e/blimpy/calib_utils/stokescal.py#L124-L181 | [
"def",
"apply_Mueller",
"(",
"I",
",",
"Q",
",",
"U",
",",
"V",
",",
"gain_offsets",
",",
"phase_offsets",
",",
"chan_per_coarse",
",",
"feedtype",
"=",
"'l'",
")",
":",
"#Find shape of data arrays and calculate number of coarse channels",
"shape",
"=",
"I",
".",
... | b8822d3e3e911944370d84371a91fa0c29e9772e |
test | calibrate_pols | Write Stokes-calibrated filterbank file for a given observation
with a calibrator noise diode measurement on the source
Parameters
----------
cross_pols : string
Path to cross polarization filterbank file (rawspec output) for observation to be calibrated
diode_cross : string
Path to... | blimpy/calib_utils/stokescal.py | def calibrate_pols(cross_pols,diode_cross,obsI=None,onefile=True,feedtype='l',**kwargs):
'''
Write Stokes-calibrated filterbank file for a given observation
with a calibrator noise diode measurement on the source
Parameters
----------
cross_pols : string
Path to cross polarization filte... | def calibrate_pols(cross_pols,diode_cross,obsI=None,onefile=True,feedtype='l',**kwargs):
'''
Write Stokes-calibrated filterbank file for a given observation
with a calibrator noise diode measurement on the source
Parameters
----------
cross_pols : string
Path to cross polarization filte... | [
"Write",
"Stokes",
"-",
"calibrated",
"filterbank",
"file",
"for",
"a",
"given",
"observation",
"with",
"a",
"calibrator",
"noise",
"diode",
"measurement",
"on",
"the",
"source"
] | UCBerkeleySETI/blimpy | python | https://github.com/UCBerkeleySETI/blimpy/blob/b8822d3e3e911944370d84371a91fa0c29e9772e/blimpy/calib_utils/stokescal.py#L183-L264 | [
"def",
"calibrate_pols",
"(",
"cross_pols",
",",
"diode_cross",
",",
"obsI",
"=",
"None",
",",
"onefile",
"=",
"True",
",",
"feedtype",
"=",
"'l'",
",",
"*",
"*",
"kwargs",
")",
":",
"#Obtain time sample length, frequencies, and noise diode data",
"obs",
"=",
"W... | b8822d3e3e911944370d84371a91fa0c29e9772e |
test | fracpols | Output fractional linear and circular polarizations for a
rawspec cross polarization .fil file. NOT STANDARD USE | blimpy/calib_utils/stokescal.py | def fracpols(str, **kwargs):
'''Output fractional linear and circular polarizations for a
rawspec cross polarization .fil file. NOT STANDARD USE'''
I,Q,U,V,L=get_stokes(str, **kwargs)
return L/I,V/I | def fracpols(str, **kwargs):
'''Output fractional linear and circular polarizations for a
rawspec cross polarization .fil file. NOT STANDARD USE'''
I,Q,U,V,L=get_stokes(str, **kwargs)
return L/I,V/I | [
"Output",
"fractional",
"linear",
"and",
"circular",
"polarizations",
"for",
"a",
"rawspec",
"cross",
"polarization",
".",
"fil",
"file",
".",
"NOT",
"STANDARD",
"USE"
] | UCBerkeleySETI/blimpy | python | https://github.com/UCBerkeleySETI/blimpy/blob/b8822d3e3e911944370d84371a91fa0c29e9772e/blimpy/calib_utils/stokescal.py#L267-L272 | [
"def",
"fracpols",
"(",
"str",
",",
"*",
"*",
"kwargs",
")",
":",
"I",
",",
"Q",
",",
"U",
",",
"V",
",",
"L",
"=",
"get_stokes",
"(",
"str",
",",
"*",
"*",
"kwargs",
")",
"return",
"L",
"/",
"I",
",",
"V",
"/",
"I"
] | b8822d3e3e911944370d84371a91fa0c29e9772e |
test | write_stokefils | Writes up to 5 new filterbank files corresponding to each Stokes
parameter (and total linear polarization L) for a given cross polarization .fil file | blimpy/calib_utils/stokescal.py | def write_stokefils(str, str_I, Ifil=False, Qfil=False, Ufil=False, Vfil=False, Lfil=False, **kwargs):
'''Writes up to 5 new filterbank files corresponding to each Stokes
parameter (and total linear polarization L) for a given cross polarization .fil file'''
I,Q,U,V,L=get_stokes(str, **kwargs)
obs = Wa... | def write_stokefils(str, str_I, Ifil=False, Qfil=False, Ufil=False, Vfil=False, Lfil=False, **kwargs):
'''Writes up to 5 new filterbank files corresponding to each Stokes
parameter (and total linear polarization L) for a given cross polarization .fil file'''
I,Q,U,V,L=get_stokes(str, **kwargs)
obs = Wa... | [
"Writes",
"up",
"to",
"5",
"new",
"filterbank",
"files",
"corresponding",
"to",
"each",
"Stokes",
"parameter",
"(",
"and",
"total",
"linear",
"polarization",
"L",
")",
"for",
"a",
"given",
"cross",
"polarization",
".",
"fil",
"file"
] | UCBerkeleySETI/blimpy | python | https://github.com/UCBerkeleySETI/blimpy/blob/b8822d3e3e911944370d84371a91fa0c29e9772e/blimpy/calib_utils/stokescal.py#L274-L298 | [
"def",
"write_stokefils",
"(",
"str",
",",
"str_I",
",",
"Ifil",
"=",
"False",
",",
"Qfil",
"=",
"False",
",",
"Ufil",
"=",
"False",
",",
"Vfil",
"=",
"False",
",",
"Lfil",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"I",
",",
"Q",
",",
"U... | b8822d3e3e911944370d84371a91fa0c29e9772e |
test | write_polfils | Writes two new filterbank files containing fractional linear and
circular polarization data | blimpy/calib_utils/stokescal.py | def write_polfils(str, str_I, **kwargs):
'''Writes two new filterbank files containing fractional linear and
circular polarization data'''
lin,circ=fracpols(str, **kwargs)
obs = Waterfall(str_I, max_load=150)
obs.data = lin
obs.write_to_fil(str[:-15]+'.linpol.fil') #assuming file is named *.... | def write_polfils(str, str_I, **kwargs):
'''Writes two new filterbank files containing fractional linear and
circular polarization data'''
lin,circ=fracpols(str, **kwargs)
obs = Waterfall(str_I, max_load=150)
obs.data = lin
obs.write_to_fil(str[:-15]+'.linpol.fil') #assuming file is named *.... | [
"Writes",
"two",
"new",
"filterbank",
"files",
"containing",
"fractional",
"linear",
"and",
"circular",
"polarization",
"data"
] | UCBerkeleySETI/blimpy | python | https://github.com/UCBerkeleySETI/blimpy/blob/b8822d3e3e911944370d84371a91fa0c29e9772e/blimpy/calib_utils/stokescal.py#L301-L312 | [
"def",
"write_polfils",
"(",
"str",
",",
"str_I",
",",
"*",
"*",
"kwargs",
")",
":",
"lin",
",",
"circ",
"=",
"fracpols",
"(",
"str",
",",
"*",
"*",
"kwargs",
")",
"obs",
"=",
"Waterfall",
"(",
"str_I",
",",
"max_load",
"=",
"150",
")",
"obs",
".... | b8822d3e3e911944370d84371a91fa0c29e9772e |
test | closest | Return the index of the closest in xarr to value val | blimpy/utils.py | def closest(xarr, val):
""" Return the index of the closest in xarr to value val """
idx_closest = np.argmin(np.abs(np.array(xarr) - val))
return idx_closest | def closest(xarr, val):
""" Return the index of the closest in xarr to value val """
idx_closest = np.argmin(np.abs(np.array(xarr) - val))
return idx_closest | [
"Return",
"the",
"index",
"of",
"the",
"closest",
"in",
"xarr",
"to",
"value",
"val"
] | UCBerkeleySETI/blimpy | python | https://github.com/UCBerkeleySETI/blimpy/blob/b8822d3e3e911944370d84371a91fa0c29e9772e/blimpy/utils.py#L18-L21 | [
"def",
"closest",
"(",
"xarr",
",",
"val",
")",
":",
"idx_closest",
"=",
"np",
".",
"argmin",
"(",
"np",
".",
"abs",
"(",
"np",
".",
"array",
"(",
"xarr",
")",
"-",
"val",
")",
")",
"return",
"idx_closest"
] | b8822d3e3e911944370d84371a91fa0c29e9772e |
test | rebin | Rebin data by averaging bins together
Args:
d (np.array): data
n_x (int): number of bins in x dir to rebin into one
n_y (int): number of bins in y dir to rebin into one
Returns:
d: rebinned data with shape (n_x, n_y) | blimpy/utils.py | def rebin(d, n_x, n_y=None):
""" Rebin data by averaging bins together
Args:
d (np.array): data
n_x (int): number of bins in x dir to rebin into one
n_y (int): number of bins in y dir to rebin into one
Returns:
d: rebinned data with shape (n_x, n_y)
"""
if d.ndim == 2:
if ... | def rebin(d, n_x, n_y=None):
""" Rebin data by averaging bins together
Args:
d (np.array): data
n_x (int): number of bins in x dir to rebin into one
n_y (int): number of bins in y dir to rebin into one
Returns:
d: rebinned data with shape (n_x, n_y)
"""
if d.ndim == 2:
if ... | [
"Rebin",
"data",
"by",
"averaging",
"bins",
"together"
] | UCBerkeleySETI/blimpy | python | https://github.com/UCBerkeleySETI/blimpy/blob/b8822d3e3e911944370d84371a91fa0c29e9772e/blimpy/utils.py#L24-L51 | [
"def",
"rebin",
"(",
"d",
",",
"n_x",
",",
"n_y",
"=",
"None",
")",
":",
"if",
"d",
".",
"ndim",
"==",
"2",
":",
"if",
"n_y",
"is",
"None",
":",
"n_y",
"=",
"1",
"if",
"n_x",
"is",
"None",
":",
"n_x",
"=",
"1",
"d",
"=",
"d",
"[",
":",
... | b8822d3e3e911944370d84371a91fa0c29e9772e |
test | unpack | upgrade data from nbits to 8bits
Notes: Pretty sure this function is a little broken! | blimpy/utils.py | def unpack(data, nbit):
"""upgrade data from nbits to 8bits
Notes: Pretty sure this function is a little broken!
"""
if nbit > 8:
raise ValueError("unpack: nbit must be <= 8")
if 8 % nbit != 0:
raise ValueError("unpack: nbit must divide into 8")
if data.dtype not in (np.uint8, n... | def unpack(data, nbit):
"""upgrade data from nbits to 8bits
Notes: Pretty sure this function is a little broken!
"""
if nbit > 8:
raise ValueError("unpack: nbit must be <= 8")
if 8 % nbit != 0:
raise ValueError("unpack: nbit must divide into 8")
if data.dtype not in (np.uint8, n... | [
"upgrade",
"data",
"from",
"nbits",
"to",
"8bits"
] | UCBerkeleySETI/blimpy | python | https://github.com/UCBerkeleySETI/blimpy/blob/b8822d3e3e911944370d84371a91fa0c29e9772e/blimpy/utils.py#L54-L75 | [
"def",
"unpack",
"(",
"data",
",",
"nbit",
")",
":",
"if",
"nbit",
">",
"8",
":",
"raise",
"ValueError",
"(",
"\"unpack: nbit must be <= 8\"",
")",
"if",
"8",
"%",
"nbit",
"!=",
"0",
":",
"raise",
"ValueError",
"(",
"\"unpack: nbit must divide into 8\"",
")"... | b8822d3e3e911944370d84371a91fa0c29e9772e |
test | unpack_2to8 | Promote 2-bit unisgned data into 8-bit unsigned data.
Args:
data: Numpy array with dtype == uint8
Notes:
DATA MUST BE LOADED as np.array() with dtype='uint8'.
This works with some clever shifting and AND / OR operations.
Data is LOADED as 8-bit, then promoted to 32-bits:
... | blimpy/utils.py | def unpack_2to8(data):
""" Promote 2-bit unisgned data into 8-bit unsigned data.
Args:
data: Numpy array with dtype == uint8
Notes:
DATA MUST BE LOADED as np.array() with dtype='uint8'.
This works with some clever shifting and AND / OR operations.
Data is LOADED as 8-bit, ... | def unpack_2to8(data):
""" Promote 2-bit unisgned data into 8-bit unsigned data.
Args:
data: Numpy array with dtype == uint8
Notes:
DATA MUST BE LOADED as np.array() with dtype='uint8'.
This works with some clever shifting and AND / OR operations.
Data is LOADED as 8-bit, ... | [
"Promote",
"2",
"-",
"bit",
"unisgned",
"data",
"into",
"8",
"-",
"bit",
"unsigned",
"data",
"."
] | UCBerkeleySETI/blimpy | python | https://github.com/UCBerkeleySETI/blimpy/blob/b8822d3e3e911944370d84371a91fa0c29e9772e/blimpy/utils.py#L87-L130 | [
"def",
"unpack_2to8",
"(",
"data",
")",
":",
"two_eight_lookup",
"=",
"{",
"0",
":",
"40",
",",
"1",
":",
"12",
",",
"2",
":",
"-",
"12",
",",
"3",
":",
"-",
"40",
"}",
"tmp",
"=",
"data",
".",
"astype",
"(",
"np",
".",
"uint32",
")",
"tmp",
... | b8822d3e3e911944370d84371a91fa0c29e9772e |
test | unpack_4to8 | Promote 2-bit unisgned data into 8-bit unsigned data.
Args:
data: Numpy array with dtype == uint8
Notes:
# The process is this:
# ABCDEFGH [Bits of one 4+4-bit value]
# 00000000ABCDEFGH [astype(uint16)]
# 0000ABCDEFGH0000 [<< 4]
# 0000ABCDXXXXEFGH [bitwise 'or' ... | blimpy/utils.py | def unpack_4to8(data):
""" Promote 2-bit unisgned data into 8-bit unsigned data.
Args:
data: Numpy array with dtype == uint8
Notes:
# The process is this:
# ABCDEFGH [Bits of one 4+4-bit value]
# 00000000ABCDEFGH [astype(uint16)]
# 0000ABCDEFGH0000 [<< 4]
# ... | def unpack_4to8(data):
""" Promote 2-bit unisgned data into 8-bit unsigned data.
Args:
data: Numpy array with dtype == uint8
Notes:
# The process is this:
# ABCDEFGH [Bits of one 4+4-bit value]
# 00000000ABCDEFGH [astype(uint16)]
# 0000ABCDEFGH0000 [<< 4]
# ... | [
"Promote",
"2",
"-",
"bit",
"unisgned",
"data",
"into",
"8",
"-",
"bit",
"unsigned",
"data",
"."
] | UCBerkeleySETI/blimpy | python | https://github.com/UCBerkeleySETI/blimpy/blob/b8822d3e3e911944370d84371a91fa0c29e9772e/blimpy/utils.py#L133-L156 | [
"def",
"unpack_4to8",
"(",
"data",
")",
":",
"tmpdata",
"=",
"data",
".",
"astype",
"(",
"np",
".",
"int16",
")",
"# np.empty(upshape, dtype=np.int16)",
"tmpdata",
"=",
"(",
"tmpdata",
"|",
"(",
"tmpdata",
"<<",
"4",
")",
")",
"&",
"0x0F0F",
"# tmpdata = t... | b8822d3e3e911944370d84371a91fa0c29e9772e |
test | get_diff | Returns ON-OFF for all Stokes parameters given a cross_pols noise diode measurement | blimpy/calib_utils/calib_plots.py | def get_diff(dio_cross,feedtype,**kwargs):
'''
Returns ON-OFF for all Stokes parameters given a cross_pols noise diode measurement
'''
#Get Stokes parameters, frequencies, and time sample length
obs = Waterfall(dio_cross,max_load=150)
freqs = obs.populate_freqs()
tsamp = obs.header['tsamp']
... | def get_diff(dio_cross,feedtype,**kwargs):
'''
Returns ON-OFF for all Stokes parameters given a cross_pols noise diode measurement
'''
#Get Stokes parameters, frequencies, and time sample length
obs = Waterfall(dio_cross,max_load=150)
freqs = obs.populate_freqs()
tsamp = obs.header['tsamp']
... | [
"Returns",
"ON",
"-",
"OFF",
"for",
"all",
"Stokes",
"parameters",
"given",
"a",
"cross_pols",
"noise",
"diode",
"measurement"
] | UCBerkeleySETI/blimpy | python | https://github.com/UCBerkeleySETI/blimpy/blob/b8822d3e3e911944370d84371a91fa0c29e9772e/blimpy/calib_utils/calib_plots.py#L7-L32 | [
"def",
"get_diff",
"(",
"dio_cross",
",",
"feedtype",
",",
"*",
"*",
"kwargs",
")",
":",
"#Get Stokes parameters, frequencies, and time sample length",
"obs",
"=",
"Waterfall",
"(",
"dio_cross",
",",
"max_load",
"=",
"150",
")",
"freqs",
"=",
"obs",
".",
"popula... | b8822d3e3e911944370d84371a91fa0c29e9772e |
test | plot_Stokes_diode | Plots the uncalibrated full stokes spectrum of the noise diode.
Use diff=False to plot both ON and OFF, or diff=True for ON-OFF | blimpy/calib_utils/calib_plots.py | def plot_Stokes_diode(dio_cross,diff=True,feedtype='l',**kwargs):
'''
Plots the uncalibrated full stokes spectrum of the noise diode.
Use diff=False to plot both ON and OFF, or diff=True for ON-OFF
'''
#If diff=True, get ON-OFF. If not get ON and OFF separately
if diff==True:
Idiff,Qdif... | def plot_Stokes_diode(dio_cross,diff=True,feedtype='l',**kwargs):
'''
Plots the uncalibrated full stokes spectrum of the noise diode.
Use diff=False to plot both ON and OFF, or diff=True for ON-OFF
'''
#If diff=True, get ON-OFF. If not get ON and OFF separately
if diff==True:
Idiff,Qdif... | [
"Plots",
"the",
"uncalibrated",
"full",
"stokes",
"spectrum",
"of",
"the",
"noise",
"diode",
".",
"Use",
"diff",
"=",
"False",
"to",
"plot",
"both",
"ON",
"and",
"OFF",
"or",
"diff",
"=",
"True",
"for",
"ON",
"-",
"OFF"
] | UCBerkeleySETI/blimpy | python | https://github.com/UCBerkeleySETI/blimpy/blob/b8822d3e3e911944370d84371a91fa0c29e9772e/blimpy/calib_utils/calib_plots.py#L34-L74 | [
"def",
"plot_Stokes_diode",
"(",
"dio_cross",
",",
"diff",
"=",
"True",
",",
"feedtype",
"=",
"'l'",
",",
"*",
"*",
"kwargs",
")",
":",
"#If diff=True, get ON-OFF. If not get ON and OFF separately",
"if",
"diff",
"==",
"True",
":",
"Idiff",
",",
"Qdiff",
",",
... | b8822d3e3e911944370d84371a91fa0c29e9772e |
test | plot_calibrated_diode | Plots the corrected noise diode spectrum for a given noise diode measurement
after application of the inverse Mueller matrix for the electronics chain. | blimpy/calib_utils/calib_plots.py | def plot_calibrated_diode(dio_cross,chan_per_coarse=8,feedtype='l',**kwargs):
'''
Plots the corrected noise diode spectrum for a given noise diode measurement
after application of the inverse Mueller matrix for the electronics chain.
'''
#Get full stokes data for the ND observation
obs = Waterfa... | def plot_calibrated_diode(dio_cross,chan_per_coarse=8,feedtype='l',**kwargs):
'''
Plots the corrected noise diode spectrum for a given noise diode measurement
after application of the inverse Mueller matrix for the electronics chain.
'''
#Get full stokes data for the ND observation
obs = Waterfa... | [
"Plots",
"the",
"corrected",
"noise",
"diode",
"spectrum",
"for",
"a",
"given",
"noise",
"diode",
"measurement",
"after",
"application",
"of",
"the",
"inverse",
"Mueller",
"matrix",
"for",
"the",
"electronics",
"chain",
"."
] | UCBerkeleySETI/blimpy | python | https://github.com/UCBerkeleySETI/blimpy/blob/b8822d3e3e911944370d84371a91fa0c29e9772e/blimpy/calib_utils/calib_plots.py#L77-L117 | [
"def",
"plot_calibrated_diode",
"(",
"dio_cross",
",",
"chan_per_coarse",
"=",
"8",
",",
"feedtype",
"=",
"'l'",
",",
"*",
"*",
"kwargs",
")",
":",
"#Get full stokes data for the ND observation",
"obs",
"=",
"Waterfall",
"(",
"dio_cross",
",",
"max_load",
"=",
"... | b8822d3e3e911944370d84371a91fa0c29e9772e |
test | plot_phase_offsets | Plots the calculated phase offsets of each coarse channel along with
the UV (or QU) noise diode spectrum for comparison | blimpy/calib_utils/calib_plots.py | def plot_phase_offsets(dio_cross,chan_per_coarse=8,feedtype='l',ax1=None,ax2=None,legend=True,**kwargs):
'''
Plots the calculated phase offsets of each coarse channel along with
the UV (or QU) noise diode spectrum for comparison
'''
#Get ON-OFF ND spectra
Idiff,Qdiff,Udiff,Vdiff,freqs = get_diff... | def plot_phase_offsets(dio_cross,chan_per_coarse=8,feedtype='l',ax1=None,ax2=None,legend=True,**kwargs):
'''
Plots the calculated phase offsets of each coarse channel along with
the UV (or QU) noise diode spectrum for comparison
'''
#Get ON-OFF ND spectra
Idiff,Qdiff,Udiff,Vdiff,freqs = get_diff... | [
"Plots",
"the",
"calculated",
"phase",
"offsets",
"of",
"each",
"coarse",
"channel",
"along",
"with",
"the",
"UV",
"(",
"or",
"QU",
")",
"noise",
"diode",
"spectrum",
"for",
"comparison"
] | UCBerkeleySETI/blimpy | python | https://github.com/UCBerkeleySETI/blimpy/blob/b8822d3e3e911944370d84371a91fa0c29e9772e/blimpy/calib_utils/calib_plots.py#L120-L165 | [
"def",
"plot_phase_offsets",
"(",
"dio_cross",
",",
"chan_per_coarse",
"=",
"8",
",",
"feedtype",
"=",
"'l'",
",",
"ax1",
"=",
"None",
",",
"ax2",
"=",
"None",
",",
"legend",
"=",
"True",
",",
"*",
"*",
"kwargs",
")",
":",
"#Get ON-OFF ND spectra",
"Idif... | b8822d3e3e911944370d84371a91fa0c29e9772e |
test | plot_gain_offsets | Plots the calculated gain offsets of each coarse channel along with
the time averaged power spectra of the X and Y feeds | blimpy/calib_utils/calib_plots.py | def plot_gain_offsets(dio_cross,dio_chan_per_coarse=8,feedtype='l',ax1=None,ax2=None,legend=True,**kwargs):
'''
Plots the calculated gain offsets of each coarse channel along with
the time averaged power spectra of the X and Y feeds
'''
#Get ON-OFF ND spectra
Idiff,Qdiff,Udiff,Vdiff,freqs = get_... | def plot_gain_offsets(dio_cross,dio_chan_per_coarse=8,feedtype='l',ax1=None,ax2=None,legend=True,**kwargs):
'''
Plots the calculated gain offsets of each coarse channel along with
the time averaged power spectra of the X and Y feeds
'''
#Get ON-OFF ND spectra
Idiff,Qdiff,Udiff,Vdiff,freqs = get_... | [
"Plots",
"the",
"calculated",
"gain",
"offsets",
"of",
"each",
"coarse",
"channel",
"along",
"with",
"the",
"time",
"averaged",
"power",
"spectra",
"of",
"the",
"X",
"and",
"Y",
"feeds"
] | UCBerkeleySETI/blimpy | python | https://github.com/UCBerkeleySETI/blimpy/blob/b8822d3e3e911944370d84371a91fa0c29e9772e/blimpy/calib_utils/calib_plots.py#L167-L215 | [
"def",
"plot_gain_offsets",
"(",
"dio_cross",
",",
"dio_chan_per_coarse",
"=",
"8",
",",
"feedtype",
"=",
"'l'",
",",
"ax1",
"=",
"None",
",",
"ax2",
"=",
"None",
",",
"legend",
"=",
"True",
",",
"*",
"*",
"kwargs",
")",
":",
"#Get ON-OFF ND spectra",
"I... | b8822d3e3e911944370d84371a91fa0c29e9772e |
test | plot_diode_fold | Plots the calculated average power and time sampling of ON (red) and
OFF (blue) for a noise diode measurement over the observation time series | blimpy/calib_utils/calib_plots.py | def plot_diode_fold(dio_cross,bothfeeds=True,feedtype='l',min_samp=-500,max_samp=7000,legend=True,**kwargs):
'''
Plots the calculated average power and time sampling of ON (red) and
OFF (blue) for a noise diode measurement over the observation time series
'''
#Get full stokes data of ND measurement
... | def plot_diode_fold(dio_cross,bothfeeds=True,feedtype='l',min_samp=-500,max_samp=7000,legend=True,**kwargs):
'''
Plots the calculated average power and time sampling of ON (red) and
OFF (blue) for a noise diode measurement over the observation time series
'''
#Get full stokes data of ND measurement
... | [
"Plots",
"the",
"calculated",
"average",
"power",
"and",
"time",
"sampling",
"of",
"ON",
"(",
"red",
")",
"and",
"OFF",
"(",
"blue",
")",
"for",
"a",
"noise",
"diode",
"measurement",
"over",
"the",
"observation",
"time",
"series"
] | UCBerkeleySETI/blimpy | python | https://github.com/UCBerkeleySETI/blimpy/blob/b8822d3e3e911944370d84371a91fa0c29e9772e/blimpy/calib_utils/calib_plots.py#L217-L272 | [
"def",
"plot_diode_fold",
"(",
"dio_cross",
",",
"bothfeeds",
"=",
"True",
",",
"feedtype",
"=",
"'l'",
",",
"min_samp",
"=",
"-",
"500",
",",
"max_samp",
"=",
"7000",
",",
"legend",
"=",
"True",
",",
"*",
"*",
"kwargs",
")",
":",
"#Get full stokes data ... | b8822d3e3e911944370d84371a91fa0c29e9772e |
test | plot_fullcalib | Generates and shows five plots: Uncalibrated diode, calibrated diode, fold information,
phase offsets, and gain offsets for a noise diode measurement. Most useful diagnostic plot to
make sure calibration proceeds correctly. | blimpy/calib_utils/calib_plots.py | def plot_fullcalib(dio_cross,feedtype='l',**kwargs):
'''
Generates and shows five plots: Uncalibrated diode, calibrated diode, fold information,
phase offsets, and gain offsets for a noise diode measurement. Most useful diagnostic plot to
make sure calibration proceeds correctly.
'''
plt.figure... | def plot_fullcalib(dio_cross,feedtype='l',**kwargs):
'''
Generates and shows five plots: Uncalibrated diode, calibrated diode, fold information,
phase offsets, and gain offsets for a noise diode measurement. Most useful diagnostic plot to
make sure calibration proceeds correctly.
'''
plt.figure... | [
"Generates",
"and",
"shows",
"five",
"plots",
":",
"Uncalibrated",
"diode",
"calibrated",
"diode",
"fold",
"information",
"phase",
"offsets",
"and",
"gain",
"offsets",
"for",
"a",
"noise",
"diode",
"measurement",
".",
"Most",
"useful",
"diagnostic",
"plot",
"to"... | UCBerkeleySETI/blimpy | python | https://github.com/UCBerkeleySETI/blimpy/blob/b8822d3e3e911944370d84371a91fa0c29e9772e/blimpy/calib_utils/calib_plots.py#L275-L323 | [
"def",
"plot_fullcalib",
"(",
"dio_cross",
",",
"feedtype",
"=",
"'l'",
",",
"*",
"*",
"kwargs",
")",
":",
"plt",
".",
"figure",
"(",
"\"Multiple Calibration Plots\"",
",",
"figsize",
"=",
"(",
"12",
",",
"9",
")",
")",
"left",
",",
"width",
"=",
"0.07... | b8822d3e3e911944370d84371a91fa0c29e9772e |
test | plot_diodespec | Plots the full-band Stokes I spectrum of the noise diode (ON-OFF) | blimpy/calib_utils/calib_plots.py | def plot_diodespec(ON_obs,OFF_obs,calflux,calfreq,spec_in,units='mJy',**kwargs):
'''
Plots the full-band Stokes I spectrum of the noise diode (ON-OFF)
'''
dspec = diode_spec(ON_obs,OFF_obs,calflux,calfreq,spec_in,**kwargs)
obs = Waterfall(ON_obs,max_load=150)
freqs = obs.populate_freqs()
ch... | def plot_diodespec(ON_obs,OFF_obs,calflux,calfreq,spec_in,units='mJy',**kwargs):
'''
Plots the full-band Stokes I spectrum of the noise diode (ON-OFF)
'''
dspec = diode_spec(ON_obs,OFF_obs,calflux,calfreq,spec_in,**kwargs)
obs = Waterfall(ON_obs,max_load=150)
freqs = obs.populate_freqs()
ch... | [
"Plots",
"the",
"full",
"-",
"band",
"Stokes",
"I",
"spectrum",
"of",
"the",
"noise",
"diode",
"(",
"ON",
"-",
"OFF",
")"
] | UCBerkeleySETI/blimpy | python | https://github.com/UCBerkeleySETI/blimpy/blob/b8822d3e3e911944370d84371a91fa0c29e9772e/blimpy/calib_utils/calib_plots.py#L325-L340 | [
"def",
"plot_diodespec",
"(",
"ON_obs",
",",
"OFF_obs",
",",
"calflux",
",",
"calfreq",
",",
"spec_in",
",",
"units",
"=",
"'mJy'",
",",
"*",
"*",
"kwargs",
")",
":",
"dspec",
"=",
"diode_spec",
"(",
"ON_obs",
",",
"OFF_obs",
",",
"calflux",
",",
"calf... | b8822d3e3e911944370d84371a91fa0c29e9772e |
test | cmd_tool | Read input and output frequency, and output file name | blimpy/dice.py | def cmd_tool():
'''Read input and output frequency, and output file name
'''
parser = argparse.ArgumentParser(description='Dices hdf5 or fil files and writes to hdf5 or fil.')
parser.add_argument('-f', '--input_filename', action='store', default=None, dest='in_fname', type=str, help='Name of file ... | def cmd_tool():
'''Read input and output frequency, and output file name
'''
parser = argparse.ArgumentParser(description='Dices hdf5 or fil files and writes to hdf5 or fil.')
parser.add_argument('-f', '--input_filename', action='store', default=None, dest='in_fname', type=str, help='Name of file ... | [
"Read",
"input",
"and",
"output",
"frequency",
"and",
"output",
"file",
"name"
] | UCBerkeleySETI/blimpy | python | https://github.com/UCBerkeleySETI/blimpy/blob/b8822d3e3e911944370d84371a91fa0c29e9772e/blimpy/dice.py#L33-L157 | [
"def",
"cmd_tool",
"(",
")",
":",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
"description",
"=",
"'Dices hdf5 or fil files and writes to hdf5 or fil.'",
")",
"parser",
".",
"add_argument",
"(",
"'-f'",
",",
"'--input_filename'",
",",
"action",
"=",
"'sto... | b8822d3e3e911944370d84371a91fa0c29e9772e |
test | cmd_tool | Command line utility for creating HDF5 blimpy files. | blimpy/deprecated/fil2hdf.py | def cmd_tool(args=None):
""" Command line utility for creating HDF5 blimpy files. """
from argparse import ArgumentParser
parser = ArgumentParser(description="Command line utility for creating HDF5 Filterbank files.")
parser.add_argument('dirname', type=str, help='Name of directory to read')
args = ... | def cmd_tool(args=None):
""" Command line utility for creating HDF5 blimpy files. """
from argparse import ArgumentParser
parser = ArgumentParser(description="Command line utility for creating HDF5 Filterbank files.")
parser.add_argument('dirname', type=str, help='Name of directory to read')
args = ... | [
"Command",
"line",
"utility",
"for",
"creating",
"HDF5",
"blimpy",
"files",
"."
] | UCBerkeleySETI/blimpy | python | https://github.com/UCBerkeleySETI/blimpy/blob/b8822d3e3e911944370d84371a91fa0c29e9772e/blimpy/deprecated/fil2hdf.py#L19-L91 | [
"def",
"cmd_tool",
"(",
"args",
"=",
"None",
")",
":",
"from",
"argparse",
"import",
"ArgumentParser",
"parser",
"=",
"ArgumentParser",
"(",
"description",
"=",
"\"Command line utility for creating HDF5 Filterbank files.\"",
")",
"parser",
".",
"add_argument",
"(",
"'... | b8822d3e3e911944370d84371a91fa0c29e9772e |
test | open_file | Open a HDF5 or filterbank file
Returns instance of a Reader to read data from file.
================== ==================================================
Filename extension File type
================== ==================================================
h5, hdf5 HDF5 format
fil ... | blimpy/file_wrapper.py | def open_file(filename, f_start=None, f_stop=None,t_start=None, t_stop=None,load_data=True,max_load=1.):
"""Open a HDF5 or filterbank file
Returns instance of a Reader to read data from file.
================== ==================================================
Filename extension File type
=======... | def open_file(filename, f_start=None, f_stop=None,t_start=None, t_stop=None,load_data=True,max_load=1.):
"""Open a HDF5 or filterbank file
Returns instance of a Reader to read data from file.
================== ==================================================
Filename extension File type
=======... | [
"Open",
"a",
"HDF5",
"or",
"filterbank",
"file"
] | UCBerkeleySETI/blimpy | python | https://github.com/UCBerkeleySETI/blimpy/blob/b8822d3e3e911944370d84371a91fa0c29e9772e/blimpy/file_wrapper.py#L736-L770 | [
"def",
"open_file",
"(",
"filename",
",",
"f_start",
"=",
"None",
",",
"f_stop",
"=",
"None",
",",
"t_start",
"=",
"None",
",",
"t_stop",
"=",
"None",
",",
"load_data",
"=",
"True",
",",
"max_load",
"=",
"1.",
")",
":",
"if",
"not",
"os",
".",
"pat... | b8822d3e3e911944370d84371a91fa0c29e9772e |
test | Reader._setup_selection_range | Making sure the selection if time and frequency are within the file limits.
Args:
init (bool): If call during __init__ | blimpy/file_wrapper.py | def _setup_selection_range(self, f_start=None, f_stop=None, t_start=None, t_stop=None, init=False):
"""Making sure the selection if time and frequency are within the file limits.
Args:
init (bool): If call during __init__
"""
# This avoids resetting values
if init i... | def _setup_selection_range(self, f_start=None, f_stop=None, t_start=None, t_stop=None, init=False):
"""Making sure the selection if time and frequency are within the file limits.
Args:
init (bool): If call during __init__
"""
# This avoids resetting values
if init i... | [
"Making",
"sure",
"the",
"selection",
"if",
"time",
"and",
"frequency",
"are",
"within",
"the",
"file",
"limits",
"."
] | UCBerkeleySETI/blimpy | python | https://github.com/UCBerkeleySETI/blimpy/blob/b8822d3e3e911944370d84371a91fa0c29e9772e/blimpy/file_wrapper.py#L45-L110 | [
"def",
"_setup_selection_range",
"(",
"self",
",",
"f_start",
"=",
"None",
",",
"f_stop",
"=",
"None",
",",
"t_start",
"=",
"None",
",",
"t_stop",
"=",
"None",
",",
"init",
"=",
"False",
")",
":",
"# This avoids resetting values",
"if",
"init",
"is",
"True... | b8822d3e3e911944370d84371a91fa0c29e9772e |
test | Reader._setup_dtype | Calculating dtype | blimpy/file_wrapper.py | def _setup_dtype(self):
"""Calculating dtype
"""
#Set up the data type
if self._n_bytes == 4:
return b'float32'
elif self._n_bytes == 2:
return b'uint16'
elif self._n_bytes == 1:
return b'uint8'
else:
logger.warn... | def _setup_dtype(self):
"""Calculating dtype
"""
#Set up the data type
if self._n_bytes == 4:
return b'float32'
elif self._n_bytes == 2:
return b'uint16'
elif self._n_bytes == 1:
return b'uint8'
else:
logger.warn... | [
"Calculating",
"dtype"
] | UCBerkeleySETI/blimpy | python | https://github.com/UCBerkeleySETI/blimpy/blob/b8822d3e3e911944370d84371a91fa0c29e9772e/blimpy/file_wrapper.py#L118-L131 | [
"def",
"_setup_dtype",
"(",
"self",
")",
":",
"#Set up the data type",
"if",
"self",
".",
"_n_bytes",
"==",
"4",
":",
"return",
"b'float32'",
"elif",
"self",
".",
"_n_bytes",
"==",
"2",
":",
"return",
"b'uint16'",
"elif",
"self",
".",
"_n_bytes",
"==",
"1"... | b8822d3e3e911944370d84371a91fa0c29e9772e |
test | Reader._calc_selection_size | Calculate size of data of interest. | blimpy/file_wrapper.py | def _calc_selection_size(self):
"""Calculate size of data of interest.
"""
#Check to see how many integrations requested
n_ints = self.t_stop - self.t_start
#Check to see how many frequency channels requested
n_chan = (self.f_stop - self.f_start) / abs(self.header[b'foff... | def _calc_selection_size(self):
"""Calculate size of data of interest.
"""
#Check to see how many integrations requested
n_ints = self.t_stop - self.t_start
#Check to see how many frequency channels requested
n_chan = (self.f_stop - self.f_start) / abs(self.header[b'foff... | [
"Calculate",
"size",
"of",
"data",
"of",
"interest",
"."
] | UCBerkeleySETI/blimpy | python | https://github.com/UCBerkeleySETI/blimpy/blob/b8822d3e3e911944370d84371a91fa0c29e9772e/blimpy/file_wrapper.py#L133-L145 | [
"def",
"_calc_selection_size",
"(",
"self",
")",
":",
"#Check to see how many integrations requested",
"n_ints",
"=",
"self",
".",
"t_stop",
"-",
"self",
".",
"t_start",
"#Check to see how many frequency channels requested",
"n_chan",
"=",
"(",
"self",
".",
"f_stop",
"-... | b8822d3e3e911944370d84371a91fa0c29e9772e |
test | Reader._calc_selection_shape | Calculate shape of data of interest. | blimpy/file_wrapper.py | def _calc_selection_shape(self):
"""Calculate shape of data of interest.
"""
#Check how many integrations requested
n_ints = int(self.t_stop - self.t_start)
#Check how many frequency channels requested
n_chan = int(np.round((self.f_stop - self.f_start) / abs(self.header[... | def _calc_selection_shape(self):
"""Calculate shape of data of interest.
"""
#Check how many integrations requested
n_ints = int(self.t_stop - self.t_start)
#Check how many frequency channels requested
n_chan = int(np.round((self.f_stop - self.f_start) / abs(self.header[... | [
"Calculate",
"shape",
"of",
"data",
"of",
"interest",
"."
] | UCBerkeleySETI/blimpy | python | https://github.com/UCBerkeleySETI/blimpy/blob/b8822d3e3e911944370d84371a91fa0c29e9772e/blimpy/file_wrapper.py#L147-L158 | [
"def",
"_calc_selection_shape",
"(",
"self",
")",
":",
"#Check how many integrations requested",
"n_ints",
"=",
"int",
"(",
"self",
".",
"t_stop",
"-",
"self",
".",
"t_start",
")",
"#Check how many frequency channels requested",
"n_chan",
"=",
"int",
"(",
"np",
".",... | b8822d3e3e911944370d84371a91fa0c29e9772e |
test | Reader._setup_chans | Setup channel borders | blimpy/file_wrapper.py | def _setup_chans(self):
"""Setup channel borders
"""
if self.header[b'foff'] < 0:
f0 = self.f_end
else:
f0 = self.f_begin
i_start, i_stop = 0, self.n_channels_in_file
if self.f_start:
i_start = np.round((self.f_start - f0) / self.head... | def _setup_chans(self):
"""Setup channel borders
"""
if self.header[b'foff'] < 0:
f0 = self.f_end
else:
f0 = self.f_begin
i_start, i_stop = 0, self.n_channels_in_file
if self.f_start:
i_start = np.round((self.f_start - f0) / self.head... | [
"Setup",
"channel",
"borders"
] | UCBerkeleySETI/blimpy | python | https://github.com/UCBerkeleySETI/blimpy/blob/b8822d3e3e911944370d84371a91fa0c29e9772e/blimpy/file_wrapper.py#L160-L183 | [
"def",
"_setup_chans",
"(",
"self",
")",
":",
"if",
"self",
".",
"header",
"[",
"b'foff'",
"]",
"<",
"0",
":",
"f0",
"=",
"self",
".",
"f_end",
"else",
":",
"f0",
"=",
"self",
".",
"f_begin",
"i_start",
",",
"i_stop",
"=",
"0",
",",
"self",
".",
... | b8822d3e3e911944370d84371a91fa0c29e9772e |
test | Reader._setup_freqs | Updating frequency borders from channel values | blimpy/file_wrapper.py | def _setup_freqs(self):
"""Updating frequency borders from channel values
"""
if self.header[b'foff'] > 0:
self.f_start = self.f_begin + self.chan_start_idx*abs(self.header[b'foff'])
self.f_stop = self.f_begin + self.chan_stop_idx*abs(self.header[b'foff'])
else:
... | def _setup_freqs(self):
"""Updating frequency borders from channel values
"""
if self.header[b'foff'] > 0:
self.f_start = self.f_begin + self.chan_start_idx*abs(self.header[b'foff'])
self.f_stop = self.f_begin + self.chan_stop_idx*abs(self.header[b'foff'])
else:
... | [
"Updating",
"frequency",
"borders",
"from",
"channel",
"values"
] | UCBerkeleySETI/blimpy | python | https://github.com/UCBerkeleySETI/blimpy/blob/b8822d3e3e911944370d84371a91fa0c29e9772e/blimpy/file_wrapper.py#L185-L194 | [
"def",
"_setup_freqs",
"(",
"self",
")",
":",
"if",
"self",
".",
"header",
"[",
"b'foff'",
"]",
">",
"0",
":",
"self",
".",
"f_start",
"=",
"self",
".",
"f_begin",
"+",
"self",
".",
"chan_start_idx",
"*",
"abs",
"(",
"self",
".",
"header",
"[",
"b'... | b8822d3e3e911944370d84371a91fa0c29e9772e |
test | Reader.populate_timestamps | Populate time axis.
IF update_header then only return tstart | blimpy/file_wrapper.py | def populate_timestamps(self,update_header=False):
""" Populate time axis.
IF update_header then only return tstart
"""
#Check to see how many integrations requested
ii_start, ii_stop = 0, self.n_ints_in_file
if self.t_start:
ii_start = self.t_start
... | def populate_timestamps(self,update_header=False):
""" Populate time axis.
IF update_header then only return tstart
"""
#Check to see how many integrations requested
ii_start, ii_stop = 0, self.n_ints_in_file
if self.t_start:
ii_start = self.t_start
... | [
"Populate",
"time",
"axis",
".",
"IF",
"update_header",
"then",
"only",
"return",
"tstart"
] | UCBerkeleySETI/blimpy | python | https://github.com/UCBerkeleySETI/blimpy/blob/b8822d3e3e911944370d84371a91fa0c29e9772e/blimpy/file_wrapper.py#L196-L217 | [
"def",
"populate_timestamps",
"(",
"self",
",",
"update_header",
"=",
"False",
")",
":",
"#Check to see how many integrations requested",
"ii_start",
",",
"ii_stop",
"=",
"0",
",",
"self",
".",
"n_ints_in_file",
"if",
"self",
".",
"t_start",
":",
"ii_start",
"=",
... | b8822d3e3e911944370d84371a91fa0c29e9772e |
test | Reader.populate_freqs | Populate frequency axis | blimpy/file_wrapper.py | def populate_freqs(self):
"""
Populate frequency axis
"""
if self.header[b'foff'] < 0:
f0 = self.f_end
else:
f0 = self.f_begin
self._setup_chans()
#create freq array
i_vals = np.arange(self.chan_start_idx, self.chan_stop_idx)
... | def populate_freqs(self):
"""
Populate frequency axis
"""
if self.header[b'foff'] < 0:
f0 = self.f_end
else:
f0 = self.f_begin
self._setup_chans()
#create freq array
i_vals = np.arange(self.chan_start_idx, self.chan_stop_idx)
... | [
"Populate",
"frequency",
"axis"
] | UCBerkeleySETI/blimpy | python | https://github.com/UCBerkeleySETI/blimpy/blob/b8822d3e3e911944370d84371a91fa0c29e9772e/blimpy/file_wrapper.py#L219-L235 | [
"def",
"populate_freqs",
"(",
"self",
")",
":",
"if",
"self",
".",
"header",
"[",
"b'foff'",
"]",
"<",
"0",
":",
"f0",
"=",
"self",
".",
"f_end",
"else",
":",
"f0",
"=",
"self",
".",
"f_begin",
"self",
".",
"_setup_chans",
"(",
")",
"#create freq arr... | b8822d3e3e911944370d84371a91fa0c29e9772e |
test | Reader.calc_n_coarse_chan | This makes an attempt to calculate the number of coarse channels in a given file.
Note:
This is unlikely to work on non-Breakthrough Listen data, as a-priori knowledge of
the digitizer system is required. | blimpy/file_wrapper.py | def calc_n_coarse_chan(self, chan_bw=None):
""" This makes an attempt to calculate the number of coarse channels in a given file.
Note:
This is unlikely to work on non-Breakthrough Listen data, as a-priori knowledge of
the digitizer system is required.
"""
... | def calc_n_coarse_chan(self, chan_bw=None):
""" This makes an attempt to calculate the number of coarse channels in a given file.
Note:
This is unlikely to work on non-Breakthrough Listen data, as a-priori knowledge of
the digitizer system is required.
"""
... | [
"This",
"makes",
"an",
"attempt",
"to",
"calculate",
"the",
"number",
"of",
"coarse",
"channels",
"in",
"a",
"given",
"file",
"."
] | UCBerkeleySETI/blimpy | python | https://github.com/UCBerkeleySETI/blimpy/blob/b8822d3e3e911944370d84371a91fa0c29e9772e/blimpy/file_wrapper.py#L237-L272 | [
"def",
"calc_n_coarse_chan",
"(",
"self",
",",
"chan_bw",
"=",
"None",
")",
":",
"nchans",
"=",
"int",
"(",
"self",
".",
"header",
"[",
"b'nchans'",
"]",
")",
"# Do we have a file with enough channels that it has coarse channelization?",
"if",
"chan_bw",
"is",
"not"... | b8822d3e3e911944370d84371a91fa0c29e9772e |
test | Reader.calc_n_blobs | Given the blob dimensions, calculate how many fit in the data selection. | blimpy/file_wrapper.py | def calc_n_blobs(self, blob_dim):
""" Given the blob dimensions, calculate how many fit in the data selection.
"""
n_blobs = int(np.ceil(1.0 * np.prod(self.selection_shape) / np.prod(blob_dim)))
return n_blobs | def calc_n_blobs(self, blob_dim):
""" Given the blob dimensions, calculate how many fit in the data selection.
"""
n_blobs = int(np.ceil(1.0 * np.prod(self.selection_shape) / np.prod(blob_dim)))
return n_blobs | [
"Given",
"the",
"blob",
"dimensions",
"calculate",
"how",
"many",
"fit",
"in",
"the",
"data",
"selection",
"."
] | UCBerkeleySETI/blimpy | python | https://github.com/UCBerkeleySETI/blimpy/blob/b8822d3e3e911944370d84371a91fa0c29e9772e/blimpy/file_wrapper.py#L274-L280 | [
"def",
"calc_n_blobs",
"(",
"self",
",",
"blob_dim",
")",
":",
"n_blobs",
"=",
"int",
"(",
"np",
".",
"ceil",
"(",
"1.0",
"*",
"np",
".",
"prod",
"(",
"self",
".",
"selection_shape",
")",
"/",
"np",
".",
"prod",
"(",
"blob_dim",
")",
")",
")",
"r... | b8822d3e3e911944370d84371a91fa0c29e9772e |
test | Reader.isheavy | Check if the current selection is too large. | blimpy/file_wrapper.py | def isheavy(self):
""" Check if the current selection is too large.
"""
selection_size_bytes = self._calc_selection_size()
if selection_size_bytes > self.MAX_DATA_ARRAY_SIZE:
return True
else:
return False | def isheavy(self):
""" Check if the current selection is too large.
"""
selection_size_bytes = self._calc_selection_size()
if selection_size_bytes > self.MAX_DATA_ARRAY_SIZE:
return True
else:
return False | [
"Check",
"if",
"the",
"current",
"selection",
"is",
"too",
"large",
"."
] | UCBerkeleySETI/blimpy | python | https://github.com/UCBerkeleySETI/blimpy/blob/b8822d3e3e911944370d84371a91fa0c29e9772e/blimpy/file_wrapper.py#L282-L291 | [
"def",
"isheavy",
"(",
"self",
")",
":",
"selection_size_bytes",
"=",
"self",
".",
"_calc_selection_size",
"(",
")",
"if",
"selection_size_bytes",
">",
"self",
".",
"MAX_DATA_ARRAY_SIZE",
":",
"return",
"True",
"else",
":",
"return",
"False"
] | b8822d3e3e911944370d84371a91fa0c29e9772e |
test | H5Reader.read_header | Read header and return a Python dictionary of key:value pairs | blimpy/file_wrapper.py | def read_header(self):
""" Read header and return a Python dictionary of key:value pairs
"""
self.header = {}
for key, val in self.h5['data'].attrs.items():
if six.PY3:
key = bytes(key, 'ascii')
if key == b'src_raj':
self.header[k... | def read_header(self):
""" Read header and return a Python dictionary of key:value pairs
"""
self.header = {}
for key, val in self.h5['data'].attrs.items():
if six.PY3:
key = bytes(key, 'ascii')
if key == b'src_raj':
self.header[k... | [
"Read",
"header",
"and",
"return",
"a",
"Python",
"dictionary",
"of",
"key",
":",
"value",
"pairs"
] | UCBerkeleySETI/blimpy | python | https://github.com/UCBerkeleySETI/blimpy/blob/b8822d3e3e911944370d84371a91fa0c29e9772e/blimpy/file_wrapper.py#L383-L399 | [
"def",
"read_header",
"(",
"self",
")",
":",
"self",
".",
"header",
"=",
"{",
"}",
"for",
"key",
",",
"val",
"in",
"self",
".",
"h5",
"[",
"'data'",
"]",
".",
"attrs",
".",
"items",
"(",
")",
":",
"if",
"six",
".",
"PY3",
":",
"key",
"=",
"by... | b8822d3e3e911944370d84371a91fa0c29e9772e |
test | H5Reader._find_blob_start | Find first blob from selection. | blimpy/file_wrapper.py | def _find_blob_start(self, blob_dim, n_blob):
"""Find first blob from selection.
"""
#Convert input frequencies into what their corresponding channel number would be.
self._setup_chans()
#Check which is the blob time offset
blob_time_start = self.t_start + blob_dim[self... | def _find_blob_start(self, blob_dim, n_blob):
"""Find first blob from selection.
"""
#Convert input frequencies into what their corresponding channel number would be.
self._setup_chans()
#Check which is the blob time offset
blob_time_start = self.t_start + blob_dim[self... | [
"Find",
"first",
"blob",
"from",
"selection",
"."
] | UCBerkeleySETI/blimpy | python | https://github.com/UCBerkeleySETI/blimpy/blob/b8822d3e3e911944370d84371a91fa0c29e9772e/blimpy/file_wrapper.py#L401-L416 | [
"def",
"_find_blob_start",
"(",
"self",
",",
"blob_dim",
",",
"n_blob",
")",
":",
"#Convert input frequencies into what their corresponding channel number would be.",
"self",
".",
"_setup_chans",
"(",
")",
"#Check which is the blob time offset",
"blob_time_start",
"=",
"self",
... | b8822d3e3e911944370d84371a91fa0c29e9772e |
test | H5Reader.read_data | Read data | blimpy/file_wrapper.py | def read_data(self, f_start=None, f_stop=None,t_start=None, t_stop=None):
""" Read data
"""
self._setup_selection_range(f_start=f_start, f_stop=f_stop, t_start=t_start, t_stop=t_stop)
#check if selection is small enough.
if self.isheavy():
logger.warning("Selection ... | def read_data(self, f_start=None, f_stop=None,t_start=None, t_stop=None):
""" Read data
"""
self._setup_selection_range(f_start=f_start, f_stop=f_stop, t_start=t_start, t_stop=t_stop)
#check if selection is small enough.
if self.isheavy():
logger.warning("Selection ... | [
"Read",
"data"
] | UCBerkeleySETI/blimpy | python | https://github.com/UCBerkeleySETI/blimpy/blob/b8822d3e3e911944370d84371a91fa0c29e9772e/blimpy/file_wrapper.py#L418-L435 | [
"def",
"read_data",
"(",
"self",
",",
"f_start",
"=",
"None",
",",
"f_stop",
"=",
"None",
",",
"t_start",
"=",
"None",
",",
"t_stop",
"=",
"None",
")",
":",
"self",
".",
"_setup_selection_range",
"(",
"f_start",
"=",
"f_start",
",",
"f_stop",
"=",
"f_s... | b8822d3e3e911944370d84371a91fa0c29e9772e |
test | H5Reader.read_blob | Read blob from a selection. | blimpy/file_wrapper.py | def read_blob(self,blob_dim,n_blob=0):
"""Read blob from a selection.
"""
n_blobs = self.calc_n_blobs(blob_dim)
if n_blob > n_blobs or n_blob < 0:
raise ValueError('Please provide correct n_blob value. Given %i, but max values is %i'%(n_blob,n_blobs))
#This prevents... | def read_blob(self,blob_dim,n_blob=0):
"""Read blob from a selection.
"""
n_blobs = self.calc_n_blobs(blob_dim)
if n_blob > n_blobs or n_blob < 0:
raise ValueError('Please provide correct n_blob value. Given %i, but max values is %i'%(n_blob,n_blobs))
#This prevents... | [
"Read",
"blob",
"from",
"a",
"selection",
"."
] | UCBerkeleySETI/blimpy | python | https://github.com/UCBerkeleySETI/blimpy/blob/b8822d3e3e911944370d84371a91fa0c29e9772e/blimpy/file_wrapper.py#L437-L462 | [
"def",
"read_blob",
"(",
"self",
",",
"blob_dim",
",",
"n_blob",
"=",
"0",
")",
":",
"n_blobs",
"=",
"self",
".",
"calc_n_blobs",
"(",
"blob_dim",
")",
"if",
"n_blob",
">",
"n_blobs",
"or",
"n_blob",
"<",
"0",
":",
"raise",
"ValueError",
"(",
"'Please ... | b8822d3e3e911944370d84371a91fa0c29e9772e |
test | FilReader.read_header | Read blimpy header and return a Python dictionary of key:value pairs
Args:
filename (str): name of file to open
Optional args:
return_idxs (bool): Default False. If true, returns the file offset indexes
for values
Returns:
Py... | blimpy/file_wrapper.py | def read_header(self, return_idxs=False):
""" Read blimpy header and return a Python dictionary of key:value pairs
Args:
filename (str): name of file to open
Optional args:
return_idxs (bool): Default False. If true, returns the file offset indexes
... | def read_header(self, return_idxs=False):
""" Read blimpy header and return a Python dictionary of key:value pairs
Args:
filename (str): name of file to open
Optional args:
return_idxs (bool): Default False. If true, returns the file offset indexes
... | [
"Read",
"blimpy",
"header",
"and",
"return",
"a",
"Python",
"dictionary",
"of",
"key",
":",
"value",
"pairs"
] | UCBerkeleySETI/blimpy | python | https://github.com/UCBerkeleySETI/blimpy/blob/b8822d3e3e911944370d84371a91fa0c29e9772e/blimpy/file_wrapper.py#L559-L574 | [
"def",
"read_header",
"(",
"self",
",",
"return_idxs",
"=",
"False",
")",
":",
"self",
".",
"header",
"=",
"sigproc",
".",
"read_header",
"(",
"self",
".",
"filename",
",",
"return_idxs",
"=",
"return_idxs",
")",
"return",
"self",
".",
"header"
] | b8822d3e3e911944370d84371a91fa0c29e9772e |
test | FilReader.read_data | Read data. | blimpy/file_wrapper.py | def read_data(self, f_start=None, f_stop=None,t_start=None, t_stop=None):
""" Read data.
"""
self._setup_selection_range(f_start=f_start, f_stop=f_stop, t_start=t_start, t_stop=t_stop)
#check if selection is small enough.
if self.isheavy():
logger.warning("Selection... | def read_data(self, f_start=None, f_stop=None,t_start=None, t_stop=None):
""" Read data.
"""
self._setup_selection_range(f_start=f_start, f_stop=f_stop, t_start=t_start, t_stop=t_stop)
#check if selection is small enough.
if self.isheavy():
logger.warning("Selection... | [
"Read",
"data",
"."
] | UCBerkeleySETI/blimpy | python | https://github.com/UCBerkeleySETI/blimpy/blob/b8822d3e3e911944370d84371a91fa0c29e9772e/blimpy/file_wrapper.py#L576-L622 | [
"def",
"read_data",
"(",
"self",
",",
"f_start",
"=",
"None",
",",
"f_stop",
"=",
"None",
",",
"t_start",
"=",
"None",
",",
"t_stop",
"=",
"None",
")",
":",
"self",
".",
"_setup_selection_range",
"(",
"f_start",
"=",
"f_start",
",",
"f_stop",
"=",
"f_s... | b8822d3e3e911944370d84371a91fa0c29e9772e |
test | FilReader._find_blob_start | Find first blob from selection. | blimpy/file_wrapper.py | def _find_blob_start(self):
"""Find first blob from selection.
"""
# Convert input frequencies into what their corresponding channel number would be.
self._setup_chans()
# Check which is the blob time offset
blob_time_start = self.t_start
# Check which is the b... | def _find_blob_start(self):
"""Find first blob from selection.
"""
# Convert input frequencies into what their corresponding channel number would be.
self._setup_chans()
# Check which is the blob time offset
blob_time_start = self.t_start
# Check which is the b... | [
"Find",
"first",
"blob",
"from",
"selection",
"."
] | UCBerkeleySETI/blimpy | python | https://github.com/UCBerkeleySETI/blimpy/blob/b8822d3e3e911944370d84371a91fa0c29e9772e/blimpy/file_wrapper.py#L624-L639 | [
"def",
"_find_blob_start",
"(",
"self",
")",
":",
"# Convert input frequencies into what their corresponding channel number would be.",
"self",
".",
"_setup_chans",
"(",
")",
"# Check which is the blob time offset",
"blob_time_start",
"=",
"self",
".",
"t_start",
"# Check which i... | b8822d3e3e911944370d84371a91fa0c29e9772e |
test | FilReader.read_blob | Read blob from a selection. | blimpy/file_wrapper.py | def read_blob(self,blob_dim,n_blob=0):
"""Read blob from a selection.
"""
n_blobs = self.calc_n_blobs(blob_dim)
if n_blob > n_blobs or n_blob < 0:
raise ValueError('Please provide correct n_blob value. Given %i, but max values is %i'%(n_blob,n_blobs))
# This prevent... | def read_blob(self,blob_dim,n_blob=0):
"""Read blob from a selection.
"""
n_blobs = self.calc_n_blobs(blob_dim)
if n_blob > n_blobs or n_blob < 0:
raise ValueError('Please provide correct n_blob value. Given %i, but max values is %i'%(n_blob,n_blobs))
# This prevent... | [
"Read",
"blob",
"from",
"a",
"selection",
"."
] | UCBerkeleySETI/blimpy | python | https://github.com/UCBerkeleySETI/blimpy/blob/b8822d3e3e911944370d84371a91fa0c29e9772e/blimpy/file_wrapper.py#L641-L690 | [
"def",
"read_blob",
"(",
"self",
",",
"blob_dim",
",",
"n_blob",
"=",
"0",
")",
":",
"n_blobs",
"=",
"self",
".",
"calc_n_blobs",
"(",
"blob_dim",
")",
"if",
"n_blob",
">",
"n_blobs",
"or",
"n_blob",
"<",
"0",
":",
"raise",
"ValueError",
"(",
"'Please ... | b8822d3e3e911944370d84371a91fa0c29e9772e |
test | FilReader.read_all | read all the data.
If reverse=True the x axis is flipped. | blimpy/file_wrapper.py | def read_all(self,reverse=True):
""" read all the data.
If reverse=True the x axis is flipped.
"""
raise NotImplementedError('To be implemented')
# go to start of the data
self.filfile.seek(int(self.datastart))
# read data into 2-D numpy array
# data=n... | def read_all(self,reverse=True):
""" read all the data.
If reverse=True the x axis is flipped.
"""
raise NotImplementedError('To be implemented')
# go to start of the data
self.filfile.seek(int(self.datastart))
# read data into 2-D numpy array
# data=n... | [
"read",
"all",
"the",
"data",
".",
"If",
"reverse",
"=",
"True",
"the",
"x",
"axis",
"is",
"flipped",
"."
] | UCBerkeleySETI/blimpy | python | https://github.com/UCBerkeleySETI/blimpy/blob/b8822d3e3e911944370d84371a91fa0c29e9772e/blimpy/file_wrapper.py#L692-L705 | [
"def",
"read_all",
"(",
"self",
",",
"reverse",
"=",
"True",
")",
":",
"raise",
"NotImplementedError",
"(",
"'To be implemented'",
")",
"# go to start of the data",
"self",
".",
"filfile",
".",
"seek",
"(",
"int",
"(",
"self",
".",
"datastart",
")",
")",
"# ... | b8822d3e3e911944370d84371a91fa0c29e9772e |
test | FilReader.read_row | Read a block of data. The number of samples per row is set in self.channels
If reverse=True the x axis is flipped. | blimpy/file_wrapper.py | def read_row(self,rownumber,reverse=True):
""" Read a block of data. The number of samples per row is set in self.channels
If reverse=True the x axis is flipped.
"""
raise NotImplementedError('To be implemented')
# go to start of the row
self.filfile.seek(int(self.da... | def read_row(self,rownumber,reverse=True):
""" Read a block of data. The number of samples per row is set in self.channels
If reverse=True the x axis is flipped.
"""
raise NotImplementedError('To be implemented')
# go to start of the row
self.filfile.seek(int(self.da... | [
"Read",
"a",
"block",
"of",
"data",
".",
"The",
"number",
"of",
"samples",
"per",
"row",
"is",
"set",
"in",
"self",
".",
"channels",
"If",
"reverse",
"=",
"True",
"the",
"x",
"axis",
"is",
"flipped",
"."
] | UCBerkeleySETI/blimpy | python | https://github.com/UCBerkeleySETI/blimpy/blob/b8822d3e3e911944370d84371a91fa0c29e9772e/blimpy/file_wrapper.py#L707-L719 | [
"def",
"read_row",
"(",
"self",
",",
"rownumber",
",",
"reverse",
"=",
"True",
")",
":",
"raise",
"NotImplementedError",
"(",
"'To be implemented'",
")",
"# go to start of the row",
"self",
".",
"filfile",
".",
"seek",
"(",
"int",
"(",
"self",
".",
"datastart"... | b8822d3e3e911944370d84371a91fa0c29e9772e |
test | cmd_tool | Command line tool for plotting and viewing info on blimpy files | blimpy/waterfall.py | def cmd_tool(args=None):
""" Command line tool for plotting and viewing info on blimpy files """
from argparse import ArgumentParser
parser = ArgumentParser(description="Command line utility for reading and plotting blimpy files.")
parser.add_argument('filename', type=str,
hel... | def cmd_tool(args=None):
""" Command line tool for plotting and viewing info on blimpy files """
from argparse import ArgumentParser
parser = ArgumentParser(description="Command line utility for reading and plotting blimpy files.")
parser.add_argument('filename', type=str,
hel... | [
"Command",
"line",
"tool",
"for",
"plotting",
"and",
"viewing",
"info",
"on",
"blimpy",
"files"
] | UCBerkeleySETI/blimpy | python | https://github.com/UCBerkeleySETI/blimpy/blob/b8822d3e3e911944370d84371a91fa0c29e9772e/blimpy/waterfall.py#L541-L663 | [
"def",
"cmd_tool",
"(",
"args",
"=",
"None",
")",
":",
"from",
"argparse",
"import",
"ArgumentParser",
"parser",
"=",
"ArgumentParser",
"(",
"description",
"=",
"\"Command line utility for reading and plotting blimpy files.\"",
")",
"parser",
".",
"add_argument",
"(",
... | b8822d3e3e911944370d84371a91fa0c29e9772e |
test | Waterfall.read_data | Reads data selection if small enough. | blimpy/waterfall.py | def read_data(self, f_start=None, f_stop=None,t_start=None, t_stop=None):
""" Reads data selection if small enough.
"""
self.container.read_data(f_start=f_start, f_stop=f_stop,t_start=t_start, t_stop=t_stop)
self.__load_data() | def read_data(self, f_start=None, f_stop=None,t_start=None, t_stop=None):
""" Reads data selection if small enough.
"""
self.container.read_data(f_start=f_start, f_stop=f_stop,t_start=t_start, t_stop=t_stop)
self.__load_data() | [
"Reads",
"data",
"selection",
"if",
"small",
"enough",
"."
] | UCBerkeleySETI/blimpy | python | https://github.com/UCBerkeleySETI/blimpy/blob/b8822d3e3e911944370d84371a91fa0c29e9772e/blimpy/waterfall.py#L159-L165 | [
"def",
"read_data",
"(",
"self",
",",
"f_start",
"=",
"None",
",",
"f_stop",
"=",
"None",
",",
"t_start",
"=",
"None",
",",
"t_stop",
"=",
"None",
")",
":",
"self",
".",
"container",
".",
"read_data",
"(",
"f_start",
"=",
"f_start",
",",
"f_stop",
"=... | b8822d3e3e911944370d84371a91fa0c29e9772e |
test | Waterfall.__update_header | Updates the header information from the original file to the selection. | blimpy/waterfall.py | def __update_header(self):
""" Updates the header information from the original file to the selection.
"""
#Updating frequency of first channel from selection
if self.header[b'foff'] < 0:
self.header[b'fch1'] = self.container.f_stop
else:
self.header[b'fc... | def __update_header(self):
""" Updates the header information from the original file to the selection.
"""
#Updating frequency of first channel from selection
if self.header[b'foff'] < 0:
self.header[b'fch1'] = self.container.f_stop
else:
self.header[b'fc... | [
"Updates",
"the",
"header",
"information",
"from",
"the",
"original",
"file",
"to",
"the",
"selection",
"."
] | UCBerkeleySETI/blimpy | python | https://github.com/UCBerkeleySETI/blimpy/blob/b8822d3e3e911944370d84371a91fa0c29e9772e/blimpy/waterfall.py#L167-L181 | [
"def",
"__update_header",
"(",
"self",
")",
":",
"#Updating frequency of first channel from selection",
"if",
"self",
".",
"header",
"[",
"b'foff'",
"]",
"<",
"0",
":",
"self",
".",
"header",
"[",
"b'fch1'",
"]",
"=",
"self",
".",
"container",
".",
"f_stop",
... | b8822d3e3e911944370d84371a91fa0c29e9772e |
test | Waterfall.info | Print header information and other derived information. | blimpy/waterfall.py | def info(self):
""" Print header information and other derived information. """
print("\n--- File Info ---")
for key, val in self.file_header.items():
if key == 'src_raj':
val = val.to_string(unit=u.hour, sep=':')
if key == 'src_dej':
val... | def info(self):
""" Print header information and other derived information. """
print("\n--- File Info ---")
for key, val in self.file_header.items():
if key == 'src_raj':
val = val.to_string(unit=u.hour, sep=':')
if key == 'src_dej':
val... | [
"Print",
"header",
"information",
"and",
"other",
"derived",
"information",
"."
] | UCBerkeleySETI/blimpy | python | https://github.com/UCBerkeleySETI/blimpy/blob/b8822d3e3e911944370d84371a91fa0c29e9772e/blimpy/waterfall.py#L195-L212 | [
"def",
"info",
"(",
"self",
")",
":",
"print",
"(",
"\"\\n--- File Info ---\"",
")",
"for",
"key",
",",
"val",
"in",
"self",
".",
"file_header",
".",
"items",
"(",
")",
":",
"if",
"key",
"==",
"'src_raj'",
":",
"val",
"=",
"val",
".",
"to_string",
"(... | b8822d3e3e911944370d84371a91fa0c29e9772e |
test | Waterfall.write_to_fil | Write data to .fil file.
It check the file size then decides how to write the file.
Args:
filename_out (str): Name of output file | blimpy/waterfall.py | def write_to_fil(self, filename_out, *args, **kwargs):
""" Write data to .fil file.
It check the file size then decides how to write the file.
Args:
filename_out (str): Name of output file
"""
#For timing how long it takes to write a file.
t0 = time.time... | def write_to_fil(self, filename_out, *args, **kwargs):
""" Write data to .fil file.
It check the file size then decides how to write the file.
Args:
filename_out (str): Name of output file
"""
#For timing how long it takes to write a file.
t0 = time.time... | [
"Write",
"data",
"to",
".",
"fil",
"file",
".",
"It",
"check",
"the",
"file",
"size",
"then",
"decides",
"how",
"to",
"write",
"the",
"file",
"."
] | UCBerkeleySETI/blimpy | python | https://github.com/UCBerkeleySETI/blimpy/blob/b8822d3e3e911944370d84371a91fa0c29e9772e/blimpy/waterfall.py#L214-L234 | [
"def",
"write_to_fil",
"(",
"self",
",",
"filename_out",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"#For timing how long it takes to write a file.",
"t0",
"=",
"time",
".",
"time",
"(",
")",
"#Update header",
"self",
".",
"__update_header",
"(",
")"... | b8822d3e3e911944370d84371a91fa0c29e9772e |
test | Waterfall.__write_to_fil_heavy | Write data to .fil file.
Args:
filename_out (str): Name of output file | blimpy/waterfall.py | def __write_to_fil_heavy(self, filename_out, *args, **kwargs):
""" Write data to .fil file.
Args:
filename_out (str): Name of output file
"""
#Note that a chunk is not a blob!!
chunk_dim = self.__get_chunk_dimensions()
blob_dim = self.__get_blob_dimensions(c... | def __write_to_fil_heavy(self, filename_out, *args, **kwargs):
""" Write data to .fil file.
Args:
filename_out (str): Name of output file
"""
#Note that a chunk is not a blob!!
chunk_dim = self.__get_chunk_dimensions()
blob_dim = self.__get_blob_dimensions(c... | [
"Write",
"data",
"to",
".",
"fil",
"file",
"."
] | UCBerkeleySETI/blimpy | python | https://github.com/UCBerkeleySETI/blimpy/blob/b8822d3e3e911944370d84371a91fa0c29e9772e/blimpy/waterfall.py#L236-L267 | [
"def",
"__write_to_fil_heavy",
"(",
"self",
",",
"filename_out",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"#Note that a chunk is not a blob!!",
"chunk_dim",
"=",
"self",
".",
"__get_chunk_dimensions",
"(",
")",
"blob_dim",
"=",
"self",
".",
"__get_bl... | b8822d3e3e911944370d84371a91fa0c29e9772e |
test | Waterfall.__write_to_fil_light | Write data to .fil file.
Args:
filename_out (str): Name of output file | blimpy/waterfall.py | def __write_to_fil_light(self, filename_out, *args, **kwargs):
""" Write data to .fil file.
Args:
filename_out (str): Name of output file
"""
n_bytes = self.header[b'nbits'] / 8
with open(filename_out, "wb") as fileh:
fileh.write(generate_sigproc_header... | def __write_to_fil_light(self, filename_out, *args, **kwargs):
""" Write data to .fil file.
Args:
filename_out (str): Name of output file
"""
n_bytes = self.header[b'nbits'] / 8
with open(filename_out, "wb") as fileh:
fileh.write(generate_sigproc_header... | [
"Write",
"data",
"to",
".",
"fil",
"file",
"."
] | UCBerkeleySETI/blimpy | python | https://github.com/UCBerkeleySETI/blimpy/blob/b8822d3e3e911944370d84371a91fa0c29e9772e/blimpy/waterfall.py#L269-L285 | [
"def",
"__write_to_fil_light",
"(",
"self",
",",
"filename_out",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"n_bytes",
"=",
"self",
".",
"header",
"[",
"b'nbits'",
"]",
"/",
"8",
"with",
"open",
"(",
"filename_out",
",",
"\"wb\"",
")",
"as",
... | b8822d3e3e911944370d84371a91fa0c29e9772e |
test | Waterfall.write_to_hdf5 | Write data to HDF5 file.
It check the file size then decides how to write the file.
Args:
filename_out (str): Name of output file | blimpy/waterfall.py | def write_to_hdf5(self, filename_out, *args, **kwargs):
""" Write data to HDF5 file.
It check the file size then decides how to write the file.
Args:
filename_out (str): Name of output file
"""
#For timing how long it takes to write a file.
t0 = time.tim... | def write_to_hdf5(self, filename_out, *args, **kwargs):
""" Write data to HDF5 file.
It check the file size then decides how to write the file.
Args:
filename_out (str): Name of output file
"""
#For timing how long it takes to write a file.
t0 = time.tim... | [
"Write",
"data",
"to",
"HDF5",
"file",
".",
"It",
"check",
"the",
"file",
"size",
"then",
"decides",
"how",
"to",
"write",
"the",
"file",
"."
] | UCBerkeleySETI/blimpy | python | https://github.com/UCBerkeleySETI/blimpy/blob/b8822d3e3e911944370d84371a91fa0c29e9772e/blimpy/waterfall.py#L287-L307 | [
"def",
"write_to_hdf5",
"(",
"self",
",",
"filename_out",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"#For timing how long it takes to write a file.",
"t0",
"=",
"time",
".",
"time",
"(",
")",
"#Update header",
"self",
".",
"__update_header",
"(",
")... | b8822d3e3e911944370d84371a91fa0c29e9772e |
test | Waterfall.__write_to_hdf5_heavy | Write data to HDF5 file.
Args:
filename_out (str): Name of output file | blimpy/waterfall.py | def __write_to_hdf5_heavy(self, filename_out, *args, **kwargs):
""" Write data to HDF5 file.
Args:
filename_out (str): Name of output file
"""
block_size = 0
#Note that a chunk is not a blob!!
chunk_dim = self.__get_chunk_dimensions()
blob_dim = sel... | def __write_to_hdf5_heavy(self, filename_out, *args, **kwargs):
""" Write data to HDF5 file.
Args:
filename_out (str): Name of output file
"""
block_size = 0
#Note that a chunk is not a blob!!
chunk_dim = self.__get_chunk_dimensions()
blob_dim = sel... | [
"Write",
"data",
"to",
"HDF5",
"file",
"."
] | UCBerkeleySETI/blimpy | python | https://github.com/UCBerkeleySETI/blimpy/blob/b8822d3e3e911944370d84371a91fa0c29e9772e/blimpy/waterfall.py#L309-L404 | [
"def",
"__write_to_hdf5_heavy",
"(",
"self",
",",
"filename_out",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"block_size",
"=",
"0",
"#Note that a chunk is not a blob!!",
"chunk_dim",
"=",
"self",
".",
"__get_chunk_dimensions",
"(",
")",
"blob_dim",
"=... | b8822d3e3e911944370d84371a91fa0c29e9772e |
test | Waterfall.__write_to_hdf5_light | Write data to HDF5 file in one go.
Args:
filename_out (str): Name of output file | blimpy/waterfall.py | def __write_to_hdf5_light(self, filename_out, *args, **kwargs):
""" Write data to HDF5 file in one go.
Args:
filename_out (str): Name of output file
"""
block_size = 0
with h5py.File(filename_out, 'w') as h5:
h5.attrs[b'CLASS'] = b'FILTERBANK'
... | def __write_to_hdf5_light(self, filename_out, *args, **kwargs):
""" Write data to HDF5 file in one go.
Args:
filename_out (str): Name of output file
"""
block_size = 0
with h5py.File(filename_out, 'w') as h5:
h5.attrs[b'CLASS'] = b'FILTERBANK'
... | [
"Write",
"data",
"to",
"HDF5",
"file",
"in",
"one",
"go",
"."
] | UCBerkeleySETI/blimpy | python | https://github.com/UCBerkeleySETI/blimpy/blob/b8822d3e3e911944370d84371a91fa0c29e9772e/blimpy/waterfall.py#L406-L452 | [
"def",
"__write_to_hdf5_light",
"(",
"self",
",",
"filename_out",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"block_size",
"=",
"0",
"with",
"h5py",
".",
"File",
"(",
"filename_out",
",",
"'w'",
")",
"as",
"h5",
":",
"h5",
".",
"attrs",
"["... | b8822d3e3e911944370d84371a91fa0c29e9772e |
test | Waterfall.__get_blob_dimensions | Sets the blob dimmentions, trying to read around 1024 MiB at a time.
This is assuming a chunk is about 1 MiB. | blimpy/waterfall.py | def __get_blob_dimensions(self, chunk_dim):
""" Sets the blob dimmentions, trying to read around 1024 MiB at a time.
This is assuming a chunk is about 1 MiB.
"""
#Taking the size into consideration, but avoiding having multiple blobs within a single time bin.
if self.selecti... | def __get_blob_dimensions(self, chunk_dim):
""" Sets the blob dimmentions, trying to read around 1024 MiB at a time.
This is assuming a chunk is about 1 MiB.
"""
#Taking the size into consideration, but avoiding having multiple blobs within a single time bin.
if self.selecti... | [
"Sets",
"the",
"blob",
"dimmentions",
"trying",
"to",
"read",
"around",
"1024",
"MiB",
"at",
"a",
"time",
".",
"This",
"is",
"assuming",
"a",
"chunk",
"is",
"about",
"1",
"MiB",
"."
] | UCBerkeleySETI/blimpy | python | https://github.com/UCBerkeleySETI/blimpy/blob/b8822d3e3e911944370d84371a91fa0c29e9772e/blimpy/waterfall.py#L454-L471 | [
"def",
"__get_blob_dimensions",
"(",
"self",
",",
"chunk_dim",
")",
":",
"#Taking the size into consideration, but avoiding having multiple blobs within a single time bin.",
"if",
"self",
".",
"selection_shape",
"[",
"self",
".",
"freq_axis",
"]",
">",
"chunk_dim",
"[",
"se... | b8822d3e3e911944370d84371a91fa0c29e9772e |
test | Waterfall.__get_chunk_dimensions | Sets the chunking dimmentions depending on the file type. | blimpy/waterfall.py | def __get_chunk_dimensions(self):
""" Sets the chunking dimmentions depending on the file type.
"""
#Usually '.0000.' is in self.filename
if np.abs(self.header[b'foff']) < 1e-5:
logger.info('Detecting high frequency resolution data.')
chunk_dim = (1,1,1048576) #1... | def __get_chunk_dimensions(self):
""" Sets the chunking dimmentions depending on the file type.
"""
#Usually '.0000.' is in self.filename
if np.abs(self.header[b'foff']) < 1e-5:
logger.info('Detecting high frequency resolution data.')
chunk_dim = (1,1,1048576) #1... | [
"Sets",
"the",
"chunking",
"dimmentions",
"depending",
"on",
"the",
"file",
"type",
"."
] | UCBerkeleySETI/blimpy | python | https://github.com/UCBerkeleySETI/blimpy/blob/b8822d3e3e911944370d84371a91fa0c29e9772e/blimpy/waterfall.py#L473-L496 | [
"def",
"__get_chunk_dimensions",
"(",
"self",
")",
":",
"#Usually '.0000.' is in self.filename",
"if",
"np",
".",
"abs",
"(",
"self",
".",
"header",
"[",
"b'foff'",
"]",
")",
"<",
"1e-5",
":",
"logger",
".",
"info",
"(",
"'Detecting high frequency resolution data.... | b8822d3e3e911944370d84371a91fa0c29e9772e |
test | Waterfall.grab_data | Extract a portion of data by frequency range.
Args:
f_start (float): start frequency in MHz
f_stop (float): stop frequency in MHz
if_id (int): IF input identification (req. when multiple IFs in file)
Returns:
(freqs, data) (np.arrays): frequency axis in ... | blimpy/waterfall.py | def grab_data(self, f_start=None, f_stop=None,t_start=None, t_stop=None, if_id=0):
""" Extract a portion of data by frequency range.
Args:
f_start (float): start frequency in MHz
f_stop (float): stop frequency in MHz
if_id (int): IF input identification (req. when mu... | def grab_data(self, f_start=None, f_stop=None,t_start=None, t_stop=None, if_id=0):
""" Extract a portion of data by frequency range.
Args:
f_start (float): start frequency in MHz
f_stop (float): stop frequency in MHz
if_id (int): IF input identification (req. when mu... | [
"Extract",
"a",
"portion",
"of",
"data",
"by",
"frequency",
"range",
"."
] | UCBerkeleySETI/blimpy | python | https://github.com/UCBerkeleySETI/blimpy/blob/b8822d3e3e911944370d84371a91fa0c29e9772e/blimpy/waterfall.py#L509-L539 | [
"def",
"grab_data",
"(",
"self",
",",
"f_start",
"=",
"None",
",",
"f_stop",
"=",
"None",
",",
"t_start",
"=",
"None",
",",
"t_stop",
"=",
"None",
",",
"if_id",
"=",
"0",
")",
":",
"self",
".",
"freqs",
"=",
"self",
".",
"populate_freqs",
"(",
")",... | b8822d3e3e911944370d84371a91fa0c29e9772e |
test | cmd_tool | Command line tool for plotting and viewing info on guppi raw files | blimpy/guppi.py | def cmd_tool(args=None):
""" Command line tool for plotting and viewing info on guppi raw files """
from argparse import ArgumentParser
parser = ArgumentParser(description="Command line utility for creating spectra from GuppiRaw files.")
parser.add_argument('filename', type=str, help='Name of file to... | def cmd_tool(args=None):
""" Command line tool for plotting and viewing info on guppi raw files """
from argparse import ArgumentParser
parser = ArgumentParser(description="Command line utility for creating spectra from GuppiRaw files.")
parser.add_argument('filename', type=str, help='Name of file to... | [
"Command",
"line",
"tool",
"for",
"plotting",
"and",
"viewing",
"info",
"on",
"guppi",
"raw",
"files"
] | UCBerkeleySETI/blimpy | python | https://github.com/UCBerkeleySETI/blimpy/blob/b8822d3e3e911944370d84371a91fa0c29e9772e/blimpy/guppi.py#L442-L459 | [
"def",
"cmd_tool",
"(",
"args",
"=",
"None",
")",
":",
"from",
"argparse",
"import",
"ArgumentParser",
"parser",
"=",
"ArgumentParser",
"(",
"description",
"=",
"\"Command line utility for creating spectra from GuppiRaw files.\"",
")",
"parser",
".",
"add_argument",
"("... | b8822d3e3e911944370d84371a91fa0c29e9772e |
test | GuppiRaw.read_header | Read next header (multiple headers in file)
Returns:
(header, data_idx) - a dictionary of keyword:value header data and
also the byte index of where the corresponding data block resides. | blimpy/guppi.py | def read_header(self):
""" Read next header (multiple headers in file)
Returns:
(header, data_idx) - a dictionary of keyword:value header data and
also the byte index of where the corresponding data block resides.
"""
start_idx = self.file_obj.tell()
key,... | def read_header(self):
""" Read next header (multiple headers in file)
Returns:
(header, data_idx) - a dictionary of keyword:value header data and
also the byte index of where the corresponding data block resides.
"""
start_idx = self.file_obj.tell()
key,... | [
"Read",
"next",
"header",
"(",
"multiple",
"headers",
"in",
"file",
")"
] | UCBerkeleySETI/blimpy | python | https://github.com/UCBerkeleySETI/blimpy/blob/b8822d3e3e911944370d84371a91fa0c29e9772e/blimpy/guppi.py#L105-L164 | [
"def",
"read_header",
"(",
"self",
")",
":",
"start_idx",
"=",
"self",
".",
"file_obj",
".",
"tell",
"(",
")",
"key",
",",
"val",
"=",
"''",
",",
"''",
"header_dict",
"=",
"{",
"}",
"keep_reading",
"=",
"True",
"first_line",
"=",
"self",
".",
"file_o... | b8822d3e3e911944370d84371a91fa0c29e9772e |
test | GuppiRaw.read_first_header | Read first header in file
Returns:
header (dict): keyword:value pairs of header metadata | blimpy/guppi.py | def read_first_header(self):
""" Read first header in file
Returns:
header (dict): keyword:value pairs of header metadata
"""
self.file_obj.seek(0)
header_dict, pos = self.read_header()
self.file_obj.seek(0)
return header_dict | def read_first_header(self):
""" Read first header in file
Returns:
header (dict): keyword:value pairs of header metadata
"""
self.file_obj.seek(0)
header_dict, pos = self.read_header()
self.file_obj.seek(0)
return header_dict | [
"Read",
"first",
"header",
"in",
"file"
] | UCBerkeleySETI/blimpy | python | https://github.com/UCBerkeleySETI/blimpy/blob/b8822d3e3e911944370d84371a91fa0c29e9772e/blimpy/guppi.py#L166-L175 | [
"def",
"read_first_header",
"(",
"self",
")",
":",
"self",
".",
"file_obj",
".",
"seek",
"(",
"0",
")",
"header_dict",
",",
"pos",
"=",
"self",
".",
"read_header",
"(",
")",
"self",
".",
"file_obj",
".",
"seek",
"(",
"0",
")",
"return",
"header_dict"
] | b8822d3e3e911944370d84371a91fa0c29e9772e |
test | GuppiRaw.get_data | returns a generator object that reads data a block at a time;
the generator prints "File depleted" and returns nothing when all data in the file has been read.
:return: | blimpy/guppi.py | def get_data(self):
"""
returns a generator object that reads data a block at a time;
the generator prints "File depleted" and returns nothing when all data in the file has been read.
:return:
"""
with self as gr:
while True:
try:
... | def get_data(self):
"""
returns a generator object that reads data a block at a time;
the generator prints "File depleted" and returns nothing when all data in the file has been read.
:return:
"""
with self as gr:
while True:
try:
... | [
"returns",
"a",
"generator",
"object",
"that",
"reads",
"data",
"a",
"block",
"at",
"a",
"time",
";",
"the",
"generator",
"prints",
"File",
"depleted",
"and",
"returns",
"nothing",
"when",
"all",
"data",
"in",
"the",
"file",
"has",
"been",
"read",
".",
"... | UCBerkeleySETI/blimpy | python | https://github.com/UCBerkeleySETI/blimpy/blob/b8822d3e3e911944370d84371a91fa0c29e9772e/blimpy/guppi.py#L194-L206 | [
"def",
"get_data",
"(",
"self",
")",
":",
"with",
"self",
"as",
"gr",
":",
"while",
"True",
":",
"try",
":",
"yield",
"gr",
".",
"read_next_data_block_int8",
"(",
")",
"except",
"Exception",
"as",
"e",
":",
"print",
"(",
"\"File depleted\"",
")",
"yield"... | b8822d3e3e911944370d84371a91fa0c29e9772e |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.