repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 75 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
eventable/vobject | docs/build/lib/vobject/icalendar.py | VAlarm.generateImplicitParameters | def generateImplicitParameters(obj):
"""
Create default ACTION and TRIGGER if they're not set.
"""
try:
obj.action
except AttributeError:
obj.add('action').value = 'AUDIO'
try:
obj.trigger
except AttributeError:
obj.... | python | def generateImplicitParameters(obj):
"""
Create default ACTION and TRIGGER if they're not set.
"""
try:
obj.action
except AttributeError:
obj.add('action').value = 'AUDIO'
try:
obj.trigger
except AttributeError:
obj.... | [
"def",
"generateImplicitParameters",
"(",
"obj",
")",
":",
"try",
":",
"obj",
".",
"action",
"except",
"AttributeError",
":",
"obj",
".",
"add",
"(",
"'action'",
")",
".",
"value",
"=",
"'AUDIO'",
"try",
":",
"obj",
".",
"trigger",
"except",
"AttributeErro... | Create default ACTION and TRIGGER if they're not set. | [
"Create",
"default",
"ACTION",
"and",
"TRIGGER",
"if",
"they",
"re",
"not",
"set",
"."
] | 498555a553155ea9b26aace93332ae79365ecb31 | https://github.com/eventable/vobject/blob/498555a553155ea9b26aace93332ae79365ecb31/docs/build/lib/vobject/icalendar.py#L1208-L1219 | train |
eventable/vobject | docs/build/lib/vobject/icalendar.py | Duration.transformToNative | def transformToNative(obj):
"""
Turn obj.value into a datetime.timedelta.
"""
if obj.isNative:
return obj
obj.isNative = True
obj.value=obj.value
if obj.value == '':
return obj
else:
deltalist=stringToDurations(obj.value... | python | def transformToNative(obj):
"""
Turn obj.value into a datetime.timedelta.
"""
if obj.isNative:
return obj
obj.isNative = True
obj.value=obj.value
if obj.value == '':
return obj
else:
deltalist=stringToDurations(obj.value... | [
"def",
"transformToNative",
"(",
"obj",
")",
":",
"if",
"obj",
".",
"isNative",
":",
"return",
"obj",
"obj",
".",
"isNative",
"=",
"True",
"obj",
".",
"value",
"=",
"obj",
".",
"value",
"if",
"obj",
".",
"value",
"==",
"''",
":",
"return",
"obj",
"... | Turn obj.value into a datetime.timedelta. | [
"Turn",
"obj",
".",
"value",
"into",
"a",
"datetime",
".",
"timedelta",
"."
] | 498555a553155ea9b26aace93332ae79365ecb31 | https://github.com/eventable/vobject/blob/498555a553155ea9b26aace93332ae79365ecb31/docs/build/lib/vobject/icalendar.py#L1332-L1349 | train |
eventable/vobject | docs/build/lib/vobject/icalendar.py | Duration.transformFromNative | def transformFromNative(obj):
"""
Replace the datetime.timedelta in obj.value with an RFC2445 string.
"""
if not obj.isNative:
return obj
obj.isNative = False
obj.value = timedeltaToString(obj.value)
return obj | python | def transformFromNative(obj):
"""
Replace the datetime.timedelta in obj.value with an RFC2445 string.
"""
if not obj.isNative:
return obj
obj.isNative = False
obj.value = timedeltaToString(obj.value)
return obj | [
"def",
"transformFromNative",
"(",
"obj",
")",
":",
"if",
"not",
"obj",
".",
"isNative",
":",
"return",
"obj",
"obj",
".",
"isNative",
"=",
"False",
"obj",
".",
"value",
"=",
"timedeltaToString",
"(",
"obj",
".",
"value",
")",
"return",
"obj"
] | Replace the datetime.timedelta in obj.value with an RFC2445 string. | [
"Replace",
"the",
"datetime",
".",
"timedelta",
"in",
"obj",
".",
"value",
"with",
"an",
"RFC2445",
"string",
"."
] | 498555a553155ea9b26aace93332ae79365ecb31 | https://github.com/eventable/vobject/blob/498555a553155ea9b26aace93332ae79365ecb31/docs/build/lib/vobject/icalendar.py#L1352-L1360 | train |
eventable/vobject | docs/build/lib/vobject/icalendar.py | Trigger.transformToNative | def transformToNative(obj):
"""
Turn obj.value into a timedelta or datetime.
"""
if obj.isNative:
return obj
value = getattr(obj, 'value_param', 'DURATION').upper()
if hasattr(obj, 'value_param'):
del obj.value_param
if obj.value == '':
... | python | def transformToNative(obj):
"""
Turn obj.value into a timedelta or datetime.
"""
if obj.isNative:
return obj
value = getattr(obj, 'value_param', 'DURATION').upper()
if hasattr(obj, 'value_param'):
del obj.value_param
if obj.value == '':
... | [
"def",
"transformToNative",
"(",
"obj",
")",
":",
"if",
"obj",
".",
"isNative",
":",
"return",
"obj",
"value",
"=",
"getattr",
"(",
"obj",
",",
"'value_param'",
",",
"'DURATION'",
")",
".",
"upper",
"(",
")",
"if",
"hasattr",
"(",
"obj",
",",
"'value_p... | Turn obj.value into a timedelta or datetime. | [
"Turn",
"obj",
".",
"value",
"into",
"a",
"timedelta",
"or",
"datetime",
"."
] | 498555a553155ea9b26aace93332ae79365ecb31 | https://github.com/eventable/vobject/blob/498555a553155ea9b26aace93332ae79365ecb31/docs/build/lib/vobject/icalendar.py#L1374-L1406 | train |
eventable/vobject | docs/build/lib/vobject/icalendar.py | PeriodBehavior.transformToNative | def transformToNative(obj):
"""
Convert comma separated periods into tuples.
"""
if obj.isNative:
return obj
obj.isNative = True
if obj.value == '':
obj.value = []
return obj
tzinfo = getTzid(getattr(obj, 'tzid_param', None))
... | python | def transformToNative(obj):
"""
Convert comma separated periods into tuples.
"""
if obj.isNative:
return obj
obj.isNative = True
if obj.value == '':
obj.value = []
return obj
tzinfo = getTzid(getattr(obj, 'tzid_param', None))
... | [
"def",
"transformToNative",
"(",
"obj",
")",
":",
"if",
"obj",
".",
"isNative",
":",
"return",
"obj",
"obj",
".",
"isNative",
"=",
"True",
"if",
"obj",
".",
"value",
"==",
"''",
":",
"obj",
".",
"value",
"=",
"[",
"]",
"return",
"obj",
"tzinfo",
"=... | Convert comma separated periods into tuples. | [
"Convert",
"comma",
"separated",
"periods",
"into",
"tuples",
"."
] | 498555a553155ea9b26aace93332ae79365ecb31 | https://github.com/eventable/vobject/blob/498555a553155ea9b26aace93332ae79365ecb31/docs/build/lib/vobject/icalendar.py#L1428-L1440 | train |
eventable/vobject | docs/build/lib/vobject/icalendar.py | PeriodBehavior.transformFromNative | def transformFromNative(cls, obj):
"""
Convert the list of tuples in obj.value to strings.
"""
if obj.isNative:
obj.isNative = False
transformed = []
for tup in obj.value:
transformed.append(periodToString(tup, cls.forceUTC))
... | python | def transformFromNative(cls, obj):
"""
Convert the list of tuples in obj.value to strings.
"""
if obj.isNative:
obj.isNative = False
transformed = []
for tup in obj.value:
transformed.append(periodToString(tup, cls.forceUTC))
... | [
"def",
"transformFromNative",
"(",
"cls",
",",
"obj",
")",
":",
"if",
"obj",
".",
"isNative",
":",
"obj",
".",
"isNative",
"=",
"False",
"transformed",
"=",
"[",
"]",
"for",
"tup",
"in",
"obj",
".",
"value",
":",
"transformed",
".",
"append",
"(",
"p... | Convert the list of tuples in obj.value to strings. | [
"Convert",
"the",
"list",
"of",
"tuples",
"in",
"obj",
".",
"value",
"to",
"strings",
"."
] | 498555a553155ea9b26aace93332ae79365ecb31 | https://github.com/eventable/vobject/blob/498555a553155ea9b26aace93332ae79365ecb31/docs/build/lib/vobject/icalendar.py#L1443-L1459 | train |
eventable/vobject | vobject/vcard.py | serializeFields | def serializeFields(obj, order=None):
"""
Turn an object's fields into a ';' and ',' seperated string.
If order is None, obj should be a list, backslash escape each field and
return a ';' separated string.
"""
fields = []
if order is None:
fields = [backslashEscape(val) for val in o... | python | def serializeFields(obj, order=None):
"""
Turn an object's fields into a ';' and ',' seperated string.
If order is None, obj should be a list, backslash escape each field and
return a ';' separated string.
"""
fields = []
if order is None:
fields = [backslashEscape(val) for val in o... | [
"def",
"serializeFields",
"(",
"obj",
",",
"order",
"=",
"None",
")",
":",
"fields",
"=",
"[",
"]",
"if",
"order",
"is",
"None",
":",
"fields",
"=",
"[",
"backslashEscape",
"(",
"val",
")",
"for",
"val",
"in",
"obj",
"]",
"else",
":",
"for",
"field... | Turn an object's fields into a ';' and ',' seperated string.
If order is None, obj should be a list, backslash escape each field and
return a ';' separated string. | [
"Turn",
"an",
"object",
"s",
"fields",
"into",
"a",
";",
"and",
"seperated",
"string",
"."
] | 498555a553155ea9b26aace93332ae79365ecb31 | https://github.com/eventable/vobject/blob/498555a553155ea9b26aace93332ae79365ecb31/vobject/vcard.py#L264-L279 | train |
eventable/vobject | vobject/vcard.py | Address.toString | def toString(val, join_char='\n'):
"""
Turn a string or array value into a string.
"""
if type(val) in (list, tuple):
return join_char.join(val)
return val | python | def toString(val, join_char='\n'):
"""
Turn a string or array value into a string.
"""
if type(val) in (list, tuple):
return join_char.join(val)
return val | [
"def",
"toString",
"(",
"val",
",",
"join_char",
"=",
"'\\n'",
")",
":",
"if",
"type",
"(",
"val",
")",
"in",
"(",
"list",
",",
"tuple",
")",
":",
"return",
"join_char",
".",
"join",
"(",
"val",
")",
"return",
"val"
] | Turn a string or array value into a string. | [
"Turn",
"a",
"string",
"or",
"array",
"value",
"into",
"a",
"string",
"."
] | 498555a553155ea9b26aace93332ae79365ecb31 | https://github.com/eventable/vobject/blob/498555a553155ea9b26aace93332ae79365ecb31/vobject/vcard.py#L75-L81 | train |
eventable/vobject | vobject/vcard.py | NameBehavior.transformToNative | def transformToNative(obj):
"""
Turn obj.value into a Name.
"""
if obj.isNative:
return obj
obj.isNative = True
obj.value = Name(**dict(zip(NAME_ORDER, splitFields(obj.value))))
return obj | python | def transformToNative(obj):
"""
Turn obj.value into a Name.
"""
if obj.isNative:
return obj
obj.isNative = True
obj.value = Name(**dict(zip(NAME_ORDER, splitFields(obj.value))))
return obj | [
"def",
"transformToNative",
"(",
"obj",
")",
":",
"if",
"obj",
".",
"isNative",
":",
"return",
"obj",
"obj",
".",
"isNative",
"=",
"True",
"obj",
".",
"value",
"=",
"Name",
"(",
"**",
"dict",
"(",
"zip",
"(",
"NAME_ORDER",
",",
"splitFields",
"(",
"o... | Turn obj.value into a Name. | [
"Turn",
"obj",
".",
"value",
"into",
"a",
"Name",
"."
] | 498555a553155ea9b26aace93332ae79365ecb31 | https://github.com/eventable/vobject/blob/498555a553155ea9b26aace93332ae79365ecb31/vobject/vcard.py#L294-L302 | train |
eventable/vobject | vobject/vcard.py | NameBehavior.transformFromNative | def transformFromNative(obj):
"""
Replace the Name in obj.value with a string.
"""
obj.isNative = False
obj.value = serializeFields(obj.value, NAME_ORDER)
return obj | python | def transformFromNative(obj):
"""
Replace the Name in obj.value with a string.
"""
obj.isNative = False
obj.value = serializeFields(obj.value, NAME_ORDER)
return obj | [
"def",
"transformFromNative",
"(",
"obj",
")",
":",
"obj",
".",
"isNative",
"=",
"False",
"obj",
".",
"value",
"=",
"serializeFields",
"(",
"obj",
".",
"value",
",",
"NAME_ORDER",
")",
"return",
"obj"
] | Replace the Name in obj.value with a string. | [
"Replace",
"the",
"Name",
"in",
"obj",
".",
"value",
"with",
"a",
"string",
"."
] | 498555a553155ea9b26aace93332ae79365ecb31 | https://github.com/eventable/vobject/blob/498555a553155ea9b26aace93332ae79365ecb31/vobject/vcard.py#L305-L311 | train |
eventable/vobject | vobject/vcard.py | AddressBehavior.transformToNative | def transformToNative(obj):
"""
Turn obj.value into an Address.
"""
if obj.isNative:
return obj
obj.isNative = True
obj.value = Address(**dict(zip(ADDRESS_ORDER, splitFields(obj.value))))
return obj | python | def transformToNative(obj):
"""
Turn obj.value into an Address.
"""
if obj.isNative:
return obj
obj.isNative = True
obj.value = Address(**dict(zip(ADDRESS_ORDER, splitFields(obj.value))))
return obj | [
"def",
"transformToNative",
"(",
"obj",
")",
":",
"if",
"obj",
".",
"isNative",
":",
"return",
"obj",
"obj",
".",
"isNative",
"=",
"True",
"obj",
".",
"value",
"=",
"Address",
"(",
"**",
"dict",
"(",
"zip",
"(",
"ADDRESS_ORDER",
",",
"splitFields",
"("... | Turn obj.value into an Address. | [
"Turn",
"obj",
".",
"value",
"into",
"an",
"Address",
"."
] | 498555a553155ea9b26aace93332ae79365ecb31 | https://github.com/eventable/vobject/blob/498555a553155ea9b26aace93332ae79365ecb31/vobject/vcard.py#L322-L330 | train |
eventable/vobject | vobject/vcard.py | OrgBehavior.transformToNative | def transformToNative(obj):
"""
Turn obj.value into a list.
"""
if obj.isNative:
return obj
obj.isNative = True
obj.value = splitFields(obj.value)
return obj | python | def transformToNative(obj):
"""
Turn obj.value into a list.
"""
if obj.isNative:
return obj
obj.isNative = True
obj.value = splitFields(obj.value)
return obj | [
"def",
"transformToNative",
"(",
"obj",
")",
":",
"if",
"obj",
".",
"isNative",
":",
"return",
"obj",
"obj",
".",
"isNative",
"=",
"True",
"obj",
".",
"value",
"=",
"splitFields",
"(",
"obj",
".",
"value",
")",
"return",
"obj"
] | Turn obj.value into a list. | [
"Turn",
"obj",
".",
"value",
"into",
"a",
"list",
"."
] | 498555a553155ea9b26aace93332ae79365ecb31 | https://github.com/eventable/vobject/blob/498555a553155ea9b26aace93332ae79365ecb31/vobject/vcard.py#L350-L358 | train |
eventable/vobject | docs/build/lib/vobject/vcard.py | VCardTextBehavior.decode | def decode(cls, line):
"""
Remove backslash escaping from line.valueDecode line, either to remove
backslash espacing, or to decode base64 encoding. The content line should
contain a ENCODING=b for base64 encoding, but Apple Addressbook seems to
export a singleton parameter of 'BA... | python | def decode(cls, line):
"""
Remove backslash escaping from line.valueDecode line, either to remove
backslash espacing, or to decode base64 encoding. The content line should
contain a ENCODING=b for base64 encoding, but Apple Addressbook seems to
export a singleton parameter of 'BA... | [
"def",
"decode",
"(",
"cls",
",",
"line",
")",
":",
"if",
"line",
".",
"encoded",
":",
"if",
"'BASE64'",
"in",
"line",
".",
"singletonparams",
":",
"line",
".",
"singletonparams",
".",
"remove",
"(",
"'BASE64'",
")",
"line",
".",
"encoding_param",
"=",
... | Remove backslash escaping from line.valueDecode line, either to remove
backslash espacing, or to decode base64 encoding. The content line should
contain a ENCODING=b for base64 encoding, but Apple Addressbook seems to
export a singleton parameter of 'BASE64', which does not match the 3.0
... | [
"Remove",
"backslash",
"escaping",
"from",
"line",
".",
"valueDecode",
"line",
"either",
"to",
"remove",
"backslash",
"espacing",
"or",
"to",
"decode",
"base64",
"encoding",
".",
"The",
"content",
"line",
"should",
"contain",
"a",
"ENCODING",
"=",
"b",
"for",
... | 498555a553155ea9b26aace93332ae79365ecb31 | https://github.com/eventable/vobject/blob/498555a553155ea9b26aace93332ae79365ecb31/docs/build/lib/vobject/vcard.py#L124-L142 | train |
eventable/vobject | vobject/behavior.py | Behavior.validate | def validate(cls, obj, raiseException=False, complainUnrecognized=False):
"""Check if the object satisfies this behavior's requirements.
@param obj:
The L{ContentLine<base.ContentLine>} or
L{Component<base.Component>} to be validated.
@param raiseException:
I... | python | def validate(cls, obj, raiseException=False, complainUnrecognized=False):
"""Check if the object satisfies this behavior's requirements.
@param obj:
The L{ContentLine<base.ContentLine>} or
L{Component<base.Component>} to be validated.
@param raiseException:
I... | [
"def",
"validate",
"(",
"cls",
",",
"obj",
",",
"raiseException",
"=",
"False",
",",
"complainUnrecognized",
"=",
"False",
")",
":",
"if",
"not",
"cls",
".",
"allowGroup",
"and",
"obj",
".",
"group",
"is",
"not",
"None",
":",
"err",
"=",
"\"{0} has a gro... | Check if the object satisfies this behavior's requirements.
@param obj:
The L{ContentLine<base.ContentLine>} or
L{Component<base.Component>} to be validated.
@param raiseException:
If True, raise a L{base.ValidateError} on validation failure.
Otherwise re... | [
"Check",
"if",
"the",
"object",
"satisfies",
"this",
"behavior",
"s",
"requirements",
"."
] | 498555a553155ea9b26aace93332ae79365ecb31 | https://github.com/eventable/vobject/blob/498555a553155ea9b26aace93332ae79365ecb31/vobject/behavior.py#L63-L103 | train |
eventable/vobject | vobject/win32tz.py | pickNthWeekday | def pickNthWeekday(year, month, dayofweek, hour, minute, whichweek):
"""dayofweek == 0 means Sunday, whichweek > 4 means last instance"""
first = datetime.datetime(year=year, month=month, hour=hour, minute=minute,
day=1)
weekdayone = first.replace(day=((dayofweek - first.isowee... | python | def pickNthWeekday(year, month, dayofweek, hour, minute, whichweek):
"""dayofweek == 0 means Sunday, whichweek > 4 means last instance"""
first = datetime.datetime(year=year, month=month, hour=hour, minute=minute,
day=1)
weekdayone = first.replace(day=((dayofweek - first.isowee... | [
"def",
"pickNthWeekday",
"(",
"year",
",",
"month",
",",
"dayofweek",
",",
"hour",
",",
"minute",
",",
"whichweek",
")",
":",
"first",
"=",
"datetime",
".",
"datetime",
"(",
"year",
"=",
"year",
",",
"month",
"=",
"month",
",",
"hour",
"=",
"hour",
"... | dayofweek == 0 means Sunday, whichweek > 4 means last instance | [
"dayofweek",
"==",
"0",
"means",
"Sunday",
"whichweek",
">",
"4",
"means",
"last",
"instance"
] | 498555a553155ea9b26aace93332ae79365ecb31 | https://github.com/eventable/vobject/blob/498555a553155ea9b26aace93332ae79365ecb31/vobject/win32tz.py#L77-L85 | train |
eventable/vobject | vobject/ics_diff.py | deleteExtraneous | def deleteExtraneous(component, ignore_dtstamp=False):
"""
Recursively walk the component's children, deleting extraneous details like
X-VOBJ-ORIGINAL-TZID.
"""
for comp in component.components():
deleteExtraneous(comp, ignore_dtstamp)
for line in component.lines():
if 'X-VOBJ-OR... | python | def deleteExtraneous(component, ignore_dtstamp=False):
"""
Recursively walk the component's children, deleting extraneous details like
X-VOBJ-ORIGINAL-TZID.
"""
for comp in component.components():
deleteExtraneous(comp, ignore_dtstamp)
for line in component.lines():
if 'X-VOBJ-OR... | [
"def",
"deleteExtraneous",
"(",
"component",
",",
"ignore_dtstamp",
"=",
"False",
")",
":",
"for",
"comp",
"in",
"component",
".",
"components",
"(",
")",
":",
"deleteExtraneous",
"(",
"comp",
",",
"ignore_dtstamp",
")",
"for",
"line",
"in",
"component",
"."... | Recursively walk the component's children, deleting extraneous details like
X-VOBJ-ORIGINAL-TZID. | [
"Recursively",
"walk",
"the",
"component",
"s",
"children",
"deleting",
"extraneous",
"details",
"like",
"X",
"-",
"VOBJ",
"-",
"ORIGINAL",
"-",
"TZID",
"."
] | 498555a553155ea9b26aace93332ae79365ecb31 | https://github.com/eventable/vobject/blob/498555a553155ea9b26aace93332ae79365ecb31/vobject/ics_diff.py#L37-L48 | train |
SoftwareDefinedBuildings/XBOS | apps/hole_filling/pelican/backfill.py | fillPelicanHole | def fillPelicanHole(site, username, password, tstat_name, start_time, end_time):
"""Fill a hole in a Pelican thermostat's data stream.
Arguments:
site -- The thermostat's Pelican site name
username -- The Pelican username for the site
password -- The Pelican password for the site
... | python | def fillPelicanHole(site, username, password, tstat_name, start_time, end_time):
"""Fill a hole in a Pelican thermostat's data stream.
Arguments:
site -- The thermostat's Pelican site name
username -- The Pelican username for the site
password -- The Pelican password for the site
... | [
"def",
"fillPelicanHole",
"(",
"site",
",",
"username",
",",
"password",
",",
"tstat_name",
",",
"start_time",
",",
"end_time",
")",
":",
"start",
"=",
"datetime",
".",
"strptime",
"(",
"start_time",
",",
"_INPUT_TIME_FORMAT",
")",
".",
"replace",
"(",
"tzin... | Fill a hole in a Pelican thermostat's data stream.
Arguments:
site -- The thermostat's Pelican site name
username -- The Pelican username for the site
password -- The Pelican password for the site
tstat_name -- The name of the thermostat, as identified by Pelican
start_time ... | [
"Fill",
"a",
"hole",
"in",
"a",
"Pelican",
"thermostat",
"s",
"data",
"stream",
"."
] | c12d4fb14518ea3ae98c471c28e0710fdf74dd25 | https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/apps/hole_filling/pelican/backfill.py#L73-L137 | train |
SoftwareDefinedBuildings/XBOS | apps/data_analysis/XBOS_data_analytics/Preprocess_Data.py | Preprocess_Data.add_degree_days | def add_degree_days(self, col='OAT', hdh_cpoint=65, cdh_cpoint=65):
""" Adds Heating & Cooling Degree Hours.
Parameters
----------
col : str
Column name which contains the outdoor air temperature.
hdh_cpoint : int
Heating degree hours. Defaults t... | python | def add_degree_days(self, col='OAT', hdh_cpoint=65, cdh_cpoint=65):
""" Adds Heating & Cooling Degree Hours.
Parameters
----------
col : str
Column name which contains the outdoor air temperature.
hdh_cpoint : int
Heating degree hours. Defaults t... | [
"def",
"add_degree_days",
"(",
"self",
",",
"col",
"=",
"'OAT'",
",",
"hdh_cpoint",
"=",
"65",
",",
"cdh_cpoint",
"=",
"65",
")",
":",
"if",
"self",
".",
"preprocessed_data",
".",
"empty",
":",
"data",
"=",
"self",
".",
"original_data",
"else",
":",
"d... | Adds Heating & Cooling Degree Hours.
Parameters
----------
col : str
Column name which contains the outdoor air temperature.
hdh_cpoint : int
Heating degree hours. Defaults to 65.
cdh_cpoint : int
Cooling degree hours. Defaults to 65... | [
"Adds",
"Heating",
"&",
"Cooling",
"Degree",
"Hours",
"."
] | c12d4fb14518ea3ae98c471c28e0710fdf74dd25 | https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/apps/data_analysis/XBOS_data_analytics/Preprocess_Data.py#L34-L65 | train |
SoftwareDefinedBuildings/XBOS | apps/data_analysis/XBOS_data_analytics/Preprocess_Data.py | Preprocess_Data.add_col_features | def add_col_features(self, col=None, degree=None):
""" Exponentiate columns of dataframe.
Basically this function squares/cubes a column.
e.g. df[col^2] = pow(df[col], degree) where degree=2.
Parameters
----------
col : list(str)
Column to exponentiate.... | python | def add_col_features(self, col=None, degree=None):
""" Exponentiate columns of dataframe.
Basically this function squares/cubes a column.
e.g. df[col^2] = pow(df[col], degree) where degree=2.
Parameters
----------
col : list(str)
Column to exponentiate.... | [
"def",
"add_col_features",
"(",
"self",
",",
"col",
"=",
"None",
",",
"degree",
"=",
"None",
")",
":",
"if",
"not",
"col",
"and",
"not",
"degree",
":",
"return",
"else",
":",
"if",
"isinstance",
"(",
"col",
",",
"list",
")",
"and",
"isinstance",
"(",... | Exponentiate columns of dataframe.
Basically this function squares/cubes a column.
e.g. df[col^2] = pow(df[col], degree) where degree=2.
Parameters
----------
col : list(str)
Column to exponentiate.
degree : list(str)
Exponentiation degree. | [
"Exponentiate",
"columns",
"of",
"dataframe",
"."
] | c12d4fb14518ea3ae98c471c28e0710fdf74dd25 | https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/apps/data_analysis/XBOS_data_analytics/Preprocess_Data.py#L68-L103 | train |
SoftwareDefinedBuildings/XBOS | apps/data_analysis/XBOS_data_analytics/Preprocess_Data.py | Preprocess_Data.standardize | def standardize(self):
""" Standardize data. """
if self.preprocessed_data.empty:
data = self.original_data
else:
data = self.preprocessed_data
scaler = preprocessing.StandardScaler()
data = pd.DataFrame(scaler.fit_transform(data), columns=data.c... | python | def standardize(self):
""" Standardize data. """
if self.preprocessed_data.empty:
data = self.original_data
else:
data = self.preprocessed_data
scaler = preprocessing.StandardScaler()
data = pd.DataFrame(scaler.fit_transform(data), columns=data.c... | [
"def",
"standardize",
"(",
"self",
")",
":",
"if",
"self",
".",
"preprocessed_data",
".",
"empty",
":",
"data",
"=",
"self",
".",
"original_data",
"else",
":",
"data",
"=",
"self",
".",
"preprocessed_data",
"scaler",
"=",
"preprocessing",
".",
"StandardScale... | Standardize data. | [
"Standardize",
"data",
"."
] | c12d4fb14518ea3ae98c471c28e0710fdf74dd25 | https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/apps/data_analysis/XBOS_data_analytics/Preprocess_Data.py#L106-L116 | train |
SoftwareDefinedBuildings/XBOS | apps/data_analysis/XBOS_data_analytics/Preprocess_Data.py | Preprocess_Data.normalize | def normalize(self):
""" Normalize data. """
if self.preprocessed_data.empty:
data = self.original_data
else:
data = self.preprocessed_data
data = pd.DataFrame(preprocessing.normalize(data), columns=data.columns, index=data.index)
self.preprocessed_data ... | python | def normalize(self):
""" Normalize data. """
if self.preprocessed_data.empty:
data = self.original_data
else:
data = self.preprocessed_data
data = pd.DataFrame(preprocessing.normalize(data), columns=data.columns, index=data.index)
self.preprocessed_data ... | [
"def",
"normalize",
"(",
"self",
")",
":",
"if",
"self",
".",
"preprocessed_data",
".",
"empty",
":",
"data",
"=",
"self",
".",
"original_data",
"else",
":",
"data",
"=",
"self",
".",
"preprocessed_data",
"data",
"=",
"pd",
".",
"DataFrame",
"(",
"prepro... | Normalize data. | [
"Normalize",
"data",
"."
] | c12d4fb14518ea3ae98c471c28e0710fdf74dd25 | https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/apps/data_analysis/XBOS_data_analytics/Preprocess_Data.py#L119-L128 | train |
SoftwareDefinedBuildings/XBOS | apps/Data_quality_analysis/Preprocess_Data.py | Preprocess_Data.add_time_features | def add_time_features(self, year=False, month=False, week=True, tod=True, dow=True):
""" Add time features to dataframe.
Parameters
----------
year : bool
Year.
month : bool
Month.
week : bool
Week.
tod : bool
... | python | def add_time_features(self, year=False, month=False, week=True, tod=True, dow=True):
""" Add time features to dataframe.
Parameters
----------
year : bool
Year.
month : bool
Month.
week : bool
Week.
tod : bool
... | [
"def",
"add_time_features",
"(",
"self",
",",
"year",
"=",
"False",
",",
"month",
"=",
"False",
",",
"week",
"=",
"True",
",",
"tod",
"=",
"True",
",",
"dow",
"=",
"True",
")",
":",
"var_to_expand",
"=",
"[",
"]",
"if",
"self",
".",
"preprocessed_dat... | Add time features to dataframe.
Parameters
----------
year : bool
Year.
month : bool
Month.
week : bool
Week.
tod : bool
Time of Day.
dow : bool
Day of Week. | [
"Add",
"time",
"features",
"to",
"dataframe",
"."
] | c12d4fb14518ea3ae98c471c28e0710fdf74dd25 | https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/apps/Data_quality_analysis/Preprocess_Data.py#L135-L187 | train |
SoftwareDefinedBuildings/XBOS | apps/Data_quality_analysis/Model_Data.py | Model_Data.split_data | def split_data(self):
""" Split data according to baseline and projection time period values. """
try:
# Extract data ranging in time_period1
time_period1 = (slice(self.baseline_period[0], self.baseline_period[1]))
self.baseline_in = self.original_data.loc[time_perio... | python | def split_data(self):
""" Split data according to baseline and projection time period values. """
try:
# Extract data ranging in time_period1
time_period1 = (slice(self.baseline_period[0], self.baseline_period[1]))
self.baseline_in = self.original_data.loc[time_perio... | [
"def",
"split_data",
"(",
"self",
")",
":",
"try",
":",
"time_period1",
"=",
"(",
"slice",
"(",
"self",
".",
"baseline_period",
"[",
"0",
"]",
",",
"self",
".",
"baseline_period",
"[",
"1",
"]",
")",
")",
"self",
".",
"baseline_in",
"=",
"self",
".",... | Split data according to baseline and projection time period values. | [
"Split",
"data",
"according",
"to",
"baseline",
"and",
"projection",
"time",
"period",
"values",
"."
] | c12d4fb14518ea3ae98c471c28e0710fdf74dd25 | https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/apps/Data_quality_analysis/Model_Data.py#L125-L152 | train |
SoftwareDefinedBuildings/XBOS | apps/Data_quality_analysis/Model_Data.py | Model_Data.linear_regression | def linear_regression(self):
""" Linear Regression.
This function runs linear regression and stores the,
1. Model
2. Model name
3. Mean score of cross validation
4. Metrics
"""
model = LinearRegression()
scores = []
kfold = KFold(n_sp... | python | def linear_regression(self):
""" Linear Regression.
This function runs linear regression and stores the,
1. Model
2. Model name
3. Mean score of cross validation
4. Metrics
"""
model = LinearRegression()
scores = []
kfold = KFold(n_sp... | [
"def",
"linear_regression",
"(",
"self",
")",
":",
"model",
"=",
"LinearRegression",
"(",
")",
"scores",
"=",
"[",
"]",
"kfold",
"=",
"KFold",
"(",
"n_splits",
"=",
"self",
".",
"cv",
",",
"shuffle",
"=",
"True",
",",
"random_state",
"=",
"42",
")",
... | Linear Regression.
This function runs linear regression and stores the,
1. Model
2. Model name
3. Mean score of cross validation
4. Metrics | [
"Linear",
"Regression",
"."
] | c12d4fb14518ea3ae98c471c28e0710fdf74dd25 | https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/apps/Data_quality_analysis/Model_Data.py#L176-L203 | train |
SoftwareDefinedBuildings/XBOS | apps/Data_quality_analysis/Model_Data.py | Model_Data.lasso_regression | def lasso_regression(self):
""" Lasso Regression.
This function runs lasso regression and stores the,
1. Model
2. Model name
3. Max score
4. Metrics
"""
score_list = []
max_score = float('-inf')
best_alpha = None
for alpha in se... | python | def lasso_regression(self):
""" Lasso Regression.
This function runs lasso regression and stores the,
1. Model
2. Model name
3. Max score
4. Metrics
"""
score_list = []
max_score = float('-inf')
best_alpha = None
for alpha in se... | [
"def",
"lasso_regression",
"(",
"self",
")",
":",
"score_list",
"=",
"[",
"]",
"max_score",
"=",
"float",
"(",
"'-inf'",
")",
"best_alpha",
"=",
"None",
"for",
"alpha",
"in",
"self",
".",
"alphas",
":",
"model",
"=",
"Lasso",
"(",
"alpha",
"=",
"alpha"... | Lasso Regression.
This function runs lasso regression and stores the,
1. Model
2. Model name
3. Max score
4. Metrics | [
"Lasso",
"Regression",
"."
] | c12d4fb14518ea3ae98c471c28e0710fdf74dd25 | https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/apps/Data_quality_analysis/Model_Data.py#L206-L246 | train |
SoftwareDefinedBuildings/XBOS | apps/Data_quality_analysis/Model_Data.py | Model_Data.random_forest | def random_forest(self):
""" Random Forest.
This function runs random forest and stores the,
1. Model
2. Model name
3. Max score
4. Metrics
"""
model = RandomForestRegressor(random_state=42)
scores = []
kfold = KFold(n_splits=self.cv, s... | python | def random_forest(self):
""" Random Forest.
This function runs random forest and stores the,
1. Model
2. Model name
3. Max score
4. Metrics
"""
model = RandomForestRegressor(random_state=42)
scores = []
kfold = KFold(n_splits=self.cv, s... | [
"def",
"random_forest",
"(",
"self",
")",
":",
"model",
"=",
"RandomForestRegressor",
"(",
"random_state",
"=",
"42",
")",
"scores",
"=",
"[",
"]",
"kfold",
"=",
"KFold",
"(",
"n_splits",
"=",
"self",
".",
"cv",
",",
"shuffle",
"=",
"True",
",",
"rando... | Random Forest.
This function runs random forest and stores the,
1. Model
2. Model name
3. Max score
4. Metrics | [
"Random",
"Forest",
"."
] | c12d4fb14518ea3ae98c471c28e0710fdf74dd25 | https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/apps/Data_quality_analysis/Model_Data.py#L338-L364 | train |
SoftwareDefinedBuildings/XBOS | apps/Data_quality_analysis/Model_Data.py | Model_Data.run_models | def run_models(self):
""" Run all models.
Returns
-------
model
Best model
dict
Metrics of the models
"""
self.linear_regression()
self.lasso_regression()
self.ridge_regression()
self.elastic_net_regression()
... | python | def run_models(self):
""" Run all models.
Returns
-------
model
Best model
dict
Metrics of the models
"""
self.linear_regression()
self.lasso_regression()
self.ridge_regression()
self.elastic_net_regression()
... | [
"def",
"run_models",
"(",
"self",
")",
":",
"self",
".",
"linear_regression",
"(",
")",
"self",
".",
"lasso_regression",
"(",
")",
"self",
".",
"ridge_regression",
"(",
")",
"self",
".",
"elastic_net_regression",
"(",
")",
"self",
".",
"random_forest",
"(",
... | Run all models.
Returns
-------
model
Best model
dict
Metrics of the models | [
"Run",
"all",
"models",
"."
] | c12d4fb14518ea3ae98c471c28e0710fdf74dd25 | https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/apps/Data_quality_analysis/Model_Data.py#L396-L424 | train |
SoftwareDefinedBuildings/XBOS | apps/Data_quality_analysis/Model_Data.py | Model_Data.custom_model | def custom_model(self, func):
""" Run custom model provided by user.
To Do,
1. Define custom function's parameters, its data types, and return types
Parameters
----------
func : function
Custom function
Returns
-------
dict
... | python | def custom_model(self, func):
""" Run custom model provided by user.
To Do,
1. Define custom function's parameters, its data types, and return types
Parameters
----------
func : function
Custom function
Returns
-------
dict
... | [
"def",
"custom_model",
"(",
"self",
",",
"func",
")",
":",
"y_pred",
"=",
"func",
"(",
"self",
".",
"baseline_in",
",",
"self",
".",
"baseline_out",
")",
"self",
".",
"custom_metrics",
"=",
"{",
"}",
"self",
".",
"custom_metrics",
"[",
"'r2'",
"]",
"="... | Run custom model provided by user.
To Do,
1. Define custom function's parameters, its data types, and return types
Parameters
----------
func : function
Custom function
Returns
-------
dict
Custom function's metrics | [
"Run",
"custom",
"model",
"provided",
"by",
"user",
"."
] | c12d4fb14518ea3ae98c471c28e0710fdf74dd25 | https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/apps/Data_quality_analysis/Model_Data.py#L427-L453 | train |
SoftwareDefinedBuildings/XBOS | apps/Data_quality_analysis/Model_Data.py | Model_Data.best_model_fit | def best_model_fit(self):
""" Fit data to optimal model and return its metrics.
Returns
-------
dict
Best model's metrics
"""
self.best_model.fit(self.baseline_in, self.baseline_out)
self.y_true = self.baseline_out # Pan... | python | def best_model_fit(self):
""" Fit data to optimal model and return its metrics.
Returns
-------
dict
Best model's metrics
"""
self.best_model.fit(self.baseline_in, self.baseline_out)
self.y_true = self.baseline_out # Pan... | [
"def",
"best_model_fit",
"(",
"self",
")",
":",
"self",
".",
"best_model",
".",
"fit",
"(",
"self",
".",
"baseline_in",
",",
"self",
".",
"baseline_out",
")",
"self",
".",
"y_true",
"=",
"self",
".",
"baseline_out",
"self",
".",
"y_pred",
"=",
"self",
... | Fit data to optimal model and return its metrics.
Returns
-------
dict
Best model's metrics | [
"Fit",
"data",
"to",
"optimal",
"model",
"and",
"return",
"its",
"metrics",
"."
] | c12d4fb14518ea3ae98c471c28e0710fdf74dd25 | https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/apps/Data_quality_analysis/Model_Data.py#L456-L497 | train |
SoftwareDefinedBuildings/XBOS | apps/Data_quality_analysis/Plot_Data.py | Plot_Data.correlation_plot | def correlation_plot(self, data):
""" Create heatmap of Pearson's correlation coefficient.
Parameters
----------
data : pd.DataFrame()
Data to display.
Returns
-------
matplotlib.figure
Heatmap.
"""
# CHECK: Add saved... | python | def correlation_plot(self, data):
""" Create heatmap of Pearson's correlation coefficient.
Parameters
----------
data : pd.DataFrame()
Data to display.
Returns
-------
matplotlib.figure
Heatmap.
"""
# CHECK: Add saved... | [
"def",
"correlation_plot",
"(",
"self",
",",
"data",
")",
":",
"fig",
"=",
"plt",
".",
"figure",
"(",
"Plot_Data",
".",
"count",
")",
"corr",
"=",
"data",
".",
"corr",
"(",
")",
"ax",
"=",
"sns",
".",
"heatmap",
"(",
"corr",
")",
"Plot_Data",
".",
... | Create heatmap of Pearson's correlation coefficient.
Parameters
----------
data : pd.DataFrame()
Data to display.
Returns
-------
matplotlib.figure
Heatmap. | [
"Create",
"heatmap",
"of",
"Pearson",
"s",
"correlation",
"coefficient",
"."
] | c12d4fb14518ea3ae98c471c28e0710fdf74dd25 | https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/apps/Data_quality_analysis/Plot_Data.py#L42-L63 | train |
SoftwareDefinedBuildings/XBOS | apps/Data_quality_analysis/Plot_Data.py | Plot_Data.baseline_projection_plot | def baseline_projection_plot(self, y_true, y_pred,
baseline_period, projection_period,
model_name, adj_r2,
data, input_col, output_col, model,
site):
""" Create baseline and projectio... | python | def baseline_projection_plot(self, y_true, y_pred,
baseline_period, projection_period,
model_name, adj_r2,
data, input_col, output_col, model,
site):
""" Create baseline and projectio... | [
"def",
"baseline_projection_plot",
"(",
"self",
",",
"y_true",
",",
"y_pred",
",",
"baseline_period",
",",
"projection_period",
",",
"model_name",
",",
"adj_r2",
",",
"data",
",",
"input_col",
",",
"output_col",
",",
"model",
",",
"site",
")",
":",
"fig",
"=... | Create baseline and projection plots.
Parameters
----------
y_true : pd.Series()
Actual y values.
y_pred : np.ndarray
Predicted y values.
baseline_period : list(str)
Baseline period.
projection_period : ... | [
"Create",
"baseline",
"and",
"projection",
"plots",
"."
] | c12d4fb14518ea3ae98c471c28e0710fdf74dd25 | https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/apps/Data_quality_analysis/Plot_Data.py#L66-L147 | train |
SoftwareDefinedBuildings/XBOS | apps/system_identification/rtu_energy.py | get_thermostat_meter_data | def get_thermostat_meter_data(zone):
"""
This method subscribes to the output of the meter for the given zone.
It returns a handler to call when you want to stop subscribing data, which
returns a list of the data readins over that time period
"""
meter_uri = zone2meter.get(zone, "None")
data... | python | def get_thermostat_meter_data(zone):
"""
This method subscribes to the output of the meter for the given zone.
It returns a handler to call when you want to stop subscribing data, which
returns a list of the data readins over that time period
"""
meter_uri = zone2meter.get(zone, "None")
data... | [
"def",
"get_thermostat_meter_data",
"(",
"zone",
")",
":",
"meter_uri",
"=",
"zone2meter",
".",
"get",
"(",
"zone",
",",
"\"None\"",
")",
"data",
"=",
"[",
"]",
"def",
"cb",
"(",
"msg",
")",
":",
"for",
"po",
"in",
"msg",
".",
"payload_objects",
":",
... | This method subscribes to the output of the meter for the given zone.
It returns a handler to call when you want to stop subscribing data, which
returns a list of the data readins over that time period | [
"This",
"method",
"subscribes",
"to",
"the",
"output",
"of",
"the",
"meter",
"for",
"the",
"given",
"zone",
".",
"It",
"returns",
"a",
"handler",
"to",
"call",
"when",
"you",
"want",
"to",
"stop",
"subscribing",
"data",
"which",
"returns",
"a",
"list",
"... | c12d4fb14518ea3ae98c471c28e0710fdf74dd25 | https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/apps/system_identification/rtu_energy.py#L53-L71 | train |
SoftwareDefinedBuildings/XBOS | apps/system_identification/rtu_energy.py | call_heat | def call_heat(tstat):
"""
Adjusts the temperature setpoints in order to call for heating. Returns
a handler to call when you want to reset the thermostat
"""
current_hsp, current_csp = tstat.heating_setpoint, tstat.cooling_setpoint
current_temp = tstat.temperature
tstat.write({
'heat... | python | def call_heat(tstat):
"""
Adjusts the temperature setpoints in order to call for heating. Returns
a handler to call when you want to reset the thermostat
"""
current_hsp, current_csp = tstat.heating_setpoint, tstat.cooling_setpoint
current_temp = tstat.temperature
tstat.write({
'heat... | [
"def",
"call_heat",
"(",
"tstat",
")",
":",
"current_hsp",
",",
"current_csp",
"=",
"tstat",
".",
"heating_setpoint",
",",
"tstat",
".",
"cooling_setpoint",
"current_temp",
"=",
"tstat",
".",
"temperature",
"tstat",
".",
"write",
"(",
"{",
"'heating_setpoint'",
... | Adjusts the temperature setpoints in order to call for heating. Returns
a handler to call when you want to reset the thermostat | [
"Adjusts",
"the",
"temperature",
"setpoints",
"in",
"order",
"to",
"call",
"for",
"heating",
".",
"Returns",
"a",
"handler",
"to",
"call",
"when",
"you",
"want",
"to",
"reset",
"the",
"thermostat"
] | c12d4fb14518ea3ae98c471c28e0710fdf74dd25 | https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/apps/system_identification/rtu_energy.py#L73-L92 | train |
SoftwareDefinedBuildings/XBOS | apps/system_identification/rtu_energy.py | call_cool | def call_cool(tstat):
"""
Adjusts the temperature setpoints in order to call for cooling. Returns
a handler to call when you want to reset the thermostat
"""
current_hsp, current_csp = tstat.heating_setpoint, tstat.cooling_setpoint
current_temp = tstat.temperature
tstat.write({
'heat... | python | def call_cool(tstat):
"""
Adjusts the temperature setpoints in order to call for cooling. Returns
a handler to call when you want to reset the thermostat
"""
current_hsp, current_csp = tstat.heating_setpoint, tstat.cooling_setpoint
current_temp = tstat.temperature
tstat.write({
'heat... | [
"def",
"call_cool",
"(",
"tstat",
")",
":",
"current_hsp",
",",
"current_csp",
"=",
"tstat",
".",
"heating_setpoint",
",",
"tstat",
".",
"cooling_setpoint",
"current_temp",
"=",
"tstat",
".",
"temperature",
"tstat",
".",
"write",
"(",
"{",
"'heating_setpoint'",
... | Adjusts the temperature setpoints in order to call for cooling. Returns
a handler to call when you want to reset the thermostat | [
"Adjusts",
"the",
"temperature",
"setpoints",
"in",
"order",
"to",
"call",
"for",
"cooling",
".",
"Returns",
"a",
"handler",
"to",
"call",
"when",
"you",
"want",
"to",
"reset",
"the",
"thermostat"
] | c12d4fb14518ea3ae98c471c28e0710fdf74dd25 | https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/apps/system_identification/rtu_energy.py#L94-L113 | train |
SoftwareDefinedBuildings/XBOS | apps/system_identification/rtu_energy.py | call_fan | def call_fan(tstat):
"""
Toggles the fan
"""
old_fan = tstat.fan
tstat.write({
'fan': not old_fan,
})
def restore():
tstat.write({
'fan': old_fan,
})
return restore | python | def call_fan(tstat):
"""
Toggles the fan
"""
old_fan = tstat.fan
tstat.write({
'fan': not old_fan,
})
def restore():
tstat.write({
'fan': old_fan,
})
return restore | [
"def",
"call_fan",
"(",
"tstat",
")",
":",
"old_fan",
"=",
"tstat",
".",
"fan",
"tstat",
".",
"write",
"(",
"{",
"'fan'",
":",
"not",
"old_fan",
",",
"}",
")",
"def",
"restore",
"(",
")",
":",
"tstat",
".",
"write",
"(",
"{",
"'fan'",
":",
"old_f... | Toggles the fan | [
"Toggles",
"the",
"fan"
] | c12d4fb14518ea3ae98c471c28e0710fdf74dd25 | https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/apps/system_identification/rtu_energy.py#L115-L129 | train |
SoftwareDefinedBuildings/XBOS | apps/Data_quality_analysis/Import_Data.py | Import_Data._load_csv | def _load_csv(self, file_name, folder_name, head_row, index_col, convert_col, concat_files):
""" Load single csv file.
Parameters
----------
file_name : str
CSV file to be imported. Defaults to '*' - all csv files in the folder.
folder_name : str
... | python | def _load_csv(self, file_name, folder_name, head_row, index_col, convert_col, concat_files):
""" Load single csv file.
Parameters
----------
file_name : str
CSV file to be imported. Defaults to '*' - all csv files in the folder.
folder_name : str
... | [
"def",
"_load_csv",
"(",
"self",
",",
"file_name",
",",
"folder_name",
",",
"head_row",
",",
"index_col",
",",
"convert_col",
",",
"concat_files",
")",
":",
"if",
"file_name",
"==",
"\"*\"",
":",
"if",
"not",
"os",
".",
"path",
".",
"isdir",
"(",
"folder... | Load single csv file.
Parameters
----------
file_name : str
CSV file to be imported. Defaults to '*' - all csv files in the folder.
folder_name : str
Folder where file resides. Defaults to '.' - current directory.
head_row : int
... | [
"Load",
"single",
"csv",
"file",
"."
] | c12d4fb14518ea3ae98c471c28e0710fdf74dd25 | https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/apps/Data_quality_analysis/Import_Data.py#L106-L174 | train |
SoftwareDefinedBuildings/XBOS | apps/Data_quality_analysis/Import_Data.py | Import_MDAL.convert_to_utc | def convert_to_utc(time):
""" Convert time to UTC
Parameters
----------
time : str
Time to convert. Has to be of the format '2016-01-01T00:00:00-08:00'.
Returns
-------
str
UTC timestamp.
"""
# time is already in UTC
... | python | def convert_to_utc(time):
""" Convert time to UTC
Parameters
----------
time : str
Time to convert. Has to be of the format '2016-01-01T00:00:00-08:00'.
Returns
-------
str
UTC timestamp.
"""
# time is already in UTC
... | [
"def",
"convert_to_utc",
"(",
"time",
")",
":",
"if",
"'Z'",
"in",
"time",
":",
"return",
"time",
"else",
":",
"time_formatted",
"=",
"time",
"[",
":",
"-",
"3",
"]",
"+",
"time",
"[",
"-",
"2",
":",
"]",
"dt",
"=",
"datetime",
".",
"strptime",
"... | Convert time to UTC
Parameters
----------
time : str
Time to convert. Has to be of the format '2016-01-01T00:00:00-08:00'.
Returns
-------
str
UTC timestamp. | [
"Convert",
"time",
"to",
"UTC"
] | c12d4fb14518ea3ae98c471c28e0710fdf74dd25 | https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/apps/Data_quality_analysis/Import_Data.py#L190-L212 | train |
SoftwareDefinedBuildings/XBOS | apps/Data_quality_analysis/Import_Data.py | Import_MDAL.get_meter | def get_meter(self, site, start, end, point_type='Green_Button_Meter',
var="meter", agg='MEAN', window='24h', aligned=True, return_names=True):
""" Get meter data from MDAL.
Parameters
----------
site : str
Building name.
start ... | python | def get_meter(self, site, start, end, point_type='Green_Button_Meter',
var="meter", agg='MEAN', window='24h', aligned=True, return_names=True):
""" Get meter data from MDAL.
Parameters
----------
site : str
Building name.
start ... | [
"def",
"get_meter",
"(",
"self",
",",
"site",
",",
"start",
",",
"end",
",",
"point_type",
"=",
"'Green_Button_Meter'",
",",
"var",
"=",
"\"meter\"",
",",
"agg",
"=",
"'MEAN'",
",",
"window",
"=",
"'24h'",
",",
"aligned",
"=",
"True",
",",
"return_names"... | Get meter data from MDAL.
Parameters
----------
site : str
Building name.
start : str
Start date - 'YYYY-MM-DDTHH:MM:SSZ'
end : str
End date - 'YYYY-MM-DDTHH:MM:SSZ'
point_type : str
Ty... | [
"Get",
"meter",
"data",
"from",
"MDAL",
"."
] | c12d4fb14518ea3ae98c471c28e0710fdf74dd25 | https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/apps/Data_quality_analysis/Import_Data.py#L215-L258 | train |
SoftwareDefinedBuildings/XBOS | apps/Data_quality_analysis/Import_Data.py | Import_MDAL.get_tstat | def get_tstat(self, site, start, end, var="tstat_temp", agg='MEAN', window='24h', aligned=True, return_names=True):
""" Get thermostat data from MDAL.
Parameters
----------
site : str
Building name.
start : str
Start date - 'YYYY-MM-D... | python | def get_tstat(self, site, start, end, var="tstat_temp", agg='MEAN', window='24h', aligned=True, return_names=True):
""" Get thermostat data from MDAL.
Parameters
----------
site : str
Building name.
start : str
Start date - 'YYYY-MM-D... | [
"def",
"get_tstat",
"(",
"self",
",",
"site",
",",
"start",
",",
"end",
",",
"var",
"=",
"\"tstat_temp\"",
",",
"agg",
"=",
"'MEAN'",
",",
"window",
"=",
"'24h'",
",",
"aligned",
"=",
"True",
",",
"return_names",
"=",
"True",
")",
":",
"start",
"=",
... | Get thermostat data from MDAL.
Parameters
----------
site : str
Building name.
start : str
Start date - 'YYYY-MM-DDTHH:MM:SSZ'
end : str
End date - 'YYYY-MM-DDTHH:MM:SSZ'
var : str
... | [
"Get",
"thermostat",
"data",
"from",
"MDAL",
"."
] | c12d4fb14518ea3ae98c471c28e0710fdf74dd25 | https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/apps/Data_quality_analysis/Import_Data.py#L307-L359 | train |
SoftwareDefinedBuildings/XBOS | apps/Data_quality_analysis/Import_Data.py | Import_MDAL.compose_MDAL_dic | def compose_MDAL_dic(self, site, point_type,
start, end, var, agg, window, aligned, points=None, return_names=False):
""" Create dictionary for MDAL request.
Parameters
----------
site : str
Building name.
start : str
... | python | def compose_MDAL_dic(self, site, point_type,
start, end, var, agg, window, aligned, points=None, return_names=False):
""" Create dictionary for MDAL request.
Parameters
----------
site : str
Building name.
start : str
... | [
"def",
"compose_MDAL_dic",
"(",
"self",
",",
"site",
",",
"point_type",
",",
"start",
",",
"end",
",",
"var",
",",
"agg",
",",
"window",
",",
"aligned",
",",
"points",
"=",
"None",
",",
"return_names",
"=",
"False",
")",
":",
"start",
"=",
"self",
".... | Create dictionary for MDAL request.
Parameters
----------
site : str
Building name.
start : str
Start date - 'YYYY-MM-DDTHH:MM:SSZ'
end : str
End date - 'YYYY-MM-DDTHH:MM:SSZ'
point_type : str
... | [
"Create",
"dictionary",
"for",
"MDAL",
"request",
"."
] | c12d4fb14518ea3ae98c471c28e0710fdf74dd25 | https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/apps/Data_quality_analysis/Import_Data.py#L362-L428 | train |
SoftwareDefinedBuildings/XBOS | apps/Data_quality_analysis/Import_Data.py | Import_MDAL.get_point_name | def get_point_name(self, context):
""" Get point name.
Parameters
----------
context : ???
???
Returns
-------
???
???
"""
metadata_table = self.parse_context(context)
return metadata_table.apply(self... | python | def get_point_name(self, context):
""" Get point name.
Parameters
----------
context : ???
???
Returns
-------
???
???
"""
metadata_table = self.parse_context(context)
return metadata_table.apply(self... | [
"def",
"get_point_name",
"(",
"self",
",",
"context",
")",
":",
"metadata_table",
"=",
"self",
".",
"parse_context",
"(",
"context",
")",
"return",
"metadata_table",
".",
"apply",
"(",
"self",
".",
"strip_point_name",
",",
"axis",
"=",
"1",
")"
] | Get point name.
Parameters
----------
context : ???
???
Returns
-------
???
??? | [
"Get",
"point",
"name",
"."
] | c12d4fb14518ea3ae98c471c28e0710fdf74dd25 | https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/apps/Data_quality_analysis/Import_Data.py#L510-L526 | train |
SoftwareDefinedBuildings/XBOS | apps/Data_quality_analysis/Import_Data.py | Import_MDAL.replace_uuid_w_names | def replace_uuid_w_names(self, resp):
""" Replace the uuid's with names.
Parameters
----------
resp : ???
???
Returns
-------
???
???
"""
col_mapper = self.get_point_name(resp.context)["?point"].to_dict()
... | python | def replace_uuid_w_names(self, resp):
""" Replace the uuid's with names.
Parameters
----------
resp : ???
???
Returns
-------
???
???
"""
col_mapper = self.get_point_name(resp.context)["?point"].to_dict()
... | [
"def",
"replace_uuid_w_names",
"(",
"self",
",",
"resp",
")",
":",
"col_mapper",
"=",
"self",
".",
"get_point_name",
"(",
"resp",
".",
"context",
")",
"[",
"\"?point\"",
"]",
".",
"to_dict",
"(",
")",
"resp",
".",
"df",
".",
"rename",
"(",
"columns",
"... | Replace the uuid's with names.
Parameters
----------
resp : ???
???
Returns
-------
???
??? | [
"Replace",
"the",
"uuid",
"s",
"with",
"names",
"."
] | c12d4fb14518ea3ae98c471c28e0710fdf74dd25 | https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/apps/Data_quality_analysis/Import_Data.py#L529-L546 | train |
SoftwareDefinedBuildings/XBOS | apps/Data_quality_analysis/Clean_Data.py | Clean_Data.resample_data | def resample_data(self, data, freq, resampler='mean'):
""" Resample dataframe.
Note
----
1. Figure out how to apply different functions to different columns .apply()
2. This theoretically work in upsampling too, check docs
http://pandas.pydata.org/pandas-docs/stable/... | python | def resample_data(self, data, freq, resampler='mean'):
""" Resample dataframe.
Note
----
1. Figure out how to apply different functions to different columns .apply()
2. This theoretically work in upsampling too, check docs
http://pandas.pydata.org/pandas-docs/stable/... | [
"def",
"resample_data",
"(",
"self",
",",
"data",
",",
"freq",
",",
"resampler",
"=",
"'mean'",
")",
":",
"if",
"resampler",
"==",
"'mean'",
":",
"data",
"=",
"data",
".",
"resample",
"(",
"freq",
")",
".",
"mean",
"(",
")",
"elif",
"resampler",
"=="... | Resample dataframe.
Note
----
1. Figure out how to apply different functions to different columns .apply()
2. This theoretically work in upsampling too, check docs
http://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.resample.html
Parameters
... | [
"Resample",
"dataframe",
"."
] | c12d4fb14518ea3ae98c471c28e0710fdf74dd25 | https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/apps/Data_quality_analysis/Clean_Data.py#L76-L108 | train |
SoftwareDefinedBuildings/XBOS | apps/Data_quality_analysis/Clean_Data.py | Clean_Data.interpolate_data | def interpolate_data(self, data, limit, method):
""" Interpolate dataframe.
Parameters
----------
data : pd.DataFrame()
Dataframe to interpolate
limit : int
Interpolation limit.
method : str
Interpolation method.
Returns... | python | def interpolate_data(self, data, limit, method):
""" Interpolate dataframe.
Parameters
----------
data : pd.DataFrame()
Dataframe to interpolate
limit : int
Interpolation limit.
method : str
Interpolation method.
Returns... | [
"def",
"interpolate_data",
"(",
"self",
",",
"data",
",",
"limit",
",",
"method",
")",
":",
"data",
"=",
"data",
".",
"interpolate",
"(",
"how",
"=",
"\"index\"",
",",
"limit",
"=",
"limit",
",",
"method",
"=",
"method",
")",
"return",
"data"
] | Interpolate dataframe.
Parameters
----------
data : pd.DataFrame()
Dataframe to interpolate
limit : int
Interpolation limit.
method : str
Interpolation method.
Returns
-------
pd.DataFrame()
Dataframe... | [
"Interpolate",
"dataframe",
"."
] | c12d4fb14518ea3ae98c471c28e0710fdf74dd25 | https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/apps/Data_quality_analysis/Clean_Data.py#L111-L130 | train |
SoftwareDefinedBuildings/XBOS | apps/Data_quality_analysis/Clean_Data.py | Clean_Data.remove_na | def remove_na(self, data, remove_na_how):
""" Remove NAs from dataframe.
Parameters
----------
data : pd.DataFrame()
Dataframe to remove NAs from.
remove_na_how : str
Specificies how to remove NA i.e. all, any...
Returns
----... | python | def remove_na(self, data, remove_na_how):
""" Remove NAs from dataframe.
Parameters
----------
data : pd.DataFrame()
Dataframe to remove NAs from.
remove_na_how : str
Specificies how to remove NA i.e. all, any...
Returns
----... | [
"def",
"remove_na",
"(",
"self",
",",
"data",
",",
"remove_na_how",
")",
":",
"data",
"=",
"data",
".",
"dropna",
"(",
"how",
"=",
"remove_na_how",
")",
"return",
"data"
] | Remove NAs from dataframe.
Parameters
----------
data : pd.DataFrame()
Dataframe to remove NAs from.
remove_na_how : str
Specificies how to remove NA i.e. all, any...
Returns
-------
pd.DataFrame()
Dataframe with ... | [
"Remove",
"NAs",
"from",
"dataframe",
"."
] | c12d4fb14518ea3ae98c471c28e0710fdf74dd25 | https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/apps/Data_quality_analysis/Clean_Data.py#L133-L150 | train |
SoftwareDefinedBuildings/XBOS | apps/Data_quality_analysis/Clean_Data.py | Clean_Data.remove_outlier | def remove_outlier(self, data, sd_val):
""" Remove outliers from dataframe.
Note
----
1. This function excludes all lines with NA in all columns.
Parameters
----------
data : pd.DataFrame()
Dataframe to remove outliers from.
sd_val : int
... | python | def remove_outlier(self, data, sd_val):
""" Remove outliers from dataframe.
Note
----
1. This function excludes all lines with NA in all columns.
Parameters
----------
data : pd.DataFrame()
Dataframe to remove outliers from.
sd_val : int
... | [
"def",
"remove_outlier",
"(",
"self",
",",
"data",
",",
"sd_val",
")",
":",
"data",
"=",
"data",
".",
"dropna",
"(",
")",
"data",
"=",
"data",
"[",
"(",
"np",
".",
"abs",
"(",
"stats",
".",
"zscore",
"(",
"data",
")",
")",
"<",
"float",
"(",
"s... | Remove outliers from dataframe.
Note
----
1. This function excludes all lines with NA in all columns.
Parameters
----------
data : pd.DataFrame()
Dataframe to remove outliers from.
sd_val : int
Standard Deviation Value (specifices how... | [
"Remove",
"outliers",
"from",
"dataframe",
"."
] | c12d4fb14518ea3ae98c471c28e0710fdf74dd25 | https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/apps/Data_quality_analysis/Clean_Data.py#L153-L175 | train |
SoftwareDefinedBuildings/XBOS | apps/Data_quality_analysis/Clean_Data.py | Clean_Data.remove_out_of_bounds | def remove_out_of_bounds(self, data, low_bound, high_bound):
""" Remove out of bound datapoints from dataframe.
This function removes all points < low_bound and > high_bound.
To Do,
1. Add a different boundary for each column.
Parameters
----------
data ... | python | def remove_out_of_bounds(self, data, low_bound, high_bound):
""" Remove out of bound datapoints from dataframe.
This function removes all points < low_bound and > high_bound.
To Do,
1. Add a different boundary for each column.
Parameters
----------
data ... | [
"def",
"remove_out_of_bounds",
"(",
"self",
",",
"data",
",",
"low_bound",
",",
"high_bound",
")",
":",
"data",
"=",
"data",
".",
"dropna",
"(",
")",
"data",
"=",
"data",
"[",
"(",
"data",
">",
"low_bound",
")",
".",
"all",
"(",
"axis",
"=",
"1",
"... | Remove out of bound datapoints from dataframe.
This function removes all points < low_bound and > high_bound.
To Do,
1. Add a different boundary for each column.
Parameters
----------
data : pd.DataFrame()
Dataframe to remove bounds from.
low... | [
"Remove",
"out",
"of",
"bound",
"datapoints",
"from",
"dataframe",
"."
] | c12d4fb14518ea3ae98c471c28e0710fdf74dd25 | https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/apps/Data_quality_analysis/Clean_Data.py#L178-L203 | train |
SoftwareDefinedBuildings/XBOS | apps/Data_quality_analysis/Clean_Data.py | Clean_Data._set_TS_index | def _set_TS_index(self, data):
""" Convert index to datetime and all other columns to numeric
Parameters
----------
data : pd.DataFrame()
Input dataframe.
Returns
-------
pd.DataFrame()
Modified dataframe.
"""
... | python | def _set_TS_index(self, data):
""" Convert index to datetime and all other columns to numeric
Parameters
----------
data : pd.DataFrame()
Input dataframe.
Returns
-------
pd.DataFrame()
Modified dataframe.
"""
... | [
"def",
"_set_TS_index",
"(",
"self",
",",
"data",
")",
":",
"data",
".",
"index",
"=",
"pd",
".",
"to_datetime",
"(",
"data",
".",
"index",
",",
"error",
"=",
"\"ignore\"",
")",
"for",
"col",
"in",
"data",
".",
"columns",
":",
"data",
"[",
"col",
"... | Convert index to datetime and all other columns to numeric
Parameters
----------
data : pd.DataFrame()
Input dataframe.
Returns
-------
pd.DataFrame()
Modified dataframe. | [
"Convert",
"index",
"to",
"datetime",
"and",
"all",
"other",
"columns",
"to",
"numeric"
] | c12d4fb14518ea3ae98c471c28e0710fdf74dd25 | https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/apps/Data_quality_analysis/Clean_Data.py#L283-L305 | train |
SoftwareDefinedBuildings/XBOS | apps/Data_quality_analysis/Clean_Data.py | Clean_Data._utc_to_local | def _utc_to_local(self, data, local_zone="America/Los_Angeles"):
""" Adjust index of dataframe according to timezone that is requested by user.
Parameters
----------
data : pd.DataFrame()
Pandas dataframe of json timeseries response from server.
local_zone :... | python | def _utc_to_local(self, data, local_zone="America/Los_Angeles"):
""" Adjust index of dataframe according to timezone that is requested by user.
Parameters
----------
data : pd.DataFrame()
Pandas dataframe of json timeseries response from server.
local_zone :... | [
"def",
"_utc_to_local",
"(",
"self",
",",
"data",
",",
"local_zone",
"=",
"\"America/Los_Angeles\"",
")",
":",
"data",
".",
"index",
"=",
"data",
".",
"index",
".",
"tz_localize",
"(",
"pytz",
".",
"utc",
")",
".",
"tz_convert",
"(",
"local_zone",
")",
"... | Adjust index of dataframe according to timezone that is requested by user.
Parameters
----------
data : pd.DataFrame()
Pandas dataframe of json timeseries response from server.
local_zone : str
pytz.timezone string of specified local timezone to change i... | [
"Adjust",
"index",
"of",
"dataframe",
"according",
"to",
"timezone",
"that",
"is",
"requested",
"by",
"user",
"."
] | c12d4fb14518ea3ae98c471c28e0710fdf74dd25 | https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/apps/Data_quality_analysis/Clean_Data.py#L308-L331 | train |
SoftwareDefinedBuildings/XBOS | apps/Data_quality_analysis/Clean_Data.py | Clean_Data._local_to_utc | def _local_to_utc(self, timestamp, local_zone="America/Los_Angeles"):
""" Convert local timestamp to UTC.
Parameters
----------
timestamp : pd.DataFrame()
Input Pandas dataframe whose index needs to be changed.
local_zone : str
Name of local zone. Defa... | python | def _local_to_utc(self, timestamp, local_zone="America/Los_Angeles"):
""" Convert local timestamp to UTC.
Parameters
----------
timestamp : pd.DataFrame()
Input Pandas dataframe whose index needs to be changed.
local_zone : str
Name of local zone. Defa... | [
"def",
"_local_to_utc",
"(",
"self",
",",
"timestamp",
",",
"local_zone",
"=",
"\"America/Los_Angeles\"",
")",
":",
"timestamp_new",
"=",
"pd",
".",
"to_datetime",
"(",
"timestamp",
",",
"infer_datetime_format",
"=",
"True",
",",
"errors",
"=",
"'coerce'",
")",
... | Convert local timestamp to UTC.
Parameters
----------
timestamp : pd.DataFrame()
Input Pandas dataframe whose index needs to be changed.
local_zone : str
Name of local zone. Defaults to PST.
Returns
-------
pd.DataFrame()
D... | [
"Convert",
"local",
"timestamp",
"to",
"UTC",
"."
] | c12d4fb14518ea3ae98c471c28e0710fdf74dd25 | https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/apps/Data_quality_analysis/Clean_Data.py#L334-L354 | train |
SoftwareDefinedBuildings/XBOS | apps/Data_quality_analysis/Clean_Data.py | Clean_Data.find_uuid | def find_uuid(self, obj, column_name):
""" Find uuid.
Parameters
----------
obj : ???
the object returned by the MDAL Query
column_name : str
input point returned from MDAL Query
Returns
-------
str
th... | python | def find_uuid(self, obj, column_name):
""" Find uuid.
Parameters
----------
obj : ???
the object returned by the MDAL Query
column_name : str
input point returned from MDAL Query
Returns
-------
str
th... | [
"def",
"find_uuid",
"(",
"self",
",",
"obj",
",",
"column_name",
")",
":",
"keys",
"=",
"obj",
".",
"context",
".",
"keys",
"(",
")",
"for",
"i",
"in",
"keys",
":",
"if",
"column_name",
"in",
"obj",
".",
"context",
"[",
"i",
"]",
"[",
"'?point'",
... | Find uuid.
Parameters
----------
obj : ???
the object returned by the MDAL Query
column_name : str
input point returned from MDAL Query
Returns
-------
str
the uuid that correlates with the data | [
"Find",
"uuid",
"."
] | c12d4fb14518ea3ae98c471c28e0710fdf74dd25 | https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/apps/Data_quality_analysis/Clean_Data.py#L952-L975 | train |
SoftwareDefinedBuildings/XBOS | apps/Data_quality_analysis/Clean_Data.py | Clean_Data.identify_missing | def identify_missing(self, df, check_start=True):
""" Identify missing data.
Parameters
----------
df : pd.DataFrame()
Dataframe to check for missing data.
check_start : bool
turns 0 to 1 for the first observation, to display the start of... | python | def identify_missing(self, df, check_start=True):
""" Identify missing data.
Parameters
----------
df : pd.DataFrame()
Dataframe to check for missing data.
check_start : bool
turns 0 to 1 for the first observation, to display the start of... | [
"def",
"identify_missing",
"(",
"self",
",",
"df",
",",
"check_start",
"=",
"True",
")",
":",
"data_missing",
"=",
"df",
".",
"isnull",
"(",
")",
"*",
"1",
"col_name",
"=",
"str",
"(",
"data_missing",
".",
"columns",
"[",
"0",
"]",
")",
"if",
"check_... | Identify missing data.
Parameters
----------
df : pd.DataFrame()
Dataframe to check for missing data.
check_start : bool
turns 0 to 1 for the first observation, to display the start of the data
as the beginning of the missing data event
... | [
"Identify",
"missing",
"data",
"."
] | c12d4fb14518ea3ae98c471c28e0710fdf74dd25 | https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/apps/Data_quality_analysis/Clean_Data.py#L978-L1006 | train |
SoftwareDefinedBuildings/XBOS | apps/Data_quality_analysis/Clean_Data.py | Clean_Data.diff_boolean | def diff_boolean(self, df, column_name=None, uuid=None, duration=True, min_event_filter='3 hours'):
""" takes the dataframe of missing values, and returns a dataframe that indicates the
length of each event where data was continuously missing
Parameters
----------
df ... | python | def diff_boolean(self, df, column_name=None, uuid=None, duration=True, min_event_filter='3 hours'):
""" takes the dataframe of missing values, and returns a dataframe that indicates the
length of each event where data was continuously missing
Parameters
----------
df ... | [
"def",
"diff_boolean",
"(",
"self",
",",
"df",
",",
"column_name",
"=",
"None",
",",
"uuid",
"=",
"None",
",",
"duration",
"=",
"True",
",",
"min_event_filter",
"=",
"'3 hours'",
")",
":",
"if",
"uuid",
"==",
"None",
":",
"uuid",
"=",
"'End'",
"data_ga... | takes the dataframe of missing values, and returns a dataframe that indicates the
length of each event where data was continuously missing
Parameters
----------
df : pd.DataFrame()
Dataframe to check for missing data (must be in boolean format where 1 indic... | [
"takes",
"the",
"dataframe",
"of",
"missing",
"values",
"and",
"returns",
"a",
"dataframe",
"that",
"indicates",
"the",
"length",
"of",
"each",
"event",
"where",
"data",
"was",
"continuously",
"missing"
] | c12d4fb14518ea3ae98c471c28e0710fdf74dd25 | https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/apps/Data_quality_analysis/Clean_Data.py#L1009-L1050 | train |
SoftwareDefinedBuildings/XBOS | apps/Data_quality_analysis/Clean_Data.py | Clean_Data.analyze_quality_table | def analyze_quality_table(self, obj,low_bound=None, high_bound=None):
""" Takes in an the object returned by the MDAL query, and analyzes the quality
of the data for each column in the df. Returns a df of data quality metrics
To Do
-----
Need to make it specific for varying met... | python | def analyze_quality_table(self, obj,low_bound=None, high_bound=None):
""" Takes in an the object returned by the MDAL query, and analyzes the quality
of the data for each column in the df. Returns a df of data quality metrics
To Do
-----
Need to make it specific for varying met... | [
"def",
"analyze_quality_table",
"(",
"self",
",",
"obj",
",",
"low_bound",
"=",
"None",
",",
"high_bound",
"=",
"None",
")",
":",
"data",
"=",
"obj",
".",
"df",
"N_rows",
"=",
"3",
"N_cols",
"=",
"data",
".",
"shape",
"[",
"1",
"]",
"d",
"=",
"pd",... | Takes in an the object returned by the MDAL query, and analyzes the quality
of the data for each column in the df. Returns a df of data quality metrics
To Do
-----
Need to make it specific for varying meters and label it for each type,
Either separate functions or make the func... | [
"Takes",
"in",
"an",
"the",
"object",
"returned",
"by",
"the",
"MDAL",
"query",
"and",
"analyzes",
"the",
"quality",
"of",
"the",
"data",
"for",
"each",
"column",
"in",
"the",
"df",
".",
"Returns",
"a",
"df",
"of",
"data",
"quality",
"metrics"
] | c12d4fb14518ea3ae98c471c28e0710fdf74dd25 | https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/apps/Data_quality_analysis/Clean_Data.py#L1053-L1108 | train |
SoftwareDefinedBuildings/XBOS | apps/Data_quality_analysis/Clean_Data.py | Clean_Data.analyze_quality_graph | def analyze_quality_graph(self, obj):
""" Takes in an the object returned by the MDAL query, and analyzes the quality
of the data for each column in the df in the form of graphs. The Graphs returned
show missing data events over time, and missing data frequency during each hour
of the d... | python | def analyze_quality_graph(self, obj):
""" Takes in an the object returned by the MDAL query, and analyzes the quality
of the data for each column in the df in the form of graphs. The Graphs returned
show missing data events over time, and missing data frequency during each hour
of the d... | [
"def",
"analyze_quality_graph",
"(",
"self",
",",
"obj",
")",
":",
"data",
"=",
"obj",
".",
"df",
"for",
"i",
"in",
"range",
"(",
"data",
".",
"shape",
"[",
"1",
"]",
")",
":",
"data_per_meter",
"=",
"data",
".",
"iloc",
"[",
":",
",",
"[",
"i",
... | Takes in an the object returned by the MDAL query, and analyzes the quality
of the data for each column in the df in the form of graphs. The Graphs returned
show missing data events over time, and missing data frequency during each hour
of the day
To Do
-----
Need to ma... | [
"Takes",
"in",
"an",
"the",
"object",
"returned",
"by",
"the",
"MDAL",
"query",
"and",
"analyzes",
"the",
"quality",
"of",
"the",
"data",
"for",
"each",
"column",
"in",
"the",
"df",
"in",
"the",
"form",
"of",
"graphs",
".",
"The",
"Graphs",
"returned",
... | c12d4fb14518ea3ae98c471c28e0710fdf74dd25 | https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/apps/Data_quality_analysis/Clean_Data.py#L1111-L1147 | train |
SoftwareDefinedBuildings/XBOS | apps/data_analysis/XBOS_data_analytics/Clean_Data.py | Clean_Data.clean_data | def clean_data(self, resample=True, freq='h', resampler='mean',
interpolate=True, limit=1, method='linear',
remove_na=True, remove_na_how='any',
remove_outliers=True, sd_val=3,
remove_out_of_bounds=True, low_bound=0, high_bound=9998):
... | python | def clean_data(self, resample=True, freq='h', resampler='mean',
interpolate=True, limit=1, method='linear',
remove_na=True, remove_na_how='any',
remove_outliers=True, sd_val=3,
remove_out_of_bounds=True, low_bound=0, high_bound=9998):
... | [
"def",
"clean_data",
"(",
"self",
",",
"resample",
"=",
"True",
",",
"freq",
"=",
"'h'",
",",
"resampler",
"=",
"'mean'",
",",
"interpolate",
"=",
"True",
",",
"limit",
"=",
"1",
",",
"method",
"=",
"'linear'",
",",
"remove_na",
"=",
"True",
",",
"re... | Clean dataframe.
Parameters
----------
resample : bool
Indicates whether to resample data or not.
freq : str
Resampling frequency i.e. d, h, 15T...
resampler : str
Resampling type i.e. mean, max.... | [
"Clean",
"dataframe",
"."
] | c12d4fb14518ea3ae98c471c28e0710fdf74dd25 | https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/apps/data_analysis/XBOS_data_analytics/Clean_Data.py#L198-L269 | train |
SoftwareDefinedBuildings/XBOS | apps/Data_quality_analysis/Wrapper.py | Wrapper.write_json | def write_json(self):
""" Dump data into json file. """
with open(self.results_folder_name + '/results-' + str(self.get_global_count()) + '.json', 'a') as f:
json.dump(self.result, f) | python | def write_json(self):
""" Dump data into json file. """
with open(self.results_folder_name + '/results-' + str(self.get_global_count()) + '.json', 'a') as f:
json.dump(self.result, f) | [
"def",
"write_json",
"(",
"self",
")",
":",
"with",
"open",
"(",
"self",
".",
"results_folder_name",
"+",
"'/results-'",
"+",
"str",
"(",
"self",
".",
"get_global_count",
"(",
")",
")",
"+",
"'.json'",
",",
"'a'",
")",
"as",
"f",
":",
"json",
".",
"d... | Dump data into json file. | [
"Dump",
"data",
"into",
"json",
"file",
"."
] | c12d4fb14518ea3ae98c471c28e0710fdf74dd25 | https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/apps/Data_quality_analysis/Wrapper.py#L143-L147 | train |
SoftwareDefinedBuildings/XBOS | apps/Data_quality_analysis/Wrapper.py | Wrapper.site_analysis | def site_analysis(self, folder_name, site_install_mapping, end_date):
""" Summarize site data into a single table.
folder_name : str
Folder where all site data resides.
site_event_mapping : dic
Dictionary of site name to date of installation.
end_date ... | python | def site_analysis(self, folder_name, site_install_mapping, end_date):
""" Summarize site data into a single table.
folder_name : str
Folder where all site data resides.
site_event_mapping : dic
Dictionary of site name to date of installation.
end_date ... | [
"def",
"site_analysis",
"(",
"self",
",",
"folder_name",
",",
"site_install_mapping",
",",
"end_date",
")",
":",
"def",
"count_number_of_days",
"(",
"site",
",",
"end_date",
")",
":",
"start_date",
"=",
"site_install_mapping",
"[",
"site",
"]",
"start_date",
"="... | Summarize site data into a single table.
folder_name : str
Folder where all site data resides.
site_event_mapping : dic
Dictionary of site name to date of installation.
end_date : str
End date of data collected. | [
"Summarize",
"site",
"data",
"into",
"a",
"single",
"table",
"."
] | c12d4fb14518ea3ae98c471c28e0710fdf74dd25 | https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/apps/Data_quality_analysis/Wrapper.py#L150-L235 | train |
SoftwareDefinedBuildings/XBOS | apps/Data_quality_analysis/Wrapper.py | Wrapper.search | def search(self, file_name, imported_data=None):
""" Run models on different data configurations.
Note
----
The input json file should include ALL parameters.
Parameters
----------
file_name : str
Optional json file to read parameters.
... | python | def search(self, file_name, imported_data=None):
""" Run models on different data configurations.
Note
----
The input json file should include ALL parameters.
Parameters
----------
file_name : str
Optional json file to read parameters.
... | [
"def",
"search",
"(",
"self",
",",
"file_name",
",",
"imported_data",
"=",
"None",
")",
":",
"resample_freq",
"=",
"[",
"'15T'",
",",
"'h'",
",",
"'d'",
"]",
"time_freq",
"=",
"{",
"'year'",
":",
"[",
"True",
",",
"False",
",",
"False",
",",
"False",... | Run models on different data configurations.
Note
----
The input json file should include ALL parameters.
Parameters
----------
file_name : str
Optional json file to read parameters.
imported_data : pd.DataFrame()
Pandas Dataframe... | [
"Run",
"models",
"on",
"different",
"data",
"configurations",
"."
] | c12d4fb14518ea3ae98c471c28e0710fdf74dd25 | https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/apps/Data_quality_analysis/Wrapper.py#L302-L373 | train |
SoftwareDefinedBuildings/XBOS | apps/Data_quality_analysis/Wrapper.py | Wrapper.clean_data | def clean_data(self, data, rename_col=None, drop_col=None,
resample=True, freq='h', resampler='mean',
interpolate=True, limit=1, method='linear',
remove_na=True, remove_na_how='any',
remove_outliers=True, sd_val=3,
remov... | python | def clean_data(self, data, rename_col=None, drop_col=None,
resample=True, freq='h', resampler='mean',
interpolate=True, limit=1, method='linear',
remove_na=True, remove_na_how='any',
remove_outliers=True, sd_val=3,
remov... | [
"def",
"clean_data",
"(",
"self",
",",
"data",
",",
"rename_col",
"=",
"None",
",",
"drop_col",
"=",
"None",
",",
"resample",
"=",
"True",
",",
"freq",
"=",
"'h'",
",",
"resampler",
"=",
"'mean'",
",",
"interpolate",
"=",
"True",
",",
"limit",
"=",
"... | Cleans dataframe according to user specifications and stores result in self.cleaned_data.
Parameters
----------
data : pd.DataFrame()
Dataframe to be cleaned.
rename_col : list(str)
List of new column names.
drop_col ... | [
"Cleans",
"dataframe",
"according",
"to",
"user",
"specifications",
"and",
"stores",
"result",
"in",
"self",
".",
"cleaned_data",
"."
] | c12d4fb14518ea3ae98c471c28e0710fdf74dd25 | https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/apps/Data_quality_analysis/Wrapper.py#L439-L543 | train |
SoftwareDefinedBuildings/XBOS | dashboards/sitedash/app.py | prevmonday | def prevmonday(num):
"""
Return unix SECOND timestamp of "num" mondays ago
"""
today = get_today()
lastmonday = today - timedelta(days=today.weekday(), weeks=num)
return lastmonday | python | def prevmonday(num):
"""
Return unix SECOND timestamp of "num" mondays ago
"""
today = get_today()
lastmonday = today - timedelta(days=today.weekday(), weeks=num)
return lastmonday | [
"def",
"prevmonday",
"(",
"num",
")",
":",
"today",
"=",
"get_today",
"(",
")",
"lastmonday",
"=",
"today",
"-",
"timedelta",
"(",
"days",
"=",
"today",
".",
"weekday",
"(",
")",
",",
"weeks",
"=",
"num",
")",
"return",
"lastmonday"
] | Return unix SECOND timestamp of "num" mondays ago | [
"Return",
"unix",
"SECOND",
"timestamp",
"of",
"num",
"mondays",
"ago"
] | c12d4fb14518ea3ae98c471c28e0710fdf74dd25 | https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/dashboards/sitedash/app.py#L74-L80 | train |
SoftwareDefinedBuildings/XBOS | apps/consumption/iec.py | med_filt | def med_filt(x, k=201):
"""Apply a length-k median filter to a 1D array x.
Boundaries are extended by repeating endpoints.
"""
if x.ndim > 1:
x = np.squeeze(x)
med = np.median(x)
assert k % 2 == 1, "Median filter length must be odd."
assert x.ndim == 1, "Input must be one-dimensional... | python | def med_filt(x, k=201):
"""Apply a length-k median filter to a 1D array x.
Boundaries are extended by repeating endpoints.
"""
if x.ndim > 1:
x = np.squeeze(x)
med = np.median(x)
assert k % 2 == 1, "Median filter length must be odd."
assert x.ndim == 1, "Input must be one-dimensional... | [
"def",
"med_filt",
"(",
"x",
",",
"k",
"=",
"201",
")",
":",
"if",
"x",
".",
"ndim",
">",
"1",
":",
"x",
"=",
"np",
".",
"squeeze",
"(",
"x",
")",
"med",
"=",
"np",
".",
"median",
"(",
"x",
")",
"assert",
"k",
"%",
"2",
"==",
"1",
",",
... | Apply a length-k median filter to a 1D array x.
Boundaries are extended by repeating endpoints. | [
"Apply",
"a",
"length",
"-",
"k",
"median",
"filter",
"to",
"a",
"1D",
"array",
"x",
".",
"Boundaries",
"are",
"extended",
"by",
"repeating",
"endpoints",
"."
] | c12d4fb14518ea3ae98c471c28e0710fdf74dd25 | https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/apps/consumption/iec.py#L114-L132 | train |
SoftwareDefinedBuildings/XBOS | apps/data_analysis/XBOS_data_analytics/Wrapper.py | Wrapper.preprocess_data | def preprocess_data(self, data,
hdh_cpoint=65, cdh_cpoint=65, col_hdh_cdh=None,
col_degree=None, degree=None,
standardize=False, normalize=False,
year=False, month=False, week=False, tod=False, dow=False,
... | python | def preprocess_data(self, data,
hdh_cpoint=65, cdh_cpoint=65, col_hdh_cdh=None,
col_degree=None, degree=None,
standardize=False, normalize=False,
year=False, month=False, week=False, tod=False, dow=False,
... | [
"def",
"preprocess_data",
"(",
"self",
",",
"data",
",",
"hdh_cpoint",
"=",
"65",
",",
"cdh_cpoint",
"=",
"65",
",",
"col_hdh_cdh",
"=",
"None",
",",
"col_degree",
"=",
"None",
",",
"degree",
"=",
"None",
",",
"standardize",
"=",
"False",
",",
"normalize... | Preprocesses dataframe according to user specifications and stores result in self.preprocessed_data.
Parameters
----------
data : pd.DataFrame()
Dataframe to be preprocessed.
hdh_cpoint : int
Heating degree hours. Defaults to 65.
cdh_cpoin... | [
"Preprocesses",
"dataframe",
"according",
"to",
"user",
"specifications",
"and",
"stores",
"result",
"in",
"self",
".",
"preprocessed_data",
"."
] | c12d4fb14518ea3ae98c471c28e0710fdf74dd25 | https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/apps/data_analysis/XBOS_data_analytics/Wrapper.py#L544-L634 | train |
SoftwareDefinedBuildings/XBOS | apps/data_analysis/XBOS_data_analytics/Wrapper.py | Wrapper.model | def model(self, data,
ind_col=None, dep_col=None,
project_ind_col=None,
baseline_period=[None, None], projection_period=None, exclude_time_period=None,
alphas=np.logspace(-4,1,30),
cv=3, plot=True, figsize=None,
custom_model_func=None):
"""... | python | def model(self, data,
ind_col=None, dep_col=None,
project_ind_col=None,
baseline_period=[None, None], projection_period=None, exclude_time_period=None,
alphas=np.logspace(-4,1,30),
cv=3, plot=True, figsize=None,
custom_model_func=None):
"""... | [
"def",
"model",
"(",
"self",
",",
"data",
",",
"ind_col",
"=",
"None",
",",
"dep_col",
"=",
"None",
",",
"project_ind_col",
"=",
"None",
",",
"baseline_period",
"=",
"[",
"None",
",",
"None",
"]",
",",
"projection_period",
"=",
"None",
",",
"exclude_time... | Split data into baseline and projection periods, run models on them and display metrics & plots.
Parameters
----------
data : pd.DataFrame()
Dataframe to model.
ind_col : list(str)
Independent column(s) of dataframe. Defaults to... | [
"Split",
"data",
"into",
"baseline",
"and",
"projection",
"periods",
"run",
"models",
"on",
"them",
"and",
"display",
"metrics",
"&",
"plots",
"."
] | c12d4fb14518ea3ae98c471c28e0710fdf74dd25 | https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/apps/data_analysis/XBOS_data_analytics/Wrapper.py#L637-L749 | train |
SoftwareDefinedBuildings/XBOS | python/xbos/services/pundat.py | make_dataframe | def make_dataframe(result):
"""
Turns the results of one of the data API calls into a pandas dataframe
"""
import pandas as pd
ret = {}
if isinstance(result,dict):
if 'timeseries' in result:
result = result['timeseries']
for uuid, data in result.items():
df = pd.D... | python | def make_dataframe(result):
"""
Turns the results of one of the data API calls into a pandas dataframe
"""
import pandas as pd
ret = {}
if isinstance(result,dict):
if 'timeseries' in result:
result = result['timeseries']
for uuid, data in result.items():
df = pd.D... | [
"def",
"make_dataframe",
"(",
"result",
")",
":",
"import",
"pandas",
"as",
"pd",
"ret",
"=",
"{",
"}",
"if",
"isinstance",
"(",
"result",
",",
"dict",
")",
":",
"if",
"'timeseries'",
"in",
"result",
":",
"result",
"=",
"result",
"[",
"'timeseries'",
"... | Turns the results of one of the data API calls into a pandas dataframe | [
"Turns",
"the",
"results",
"of",
"one",
"of",
"the",
"data",
"API",
"calls",
"into",
"a",
"pandas",
"dataframe"
] | c12d4fb14518ea3ae98c471c28e0710fdf74dd25 | https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/python/xbos/services/pundat.py#L247-L265 | train |
SoftwareDefinedBuildings/XBOS | python/xbos/services/pundat.py | DataClient.query | def query(self, query, archiver="", timeout=DEFAULT_TIMEOUT):
"""
Runs the given pundat query and returns the results as a Python object.
Arguments:
[query]: the query string
[archiver]: if specified, this is the archiver to use. Else, it will run on the first archiver passed
... | python | def query(self, query, archiver="", timeout=DEFAULT_TIMEOUT):
"""
Runs the given pundat query and returns the results as a Python object.
Arguments:
[query]: the query string
[archiver]: if specified, this is the archiver to use. Else, it will run on the first archiver passed
... | [
"def",
"query",
"(",
"self",
",",
"query",
",",
"archiver",
"=",
"\"\"",
",",
"timeout",
"=",
"DEFAULT_TIMEOUT",
")",
":",
"if",
"archiver",
"==",
"\"\"",
":",
"archiver",
"=",
"self",
".",
"archivers",
"[",
"0",
"]",
"nonce",
"=",
"random",
".",
"ra... | Runs the given pundat query and returns the results as a Python object.
Arguments:
[query]: the query string
[archiver]: if specified, this is the archiver to use. Else, it will run on the first archiver passed
into the constructor for the client
[timeout]: time in s... | [
"Runs",
"the",
"given",
"pundat",
"query",
"and",
"returns",
"the",
"results",
"as",
"a",
"Python",
"object",
"."
] | c12d4fb14518ea3ae98c471c28e0710fdf74dd25 | https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/python/xbos/services/pundat.py#L61-L111 | train |
SoftwareDefinedBuildings/XBOS | python/xbos/services/pundat.py | DataClient.uuids | def uuids(self, where, archiver="", timeout=DEFAULT_TIMEOUT):
"""
Using the given where-clause, finds all UUIDs that match
Arguments:
[where]: the where clause (e.g. 'path like "keti"', 'SourceName = "TED Main"')
[archiver]: if specified, this is the archiver to use. Else, it wi... | python | def uuids(self, where, archiver="", timeout=DEFAULT_TIMEOUT):
"""
Using the given where-clause, finds all UUIDs that match
Arguments:
[where]: the where clause (e.g. 'path like "keti"', 'SourceName = "TED Main"')
[archiver]: if specified, this is the archiver to use. Else, it wi... | [
"def",
"uuids",
"(",
"self",
",",
"where",
",",
"archiver",
"=",
"\"\"",
",",
"timeout",
"=",
"DEFAULT_TIMEOUT",
")",
":",
"resp",
"=",
"self",
".",
"query",
"(",
"\"select uuid where {0}\"",
".",
"format",
"(",
"where",
")",
",",
"archiver",
",",
"timeo... | Using the given where-clause, finds all UUIDs that match
Arguments:
[where]: the where clause (e.g. 'path like "keti"', 'SourceName = "TED Main"')
[archiver]: if specified, this is the archiver to use. Else, it will run on the first archiver passed
into the constructor for t... | [
"Using",
"the",
"given",
"where",
"-",
"clause",
"finds",
"all",
"UUIDs",
"that",
"match"
] | c12d4fb14518ea3ae98c471c28e0710fdf74dd25 | https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/python/xbos/services/pundat.py#L113-L127 | train |
SoftwareDefinedBuildings/XBOS | python/xbos/services/pundat.py | DataClient.tags | def tags(self, where, archiver="", timeout=DEFAULT_TIMEOUT):
"""
Retrieves tags for all streams matching the given WHERE clause
Arguments:
[where]: the where clause (e.g. 'path like "keti"', 'SourceName = "TED Main"')
[archiver]: if specified, this is the archiver to use. Else, ... | python | def tags(self, where, archiver="", timeout=DEFAULT_TIMEOUT):
"""
Retrieves tags for all streams matching the given WHERE clause
Arguments:
[where]: the where clause (e.g. 'path like "keti"', 'SourceName = "TED Main"')
[archiver]: if specified, this is the archiver to use. Else, ... | [
"def",
"tags",
"(",
"self",
",",
"where",
",",
"archiver",
"=",
"\"\"",
",",
"timeout",
"=",
"DEFAULT_TIMEOUT",
")",
":",
"return",
"self",
".",
"query",
"(",
"\"select * where {0}\"",
".",
"format",
"(",
"where",
")",
",",
"archiver",
",",
"timeout",
")... | Retrieves tags for all streams matching the given WHERE clause
Arguments:
[where]: the where clause (e.g. 'path like "keti"', 'SourceName = "TED Main"')
[archiver]: if specified, this is the archiver to use. Else, it will run on the first archiver passed
into the constructor... | [
"Retrieves",
"tags",
"for",
"all",
"streams",
"matching",
"the",
"given",
"WHERE",
"clause"
] | c12d4fb14518ea3ae98c471c28e0710fdf74dd25 | https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/python/xbos/services/pundat.py#L129-L139 | train |
SoftwareDefinedBuildings/XBOS | python/xbos/services/pundat.py | DataClient.tags_uuids | def tags_uuids(self, uuids, archiver="", timeout=DEFAULT_TIMEOUT):
"""
Retrieves tags for all streams with the provided UUIDs
Arguments:
[uuids]: list of UUIDs
[archiver]: if specified, this is the archiver to use. Else, it will run on the first archiver passed
... | python | def tags_uuids(self, uuids, archiver="", timeout=DEFAULT_TIMEOUT):
"""
Retrieves tags for all streams with the provided UUIDs
Arguments:
[uuids]: list of UUIDs
[archiver]: if specified, this is the archiver to use. Else, it will run on the first archiver passed
... | [
"def",
"tags_uuids",
"(",
"self",
",",
"uuids",
",",
"archiver",
"=",
"\"\"",
",",
"timeout",
"=",
"DEFAULT_TIMEOUT",
")",
":",
"if",
"not",
"isinstance",
"(",
"uuids",
",",
"list",
")",
":",
"uuids",
"=",
"[",
"uuids",
"]",
"where",
"=",
"\" or \"",
... | Retrieves tags for all streams with the provided UUIDs
Arguments:
[uuids]: list of UUIDs
[archiver]: if specified, this is the archiver to use. Else, it will run on the first archiver passed
into the constructor for the client
[timeout]: time in seconds to wait for a... | [
"Retrieves",
"tags",
"for",
"all",
"streams",
"with",
"the",
"provided",
"UUIDs"
] | c12d4fb14518ea3ae98c471c28e0710fdf74dd25 | https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/python/xbos/services/pundat.py#L141-L154 | train |
SoftwareDefinedBuildings/XBOS | python/xbos/services/pundat.py | DataClient.data | def data(self, where, start, end, archiver="", timeout=DEFAULT_TIMEOUT):
"""
With the given WHERE clause, retrieves all RAW data between the 2 given timestamps
Arguments:
[where]: the where clause (e.g. 'path like "keti"', 'SourceName = "TED Main"')
[start, end]: time references... | python | def data(self, where, start, end, archiver="", timeout=DEFAULT_TIMEOUT):
"""
With the given WHERE clause, retrieves all RAW data between the 2 given timestamps
Arguments:
[where]: the where clause (e.g. 'path like "keti"', 'SourceName = "TED Main"')
[start, end]: time references... | [
"def",
"data",
"(",
"self",
",",
"where",
",",
"start",
",",
"end",
",",
"archiver",
"=",
"\"\"",
",",
"timeout",
"=",
"DEFAULT_TIMEOUT",
")",
":",
"return",
"self",
".",
"query",
"(",
"\"select data in ({0}, {1}) where {2}\"",
".",
"format",
"(",
"start",
... | With the given WHERE clause, retrieves all RAW data between the 2 given timestamps
Arguments:
[where]: the where clause (e.g. 'path like "keti"', 'SourceName = "TED Main"')
[start, end]: time references:
[archiver]: if specified, this is the archiver to use. Else, it will run on the fir... | [
"With",
"the",
"given",
"WHERE",
"clause",
"retrieves",
"all",
"RAW",
"data",
"between",
"the",
"2",
"given",
"timestamps"
] | c12d4fb14518ea3ae98c471c28e0710fdf74dd25 | https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/python/xbos/services/pundat.py#L156-L167 | train |
SoftwareDefinedBuildings/XBOS | python/xbos/services/pundat.py | DataClient.data_uuids | def data_uuids(self, uuids, start, end, archiver="", timeout=DEFAULT_TIMEOUT):
"""
With the given list of UUIDs, retrieves all RAW data between the 2 given timestamps
Arguments:
[uuids]: list of UUIDs
[start, end]: time references:
[archiver]: if specified, this is the a... | python | def data_uuids(self, uuids, start, end, archiver="", timeout=DEFAULT_TIMEOUT):
"""
With the given list of UUIDs, retrieves all RAW data between the 2 given timestamps
Arguments:
[uuids]: list of UUIDs
[start, end]: time references:
[archiver]: if specified, this is the a... | [
"def",
"data_uuids",
"(",
"self",
",",
"uuids",
",",
"start",
",",
"end",
",",
"archiver",
"=",
"\"\"",
",",
"timeout",
"=",
"DEFAULT_TIMEOUT",
")",
":",
"if",
"not",
"isinstance",
"(",
"uuids",
",",
"list",
")",
":",
"uuids",
"=",
"[",
"uuids",
"]",... | With the given list of UUIDs, retrieves all RAW data between the 2 given timestamps
Arguments:
[uuids]: list of UUIDs
[start, end]: time references:
[archiver]: if specified, this is the archiver to use. Else, it will run on the first archiver passed
into the constru... | [
"With",
"the",
"given",
"list",
"of",
"UUIDs",
"retrieves",
"all",
"RAW",
"data",
"between",
"the",
"2",
"given",
"timestamps"
] | c12d4fb14518ea3ae98c471c28e0710fdf74dd25 | https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/python/xbos/services/pundat.py#L169-L183 | train |
SoftwareDefinedBuildings/XBOS | python/xbos/services/pundat.py | DataClient.stats | def stats(self, where, start, end, pw, archiver="", timeout=DEFAULT_TIMEOUT):
"""
With the given WHERE clause, retrieves all statistical data between the 2 given timestamps, using the given pointwidth
Arguments:
[where]: the where clause (e.g. 'path like "keti"', 'SourceName = "TED Main... | python | def stats(self, where, start, end, pw, archiver="", timeout=DEFAULT_TIMEOUT):
"""
With the given WHERE clause, retrieves all statistical data between the 2 given timestamps, using the given pointwidth
Arguments:
[where]: the where clause (e.g. 'path like "keti"', 'SourceName = "TED Main... | [
"def",
"stats",
"(",
"self",
",",
"where",
",",
"start",
",",
"end",
",",
"pw",
",",
"archiver",
"=",
"\"\"",
",",
"timeout",
"=",
"DEFAULT_TIMEOUT",
")",
":",
"return",
"self",
".",
"query",
"(",
"\"select statistical({3}) data in ({0}, {1}) where {2}\"",
"."... | With the given WHERE clause, retrieves all statistical data between the 2 given timestamps, using the given pointwidth
Arguments:
[where]: the where clause (e.g. 'path like "keti"', 'SourceName = "TED Main"')
[start, end]: time references:
[pw]: pointwidth (window size of 2^pw nanosecon... | [
"With",
"the",
"given",
"WHERE",
"clause",
"retrieves",
"all",
"statistical",
"data",
"between",
"the",
"2",
"given",
"timestamps",
"using",
"the",
"given",
"pointwidth"
] | c12d4fb14518ea3ae98c471c28e0710fdf74dd25 | https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/python/xbos/services/pundat.py#L185-L197 | train |
SoftwareDefinedBuildings/XBOS | python/xbos/services/pundat.py | DataClient.window | def window(self, where, start, end, width, archiver="", timeout=DEFAULT_TIMEOUT):
"""
With the given WHERE clause, retrieves all statistical data between the 2 given timestamps, using the given window size
Arguments:
[where]: the where clause (e.g. 'path like "keti"', 'SourceName = "TED... | python | def window(self, where, start, end, width, archiver="", timeout=DEFAULT_TIMEOUT):
"""
With the given WHERE clause, retrieves all statistical data between the 2 given timestamps, using the given window size
Arguments:
[where]: the where clause (e.g. 'path like "keti"', 'SourceName = "TED... | [
"def",
"window",
"(",
"self",
",",
"where",
",",
"start",
",",
"end",
",",
"width",
",",
"archiver",
"=",
"\"\"",
",",
"timeout",
"=",
"DEFAULT_TIMEOUT",
")",
":",
"return",
"self",
".",
"query",
"(",
"\"select window({3}) data in ({0}, {1}) where {2}\"",
".",... | With the given WHERE clause, retrieves all statistical data between the 2 given timestamps, using the given window size
Arguments:
[where]: the where clause (e.g. 'path like "keti"', 'SourceName = "TED Main"')
[start, end]: time references:
[width]: a time expression for the window size... | [
"With",
"the",
"given",
"WHERE",
"clause",
"retrieves",
"all",
"statistical",
"data",
"between",
"the",
"2",
"given",
"timestamps",
"using",
"the",
"given",
"window",
"size"
] | c12d4fb14518ea3ae98c471c28e0710fdf74dd25 | https://github.com/SoftwareDefinedBuildings/XBOS/blob/c12d4fb14518ea3ae98c471c28e0710fdf74dd25/python/xbos/services/pundat.py#L216-L228 | train |
Danielhiversen/flux_led | flux_led/__main__.py | WifiLedBulb.brightness | def brightness(self):
"""Return current brightness 0-255.
For warm white return current led level. For RGB
calculate the HSV and return the 'value'.
"""
if self.mode == "ww":
return int(self.raw_state[9])
else:
_, _, v = colorsys.rgb_to_hsv(*self.... | python | def brightness(self):
"""Return current brightness 0-255.
For warm white return current led level. For RGB
calculate the HSV and return the 'value'.
"""
if self.mode == "ww":
return int(self.raw_state[9])
else:
_, _, v = colorsys.rgb_to_hsv(*self.... | [
"def",
"brightness",
"(",
"self",
")",
":",
"if",
"self",
".",
"mode",
"==",
"\"ww\"",
":",
"return",
"int",
"(",
"self",
".",
"raw_state",
"[",
"9",
"]",
")",
"else",
":",
"_",
",",
"_",
",",
"v",
"=",
"colorsys",
".",
"rgb_to_hsv",
"(",
"*",
... | Return current brightness 0-255.
For warm white return current led level. For RGB
calculate the HSV and return the 'value'. | [
"Return",
"current",
"brightness",
"0",
"-",
"255",
"."
] | 13e87e06ff7589356c83e084a6be768ad1290557 | https://github.com/Danielhiversen/flux_led/blob/13e87e06ff7589356c83e084a6be768ad1290557/flux_led/__main__.py#L544-L554 | train |
kyrus/python-junit-xml | junit_xml/__init__.py | decode | def decode(var, encoding):
"""
If not already unicode, decode it.
"""
if PY2:
if isinstance(var, unicode):
ret = var
elif isinstance(var, str):
if encoding:
ret = var.decode(encoding)
else:
ret = unicode(var)
els... | python | def decode(var, encoding):
"""
If not already unicode, decode it.
"""
if PY2:
if isinstance(var, unicode):
ret = var
elif isinstance(var, str):
if encoding:
ret = var.decode(encoding)
else:
ret = unicode(var)
els... | [
"def",
"decode",
"(",
"var",
",",
"encoding",
")",
":",
"if",
"PY2",
":",
"if",
"isinstance",
"(",
"var",
",",
"unicode",
")",
":",
"ret",
"=",
"var",
"elif",
"isinstance",
"(",
"var",
",",
"str",
")",
":",
"if",
"encoding",
":",
"ret",
"=",
"var... | If not already unicode, decode it. | [
"If",
"not",
"already",
"unicode",
"decode",
"it",
"."
] | 9bb2675bf0058742da04285dcdcf8781eee03db0 | https://github.com/kyrus/python-junit-xml/blob/9bb2675bf0058742da04285dcdcf8781eee03db0/junit_xml/__init__.py#L57-L73 | train |
esheldon/fitsio | fitsio/util.py | cfitsio_version | def cfitsio_version(asfloat=False):
"""
Return the cfitsio version as a string.
"""
# use string version to avoid roundoffs
ver = '%0.3f' % _fitsio_wrap.cfitsio_version()
if asfloat:
return float(ver)
else:
return ver | python | def cfitsio_version(asfloat=False):
"""
Return the cfitsio version as a string.
"""
# use string version to avoid roundoffs
ver = '%0.3f' % _fitsio_wrap.cfitsio_version()
if asfloat:
return float(ver)
else:
return ver | [
"def",
"cfitsio_version",
"(",
"asfloat",
"=",
"False",
")",
":",
"ver",
"=",
"'%0.3f'",
"%",
"_fitsio_wrap",
".",
"cfitsio_version",
"(",
")",
"if",
"asfloat",
":",
"return",
"float",
"(",
"ver",
")",
"else",
":",
"return",
"ver"
] | Return the cfitsio version as a string. | [
"Return",
"the",
"cfitsio",
"version",
"as",
"a",
"string",
"."
] | a6f07919f457a282fe240adad9d2c30906b71a15 | https://github.com/esheldon/fitsio/blob/a6f07919f457a282fe240adad9d2c30906b71a15/fitsio/util.py#L19-L28 | train |
esheldon/fitsio | fitsio/util.py | is_little_endian | def is_little_endian(array):
"""
Return True if array is little endian, False otherwise.
Parameters
----------
array: numpy array
A numerical python array.
Returns
-------
Truth value:
True for little-endian
Notes
-----
Strings are neither big or little end... | python | def is_little_endian(array):
"""
Return True if array is little endian, False otherwise.
Parameters
----------
array: numpy array
A numerical python array.
Returns
-------
Truth value:
True for little-endian
Notes
-----
Strings are neither big or little end... | [
"def",
"is_little_endian",
"(",
"array",
")",
":",
"if",
"numpy",
".",
"little_endian",
":",
"machine_little",
"=",
"True",
"else",
":",
"machine_little",
"=",
"False",
"byteorder",
"=",
"array",
".",
"dtype",
".",
"base",
".",
"byteorder",
"return",
"(",
... | Return True if array is little endian, False otherwise.
Parameters
----------
array: numpy array
A numerical python array.
Returns
-------
Truth value:
True for little-endian
Notes
-----
Strings are neither big or little endian. The input must be a simple numpy
... | [
"Return",
"True",
"if",
"array",
"is",
"little",
"endian",
"False",
"otherwise",
"."
] | a6f07919f457a282fe240adad9d2c30906b71a15 | https://github.com/esheldon/fitsio/blob/a6f07919f457a282fe240adad9d2c30906b71a15/fitsio/util.py#L73-L98 | train |
esheldon/fitsio | fitsio/util.py | array_to_native | def array_to_native(array, inplace=False):
"""
Convert an array to the native byte order.
NOTE: the inplace keyword argument is not currently used.
"""
if numpy.little_endian:
machine_little = True
else:
machine_little = False
data_little = False
if array.dtype.names is... | python | def array_to_native(array, inplace=False):
"""
Convert an array to the native byte order.
NOTE: the inplace keyword argument is not currently used.
"""
if numpy.little_endian:
machine_little = True
else:
machine_little = False
data_little = False
if array.dtype.names is... | [
"def",
"array_to_native",
"(",
"array",
",",
"inplace",
"=",
"False",
")",
":",
"if",
"numpy",
".",
"little_endian",
":",
"machine_little",
"=",
"True",
"else",
":",
"machine_little",
"=",
"False",
"data_little",
"=",
"False",
"if",
"array",
".",
"dtype",
... | Convert an array to the native byte order.
NOTE: the inplace keyword argument is not currently used. | [
"Convert",
"an",
"array",
"to",
"the",
"native",
"byte",
"order",
"."
] | a6f07919f457a282fe240adad9d2c30906b71a15 | https://github.com/esheldon/fitsio/blob/a6f07919f457a282fe240adad9d2c30906b71a15/fitsio/util.py#L101-L134 | train |
esheldon/fitsio | fitsio/util.py | mks | def mks(val):
"""
make sure the value is a string, paying mind to python3 vs 2
"""
if sys.version_info > (3, 0, 0):
if isinstance(val, bytes):
sval = str(val, 'utf-8')
else:
sval = str(val)
else:
sval = str(val)
return sval | python | def mks(val):
"""
make sure the value is a string, paying mind to python3 vs 2
"""
if sys.version_info > (3, 0, 0):
if isinstance(val, bytes):
sval = str(val, 'utf-8')
else:
sval = str(val)
else:
sval = str(val)
return sval | [
"def",
"mks",
"(",
"val",
")",
":",
"if",
"sys",
".",
"version_info",
">",
"(",
"3",
",",
"0",
",",
"0",
")",
":",
"if",
"isinstance",
"(",
"val",
",",
"bytes",
")",
":",
"sval",
"=",
"str",
"(",
"val",
",",
"'utf-8'",
")",
"else",
":",
"sval... | make sure the value is a string, paying mind to python3 vs 2 | [
"make",
"sure",
"the",
"value",
"is",
"a",
"string",
"paying",
"mind",
"to",
"python3",
"vs",
"2"
] | a6f07919f457a282fe240adad9d2c30906b71a15 | https://github.com/esheldon/fitsio/blob/a6f07919f457a282fe240adad9d2c30906b71a15/fitsio/util.py#L143-L155 | train |
esheldon/fitsio | fitsio/hdu/table.py | _get_col_dimstr | def _get_col_dimstr(tdim, is_string=False):
"""
not for variable length
"""
dimstr = ''
if tdim is None:
dimstr = 'array[bad TDIM]'
else:
if is_string:
if len(tdim) > 1:
dimstr = [str(d) for d in tdim[1:]]
else:
if len(tdim) > 1 or ... | python | def _get_col_dimstr(tdim, is_string=False):
"""
not for variable length
"""
dimstr = ''
if tdim is None:
dimstr = 'array[bad TDIM]'
else:
if is_string:
if len(tdim) > 1:
dimstr = [str(d) for d in tdim[1:]]
else:
if len(tdim) > 1 or ... | [
"def",
"_get_col_dimstr",
"(",
"tdim",
",",
"is_string",
"=",
"False",
")",
":",
"dimstr",
"=",
"''",
"if",
"tdim",
"is",
"None",
":",
"dimstr",
"=",
"'array[bad TDIM]'",
"else",
":",
"if",
"is_string",
":",
"if",
"len",
"(",
"tdim",
")",
">",
"1",
"... | not for variable length | [
"not",
"for",
"variable",
"length"
] | a6f07919f457a282fe240adad9d2c30906b71a15 | https://github.com/esheldon/fitsio/blob/a6f07919f457a282fe240adad9d2c30906b71a15/fitsio/hdu/table.py#L2019-L2037 | train |
esheldon/fitsio | fitsio/hdu/table.py | TableHDU.get_colname | def get_colname(self, colnum):
"""
Get the name associated with the given column number
parameters
----------
colnum: integer
The number for the column, zero offset
"""
if colnum < 0 or colnum > (len(self._colnames)-1):
raise ValueError(
... | python | def get_colname(self, colnum):
"""
Get the name associated with the given column number
parameters
----------
colnum: integer
The number for the column, zero offset
"""
if colnum < 0 or colnum > (len(self._colnames)-1):
raise ValueError(
... | [
"def",
"get_colname",
"(",
"self",
",",
"colnum",
")",
":",
"if",
"colnum",
"<",
"0",
"or",
"colnum",
">",
"(",
"len",
"(",
"self",
".",
"_colnames",
")",
"-",
"1",
")",
":",
"raise",
"ValueError",
"(",
"\"colnum out of range [0,%s-1]\"",
"%",
"(",
"0"... | Get the name associated with the given column number
parameters
----------
colnum: integer
The number for the column, zero offset | [
"Get",
"the",
"name",
"associated",
"with",
"the",
"given",
"column",
"number"
] | a6f07919f457a282fe240adad9d2c30906b71a15 | https://github.com/esheldon/fitsio/blob/a6f07919f457a282fe240adad9d2c30906b71a15/fitsio/hdu/table.py#L84-L96 | train |
esheldon/fitsio | fitsio/hdu/table.py | TableHDU.write_column | def write_column(self, column, data, **keys):
"""
Write data to a column in this HDU
This HDU must be a table HDU.
parameters
----------
column: scalar string/integer
The column in which to write. Can be the name or number (0 offset)
column: ndarray... | python | def write_column(self, column, data, **keys):
"""
Write data to a column in this HDU
This HDU must be a table HDU.
parameters
----------
column: scalar string/integer
The column in which to write. Can be the name or number (0 offset)
column: ndarray... | [
"def",
"write_column",
"(",
"self",
",",
"column",
",",
"data",
",",
"**",
"keys",
")",
":",
"firstrow",
"=",
"keys",
".",
"get",
"(",
"'firstrow'",
",",
"0",
")",
"colnum",
"=",
"self",
".",
"_extract_colnum",
"(",
"column",
")",
"if",
"not",
"data"... | Write data to a column in this HDU
This HDU must be a table HDU.
parameters
----------
column: scalar string/integer
The column in which to write. Can be the name or number (0 offset)
column: ndarray
Numerical python array to write. This should match t... | [
"Write",
"data",
"to",
"a",
"column",
"in",
"this",
"HDU"
] | a6f07919f457a282fe240adad9d2c30906b71a15 | https://github.com/esheldon/fitsio/blob/a6f07919f457a282fe240adad9d2c30906b71a15/fitsio/hdu/table.py#L242-L290 | train |
esheldon/fitsio | fitsio/hdu/table.py | TableHDU._verify_column_data | def _verify_column_data(self, colnum, data):
"""
verify the input data is of the correct type and shape
"""
this_dt = data.dtype.descr[0]
if len(data.shape) > 2:
this_shape = data.shape[1:]
elif len(data.shape) == 2 and data.shape[1] > 1:
this_sha... | python | def _verify_column_data(self, colnum, data):
"""
verify the input data is of the correct type and shape
"""
this_dt = data.dtype.descr[0]
if len(data.shape) > 2:
this_shape = data.shape[1:]
elif len(data.shape) == 2 and data.shape[1] > 1:
this_sha... | [
"def",
"_verify_column_data",
"(",
"self",
",",
"colnum",
",",
"data",
")",
":",
"this_dt",
"=",
"data",
".",
"dtype",
".",
"descr",
"[",
"0",
"]",
"if",
"len",
"(",
"data",
".",
"shape",
")",
">",
"2",
":",
"this_shape",
"=",
"data",
".",
"shape",... | verify the input data is of the correct type and shape | [
"verify",
"the",
"input",
"data",
"is",
"of",
"the",
"correct",
"type",
"and",
"shape"
] | a6f07919f457a282fe240adad9d2c30906b71a15 | https://github.com/esheldon/fitsio/blob/a6f07919f457a282fe240adad9d2c30906b71a15/fitsio/hdu/table.py#L292-L356 | train |
esheldon/fitsio | fitsio/hdu/table.py | TableHDU.write_var_column | def write_var_column(self, column, data, firstrow=0, **keys):
"""
Write data to a variable-length column in this HDU
This HDU must be a table HDU.
parameters
----------
column: scalar string/integer
The column in which to write. Can be the name or number (0... | python | def write_var_column(self, column, data, firstrow=0, **keys):
"""
Write data to a variable-length column in this HDU
This HDU must be a table HDU.
parameters
----------
column: scalar string/integer
The column in which to write. Can be the name or number (0... | [
"def",
"write_var_column",
"(",
"self",
",",
"column",
",",
"data",
",",
"firstrow",
"=",
"0",
",",
"**",
"keys",
")",
":",
"if",
"not",
"is_object",
"(",
"data",
")",
":",
"raise",
"ValueError",
"(",
"\"Only object fields can be written to \"",
"\"variable-le... | Write data to a variable-length column in this HDU
This HDU must be a table HDU.
parameters
----------
column: scalar string/integer
The column in which to write. Can be the name or number (0 offset)
column: ndarray
Numerical python array to write. Thi... | [
"Write",
"data",
"to",
"a",
"variable",
"-",
"length",
"column",
"in",
"this",
"HDU"
] | a6f07919f457a282fe240adad9d2c30906b71a15 | https://github.com/esheldon/fitsio/blob/a6f07919f457a282fe240adad9d2c30906b71a15/fitsio/hdu/table.py#L358-L382 | train |
esheldon/fitsio | fitsio/hdu/table.py | TableHDU.insert_column | def insert_column(self, name, data, colnum=None):
"""
Insert a new column.
parameters
----------
name: string
The column name
data:
The data to write into the new column.
colnum: int, optional
The column number for the new colu... | python | def insert_column(self, name, data, colnum=None):
"""
Insert a new column.
parameters
----------
name: string
The column name
data:
The data to write into the new column.
colnum: int, optional
The column number for the new colu... | [
"def",
"insert_column",
"(",
"self",
",",
"name",
",",
"data",
",",
"colnum",
"=",
"None",
")",
":",
"if",
"name",
"in",
"self",
".",
"_colnames",
":",
"raise",
"ValueError",
"(",
"\"column '%s' already exists\"",
"%",
"name",
")",
"if",
"IS_PY3",
"and",
... | Insert a new column.
parameters
----------
name: string
The column name
data:
The data to write into the new column.
colnum: int, optional
The column number for the new column, zero-offset. Default
is to add the new column after t... | [
"Insert",
"a",
"new",
"column",
"."
] | a6f07919f457a282fe240adad9d2c30906b71a15 | https://github.com/esheldon/fitsio/blob/a6f07919f457a282fe240adad9d2c30906b71a15/fitsio/hdu/table.py#L384-L439 | train |
esheldon/fitsio | fitsio/hdu/table.py | TableHDU.append | def append(self, data, **keys):
"""
Append new rows to a table HDU
parameters
----------
data: ndarray or list of arrays
A numerical python array with fields (recarray) or a list of
arrays. Should have the same fields as the existing table. If only
... | python | def append(self, data, **keys):
"""
Append new rows to a table HDU
parameters
----------
data: ndarray or list of arrays
A numerical python array with fields (recarray) or a list of
arrays. Should have the same fields as the existing table. If only
... | [
"def",
"append",
"(",
"self",
",",
"data",
",",
"**",
"keys",
")",
":",
"firstrow",
"=",
"self",
".",
"_info",
"[",
"'nrows'",
"]",
"keys",
"[",
"'firstrow'",
"]",
"=",
"firstrow",
"self",
".",
"write",
"(",
"data",
",",
"**",
"keys",
")"
] | Append new rows to a table HDU
parameters
----------
data: ndarray or list of arrays
A numerical python array with fields (recarray) or a list of
arrays. Should have the same fields as the existing table. If only
a subset of the table columns are present, t... | [
"Append",
"new",
"rows",
"to",
"a",
"table",
"HDU"
] | a6f07919f457a282fe240adad9d2c30906b71a15 | https://github.com/esheldon/fitsio/blob/a6f07919f457a282fe240adad9d2c30906b71a15/fitsio/hdu/table.py#L441-L462 | train |
esheldon/fitsio | fitsio/hdu/table.py | TableHDU.delete_rows | def delete_rows(self, rows):
"""
Delete rows from the table
parameters
----------
rows: sequence or slice
The exact rows to delete as a sequence, or a slice.
examples
--------
# delete a range of rows
with fitsio.FITS(fname,'r... | python | def delete_rows(self, rows):
"""
Delete rows from the table
parameters
----------
rows: sequence or slice
The exact rows to delete as a sequence, or a slice.
examples
--------
# delete a range of rows
with fitsio.FITS(fname,'r... | [
"def",
"delete_rows",
"(",
"self",
",",
"rows",
")",
":",
"if",
"rows",
"is",
"None",
":",
"return",
"if",
"isinstance",
"(",
"rows",
",",
"slice",
")",
":",
"rows",
"=",
"self",
".",
"_process_slice",
"(",
"rows",
")",
"if",
"rows",
".",
"step",
"... | Delete rows from the table
parameters
----------
rows: sequence or slice
The exact rows to delete as a sequence, or a slice.
examples
--------
# delete a range of rows
with fitsio.FITS(fname,'rw') as fits:
fits['mytable'].dele... | [
"Delete",
"rows",
"from",
"the",
"table"
] | a6f07919f457a282fe240adad9d2c30906b71a15 | https://github.com/esheldon/fitsio/blob/a6f07919f457a282fe240adad9d2c30906b71a15/fitsio/hdu/table.py#L464-L513 | train |
esheldon/fitsio | fitsio/hdu/table.py | TableHDU.resize | def resize(self, nrows, front=False):
"""
Resize the table to the given size, removing or adding rows as
necessary. Note if expanding the table at the end, it is more
efficient to use the append function than resizing and then
writing.
New added rows are zerod, except f... | python | def resize(self, nrows, front=False):
"""
Resize the table to the given size, removing or adding rows as
necessary. Note if expanding the table at the end, it is more
efficient to use the append function than resizing and then
writing.
New added rows are zerod, except f... | [
"def",
"resize",
"(",
"self",
",",
"nrows",
",",
"front",
"=",
"False",
")",
":",
"nrows_current",
"=",
"self",
".",
"get_nrows",
"(",
")",
"if",
"nrows",
"==",
"nrows_current",
":",
"return",
"if",
"nrows",
"<",
"nrows_current",
":",
"rowdiff",
"=",
"... | Resize the table to the given size, removing or adding rows as
necessary. Note if expanding the table at the end, it is more
efficient to use the append function than resizing and then
writing.
New added rows are zerod, except for 'i1', 'u2' and 'u4' data types
which get -128,3... | [
"Resize",
"the",
"table",
"to",
"the",
"given",
"size",
"removing",
"or",
"adding",
"rows",
"as",
"necessary",
".",
"Note",
"if",
"expanding",
"the",
"table",
"at",
"the",
"end",
"it",
"is",
"more",
"efficient",
"to",
"use",
"the",
"append",
"function",
... | a6f07919f457a282fe240adad9d2c30906b71a15 | https://github.com/esheldon/fitsio/blob/a6f07919f457a282fe240adad9d2c30906b71a15/fitsio/hdu/table.py#L515-L560 | train |
esheldon/fitsio | fitsio/hdu/table.py | TableHDU.read | def read(self, **keys):
"""
read data from this HDU
By default, all data are read.
send columns= and rows= to select subsets of the data.
Table data are read into a recarray; use read_column() to get a single
column as an ordinary array. You can alternatively use slice... | python | def read(self, **keys):
"""
read data from this HDU
By default, all data are read.
send columns= and rows= to select subsets of the data.
Table data are read into a recarray; use read_column() to get a single
column as an ordinary array. You can alternatively use slice... | [
"def",
"read",
"(",
"self",
",",
"**",
"keys",
")",
":",
"columns",
"=",
"keys",
".",
"get",
"(",
"'columns'",
",",
"None",
")",
"rows",
"=",
"keys",
".",
"get",
"(",
"'rows'",
",",
"None",
")",
"if",
"columns",
"is",
"not",
"None",
":",
"if",
... | read data from this HDU
By default, all data are read.
send columns= and rows= to select subsets of the data.
Table data are read into a recarray; use read_column() to get a single
column as an ordinary array. You can alternatively use slice notation
fits=fitsio.FITS(filen... | [
"read",
"data",
"from",
"this",
"HDU"
] | a6f07919f457a282fe240adad9d2c30906b71a15 | https://github.com/esheldon/fitsio/blob/a6f07919f457a282fe240adad9d2c30906b71a15/fitsio/hdu/table.py#L562-L606 | train |
esheldon/fitsio | fitsio/hdu/table.py | TableHDU._read_all | def _read_all(self, **keys):
"""
Read all data in the HDU.
parameters
----------
vstorage: string, optional
Over-ride the default method to store variable length columns. Can
be 'fixed' or 'object'. See docs on fitsio.FITS for details.
lower: bo... | python | def _read_all(self, **keys):
"""
Read all data in the HDU.
parameters
----------
vstorage: string, optional
Over-ride the default method to store variable length columns. Can
be 'fixed' or 'object'. See docs on fitsio.FITS for details.
lower: bo... | [
"def",
"_read_all",
"(",
"self",
",",
"**",
"keys",
")",
":",
"dtype",
",",
"offsets",
",",
"isvar",
"=",
"self",
".",
"get_rec_dtype",
"(",
"**",
"keys",
")",
"w",
",",
"=",
"numpy",
".",
"where",
"(",
"isvar",
"==",
"True",
")",
"has_tbit",
"=",
... | Read all data in the HDU.
parameters
----------
vstorage: string, optional
Over-ride the default method to store variable length columns. Can
be 'fixed' or 'object'. See docs on fitsio.FITS for details.
lower: bool, optional
If True, force all colum... | [
"Read",
"all",
"data",
"in",
"the",
"HDU",
"."
] | a6f07919f457a282fe240adad9d2c30906b71a15 | https://github.com/esheldon/fitsio/blob/a6f07919f457a282fe240adad9d2c30906b71a15/fitsio/hdu/table.py#L608-L665 | train |
esheldon/fitsio | fitsio/hdu/table.py | TableHDU.read_column | def read_column(self, col, **keys):
"""
Read the specified column
Alternatively, you can use slice notation
fits=fitsio.FITS(filename)
fits[ext][colname][:]
fits[ext][colname][2:5]
fits[ext][colname][200:235:2]
fits[ext][colname][rows]... | python | def read_column(self, col, **keys):
"""
Read the specified column
Alternatively, you can use slice notation
fits=fitsio.FITS(filename)
fits[ext][colname][:]
fits[ext][colname][2:5]
fits[ext][colname][200:235:2]
fits[ext][colname][rows]... | [
"def",
"read_column",
"(",
"self",
",",
"col",
",",
"**",
"keys",
")",
":",
"res",
"=",
"self",
".",
"read_columns",
"(",
"[",
"col",
"]",
",",
"**",
"keys",
")",
"colname",
"=",
"res",
".",
"dtype",
".",
"names",
"[",
"0",
"]",
"data",
"=",
"r... | Read the specified column
Alternatively, you can use slice notation
fits=fitsio.FITS(filename)
fits[ext][colname][:]
fits[ext][colname][2:5]
fits[ext][colname][200:235:2]
fits[ext][colname][rows]
Note, if reading multiple columns, it is more ... | [
"Read",
"the",
"specified",
"column"
] | a6f07919f457a282fe240adad9d2c30906b71a15 | https://github.com/esheldon/fitsio/blob/a6f07919f457a282fe240adad9d2c30906b71a15/fitsio/hdu/table.py#L667-L697 | train |
esheldon/fitsio | fitsio/hdu/table.py | TableHDU.read_rows | def read_rows(self, rows, **keys):
"""
Read the specified rows.
parameters
----------
rows: list,array
A list or array of row indices.
vstorage: string, optional
Over-ride the default method to store variable length columns. Can
be 'f... | python | def read_rows(self, rows, **keys):
"""
Read the specified rows.
parameters
----------
rows: list,array
A list or array of row indices.
vstorage: string, optional
Over-ride the default method to store variable length columns. Can
be 'f... | [
"def",
"read_rows",
"(",
"self",
",",
"rows",
",",
"**",
"keys",
")",
":",
"if",
"rows",
"is",
"None",
":",
"return",
"self",
".",
"_read_all",
"(",
")",
"if",
"self",
".",
"_info",
"[",
"'hdutype'",
"]",
"==",
"ASCII_TBL",
":",
"keys",
"[",
"'rows... | Read the specified rows.
parameters
----------
rows: list,array
A list or array of row indices.
vstorage: string, optional
Over-ride the default method to store variable length columns. Can
be 'fixed' or 'object'. See docs on fitsio.FITS for details... | [
"Read",
"the",
"specified",
"rows",
"."
] | a6f07919f457a282fe240adad9d2c30906b71a15 | https://github.com/esheldon/fitsio/blob/a6f07919f457a282fe240adad9d2c30906b71a15/fitsio/hdu/table.py#L699-L756 | train |
esheldon/fitsio | fitsio/hdu/table.py | TableHDU.read_columns | def read_columns(self, columns, **keys):
"""
read a subset of columns from this binary table HDU
By default, all rows are read. Send rows= to select subsets of the
data. Table data are read into a recarray for multiple columns,
plain array for a single column.
paramet... | python | def read_columns(self, columns, **keys):
"""
read a subset of columns from this binary table HDU
By default, all rows are read. Send rows= to select subsets of the
data. Table data are read into a recarray for multiple columns,
plain array for a single column.
paramet... | [
"def",
"read_columns",
"(",
"self",
",",
"columns",
",",
"**",
"keys",
")",
":",
"if",
"self",
".",
"_info",
"[",
"'hdutype'",
"]",
"==",
"ASCII_TBL",
":",
"keys",
"[",
"'columns'",
"]",
"=",
"columns",
"return",
"self",
".",
"read",
"(",
"**",
"keys... | read a subset of columns from this binary table HDU
By default, all rows are read. Send rows= to select subsets of the
data. Table data are read into a recarray for multiple columns,
plain array for a single column.
parameters
----------
columns: list/array
... | [
"read",
"a",
"subset",
"of",
"columns",
"from",
"this",
"binary",
"table",
"HDU"
] | a6f07919f457a282fe240adad9d2c30906b71a15 | https://github.com/esheldon/fitsio/blob/a6f07919f457a282fe240adad9d2c30906b71a15/fitsio/hdu/table.py#L758-L845 | train |
esheldon/fitsio | fitsio/hdu/table.py | TableHDU.read_slice | def read_slice(self, firstrow, lastrow, step=1, **keys):
"""
Read the specified row slice from a table.
Read all rows between firstrow and lastrow (non-inclusive, as per
python slice notation). Note you must use slice notation for
images, e.g. f[ext][20:30, 40:50]
para... | python | def read_slice(self, firstrow, lastrow, step=1, **keys):
"""
Read the specified row slice from a table.
Read all rows between firstrow and lastrow (non-inclusive, as per
python slice notation). Note you must use slice notation for
images, e.g. f[ext][20:30, 40:50]
para... | [
"def",
"read_slice",
"(",
"self",
",",
"firstrow",
",",
"lastrow",
",",
"step",
"=",
"1",
",",
"**",
"keys",
")",
":",
"if",
"self",
".",
"_info",
"[",
"'hdutype'",
"]",
"==",
"ASCII_TBL",
":",
"rows",
"=",
"numpy",
".",
"arange",
"(",
"firstrow",
... | Read the specified row slice from a table.
Read all rows between firstrow and lastrow (non-inclusive, as per
python slice notation). Note you must use slice notation for
images, e.g. f[ext][20:30, 40:50]
parameters
----------
firstrow: integer
The first row... | [
"Read",
"the",
"specified",
"row",
"slice",
"from",
"a",
"table",
"."
] | a6f07919f457a282fe240adad9d2c30906b71a15 | https://github.com/esheldon/fitsio/blob/a6f07919f457a282fe240adad9d2c30906b71a15/fitsio/hdu/table.py#L847-L931 | train |
esheldon/fitsio | fitsio/hdu/table.py | TableHDU.get_rec_dtype | def get_rec_dtype(self, **keys):
"""
Get the dtype for the specified columns
parameters
----------
colnums: integer array
The column numbers, 0 offset
vstorage: string, optional
See docs in read_columns
"""
colnums = keys.get('coln... | python | def get_rec_dtype(self, **keys):
"""
Get the dtype for the specified columns
parameters
----------
colnums: integer array
The column numbers, 0 offset
vstorage: string, optional
See docs in read_columns
"""
colnums = keys.get('coln... | [
"def",
"get_rec_dtype",
"(",
"self",
",",
"**",
"keys",
")",
":",
"colnums",
"=",
"keys",
".",
"get",
"(",
"'colnums'",
",",
"None",
")",
"vstorage",
"=",
"keys",
".",
"get",
"(",
"'vstorage'",
",",
"self",
".",
"_vstorage",
")",
"if",
"colnums",
"is... | Get the dtype for the specified columns
parameters
----------
colnums: integer array
The column numbers, 0 offset
vstorage: string, optional
See docs in read_columns | [
"Get",
"the",
"dtype",
"for",
"the",
"specified",
"columns"
] | a6f07919f457a282fe240adad9d2c30906b71a15 | https://github.com/esheldon/fitsio/blob/a6f07919f457a282fe240adad9d2c30906b71a15/fitsio/hdu/table.py#L933-L961 | train |
esheldon/fitsio | fitsio/hdu/table.py | TableHDU._check_tbit | def _check_tbit(self, **keys):
"""
Check if one of the columns is a TBIT column
parameters
----------
colnums: integer array, optional
"""
colnums = keys.get('colnums', None)
if colnums is None:
colnums = self._extract_colnums()
has_... | python | def _check_tbit(self, **keys):
"""
Check if one of the columns is a TBIT column
parameters
----------
colnums: integer array, optional
"""
colnums = keys.get('colnums', None)
if colnums is None:
colnums = self._extract_colnums()
has_... | [
"def",
"_check_tbit",
"(",
"self",
",",
"**",
"keys",
")",
":",
"colnums",
"=",
"keys",
".",
"get",
"(",
"'colnums'",
",",
"None",
")",
"if",
"colnums",
"is",
"None",
":",
"colnums",
"=",
"self",
".",
"_extract_colnums",
"(",
")",
"has_tbit",
"=",
"F... | Check if one of the columns is a TBIT column
parameters
----------
colnums: integer array, optional | [
"Check",
"if",
"one",
"of",
"the",
"columns",
"is",
"a",
"TBIT",
"column"
] | a6f07919f457a282fe240adad9d2c30906b71a15 | https://github.com/esheldon/fitsio/blob/a6f07919f457a282fe240adad9d2c30906b71a15/fitsio/hdu/table.py#L963-L983 | train |
esheldon/fitsio | fitsio/hdu/table.py | TableHDU._fix_tbit_dtype | def _fix_tbit_dtype(self, array, colnums):
"""
If necessary, patch up the TBIT to convert to bool array
parameters
----------
array: record array
colnums: column numbers for lookup
"""
descr = array.dtype.descr
for i, colnum in enumerate(colnums):... | python | def _fix_tbit_dtype(self, array, colnums):
"""
If necessary, patch up the TBIT to convert to bool array
parameters
----------
array: record array
colnums: column numbers for lookup
"""
descr = array.dtype.descr
for i, colnum in enumerate(colnums):... | [
"def",
"_fix_tbit_dtype",
"(",
"self",
",",
"array",
",",
"colnums",
")",
":",
"descr",
"=",
"array",
".",
"dtype",
".",
"descr",
"for",
"i",
",",
"colnum",
"in",
"enumerate",
"(",
"colnums",
")",
":",
"npy_type",
",",
"isvar",
",",
"istbit",
"=",
"s... | If necessary, patch up the TBIT to convert to bool array
parameters
----------
array: record array
colnums: column numbers for lookup | [
"If",
"necessary",
"patch",
"up",
"the",
"TBIT",
"to",
"convert",
"to",
"bool",
"array"
] | a6f07919f457a282fe240adad9d2c30906b71a15 | https://github.com/esheldon/fitsio/blob/a6f07919f457a282fe240adad9d2c30906b71a15/fitsio/hdu/table.py#L985-L1002 | train |
esheldon/fitsio | fitsio/hdu/table.py | TableHDU._get_simple_dtype_and_shape | def _get_simple_dtype_and_shape(self, colnum, rows=None):
"""
When reading a single column, we want the basic data
type and the shape of the array.
for scalar columns, shape is just nrows, otherwise
it is (nrows, dim1, dim2)
Note if rows= is sent and only a single row i... | python | def _get_simple_dtype_and_shape(self, colnum, rows=None):
"""
When reading a single column, we want the basic data
type and the shape of the array.
for scalar columns, shape is just nrows, otherwise
it is (nrows, dim1, dim2)
Note if rows= is sent and only a single row i... | [
"def",
"_get_simple_dtype_and_shape",
"(",
"self",
",",
"colnum",
",",
"rows",
"=",
"None",
")",
":",
"npy_type",
",",
"isvar",
",",
"istbit",
"=",
"self",
".",
"_get_tbl_numpy_dtype",
"(",
"colnum",
")",
"info",
"=",
"self",
".",
"_info",
"[",
"'colinfo'"... | When reading a single column, we want the basic data
type and the shape of the array.
for scalar columns, shape is just nrows, otherwise
it is (nrows, dim1, dim2)
Note if rows= is sent and only a single row is requested,
the shape will be (dim2,dim2) | [
"When",
"reading",
"a",
"single",
"column",
"we",
"want",
"the",
"basic",
"data",
"type",
"and",
"the",
"shape",
"of",
"the",
"array",
"."
] | a6f07919f457a282fe240adad9d2c30906b71a15 | https://github.com/esheldon/fitsio/blob/a6f07919f457a282fe240adad9d2c30906b71a15/fitsio/hdu/table.py#L1004-L1041 | train |
esheldon/fitsio | fitsio/hdu/table.py | TableHDU.get_rec_column_descr | def get_rec_column_descr(self, colnum, vstorage):
"""
Get a descriptor entry for the specified column.
parameters
----------
colnum: integer
The column number, 0 offset
vstorage: string
See docs in read_columns
"""
npy_type, isvar,... | python | def get_rec_column_descr(self, colnum, vstorage):
"""
Get a descriptor entry for the specified column.
parameters
----------
colnum: integer
The column number, 0 offset
vstorage: string
See docs in read_columns
"""
npy_type, isvar,... | [
"def",
"get_rec_column_descr",
"(",
"self",
",",
"colnum",
",",
"vstorage",
")",
":",
"npy_type",
",",
"isvar",
",",
"istbit",
"=",
"self",
".",
"_get_tbl_numpy_dtype",
"(",
"colnum",
")",
"name",
"=",
"self",
".",
"_info",
"[",
"'colinfo'",
"]",
"[",
"c... | Get a descriptor entry for the specified column.
parameters
----------
colnum: integer
The column number, 0 offset
vstorage: string
See docs in read_columns | [
"Get",
"a",
"descriptor",
"entry",
"for",
"the",
"specified",
"column",
"."
] | a6f07919f457a282fe240adad9d2c30906b71a15 | https://github.com/esheldon/fitsio/blob/a6f07919f457a282fe240adad9d2c30906b71a15/fitsio/hdu/table.py#L1043-L1100 | train |
esheldon/fitsio | fitsio/hdu/table.py | TableHDU._read_rec_with_var | def _read_rec_with_var(
self, colnums, rows, dtype, offsets, isvar, vstorage):
"""
Read columns from a table into a rec array, including variable length
columns. This is special because, for efficiency, it involves reading
from the main table as normal but skipping the colum... | python | def _read_rec_with_var(
self, colnums, rows, dtype, offsets, isvar, vstorage):
"""
Read columns from a table into a rec array, including variable length
columns. This is special because, for efficiency, it involves reading
from the main table as normal but skipping the colum... | [
"def",
"_read_rec_with_var",
"(",
"self",
",",
"colnums",
",",
"rows",
",",
"dtype",
",",
"offsets",
",",
"isvar",
",",
"vstorage",
")",
":",
"colnumsp",
"=",
"colnums",
"+",
"1",
"if",
"rows",
"is",
"None",
":",
"nrows",
"=",
"self",
".",
"_info",
"... | Read columns from a table into a rec array, including variable length
columns. This is special because, for efficiency, it involves reading
from the main table as normal but skipping the columns in the array
that are variable. Then reading the variable length columns, with
accounting f... | [
"Read",
"columns",
"from",
"a",
"table",
"into",
"a",
"rec",
"array",
"including",
"variable",
"length",
"columns",
".",
"This",
"is",
"special",
"because",
"for",
"efficiency",
"it",
"involves",
"reading",
"from",
"the",
"main",
"table",
"as",
"normal",
"bu... | a6f07919f457a282fe240adad9d2c30906b71a15 | https://github.com/esheldon/fitsio/blob/a6f07919f457a282fe240adad9d2c30906b71a15/fitsio/hdu/table.py#L1102-L1188 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.