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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
ladybug-tools/ladybug | ladybug/analysisperiod.py | AnalysisPeriod.is_time_included | def is_time_included(self, time):
"""Check if time is included in analysis period.
Return True if time is inside this analysis period,
otherwise return False
Args:
time: A DateTime to be tested
Returns:
A boolean. True if time is included in analysis pe... | python | def is_time_included(self, time):
"""Check if time is included in analysis period.
Return True if time is inside this analysis period,
otherwise return False
Args:
time: A DateTime to be tested
Returns:
A boolean. True if time is included in analysis pe... | [
"def",
"is_time_included",
"(",
"self",
",",
"time",
")",
":",
"if",
"self",
".",
"_timestamps_data",
"is",
"None",
":",
"self",
".",
"_calculate_timestamps",
"(",
")",
"return",
"time",
".",
"moy",
"in",
"self",
".",
"_timestamps_data"
] | Check if time is included in analysis period.
Return True if time is inside this analysis period,
otherwise return False
Args:
time: A DateTime to be tested
Returns:
A boolean. True if time is included in analysis period | [
"Check",
"if",
"time",
"is",
"included",
"in",
"analysis",
"period",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/analysisperiod.py#L357-L375 | train |
ladybug-tools/ladybug | ladybug/analysisperiod.py | AnalysisPeriod.duplicate | def duplicate(self):
"""Return a copy of the analysis period."""
return AnalysisPeriod(self.st_month, self.st_day, self.st_hour,
self.end_month, self.end_day, self.end_hour,
self.timestep, self.is_leap_year) | python | def duplicate(self):
"""Return a copy of the analysis period."""
return AnalysisPeriod(self.st_month, self.st_day, self.st_hour,
self.end_month, self.end_day, self.end_hour,
self.timestep, self.is_leap_year) | [
"def",
"duplicate",
"(",
"self",
")",
":",
"return",
"AnalysisPeriod",
"(",
"self",
".",
"st_month",
",",
"self",
".",
"st_day",
",",
"self",
".",
"st_hour",
",",
"self",
".",
"end_month",
",",
"self",
".",
"end_day",
",",
"self",
".",
"end_hour",
",",... | Return a copy of the analysis period. | [
"Return",
"a",
"copy",
"of",
"the",
"analysis",
"period",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/analysisperiod.py#L377-L381 | train |
ladybug-tools/ladybug | ladybug/analysisperiod.py | AnalysisPeriod.to_json | def to_json(self):
"""Convert the analysis period to a dictionary."""
return {
'st_month': self.st_month,
'st_day': self.st_day,
'st_hour': self.st_hour,
'end_month': self.end_month,
'end_day': self.end_day,
'end_hour': self.end_hou... | python | def to_json(self):
"""Convert the analysis period to a dictionary."""
return {
'st_month': self.st_month,
'st_day': self.st_day,
'st_hour': self.st_hour,
'end_month': self.end_month,
'end_day': self.end_day,
'end_hour': self.end_hou... | [
"def",
"to_json",
"(",
"self",
")",
":",
"return",
"{",
"'st_month'",
":",
"self",
".",
"st_month",
",",
"'st_day'",
":",
"self",
".",
"st_day",
",",
"'st_hour'",
":",
"self",
".",
"st_hour",
",",
"'end_month'",
":",
"self",
".",
"end_month",
",",
"'en... | Convert the analysis period to a dictionary. | [
"Convert",
"the",
"analysis",
"period",
"to",
"a",
"dictionary",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/analysisperiod.py#L383-L394 | train |
ladybug-tools/ladybug | ladybug/analysisperiod.py | AnalysisPeriod._calc_timestamps | def _calc_timestamps(self, st_time, end_time):
"""Calculate timesteps between start time and end time.
Use this method only when start time month is before end time month.
"""
# calculate based on minutes
# I have to convert the object to DateTime because of how Dynamo
#... | python | def _calc_timestamps(self, st_time, end_time):
"""Calculate timesteps between start time and end time.
Use this method only when start time month is before end time month.
"""
# calculate based on minutes
# I have to convert the object to DateTime because of how Dynamo
#... | [
"def",
"_calc_timestamps",
"(",
"self",
",",
"st_time",
",",
"end_time",
")",
":",
"curr",
"=",
"datetime",
"(",
"st_time",
".",
"year",
",",
"st_time",
".",
"month",
",",
"st_time",
".",
"day",
",",
"st_time",
".",
"hour",
",",
"st_time",
".",
"minute... | Calculate timesteps between start time and end time.
Use this method only when start time month is before end time month. | [
"Calculate",
"timesteps",
"between",
"start",
"time",
"and",
"end",
"time",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/analysisperiod.py#L396-L425 | train |
ladybug-tools/ladybug | ladybug/analysisperiod.py | AnalysisPeriod._calculate_timestamps | def _calculate_timestamps(self):
"""Return a list of Ladybug DateTime in this analysis period."""
self._timestamps_data = []
if not self._is_reversed:
self._calc_timestamps(self.st_time, self.end_time)
else:
self._calc_timestamps(self.st_time, DateTime.from_hoy(87... | python | def _calculate_timestamps(self):
"""Return a list of Ladybug DateTime in this analysis period."""
self._timestamps_data = []
if not self._is_reversed:
self._calc_timestamps(self.st_time, self.end_time)
else:
self._calc_timestamps(self.st_time, DateTime.from_hoy(87... | [
"def",
"_calculate_timestamps",
"(",
"self",
")",
":",
"self",
".",
"_timestamps_data",
"=",
"[",
"]",
"if",
"not",
"self",
".",
"_is_reversed",
":",
"self",
".",
"_calc_timestamps",
"(",
"self",
".",
"st_time",
",",
"self",
".",
"end_time",
")",
"else",
... | Return a list of Ladybug DateTime in this analysis period. | [
"Return",
"a",
"list",
"of",
"Ladybug",
"DateTime",
"in",
"this",
"analysis",
"period",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/analysisperiod.py#L427-L434 | train |
ladybug-tools/ladybug | ladybug/analysisperiod.py | AnalysisPeriod._calc_daystamps | def _calc_daystamps(self, st_time, end_time):
"""Calculate days of the year between start time and end time.
Use this method only when start time month is before end time month.
"""
start_doy = sum(self._num_of_days_each_month[:st_time.month-1]) + st_time.day
end_doy = sum(self.... | python | def _calc_daystamps(self, st_time, end_time):
"""Calculate days of the year between start time and end time.
Use this method only when start time month is before end time month.
"""
start_doy = sum(self._num_of_days_each_month[:st_time.month-1]) + st_time.day
end_doy = sum(self.... | [
"def",
"_calc_daystamps",
"(",
"self",
",",
"st_time",
",",
"end_time",
")",
":",
"start_doy",
"=",
"sum",
"(",
"self",
".",
"_num_of_days_each_month",
"[",
":",
"st_time",
".",
"month",
"-",
"1",
"]",
")",
"+",
"st_time",
".",
"day",
"end_doy",
"=",
"... | Calculate days of the year between start time and end time.
Use this method only when start time month is before end time month. | [
"Calculate",
"days",
"of",
"the",
"year",
"between",
"start",
"time",
"and",
"end",
"time",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/analysisperiod.py#L436-L443 | train |
ladybug-tools/ladybug | ladybug/wea.py | Wea.from_values | def from_values(cls, location, direct_normal_irradiance,
diffuse_horizontal_irradiance, timestep=1, is_leap_year=False):
"""Create wea from a list of irradiance values.
This method converts input lists to data collection.
"""
err_message = 'For timestep %d, %d number... | python | def from_values(cls, location, direct_normal_irradiance,
diffuse_horizontal_irradiance, timestep=1, is_leap_year=False):
"""Create wea from a list of irradiance values.
This method converts input lists to data collection.
"""
err_message = 'For timestep %d, %d number... | [
"def",
"from_values",
"(",
"cls",
",",
"location",
",",
"direct_normal_irradiance",
",",
"diffuse_horizontal_irradiance",
",",
"timestep",
"=",
"1",
",",
"is_leap_year",
"=",
"False",
")",
":",
"err_message",
"=",
"'For timestep %d, %d number of data for %s is expected. '... | Create wea from a list of irradiance values.
This method converts input lists to data collection. | [
"Create",
"wea",
"from",
"a",
"list",
"of",
"irradiance",
"values",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/wea.py#L69-L99 | train |
ladybug-tools/ladybug | ladybug/wea.py | Wea.from_file | def from_file(cls, weafile, timestep=1, is_leap_year=False):
"""Create wea object from a wea file.
Args:
weafile:Full path to wea file.
timestep: An optional integer to set the number of time steps per hour.
Default is 1 for one value per hour. If the wea file ha... | python | def from_file(cls, weafile, timestep=1, is_leap_year=False):
"""Create wea object from a wea file.
Args:
weafile:Full path to wea file.
timestep: An optional integer to set the number of time steps per hour.
Default is 1 for one value per hour. If the wea file ha... | [
"def",
"from_file",
"(",
"cls",
",",
"weafile",
",",
"timestep",
"=",
"1",
",",
"is_leap_year",
"=",
"False",
")",
":",
"assert",
"os",
".",
"path",
".",
"isfile",
"(",
"weafile",
")",
",",
"'Failed to find {}'",
".",
"format",
"(",
"weafile",
")",
"lo... | Create wea object from a wea file.
Args:
weafile:Full path to wea file.
timestep: An optional integer to set the number of time steps per hour.
Default is 1 for one value per hour. If the wea file has a time step
smaller than an hour adjust this input acc... | [
"Create",
"wea",
"object",
"from",
"a",
"wea",
"file",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/wea.py#L139-L174 | train |
ladybug-tools/ladybug | ladybug/wea.py | Wea.from_epw_file | def from_epw_file(cls, epwfile, timestep=1):
"""Create a wea object using the solar irradiance values in an epw file.
Args:
epwfile: Full path to epw weather file.
timestep: An optional integer to set the number of time steps per hour.
Default is 1 for one value ... | python | def from_epw_file(cls, epwfile, timestep=1):
"""Create a wea object using the solar irradiance values in an epw file.
Args:
epwfile: Full path to epw weather file.
timestep: An optional integer to set the number of time steps per hour.
Default is 1 for one value ... | [
"def",
"from_epw_file",
"(",
"cls",
",",
"epwfile",
",",
"timestep",
"=",
"1",
")",
":",
"is_leap_year",
"=",
"False",
"epw",
"=",
"EPW",
"(",
"epwfile",
")",
"direct_normal",
",",
"diffuse_horizontal",
"=",
"cls",
".",
"_get_data_collections",
"(",
"epw",
... | Create a wea object using the solar irradiance values in an epw file.
Args:
epwfile: Full path to epw weather file.
timestep: An optional integer to set the number of time steps per hour.
Default is 1 for one value per hour. Note that this input
will only... | [
"Create",
"a",
"wea",
"object",
"using",
"the",
"solar",
"irradiance",
"values",
"in",
"an",
"epw",
"file",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/wea.py#L177-L216 | train |
ladybug-tools/ladybug | ladybug/wea.py | Wea.from_stat_file | def from_stat_file(cls, statfile, timestep=1, is_leap_year=False):
"""Create an ASHRAE Revised Clear Sky wea object from the monthly sky
optical depths in a .stat file.
Args:
statfile: Full path to the .stat file.
timestep: An optional integer to set the number of time s... | python | def from_stat_file(cls, statfile, timestep=1, is_leap_year=False):
"""Create an ASHRAE Revised Clear Sky wea object from the monthly sky
optical depths in a .stat file.
Args:
statfile: Full path to the .stat file.
timestep: An optional integer to set the number of time s... | [
"def",
"from_stat_file",
"(",
"cls",
",",
"statfile",
",",
"timestep",
"=",
"1",
",",
"is_leap_year",
"=",
"False",
")",
":",
"stat",
"=",
"STAT",
"(",
"statfile",
")",
"def",
"check_missing",
"(",
"opt_data",
",",
"data_name",
")",
":",
"if",
"opt_data"... | Create an ASHRAE Revised Clear Sky wea object from the monthly sky
optical depths in a .stat file.
Args:
statfile: Full path to the .stat file.
timestep: An optional integer to set the number of time steps per
hour. Default is 1 for one value per hour.
... | [
"Create",
"an",
"ASHRAE",
"Revised",
"Clear",
"Sky",
"wea",
"object",
"from",
"the",
"monthly",
"sky",
"optical",
"depths",
"in",
"a",
".",
"stat",
"file",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/wea.py#L219-L247 | train |
ladybug-tools/ladybug | ladybug/wea.py | Wea.from_zhang_huang_solar | def from_zhang_huang_solar(cls, location, cloud_cover,
relative_humidity, dry_bulb_temperature,
wind_speed, atmospheric_pressure=None,
timestep=1, is_leap_year=False, use_disc=False):
"""Create a wea object from climate... | python | def from_zhang_huang_solar(cls, location, cloud_cover,
relative_humidity, dry_bulb_temperature,
wind_speed, atmospheric_pressure=None,
timestep=1, is_leap_year=False, use_disc=False):
"""Create a wea object from climate... | [
"def",
"from_zhang_huang_solar",
"(",
"cls",
",",
"location",
",",
"cloud_cover",
",",
"relative_humidity",
",",
"dry_bulb_temperature",
",",
"wind_speed",
",",
"atmospheric_pressure",
"=",
"None",
",",
"timestep",
"=",
"1",
",",
"is_leap_year",
"=",
"False",
",",... | Create a wea object from climate data using the Zhang-Huang model.
The Zhang-Huang solar model was developed to estimate solar
irradiance for weather stations that lack such values, which are
typically colleted with a pyranometer. Using total cloud cover,
dry-bulb temperature, relative ... | [
"Create",
"a",
"wea",
"object",
"from",
"climate",
"data",
"using",
"the",
"Zhang",
"-",
"Huang",
"model",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/wea.py#L357-L437 | train |
ladybug-tools/ladybug | ladybug/wea.py | Wea.datetimes | def datetimes(self):
"""Datetimes in wea file."""
if self.timestep == 1:
return tuple(dt.add_minute(30) for dt in
self.direct_normal_irradiance.datetimes)
else:
return self.direct_normal_irradiance.datetimes | python | def datetimes(self):
"""Datetimes in wea file."""
if self.timestep == 1:
return tuple(dt.add_minute(30) for dt in
self.direct_normal_irradiance.datetimes)
else:
return self.direct_normal_irradiance.datetimes | [
"def",
"datetimes",
"(",
"self",
")",
":",
"if",
"self",
".",
"timestep",
"==",
"1",
":",
"return",
"tuple",
"(",
"dt",
".",
"add_minute",
"(",
"30",
")",
"for",
"dt",
"in",
"self",
".",
"direct_normal_irradiance",
".",
"datetimes",
")",
"else",
":",
... | Datetimes in wea file. | [
"Datetimes",
"in",
"wea",
"file",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/wea.py#L450-L456 | train |
ladybug-tools/ladybug | ladybug/wea.py | Wea.global_horizontal_irradiance | def global_horizontal_irradiance(self):
"""Returns the global horizontal irradiance at each timestep."""
analysis_period = AnalysisPeriod(timestep=self.timestep,
is_leap_year=self.is_leap_year)
header_ghr = Header(data_type=GlobalHorizontalIrradiance(),
... | python | def global_horizontal_irradiance(self):
"""Returns the global horizontal irradiance at each timestep."""
analysis_period = AnalysisPeriod(timestep=self.timestep,
is_leap_year=self.is_leap_year)
header_ghr = Header(data_type=GlobalHorizontalIrradiance(),
... | [
"def",
"global_horizontal_irradiance",
"(",
"self",
")",
":",
"analysis_period",
"=",
"AnalysisPeriod",
"(",
"timestep",
"=",
"self",
".",
"timestep",
",",
"is_leap_year",
"=",
"self",
".",
"is_leap_year",
")",
"header_ghr",
"=",
"Header",
"(",
"data_type",
"=",... | Returns the global horizontal irradiance at each timestep. | [
"Returns",
"the",
"global",
"horizontal",
"irradiance",
"at",
"each",
"timestep",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/wea.py#L498-L513 | train |
ladybug-tools/ladybug | ladybug/wea.py | Wea.direct_horizontal_irradiance | def direct_horizontal_irradiance(self):
"""Returns the direct irradiance on a horizontal surface at each timestep.
Note that this is different from the direct_normal_irradiance needed
to construct a Wea, which is NORMAL and not HORIZONTAL."""
analysis_period = AnalysisPeriod(timestep=se... | python | def direct_horizontal_irradiance(self):
"""Returns the direct irradiance on a horizontal surface at each timestep.
Note that this is different from the direct_normal_irradiance needed
to construct a Wea, which is NORMAL and not HORIZONTAL."""
analysis_period = AnalysisPeriod(timestep=se... | [
"def",
"direct_horizontal_irradiance",
"(",
"self",
")",
":",
"analysis_period",
"=",
"AnalysisPeriod",
"(",
"timestep",
"=",
"self",
".",
"timestep",
",",
"is_leap_year",
"=",
"self",
".",
"is_leap_year",
")",
"header_dhr",
"=",
"Header",
"(",
"data_type",
"=",... | Returns the direct irradiance on a horizontal surface at each timestep.
Note that this is different from the direct_normal_irradiance needed
to construct a Wea, which is NORMAL and not HORIZONTAL. | [
"Returns",
"the",
"direct",
"irradiance",
"on",
"a",
"horizontal",
"surface",
"at",
"each",
"timestep",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/wea.py#L516-L533 | train |
ladybug-tools/ladybug | ladybug/wea.py | Wea._get_datetimes | def _get_datetimes(timestep, is_leap_year):
"""List of datetimes based on timestep.
This method should only be used for classmethods. For datetimes use datetiems or
hoys methods.
"""
hour_count = 8760 + 24 if is_leap_year else 8760
adjust_time = 30 if timestep == 1 else ... | python | def _get_datetimes(timestep, is_leap_year):
"""List of datetimes based on timestep.
This method should only be used for classmethods. For datetimes use datetiems or
hoys methods.
"""
hour_count = 8760 + 24 if is_leap_year else 8760
adjust_time = 30 if timestep == 1 else ... | [
"def",
"_get_datetimes",
"(",
"timestep",
",",
"is_leap_year",
")",
":",
"hour_count",
"=",
"8760",
"+",
"24",
"if",
"is_leap_year",
"else",
"8760",
"adjust_time",
"=",
"30",
"if",
"timestep",
"==",
"1",
"else",
"0",
"return",
"tuple",
"(",
"DateTime",
"."... | List of datetimes based on timestep.
This method should only be used for classmethods. For datetimes use datetiems or
hoys methods. | [
"List",
"of",
"datetimes",
"based",
"on",
"timestep",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/wea.py#L550-L561 | train |
ladybug-tools/ladybug | ladybug/wea.py | Wea._get_data_collections | def _get_data_collections(dnr_values, dhr_values, metadata, timestep, is_leap_year):
"""Return two data collections for Direct Normal , Diffuse Horizontal
"""
analysis_period = AnalysisPeriod(timestep=timestep, is_leap_year=is_leap_year)
dnr_header = Header(data_type=DirectNormalIrradian... | python | def _get_data_collections(dnr_values, dhr_values, metadata, timestep, is_leap_year):
"""Return two data collections for Direct Normal , Diffuse Horizontal
"""
analysis_period = AnalysisPeriod(timestep=timestep, is_leap_year=is_leap_year)
dnr_header = Header(data_type=DirectNormalIrradian... | [
"def",
"_get_data_collections",
"(",
"dnr_values",
",",
"dhr_values",
",",
"metadata",
",",
"timestep",
",",
"is_leap_year",
")",
":",
"analysis_period",
"=",
"AnalysisPeriod",
"(",
"timestep",
"=",
"timestep",
",",
"is_leap_year",
"=",
"is_leap_year",
")",
"dnr_h... | Return two data collections for Direct Normal , Diffuse Horizontal | [
"Return",
"two",
"data",
"collections",
"for",
"Direct",
"Normal",
"Diffuse",
"Horizontal"
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/wea.py#L564-L579 | train |
ladybug-tools/ladybug | ladybug/wea.py | Wea.get_irradiance_value | def get_irradiance_value(self, month, day, hour):
"""Get direct and diffuse irradiance values for a point in time."""
dt = DateTime(month, day, hour, leap_year=self.is_leap_year)
count = int(dt.hoy * self.timestep)
return self.direct_normal_irradiance[count], \
self.diffuse_h... | python | def get_irradiance_value(self, month, day, hour):
"""Get direct and diffuse irradiance values for a point in time."""
dt = DateTime(month, day, hour, leap_year=self.is_leap_year)
count = int(dt.hoy * self.timestep)
return self.direct_normal_irradiance[count], \
self.diffuse_h... | [
"def",
"get_irradiance_value",
"(",
"self",
",",
"month",
",",
"day",
",",
"hour",
")",
":",
"dt",
"=",
"DateTime",
"(",
"month",
",",
"day",
",",
"hour",
",",
"leap_year",
"=",
"self",
".",
"is_leap_year",
")",
"count",
"=",
"int",
"(",
"dt",
".",
... | Get direct and diffuse irradiance values for a point in time. | [
"Get",
"direct",
"and",
"diffuse",
"irradiance",
"values",
"for",
"a",
"point",
"in",
"time",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/wea.py#L581-L586 | train |
ladybug-tools/ladybug | ladybug/wea.py | Wea.get_irradiance_value_for_hoy | def get_irradiance_value_for_hoy(self, hoy):
"""Get direct and diffuse irradiance values for an hoy."""
count = int(hoy * self.timestep)
return self.direct_normal_irradiance[count], \
self.diffuse_horizontal_irradiance[count] | python | def get_irradiance_value_for_hoy(self, hoy):
"""Get direct and diffuse irradiance values for an hoy."""
count = int(hoy * self.timestep)
return self.direct_normal_irradiance[count], \
self.diffuse_horizontal_irradiance[count] | [
"def",
"get_irradiance_value_for_hoy",
"(",
"self",
",",
"hoy",
")",
":",
"count",
"=",
"int",
"(",
"hoy",
"*",
"self",
".",
"timestep",
")",
"return",
"self",
".",
"direct_normal_irradiance",
"[",
"count",
"]",
",",
"self",
".",
"diffuse_horizontal_irradiance... | Get direct and diffuse irradiance values for an hoy. | [
"Get",
"direct",
"and",
"diffuse",
"irradiance",
"values",
"for",
"an",
"hoy",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/wea.py#L588-L592 | train |
ladybug-tools/ladybug | ladybug/wea.py | Wea.directional_irradiance | def directional_irradiance(self, altitude=90, azimuth=180,
ground_reflectance=0.2, isotrophic=True):
"""Returns the irradiance components facing a given altitude and azimuth.
This method computes unobstructed solar flux facing a given
altitude and azimuth. The def... | python | def directional_irradiance(self, altitude=90, azimuth=180,
ground_reflectance=0.2, isotrophic=True):
"""Returns the irradiance components facing a given altitude and azimuth.
This method computes unobstructed solar flux facing a given
altitude and azimuth. The def... | [
"def",
"directional_irradiance",
"(",
"self",
",",
"altitude",
"=",
"90",
",",
"azimuth",
"=",
"180",
",",
"ground_reflectance",
"=",
"0.2",
",",
"isotrophic",
"=",
"True",
")",
":",
"def",
"pol2cart",
"(",
"phi",
",",
"theta",
")",
":",
"mult",
"=",
"... | Returns the irradiance components facing a given altitude and azimuth.
This method computes unobstructed solar flux facing a given
altitude and azimuth. The default is set to return the golbal horizontal
irradiance, assuming an altitude facing straight up (90 degrees).
Args:
... | [
"Returns",
"the",
"irradiance",
"components",
"facing",
"a",
"given",
"altitude",
"and",
"azimuth",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/wea.py#L594-L692 | train |
ladybug-tools/ladybug | ladybug/wea.py | Wea.header | def header(self):
"""Wea header."""
return "place %s\n" % self.location.city + \
"latitude %.2f\n" % self.location.latitude + \
"longitude %.2f\n" % -self.location.longitude + \
"time_zone %d\n" % (-self.location.time_zone * 15) + \
"site_elevation %.1f\n"... | python | def header(self):
"""Wea header."""
return "place %s\n" % self.location.city + \
"latitude %.2f\n" % self.location.latitude + \
"longitude %.2f\n" % -self.location.longitude + \
"time_zone %d\n" % (-self.location.time_zone * 15) + \
"site_elevation %.1f\n"... | [
"def",
"header",
"(",
"self",
")",
":",
"return",
"\"place %s\\n\"",
"%",
"self",
".",
"location",
".",
"city",
"+",
"\"latitude %.2f\\n\"",
"%",
"self",
".",
"location",
".",
"latitude",
"+",
"\"longitude %.2f\\n\"",
"%",
"-",
"self",
".",
"location",
".",
... | Wea header. | [
"Wea",
"header",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/wea.py#L695-L702 | train |
ladybug-tools/ladybug | ladybug/wea.py | Wea.write | def write(self, file_path, hoys=None, write_hours=False):
"""Write the wea file.
WEA carries irradiance values from epw and is what gendaymtx uses to
generate the sky.
"""
if not file_path.lower().endswith('.wea'):
file_path += '.wea'
# generate hoys in wea ... | python | def write(self, file_path, hoys=None, write_hours=False):
"""Write the wea file.
WEA carries irradiance values from epw and is what gendaymtx uses to
generate the sky.
"""
if not file_path.lower().endswith('.wea'):
file_path += '.wea'
# generate hoys in wea ... | [
"def",
"write",
"(",
"self",
",",
"file_path",
",",
"hoys",
"=",
"None",
",",
"write_hours",
"=",
"False",
")",
":",
"if",
"not",
"file_path",
".",
"lower",
"(",
")",
".",
"endswith",
"(",
"'.wea'",
")",
":",
"file_path",
"+=",
"'.wea'",
"full_wea",
... | Write the wea file.
WEA carries irradiance values from epw and is what gendaymtx uses to
generate the sky. | [
"Write",
"the",
"wea",
"file",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/wea.py#L725-L773 | train |
ladybug-tools/ladybug | ladybug/listoperations.py | flatten | def flatten(input_list):
"""Return a flattened genertor from an input list.
Usage:
input_list = [['a'], ['b', 'c', 'd'], [['e']], ['f']]
list(flatten(input_list))
>> ['a', 'b', 'c', 'd', 'e', 'f']
"""
for el in input_list:
if isinstance(el, collections.Iterable) \
... | python | def flatten(input_list):
"""Return a flattened genertor from an input list.
Usage:
input_list = [['a'], ['b', 'c', 'd'], [['e']], ['f']]
list(flatten(input_list))
>> ['a', 'b', 'c', 'd', 'e', 'f']
"""
for el in input_list:
if isinstance(el, collections.Iterable) \
... | [
"def",
"flatten",
"(",
"input_list",
")",
":",
"for",
"el",
"in",
"input_list",
":",
"if",
"isinstance",
"(",
"el",
",",
"collections",
".",
"Iterable",
")",
"and",
"not",
"isinstance",
"(",
"el",
",",
"basestring",
")",
":",
"for",
"sub",
"in",
"flatt... | Return a flattened genertor from an input list.
Usage:
input_list = [['a'], ['b', 'c', 'd'], [['e']], ['f']]
list(flatten(input_list))
>> ['a', 'b', 'c', 'd', 'e', 'f'] | [
"Return",
"a",
"flattened",
"genertor",
"from",
"an",
"input",
"list",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/listoperations.py#L8-L23 | train |
ladybug-tools/ladybug | ladybug/listoperations.py | unflatten | def unflatten(guide, falttened_input):
"""Unflatten a falttened generator.
Args:
guide: A guide list to follow the structure
falttened_input: A flattened iterator object
Usage:
guide = [["a"], ["b","c","d"], [["e"]], ["f"]]
input_list = [0, 1, 2, 3, 4, 5, 6, 7]
unf... | python | def unflatten(guide, falttened_input):
"""Unflatten a falttened generator.
Args:
guide: A guide list to follow the structure
falttened_input: A flattened iterator object
Usage:
guide = [["a"], ["b","c","d"], [["e"]], ["f"]]
input_list = [0, 1, 2, 3, 4, 5, 6, 7]
unf... | [
"def",
"unflatten",
"(",
"guide",
",",
"falttened_input",
")",
":",
"return",
"[",
"unflatten",
"(",
"sub_list",
",",
"falttened_input",
")",
"if",
"isinstance",
"(",
"sub_list",
",",
"list",
")",
"else",
"next",
"(",
"falttened_input",
")",
"for",
"sub_list... | Unflatten a falttened generator.
Args:
guide: A guide list to follow the structure
falttened_input: A flattened iterator object
Usage:
guide = [["a"], ["b","c","d"], [["e"]], ["f"]]
input_list = [0, 1, 2, 3, 4, 5, 6, 7]
unflatten(guide, iter(input_list))
>> [[0... | [
"Unflatten",
"a",
"falttened",
"generator",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/listoperations.py#L26-L41 | train |
ladybug-tools/ladybug | ladybug/color.py | ColorRange.color | def color(self, value):
"""Return color for an input value."""
assert self._is_domain_set, \
"Domain is not set. Use self.domain to set the domain."
if self._ctype == 2:
# if ordinal map the value and color
try:
return self._colors[self._domai... | python | def color(self, value):
"""Return color for an input value."""
assert self._is_domain_set, \
"Domain is not set. Use self.domain to set the domain."
if self._ctype == 2:
# if ordinal map the value and color
try:
return self._colors[self._domai... | [
"def",
"color",
"(",
"self",
",",
"value",
")",
":",
"assert",
"self",
".",
"_is_domain_set",
",",
"\"Domain is not set. Use self.domain to set the domain.\"",
"if",
"self",
".",
"_ctype",
"==",
"2",
":",
"try",
":",
"return",
"self",
".",
"_colors",
"[",
"sel... | Return color for an input value. | [
"Return",
"color",
"for",
"an",
"input",
"value",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/color.py#L436-L462 | train |
ladybug-tools/ladybug | ladybug/color.py | ColorRange._cal_color | def _cal_color(self, value, color_index):
"""Blend between two colors based on input value."""
range_min_p = self._domain[color_index]
range_p = self._domain[color_index + 1] - range_min_p
try:
factor = (value - range_min_p) / range_p
except ZeroDivisionError:
... | python | def _cal_color(self, value, color_index):
"""Blend between two colors based on input value."""
range_min_p = self._domain[color_index]
range_p = self._domain[color_index + 1] - range_min_p
try:
factor = (value - range_min_p) / range_p
except ZeroDivisionError:
... | [
"def",
"_cal_color",
"(",
"self",
",",
"value",
",",
"color_index",
")",
":",
"range_min_p",
"=",
"self",
".",
"_domain",
"[",
"color_index",
"]",
"range_p",
"=",
"self",
".",
"_domain",
"[",
"color_index",
"+",
"1",
"]",
"-",
"range_min_p",
"try",
":",
... | Blend between two colors based on input value. | [
"Blend",
"between",
"two",
"colors",
"based",
"on",
"input",
"value",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/color.py#L464-L479 | train |
ladybug-tools/ladybug | ladybug/sunpath.py | Sunpath.from_location | def from_location(cls, location, north_angle=0, daylight_saving_period=None):
"""Create a sun path from a LBlocation."""
location = Location.from_location(location)
return cls(location.latitude, location.longitude,
location.time_zone, north_angle, daylight_saving_period) | python | def from_location(cls, location, north_angle=0, daylight_saving_period=None):
"""Create a sun path from a LBlocation."""
location = Location.from_location(location)
return cls(location.latitude, location.longitude,
location.time_zone, north_angle, daylight_saving_period) | [
"def",
"from_location",
"(",
"cls",
",",
"location",
",",
"north_angle",
"=",
"0",
",",
"daylight_saving_period",
"=",
"None",
")",
":",
"location",
"=",
"Location",
".",
"from_location",
"(",
"location",
")",
"return",
"cls",
"(",
"location",
".",
"latitude... | Create a sun path from a LBlocation. | [
"Create",
"a",
"sun",
"path",
"from",
"a",
"LBlocation",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/sunpath.py#L84-L88 | train |
ladybug-tools/ladybug | ladybug/sunpath.py | Sunpath.latitude | def latitude(self, value):
"""Set latitude value."""
self._latitude = math.radians(float(value))
assert -self.PI / 2 <= self._latitude <= self.PI / 2, \
"latitude value should be between -90..90." | python | def latitude(self, value):
"""Set latitude value."""
self._latitude = math.radians(float(value))
assert -self.PI / 2 <= self._latitude <= self.PI / 2, \
"latitude value should be between -90..90." | [
"def",
"latitude",
"(",
"self",
",",
"value",
")",
":",
"self",
".",
"_latitude",
"=",
"math",
".",
"radians",
"(",
"float",
"(",
"value",
")",
")",
"assert",
"-",
"self",
".",
"PI",
"/",
"2",
"<=",
"self",
".",
"_latitude",
"<=",
"self",
".",
"P... | Set latitude value. | [
"Set",
"latitude",
"value",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/sunpath.py#L96-L100 | train |
ladybug-tools/ladybug | ladybug/sunpath.py | Sunpath.longitude | def longitude(self, value):
"""Set longitude value in degrees."""
self._longitude = math.radians(float(value))
# update time_zone
if abs((value / 15.0) - self.time_zone) > 1:
# if time_zone doesn't match the longitude update the time_zone
self.time_zone = value /... | python | def longitude(self, value):
"""Set longitude value in degrees."""
self._longitude = math.radians(float(value))
# update time_zone
if abs((value / 15.0) - self.time_zone) > 1:
# if time_zone doesn't match the longitude update the time_zone
self.time_zone = value /... | [
"def",
"longitude",
"(",
"self",
",",
"value",
")",
":",
"self",
".",
"_longitude",
"=",
"math",
".",
"radians",
"(",
"float",
"(",
"value",
")",
")",
"if",
"abs",
"(",
"(",
"value",
"/",
"15.0",
")",
"-",
"self",
".",
"time_zone",
")",
">",
"1",... | Set longitude value in degrees. | [
"Set",
"longitude",
"value",
"in",
"degrees",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/sunpath.py#L108-L115 | train |
ladybug-tools/ladybug | ladybug/sunpath.py | Sunpath.is_daylight_saving_hour | def is_daylight_saving_hour(self, datetime):
"""Check if a datetime is a daylight saving time."""
if not self.daylight_saving_period:
return False
return self.daylight_saving_period.isTimeIncluded(datetime.hoy) | python | def is_daylight_saving_hour(self, datetime):
"""Check if a datetime is a daylight saving time."""
if not self.daylight_saving_period:
return False
return self.daylight_saving_period.isTimeIncluded(datetime.hoy) | [
"def",
"is_daylight_saving_hour",
"(",
"self",
",",
"datetime",
")",
":",
"if",
"not",
"self",
".",
"daylight_saving_period",
":",
"return",
"False",
"return",
"self",
".",
"daylight_saving_period",
".",
"isTimeIncluded",
"(",
"datetime",
".",
"hoy",
")"
] | Check if a datetime is a daylight saving time. | [
"Check",
"if",
"a",
"datetime",
"is",
"a",
"daylight",
"saving",
"time",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/sunpath.py#L127-L131 | train |
ladybug-tools/ladybug | ladybug/sunpath.py | Sunpath.calculate_sun_from_date_time | def calculate_sun_from_date_time(self, datetime, is_solar_time=False):
"""Get Sun for an hour of the year.
This code is originally written by Trygve Wastvedt \
(Trygve.Wastvedt@gmail.com)
based on (NOAA) and modified by Chris Mackey and Mostapha Roudsari
Args:
date... | python | def calculate_sun_from_date_time(self, datetime, is_solar_time=False):
"""Get Sun for an hour of the year.
This code is originally written by Trygve Wastvedt \
(Trygve.Wastvedt@gmail.com)
based on (NOAA) and modified by Chris Mackey and Mostapha Roudsari
Args:
date... | [
"def",
"calculate_sun_from_date_time",
"(",
"self",
",",
"datetime",
",",
"is_solar_time",
"=",
"False",
")",
":",
"if",
"datetime",
".",
"year",
"!=",
"2016",
"and",
"self",
".",
"is_leap_year",
":",
"datetime",
"=",
"DateTime",
"(",
"datetime",
".",
"month... | Get Sun for an hour of the year.
This code is originally written by Trygve Wastvedt \
(Trygve.Wastvedt@gmail.com)
based on (NOAA) and modified by Chris Mackey and Mostapha Roudsari
Args:
datetime: Ladybug datetime
is_solar_time: A boolean to indicate if the inp... | [
"Get",
"Sun",
"for",
"an",
"hour",
"of",
"the",
"year",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/sunpath.py#L164-L261 | train |
ladybug-tools/ladybug | ladybug/sunpath.py | Sunpath.calculate_sunrise_sunset | def calculate_sunrise_sunset(self, month, day, depression=0.833,
is_solar_time=False):
"""Calculate sunrise, noon and sunset.
Return:
A dictionary. Keys are ("sunrise", "noon", "sunset")
"""
datetime = DateTime(month, day, hour=12, leap_year=... | python | def calculate_sunrise_sunset(self, month, day, depression=0.833,
is_solar_time=False):
"""Calculate sunrise, noon and sunset.
Return:
A dictionary. Keys are ("sunrise", "noon", "sunset")
"""
datetime = DateTime(month, day, hour=12, leap_year=... | [
"def",
"calculate_sunrise_sunset",
"(",
"self",
",",
"month",
",",
"day",
",",
"depression",
"=",
"0.833",
",",
"is_solar_time",
"=",
"False",
")",
":",
"datetime",
"=",
"DateTime",
"(",
"month",
",",
"day",
",",
"hour",
"=",
"12",
",",
"leap_year",
"=",... | Calculate sunrise, noon and sunset.
Return:
A dictionary. Keys are ("sunrise", "noon", "sunset") | [
"Calculate",
"sunrise",
"noon",
"and",
"sunset",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/sunpath.py#L263-L274 | train |
ladybug-tools/ladybug | ladybug/sunpath.py | Sunpath.calculate_sunrise_sunset_from_datetime | def calculate_sunrise_sunset_from_datetime(self, datetime, depression=0.833,
is_solar_time=False):
"""Calculate sunrise, sunset and noon for a day of year."""
# TODO(mostapha): This should be more generic and based on a method
if datetime.year != 20... | python | def calculate_sunrise_sunset_from_datetime(self, datetime, depression=0.833,
is_solar_time=False):
"""Calculate sunrise, sunset and noon for a day of year."""
# TODO(mostapha): This should be more generic and based on a method
if datetime.year != 20... | [
"def",
"calculate_sunrise_sunset_from_datetime",
"(",
"self",
",",
"datetime",
",",
"depression",
"=",
"0.833",
",",
"is_solar_time",
"=",
"False",
")",
":",
"if",
"datetime",
".",
"year",
"!=",
"2016",
"and",
"self",
".",
"is_leap_year",
":",
"datetime",
"=",... | Calculate sunrise, sunset and noon for a day of year. | [
"Calculate",
"sunrise",
"sunset",
"and",
"noon",
"for",
"a",
"day",
"of",
"year",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/sunpath.py#L277-L325 | train |
ladybug-tools/ladybug | ladybug/sunpath.py | Sunpath._calculate_sunrise_hour_angle | def _calculate_sunrise_hour_angle(self, solar_dec, depression=0.833):
"""Calculate hour angle for sunrise time in degrees."""
hour_angle_arg = math.degrees(math.acos(
math.cos(math.radians(90 + depression)) /
(math.cos(math.radians(self.latitude)) * math.cos(
mat... | python | def _calculate_sunrise_hour_angle(self, solar_dec, depression=0.833):
"""Calculate hour angle for sunrise time in degrees."""
hour_angle_arg = math.degrees(math.acos(
math.cos(math.radians(90 + depression)) /
(math.cos(math.radians(self.latitude)) * math.cos(
mat... | [
"def",
"_calculate_sunrise_hour_angle",
"(",
"self",
",",
"solar_dec",
",",
"depression",
"=",
"0.833",
")",
":",
"hour_angle_arg",
"=",
"math",
".",
"degrees",
"(",
"math",
".",
"acos",
"(",
"math",
".",
"cos",
"(",
"math",
".",
"radians",
"(",
"90",
"+... | Calculate hour angle for sunrise time in degrees. | [
"Calculate",
"hour",
"angle",
"for",
"sunrise",
"time",
"in",
"degrees",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/sunpath.py#L468-L479 | train |
ladybug-tools/ladybug | ladybug/sunpath.py | Sunpath._calculate_solar_time | def _calculate_solar_time(self, hour, eq_of_time, is_solar_time):
"""Calculate Solar time for an hour."""
if is_solar_time:
return hour
return (
(hour * 60 + eq_of_time + 4 * math.degrees(self._longitude) -
60 * self.time_zone) % 1440) / 60 | python | def _calculate_solar_time(self, hour, eq_of_time, is_solar_time):
"""Calculate Solar time for an hour."""
if is_solar_time:
return hour
return (
(hour * 60 + eq_of_time + 4 * math.degrees(self._longitude) -
60 * self.time_zone) % 1440) / 60 | [
"def",
"_calculate_solar_time",
"(",
"self",
",",
"hour",
",",
"eq_of_time",
",",
"is_solar_time",
")",
":",
"if",
"is_solar_time",
":",
"return",
"hour",
"return",
"(",
"(",
"hour",
"*",
"60",
"+",
"eq_of_time",
"+",
"4",
"*",
"math",
".",
"degrees",
"(... | Calculate Solar time for an hour. | [
"Calculate",
"Solar",
"time",
"for",
"an",
"hour",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/sunpath.py#L481-L488 | train |
ladybug-tools/ladybug | ladybug/sunpath.py | Sunpath._calculate_solar_time_by_doy | def _calculate_solar_time_by_doy(self, hour, doy):
"""This is how radiance calculates solar time.
This is a place holder and \
need to be validated against calculateSolarTime.
"""
raise NotImplementedError()
return (0.170 * math.sin((4 * math.pi / 373) * (doy - 80)) -
... | python | def _calculate_solar_time_by_doy(self, hour, doy):
"""This is how radiance calculates solar time.
This is a place holder and \
need to be validated against calculateSolarTime.
"""
raise NotImplementedError()
return (0.170 * math.sin((4 * math.pi / 373) * (doy - 80)) -
... | [
"def",
"_calculate_solar_time_by_doy",
"(",
"self",
",",
"hour",
",",
"doy",
")",
":",
"raise",
"NotImplementedError",
"(",
")",
"return",
"(",
"0.170",
"*",
"math",
".",
"sin",
"(",
"(",
"4",
"*",
"math",
".",
"pi",
"/",
"373",
")",
"*",
"(",
"doy",... | This is how radiance calculates solar time.
This is a place holder and \
need to be validated against calculateSolarTime. | [
"This",
"is",
"how",
"radiance",
"calculates",
"solar",
"time",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/sunpath.py#L490-L499 | train |
ladybug-tools/ladybug | ladybug/sunpath.py | Sunpath.draw_sunpath | def draw_sunpath(self,
hoys=None,
origin=None,
scale=1, sun_scale=1, annual=True, rem_night=True):
"""Create sunpath geometry. \
This method should only be used from the + libraries.
Args:
hoys: An optional list of hours... | python | def draw_sunpath(self,
hoys=None,
origin=None,
scale=1, sun_scale=1, annual=True, rem_night=True):
"""Create sunpath geometry. \
This method should only be used from the + libraries.
Args:
hoys: An optional list of hours... | [
"def",
"draw_sunpath",
"(",
"self",
",",
"hoys",
"=",
"None",
",",
"origin",
"=",
"None",
",",
"scale",
"=",
"1",
",",
"sun_scale",
"=",
"1",
",",
"annual",
"=",
"True",
",",
"rem_night",
"=",
"True",
")",
":",
"assert",
"ladybug",
".",
"isplus",
"... | Create sunpath geometry. \
This method should only be used from the + libraries.
Args:
hoys: An optional list of hours of the year(default: None).
origin: Sunpath origin(default: (0, 0, 0)).
scale: Sunpath scale(default: 1).
sun_scale: Scale for the sun s... | [
"Create",
"sunpath",
"geometry",
".",
"\\",
"This",
"method",
"should",
"only",
"be",
"used",
"from",
"the",
"+",
"libraries",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/sunpath.py#L512-L592 | train |
ladybug-tools/ladybug | ladybug/sunpath.py | Sunpath._analemma_position | def _analemma_position(self, hour):
"""Check what the analemma position is for an hour.
This is useful for calculating hours of analemma curves.
Returns:
-1 if always night,
0 if both day and night,
1 if always day.
"""
# check for 21 dec and... | python | def _analemma_position(self, hour):
"""Check what the analemma position is for an hour.
This is useful for calculating hours of analemma curves.
Returns:
-1 if always night,
0 if both day and night,
1 if always day.
"""
# check for 21 dec and... | [
"def",
"_analemma_position",
"(",
"self",
",",
"hour",
")",
":",
"low",
"=",
"self",
".",
"calculate_sun",
"(",
"12",
",",
"21",
",",
"hour",
")",
".",
"is_during_day",
"high",
"=",
"self",
".",
"calculate_sun",
"(",
"6",
",",
"21",
",",
"hour",
")",... | Check what the analemma position is for an hour.
This is useful for calculating hours of analemma curves.
Returns:
-1 if always night,
0 if both day and night,
1 if always day. | [
"Check",
"what",
"the",
"analemma",
"position",
"is",
"for",
"an",
"hour",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/sunpath.py#L594-L613 | train |
ladybug-tools/ladybug | ladybug/sunpath.py | Sunpath._analemma_suns | def _analemma_suns(self):
"""Calculate times that should be used for drawing analemma_curves.
Returns:
A list of list of analemma suns.
"""
for h in xrange(0, 24):
if self._analemma_position(h) < 0:
continue
elif self._analemma_positio... | python | def _analemma_suns(self):
"""Calculate times that should be used for drawing analemma_curves.
Returns:
A list of list of analemma suns.
"""
for h in xrange(0, 24):
if self._analemma_position(h) < 0:
continue
elif self._analemma_positio... | [
"def",
"_analemma_suns",
"(",
"self",
")",
":",
"for",
"h",
"in",
"xrange",
"(",
"0",
",",
"24",
")",
":",
"if",
"self",
".",
"_analemma_position",
"(",
"h",
")",
"<",
"0",
":",
"continue",
"elif",
"self",
".",
"_analemma_position",
"(",
"h",
")",
... | Calculate times that should be used for drawing analemma_curves.
Returns:
A list of list of analemma suns. | [
"Calculate",
"times",
"that",
"should",
"be",
"used",
"for",
"drawing",
"analemma_curves",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/sunpath.py#L615-L666 | train |
ladybug-tools/ladybug | ladybug/sunpath.py | Sunpath._daily_suns | def _daily_suns(self, datetimes):
"""Get sun curve for multiple days of the year."""
for dt in datetimes:
# calculate sunrise sunset and noon
nss = self.calculate_sunrise_sunset(dt.month, dt.day)
dts = tuple(nss[k] for k in ('sunrise', 'noon', 'sunset'))
i... | python | def _daily_suns(self, datetimes):
"""Get sun curve for multiple days of the year."""
for dt in datetimes:
# calculate sunrise sunset and noon
nss = self.calculate_sunrise_sunset(dt.month, dt.day)
dts = tuple(nss[k] for k in ('sunrise', 'noon', 'sunset'))
i... | [
"def",
"_daily_suns",
"(",
"self",
",",
"datetimes",
")",
":",
"for",
"dt",
"in",
"datetimes",
":",
"nss",
"=",
"self",
".",
"calculate_sunrise_sunset",
"(",
"dt",
".",
"month",
",",
"dt",
".",
"day",
")",
"dts",
"=",
"tuple",
"(",
"nss",
"[",
"k",
... | Get sun curve for multiple days of the year. | [
"Get",
"sun",
"curve",
"for",
"multiple",
"days",
"of",
"the",
"year",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/sunpath.py#L668-L681 | train |
ladybug-tools/ladybug | ladybug/sunpath.py | Sun._calculate_sun_vector | def _calculate_sun_vector(self):
"""Calculate sun vector for this sun."""
z_axis = Vector3(0., 0., -1.)
x_axis = Vector3(1., 0., 0.)
north_vector = Vector3(0., 1., 0.)
# rotate north vector based on azimuth, altitude, and north
_sun_vector = north_vector \
.r... | python | def _calculate_sun_vector(self):
"""Calculate sun vector for this sun."""
z_axis = Vector3(0., 0., -1.)
x_axis = Vector3(1., 0., 0.)
north_vector = Vector3(0., 1., 0.)
# rotate north vector based on azimuth, altitude, and north
_sun_vector = north_vector \
.r... | [
"def",
"_calculate_sun_vector",
"(",
"self",
")",
":",
"z_axis",
"=",
"Vector3",
"(",
"0.",
",",
"0.",
",",
"-",
"1.",
")",
"x_axis",
"=",
"Vector3",
"(",
"1.",
",",
"0.",
",",
"0.",
")",
"north_vector",
"=",
"Vector3",
"(",
"0.",
",",
"1.",
",",
... | Calculate sun vector for this sun. | [
"Calculate",
"sun",
"vector",
"for",
"this",
"sun",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/sunpath.py#L798-L819 | train |
ladybug-tools/ladybug | ladybug/designday.py | DDY.from_json | def from_json(cls, data):
"""Create a DDY from a dictionary.
Args:
data = {
"location": ladybug Location schema,
"design_days": [] // list of ladybug DesignDay schemas}
"""
required_keys = ('location', 'design_days')
for key in required_keys:
... | python | def from_json(cls, data):
"""Create a DDY from a dictionary.
Args:
data = {
"location": ladybug Location schema,
"design_days": [] // list of ladybug DesignDay schemas}
"""
required_keys = ('location', 'design_days')
for key in required_keys:
... | [
"def",
"from_json",
"(",
"cls",
",",
"data",
")",
":",
"required_keys",
"=",
"(",
"'location'",
",",
"'design_days'",
")",
"for",
"key",
"in",
"required_keys",
":",
"assert",
"key",
"in",
"data",
",",
"'Required key \"{}\" is missing!'",
".",
"format",
"(",
... | Create a DDY from a dictionary.
Args:
data = {
"location": ladybug Location schema,
"design_days": [] // list of ladybug DesignDay schemas} | [
"Create",
"a",
"DDY",
"from",
"a",
"dictionary",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/designday.py#L48-L61 | train |
ladybug-tools/ladybug | ladybug/designday.py | DDY.from_ddy_file | def from_ddy_file(cls, file_path):
"""Initalize from a ddy file object from an existing ddy file.
args:
file_path: A string representing a complete path to the .ddy file.
"""
# check that the file is there
if not os.path.isfile(file_path):
raise ValueErro... | python | def from_ddy_file(cls, file_path):
"""Initalize from a ddy file object from an existing ddy file.
args:
file_path: A string representing a complete path to the .ddy file.
"""
# check that the file is there
if not os.path.isfile(file_path):
raise ValueErro... | [
"def",
"from_ddy_file",
"(",
"cls",
",",
"file_path",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"isfile",
"(",
"file_path",
")",
":",
"raise",
"ValueError",
"(",
"'Cannot find a .ddy file at {}'",
".",
"format",
"(",
"file_path",
")",
")",
"if",
"not"... | Initalize from a ddy file object from an existing ddy file.
args:
file_path: A string representing a complete path to the .ddy file. | [
"Initalize",
"from",
"a",
"ddy",
"file",
"object",
"from",
"an",
"existing",
"ddy",
"file",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/designday.py#L64-L115 | train |
ladybug-tools/ladybug | ladybug/designday.py | DDY.save | def save(self, file_path):
"""Save ddy object as a .ddy file.
args:
file_path: A string representing the path to write the ddy file to.
"""
# write all data into the file
# write the file
data = self.location.ep_style_location_string + '\n\n'
for d_da... | python | def save(self, file_path):
"""Save ddy object as a .ddy file.
args:
file_path: A string representing the path to write the ddy file to.
"""
# write all data into the file
# write the file
data = self.location.ep_style_location_string + '\n\n'
for d_da... | [
"def",
"save",
"(",
"self",
",",
"file_path",
")",
":",
"data",
"=",
"self",
".",
"location",
".",
"ep_style_location_string",
"+",
"'\\n\\n'",
"for",
"d_day",
"in",
"self",
".",
"design_days",
":",
"data",
"=",
"data",
"+",
"d_day",
".",
"ep_style_string"... | Save ddy object as a .ddy file.
args:
file_path: A string representing the path to write the ddy file to. | [
"Save",
"ddy",
"object",
"as",
"a",
".",
"ddy",
"file",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/designday.py#L126-L137 | train |
ladybug-tools/ladybug | ladybug/designday.py | DDY.filter_by_keyword | def filter_by_keyword(self, keyword):
"""Return a list of ddys that have a certain keyword in their name.
This is useful for selecting out design days from a ddy file that are
for a specific type of condition (for example, .4% cooling design days)
"""
filtered_days = []
... | python | def filter_by_keyword(self, keyword):
"""Return a list of ddys that have a certain keyword in their name.
This is useful for selecting out design days from a ddy file that are
for a specific type of condition (for example, .4% cooling design days)
"""
filtered_days = []
... | [
"def",
"filter_by_keyword",
"(",
"self",
",",
"keyword",
")",
":",
"filtered_days",
"=",
"[",
"]",
"for",
"des_day",
"in",
"self",
".",
"design_days",
":",
"if",
"keyword",
"in",
"des_day",
".",
"name",
":",
"filtered_days",
".",
"append",
"(",
"des_day",
... | Return a list of ddys that have a certain keyword in their name.
This is useful for selecting out design days from a ddy file that are
for a specific type of condition (for example, .4% cooling design days) | [
"Return",
"a",
"list",
"of",
"ddys",
"that",
"have",
"a",
"certain",
"keyword",
"in",
"their",
"name",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/designday.py#L139-L149 | train |
ladybug-tools/ladybug | ladybug/designday.py | DesignDay.from_json | def from_json(cls, data):
"""Create a Design Day from a dictionary.
Args:
data = {
"name": string,
"day_type": string,
"location": ladybug Location schema,
"dry_bulb_condition": ladybug DryBulbCondition schema,
"humidity_condition"... | python | def from_json(cls, data):
"""Create a Design Day from a dictionary.
Args:
data = {
"name": string,
"day_type": string,
"location": ladybug Location schema,
"dry_bulb_condition": ladybug DryBulbCondition schema,
"humidity_condition"... | [
"def",
"from_json",
"(",
"cls",
",",
"data",
")",
":",
"required_keys",
"=",
"(",
"'name'",
",",
"'day_type'",
",",
"'location'",
",",
"'dry_bulb_condition'",
",",
"'humidity_condition'",
",",
"'wind_condition'",
",",
"'sky_condition'",
")",
"for",
"key",
"in",
... | Create a Design Day from a dictionary.
Args:
data = {
"name": string,
"day_type": string,
"location": ladybug Location schema,
"dry_bulb_condition": ladybug DryBulbCondition schema,
"humidity_condition": ladybug HumidityCondition schema,
... | [
"Create",
"a",
"Design",
"Day",
"from",
"a",
"dictionary",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/designday.py#L298-L320 | train |
ladybug-tools/ladybug | ladybug/designday.py | DesignDay.from_design_day_properties | def from_design_day_properties(cls, name, day_type, location, analysis_period,
dry_bulb_max, dry_bulb_range, humidity_type,
humidity_value, barometric_p, wind_speed, wind_dir,
sky_model, sky_properties):
"""... | python | def from_design_day_properties(cls, name, day_type, location, analysis_period,
dry_bulb_max, dry_bulb_range, humidity_type,
humidity_value, barometric_p, wind_speed, wind_dir,
sky_model, sky_properties):
"""... | [
"def",
"from_design_day_properties",
"(",
"cls",
",",
"name",
",",
"day_type",
",",
"location",
",",
"analysis_period",
",",
"dry_bulb_max",
",",
"dry_bulb_range",
",",
"humidity_type",
",",
"humidity_value",
",",
"barometric_p",
",",
"wind_speed",
",",
"wind_dir",
... | Create a design day object from various key properties.
Args:
name: A text string to set the name of the design day
day_type: Choose from 'SummerDesignDay', 'WinterDesignDay' or other
EnergyPlus days
location: Location for the design day
analysis_... | [
"Create",
"a",
"design",
"day",
"object",
"from",
"various",
"key",
"properties",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/designday.py#L386-L425 | train |
ladybug-tools/ladybug | ladybug/designday.py | DesignDay.analysis_period | def analysis_period(self):
"""The analysisperiod of the design day."""
return AnalysisPeriod(
self.sky_condition.month,
self.sky_condition.day_of_month,
0,
self.sky_condition.month,
self.sky_condition.day_of_month,
23) | python | def analysis_period(self):
"""The analysisperiod of the design day."""
return AnalysisPeriod(
self.sky_condition.month,
self.sky_condition.day_of_month,
0,
self.sky_condition.month,
self.sky_condition.day_of_month,
23) | [
"def",
"analysis_period",
"(",
"self",
")",
":",
"return",
"AnalysisPeriod",
"(",
"self",
".",
"sky_condition",
".",
"month",
",",
"self",
".",
"sky_condition",
".",
"day_of_month",
",",
"0",
",",
"self",
".",
"sky_condition",
".",
"month",
",",
"self",
".... | The analysisperiod of the design day. | [
"The",
"analysisperiod",
"of",
"the",
"design",
"day",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/designday.py#L629-L637 | train |
ladybug-tools/ladybug | ladybug/designday.py | DesignDay.hourly_dew_point | def hourly_dew_point(self):
"""A data collection containing hourly dew points over they day."""
dpt_data = self._humidity_condition.hourly_dew_point_values(
self._dry_bulb_condition)
return self._get_daily_data_collections(
temperature.DewPointTemperature(), 'C', dpt_data... | python | def hourly_dew_point(self):
"""A data collection containing hourly dew points over they day."""
dpt_data = self._humidity_condition.hourly_dew_point_values(
self._dry_bulb_condition)
return self._get_daily_data_collections(
temperature.DewPointTemperature(), 'C', dpt_data... | [
"def",
"hourly_dew_point",
"(",
"self",
")",
":",
"dpt_data",
"=",
"self",
".",
"_humidity_condition",
".",
"hourly_dew_point_values",
"(",
"self",
".",
"_dry_bulb_condition",
")",
"return",
"self",
".",
"_get_daily_data_collections",
"(",
"temperature",
".",
"DewPo... | A data collection containing hourly dew points over they day. | [
"A",
"data",
"collection",
"containing",
"hourly",
"dew",
"points",
"over",
"they",
"day",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/designday.py#L651-L656 | train |
ladybug-tools/ladybug | ladybug/designday.py | DesignDay.hourly_relative_humidity | def hourly_relative_humidity(self):
"""A data collection containing hourly relative humidity over they day."""
dpt_data = self._humidity_condition.hourly_dew_point_values(
self._dry_bulb_condition)
rh_data = [rel_humid_from_db_dpt(x, y) for x, y in zip(
self._dry_bulb_con... | python | def hourly_relative_humidity(self):
"""A data collection containing hourly relative humidity over they day."""
dpt_data = self._humidity_condition.hourly_dew_point_values(
self._dry_bulb_condition)
rh_data = [rel_humid_from_db_dpt(x, y) for x, y in zip(
self._dry_bulb_con... | [
"def",
"hourly_relative_humidity",
"(",
"self",
")",
":",
"dpt_data",
"=",
"self",
".",
"_humidity_condition",
".",
"hourly_dew_point_values",
"(",
"self",
".",
"_dry_bulb_condition",
")",
"rh_data",
"=",
"[",
"rel_humid_from_db_dpt",
"(",
"x",
",",
"y",
")",
"f... | A data collection containing hourly relative humidity over they day. | [
"A",
"data",
"collection",
"containing",
"hourly",
"relative",
"humidity",
"over",
"they",
"day",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/designday.py#L659-L666 | train |
ladybug-tools/ladybug | ladybug/designday.py | DesignDay.hourly_solar_radiation | def hourly_solar_radiation(self):
"""Three data collections containing hourly direct normal, diffuse horizontal,
and global horizontal radiation.
"""
dir_norm, diff_horiz, glob_horiz = \
self._sky_condition.radiation_values(self._location)
dir_norm_data = self._get_d... | python | def hourly_solar_radiation(self):
"""Three data collections containing hourly direct normal, diffuse horizontal,
and global horizontal radiation.
"""
dir_norm, diff_horiz, glob_horiz = \
self._sky_condition.radiation_values(self._location)
dir_norm_data = self._get_d... | [
"def",
"hourly_solar_radiation",
"(",
"self",
")",
":",
"dir_norm",
",",
"diff_horiz",
",",
"glob_horiz",
"=",
"self",
".",
"_sky_condition",
".",
"radiation_values",
"(",
"self",
".",
"_location",
")",
"dir_norm_data",
"=",
"self",
".",
"_get_daily_data_collectio... | Three data collections containing hourly direct normal, diffuse horizontal,
and global horizontal radiation. | [
"Three",
"data",
"collections",
"containing",
"hourly",
"direct",
"normal",
"diffuse",
"horizontal",
"and",
"global",
"horizontal",
"radiation",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/designday.py#L688-L702 | train |
ladybug-tools/ladybug | ladybug/designday.py | DesignDay._get_daily_data_collections | def _get_daily_data_collections(self, data_type, unit, values):
"""Return an empty data collection."""
data_header = Header(data_type=data_type, unit=unit,
analysis_period=self.analysis_period,
metadata={'source': self._location.source,
... | python | def _get_daily_data_collections(self, data_type, unit, values):
"""Return an empty data collection."""
data_header = Header(data_type=data_type, unit=unit,
analysis_period=self.analysis_period,
metadata={'source': self._location.source,
... | [
"def",
"_get_daily_data_collections",
"(",
"self",
",",
"data_type",
",",
"unit",
",",
"values",
")",
":",
"data_header",
"=",
"Header",
"(",
"data_type",
"=",
"data_type",
",",
"unit",
"=",
"unit",
",",
"analysis_period",
"=",
"self",
".",
"analysis_period",
... | Return an empty data collection. | [
"Return",
"an",
"empty",
"data",
"collection",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/designday.py#L727-L734 | train |
ladybug-tools/ladybug | ladybug/designday.py | DryBulbCondition.hourly_values | def hourly_values(self):
"""A list of temperature values for each hour over the design day."""
return [self._dry_bulb_max - self._dry_bulb_range * x for
x in self.temp_multipliers] | python | def hourly_values(self):
"""A list of temperature values for each hour over the design day."""
return [self._dry_bulb_max - self._dry_bulb_range * x for
x in self.temp_multipliers] | [
"def",
"hourly_values",
"(",
"self",
")",
":",
"return",
"[",
"self",
".",
"_dry_bulb_max",
"-",
"self",
".",
"_dry_bulb_range",
"*",
"x",
"for",
"x",
"in",
"self",
".",
"temp_multipliers",
"]"
] | A list of temperature values for each hour over the design day. | [
"A",
"list",
"of",
"temperature",
"values",
"for",
"each",
"hour",
"over",
"the",
"design",
"day",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/designday.py#L805-L808 | train |
ladybug-tools/ladybug | ladybug/designday.py | DryBulbCondition.to_json | def to_json(self):
"""Convert the Dry Bulb Condition to a dictionary."""
return {
'dry_bulb_max': self.dry_bulb_max,
'dry_bulb_range': self.dry_bulb_range,
'modifier_type': self.modifier_type,
'modifier_schedule': self.modifier_schedule
} | python | def to_json(self):
"""Convert the Dry Bulb Condition to a dictionary."""
return {
'dry_bulb_max': self.dry_bulb_max,
'dry_bulb_range': self.dry_bulb_range,
'modifier_type': self.modifier_type,
'modifier_schedule': self.modifier_schedule
} | [
"def",
"to_json",
"(",
"self",
")",
":",
"return",
"{",
"'dry_bulb_max'",
":",
"self",
".",
"dry_bulb_max",
",",
"'dry_bulb_range'",
":",
"self",
".",
"dry_bulb_range",
",",
"'modifier_type'",
":",
"self",
".",
"modifier_type",
",",
"'modifier_schedule'",
":",
... | Convert the Dry Bulb Condition to a dictionary. | [
"Convert",
"the",
"Dry",
"Bulb",
"Condition",
"to",
"a",
"dictionary",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/designday.py#L846-L853 | train |
ladybug-tools/ladybug | ladybug/designday.py | HumidityCondition.from_json | def from_json(cls, data):
"""Create a Humidity Condition from a dictionary.
Args:
data = {
"hum_type": string,
"hum_value": float,
"barometric_pressure": float,
"schedule": string,
"wet_bulb_range": string}
"""
# Ch... | python | def from_json(cls, data):
"""Create a Humidity Condition from a dictionary.
Args:
data = {
"hum_type": string,
"hum_value": float,
"barometric_pressure": float,
"schedule": string,
"wet_bulb_range": string}
"""
# Ch... | [
"def",
"from_json",
"(",
"cls",
",",
"data",
")",
":",
"required_keys",
"=",
"(",
"'hum_type'",
",",
"'hum_value'",
")",
"optional_keys",
"=",
"{",
"'barometric_pressure'",
":",
"101325",
",",
"'schedule'",
":",
"''",
",",
"'wet_bulb_range'",
":",
"''",
"}",... | Create a Humidity Condition from a dictionary.
Args:
data = {
"hum_type": string,
"hum_value": float,
"barometric_pressure": float,
"schedule": string,
"wet_bulb_range": string} | [
"Create",
"a",
"Humidity",
"Condition",
"from",
"a",
"dictionary",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/designday.py#L886-L908 | train |
ladybug-tools/ladybug | ladybug/designday.py | HumidityCondition.to_json | def to_json(self):
"""Convert the Humidity Condition to a dictionary."""
return {
'hum_type': self.hum_type,
'hum_value': self.hum_value,
'barometric_pressure': self.barometric_pressure,
'schedule': self.schedule,
'wet_bulb_range': self.wet_bul... | python | def to_json(self):
"""Convert the Humidity Condition to a dictionary."""
return {
'hum_type': self.hum_type,
'hum_value': self.hum_value,
'barometric_pressure': self.barometric_pressure,
'schedule': self.schedule,
'wet_bulb_range': self.wet_bul... | [
"def",
"to_json",
"(",
"self",
")",
":",
"return",
"{",
"'hum_type'",
":",
"self",
".",
"hum_type",
",",
"'hum_value'",
":",
"self",
".",
"hum_value",
",",
"'barometric_pressure'",
":",
"self",
".",
"barometric_pressure",
",",
"'schedule'",
":",
"self",
".",... | Convert the Humidity Condition to a dictionary. | [
"Convert",
"the",
"Humidity",
"Condition",
"to",
"a",
"dictionary",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/designday.py#L991-L999 | train |
ladybug-tools/ladybug | ladybug/designday.py | WindCondition.from_json | def from_json(cls, data):
"""Create a Wind Condition from a dictionary.
Args:
data = {
"wind_speed": float,
"wind_direction": float,
"rain": bool,
"snow_on_ground": bool}
"""
# Check required and optional keys
optional_... | python | def from_json(cls, data):
"""Create a Wind Condition from a dictionary.
Args:
data = {
"wind_speed": float,
"wind_direction": float,
"rain": bool,
"snow_on_ground": bool}
"""
# Check required and optional keys
optional_... | [
"def",
"from_json",
"(",
"cls",
",",
"data",
")",
":",
"optional_keys",
"=",
"{",
"'wind_direction'",
":",
"0",
",",
"'rain'",
":",
"False",
",",
"'snow_on_ground'",
":",
"False",
"}",
"assert",
"'wind_speed'",
"in",
"data",
",",
"'Required key \"wind_speed\" ... | Create a Wind Condition from a dictionary.
Args:
data = {
"wind_speed": float,
"wind_direction": float,
"rain": bool,
"snow_on_ground": bool} | [
"Create",
"a",
"Wind",
"Condition",
"from",
"a",
"dictionary",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/designday.py#L1029-L1047 | train |
ladybug-tools/ladybug | ladybug/designday.py | WindCondition.to_json | def to_json(self):
"""Convert the Wind Condition to a dictionary."""
return {
'wind_speed': self.wind_speed,
'wind_direction': self.wind_direction,
'rain': self.rain,
'snow_on_ground': self.snow_on_ground
} | python | def to_json(self):
"""Convert the Wind Condition to a dictionary."""
return {
'wind_speed': self.wind_speed,
'wind_direction': self.wind_direction,
'rain': self.rain,
'snow_on_ground': self.snow_on_ground
} | [
"def",
"to_json",
"(",
"self",
")",
":",
"return",
"{",
"'wind_speed'",
":",
"self",
".",
"wind_speed",
",",
"'wind_direction'",
":",
"self",
".",
"wind_direction",
",",
"'rain'",
":",
"self",
".",
"rain",
",",
"'snow_on_ground'",
":",
"self",
".",
"snow_o... | Convert the Wind Condition to a dictionary. | [
"Convert",
"the",
"Wind",
"Condition",
"to",
"a",
"dictionary",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/designday.py#L1116-L1123 | train |
ladybug-tools/ladybug | ladybug/designday.py | SkyCondition._get_datetimes | def _get_datetimes(self, timestep=1):
"""List of datetimes based on design day date and timestep."""
start_moy = DateTime(self._month, self._day_of_month).moy
if timestep == 1:
start_moy = start_moy + 30
num_moys = 24 * timestep
return tuple(
DateTime.from... | python | def _get_datetimes(self, timestep=1):
"""List of datetimes based on design day date and timestep."""
start_moy = DateTime(self._month, self._day_of_month).moy
if timestep == 1:
start_moy = start_moy + 30
num_moys = 24 * timestep
return tuple(
DateTime.from... | [
"def",
"_get_datetimes",
"(",
"self",
",",
"timestep",
"=",
"1",
")",
":",
"start_moy",
"=",
"DateTime",
"(",
"self",
".",
"_month",
",",
"self",
".",
"_day_of_month",
")",
".",
"moy",
"if",
"timestep",
"==",
"1",
":",
"start_moy",
"=",
"start_moy",
"+... | List of datetimes based on design day date and timestep. | [
"List",
"of",
"datetimes",
"based",
"on",
"design",
"day",
"date",
"and",
"timestep",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/designday.py#L1230-L1239 | train |
ladybug-tools/ladybug | ladybug/designday.py | OriginalClearSkyCondition.from_analysis_period | def from_analysis_period(cls, analysis_period, clearness=1,
daylight_savings_indicator='No'):
""""Initialize a OriginalClearSkyCondition from an analysis_period"""
_check_analysis_period(analysis_period)
return cls(analysis_period.st_month, analysis_period.st_day, cl... | python | def from_analysis_period(cls, analysis_period, clearness=1,
daylight_savings_indicator='No'):
""""Initialize a OriginalClearSkyCondition from an analysis_period"""
_check_analysis_period(analysis_period)
return cls(analysis_period.st_month, analysis_period.st_day, cl... | [
"def",
"from_analysis_period",
"(",
"cls",
",",
"analysis_period",
",",
"clearness",
"=",
"1",
",",
"daylight_savings_indicator",
"=",
"'No'",
")",
":",
"_check_analysis_period",
"(",
"analysis_period",
")",
"return",
"cls",
"(",
"analysis_period",
".",
"st_month",
... | Initialize a OriginalClearSkyCondition from an analysis_period | [
"Initialize",
"a",
"OriginalClearSkyCondition",
"from",
"an",
"analysis_period"
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/designday.py#L1289-L1294 | train |
ladybug-tools/ladybug | ladybug/designday.py | OriginalClearSkyCondition.radiation_values | def radiation_values(self, location, timestep=1):
"""Lists of driect normal, diffuse horiz, and global horiz rad at each timestep.
"""
# create sunpath and get altitude at every timestep of the design day
sp = Sunpath.from_location(location)
altitudes = []
dates = self._g... | python | def radiation_values(self, location, timestep=1):
"""Lists of driect normal, diffuse horiz, and global horiz rad at each timestep.
"""
# create sunpath and get altitude at every timestep of the design day
sp = Sunpath.from_location(location)
altitudes = []
dates = self._g... | [
"def",
"radiation_values",
"(",
"self",
",",
"location",
",",
"timestep",
"=",
"1",
")",
":",
"sp",
"=",
"Sunpath",
".",
"from_location",
"(",
"location",
")",
"altitudes",
"=",
"[",
"]",
"dates",
"=",
"self",
".",
"_get_datetimes",
"(",
"timestep",
")",... | Lists of driect normal, diffuse horiz, and global horiz rad at each timestep. | [
"Lists",
"of",
"driect",
"normal",
"diffuse",
"horiz",
"and",
"global",
"horiz",
"rad",
"at",
"each",
"timestep",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/designday.py#L1341-L1355 | train |
ladybug-tools/ladybug | ladybug/designday.py | RevisedClearSkyCondition.from_analysis_period | def from_analysis_period(cls, analysis_period, tau_b, tau_d,
daylight_savings_indicator='No'):
""""Initialize a RevisedClearSkyCondition from an analysis_period"""
_check_analysis_period(analysis_period)
return cls(analysis_period.st_month, analysis_period.st_day, ta... | python | def from_analysis_period(cls, analysis_period, tau_b, tau_d,
daylight_savings_indicator='No'):
""""Initialize a RevisedClearSkyCondition from an analysis_period"""
_check_analysis_period(analysis_period)
return cls(analysis_period.st_month, analysis_period.st_day, ta... | [
"def",
"from_analysis_period",
"(",
"cls",
",",
"analysis_period",
",",
"tau_b",
",",
"tau_d",
",",
"daylight_savings_indicator",
"=",
"'No'",
")",
":",
"_check_analysis_period",
"(",
"analysis_period",
")",
"return",
"cls",
"(",
"analysis_period",
".",
"st_month",
... | Initialize a RevisedClearSkyCondition from an analysis_period | [
"Initialize",
"a",
"RevisedClearSkyCondition",
"from",
"an",
"analysis_period"
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/designday.py#L1387-L1392 | train |
ladybug-tools/ladybug | ladybug/_datacollectionbase.py | BaseCollection.convert_to_unit | def convert_to_unit(self, unit):
"""Convert the Data Collection to the input unit."""
self._values = self._header.data_type.to_unit(
self._values, unit, self._header.unit)
self._header._unit = unit | python | def convert_to_unit(self, unit):
"""Convert the Data Collection to the input unit."""
self._values = self._header.data_type.to_unit(
self._values, unit, self._header.unit)
self._header._unit = unit | [
"def",
"convert_to_unit",
"(",
"self",
",",
"unit",
")",
":",
"self",
".",
"_values",
"=",
"self",
".",
"_header",
".",
"data_type",
".",
"to_unit",
"(",
"self",
".",
"_values",
",",
"unit",
",",
"self",
".",
"_header",
".",
"unit",
")",
"self",
".",... | Convert the Data Collection to the input unit. | [
"Convert",
"the",
"Data",
"Collection",
"to",
"the",
"input",
"unit",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/_datacollectionbase.py#L126-L130 | train |
ladybug-tools/ladybug | ladybug/_datacollectionbase.py | BaseCollection.convert_to_ip | def convert_to_ip(self):
"""Convert the Data Collection to IP units."""
self._values, self._header._unit = self._header.data_type.to_ip(
self._values, self._header.unit) | python | def convert_to_ip(self):
"""Convert the Data Collection to IP units."""
self._values, self._header._unit = self._header.data_type.to_ip(
self._values, self._header.unit) | [
"def",
"convert_to_ip",
"(",
"self",
")",
":",
"self",
".",
"_values",
",",
"self",
".",
"_header",
".",
"_unit",
"=",
"self",
".",
"_header",
".",
"data_type",
".",
"to_ip",
"(",
"self",
".",
"_values",
",",
"self",
".",
"_header",
".",
"unit",
")"
... | Convert the Data Collection to IP units. | [
"Convert",
"the",
"Data",
"Collection",
"to",
"IP",
"units",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/_datacollectionbase.py#L132-L135 | train |
ladybug-tools/ladybug | ladybug/_datacollectionbase.py | BaseCollection.convert_to_si | def convert_to_si(self):
"""Convert the Data Collection to SI units."""
self._values, self._header._unit = self._header.data_type.to_si(
self._values, self._header.unit) | python | def convert_to_si(self):
"""Convert the Data Collection to SI units."""
self._values, self._header._unit = self._header.data_type.to_si(
self._values, self._header.unit) | [
"def",
"convert_to_si",
"(",
"self",
")",
":",
"self",
".",
"_values",
",",
"self",
".",
"_header",
".",
"_unit",
"=",
"self",
".",
"_header",
".",
"data_type",
".",
"to_si",
"(",
"self",
".",
"_values",
",",
"self",
".",
"_header",
".",
"unit",
")"
... | Convert the Data Collection to SI units. | [
"Convert",
"the",
"Data",
"Collection",
"to",
"SI",
"units",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/_datacollectionbase.py#L137-L140 | train |
ladybug-tools/ladybug | ladybug/_datacollectionbase.py | BaseCollection.to_unit | def to_unit(self, unit):
"""Return a Data Collection in the input unit."""
new_data_c = self.duplicate()
new_data_c.convert_to_unit(unit)
return new_data_c | python | def to_unit(self, unit):
"""Return a Data Collection in the input unit."""
new_data_c = self.duplicate()
new_data_c.convert_to_unit(unit)
return new_data_c | [
"def",
"to_unit",
"(",
"self",
",",
"unit",
")",
":",
"new_data_c",
"=",
"self",
".",
"duplicate",
"(",
")",
"new_data_c",
".",
"convert_to_unit",
"(",
"unit",
")",
"return",
"new_data_c"
] | Return a Data Collection in the input unit. | [
"Return",
"a",
"Data",
"Collection",
"in",
"the",
"input",
"unit",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/_datacollectionbase.py#L142-L146 | train |
ladybug-tools/ladybug | ladybug/_datacollectionbase.py | BaseCollection.is_in_data_type_range | def is_in_data_type_range(self, raise_exception=True):
"""Check if collection values are in physically possible ranges for the data_type.
If this method returns False, the Data Collection's data is
physically or mathematically impossible for the data_type."""
return self._header.data_ty... | python | def is_in_data_type_range(self, raise_exception=True):
"""Check if collection values are in physically possible ranges for the data_type.
If this method returns False, the Data Collection's data is
physically or mathematically impossible for the data_type."""
return self._header.data_ty... | [
"def",
"is_in_data_type_range",
"(",
"self",
",",
"raise_exception",
"=",
"True",
")",
":",
"return",
"self",
".",
"_header",
".",
"data_type",
".",
"is_in_range",
"(",
"self",
".",
"_values",
",",
"self",
".",
"_header",
".",
"unit",
",",
"raise_exception",... | Check if collection values are in physically possible ranges for the data_type.
If this method returns False, the Data Collection's data is
physically or mathematically impossible for the data_type. | [
"Check",
"if",
"collection",
"values",
"are",
"in",
"physically",
"possible",
"ranges",
"for",
"the",
"data_type",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/_datacollectionbase.py#L160-L166 | train |
ladybug-tools/ladybug | ladybug/_datacollectionbase.py | BaseCollection.get_highest_values | def get_highest_values(self, count):
"""Get a list of the the x highest values of the Data Collection and their indices.
This is useful for situations where one needs to know the times of
the year when the largest values of a data collection occur. For example,
there is a European dayi... | python | def get_highest_values(self, count):
"""Get a list of the the x highest values of the Data Collection and their indices.
This is useful for situations where one needs to know the times of
the year when the largest values of a data collection occur. For example,
there is a European dayi... | [
"def",
"get_highest_values",
"(",
"self",
",",
"count",
")",
":",
"count",
"=",
"int",
"(",
"count",
")",
"assert",
"count",
"<=",
"len",
"(",
"self",
".",
"_values",
")",
",",
"'count must be smaller than or equal to values length. {} > {}.'",
".",
"format",
"(... | Get a list of the the x highest values of the Data Collection and their indices.
This is useful for situations where one needs to know the times of
the year when the largest values of a data collection occur. For example,
there is a European dayight code that requires an analysis for the hours... | [
"Get",
"a",
"list",
"of",
"the",
"the",
"x",
"highest",
"values",
"of",
"the",
"Data",
"Collection",
"and",
"their",
"indices",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/_datacollectionbase.py#L179-L207 | train |
ladybug-tools/ladybug | ladybug/_datacollectionbase.py | BaseCollection.get_lowest_values | def get_lowest_values(self, count):
"""Get a list of the the x lowest values of the Data Collection and their indices.
This is useful for situations where one needs to know the times of
the year when the smallest values of a data collection occur.
Args:
count: Integer repre... | python | def get_lowest_values(self, count):
"""Get a list of the the x lowest values of the Data Collection and their indices.
This is useful for situations where one needs to know the times of
the year when the smallest values of a data collection occur.
Args:
count: Integer repre... | [
"def",
"get_lowest_values",
"(",
"self",
",",
"count",
")",
":",
"count",
"=",
"int",
"(",
"count",
")",
"assert",
"count",
"<=",
"len",
"(",
"self",
".",
"_values",
")",
",",
"'count must be <= to Data Collection len. {} > {}.'",
".",
"format",
"(",
"count",
... | Get a list of the the x lowest values of the Data Collection and their indices.
This is useful for situations where one needs to know the times of
the year when the smallest values of a data collection occur.
Args:
count: Integer representing the number of lowest values to account ... | [
"Get",
"a",
"list",
"of",
"the",
"the",
"x",
"lowest",
"values",
"of",
"the",
"Data",
"Collection",
"and",
"their",
"indices",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/_datacollectionbase.py#L209-L233 | train |
ladybug-tools/ladybug | ladybug/_datacollectionbase.py | BaseCollection.get_percentile | def get_percentile(self, percentile):
"""Get a value representing a the input percentile of the Data Collection.
Args:
percentile: A float value from 0 to 100 representing the
requested percentile.
Return:
The Data Collection value at the input percentil... | python | def get_percentile(self, percentile):
"""Get a value representing a the input percentile of the Data Collection.
Args:
percentile: A float value from 0 to 100 representing the
requested percentile.
Return:
The Data Collection value at the input percentil... | [
"def",
"get_percentile",
"(",
"self",
",",
"percentile",
")",
":",
"assert",
"0",
"<=",
"percentile",
"<=",
"100",
",",
"'percentile must be between 0 and 100. Got {}'",
".",
"format",
"(",
"percentile",
")",
"return",
"self",
".",
"_percentile",
"(",
"self",
".... | Get a value representing a the input percentile of the Data Collection.
Args:
percentile: A float value from 0 to 100 representing the
requested percentile.
Return:
The Data Collection value at the input percentile | [
"Get",
"a",
"value",
"representing",
"a",
"the",
"input",
"percentile",
"of",
"the",
"Data",
"Collection",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/_datacollectionbase.py#L235-L247 | train |
ladybug-tools/ladybug | ladybug/_datacollectionbase.py | BaseCollection.get_aligned_collection | def get_aligned_collection(self, value=0, data_type=None, unit=None, mutable=None):
"""Return a Collection aligned with this one composed of one repeated value.
Aligned Data Collections are of the same Data Collection class, have the same
number of values and have matching datetimes.
A... | python | def get_aligned_collection(self, value=0, data_type=None, unit=None, mutable=None):
"""Return a Collection aligned with this one composed of one repeated value.
Aligned Data Collections are of the same Data Collection class, have the same
number of values and have matching datetimes.
A... | [
"def",
"get_aligned_collection",
"(",
"self",
",",
"value",
"=",
"0",
",",
"data_type",
"=",
"None",
",",
"unit",
"=",
"None",
",",
"mutable",
"=",
"None",
")",
":",
"header",
"=",
"self",
".",
"_check_aligned_header",
"(",
"data_type",
",",
"unit",
")",... | Return a Collection aligned with this one composed of one repeated value.
Aligned Data Collections are of the same Data Collection class, have the same
number of values and have matching datetimes.
Args:
value: A value to be repeated in the aliged collection values or
... | [
"Return",
"a",
"Collection",
"aligned",
"with",
"this",
"one",
"composed",
"of",
"one",
"repeated",
"value",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/_datacollectionbase.py#L308-L346 | train |
ladybug-tools/ladybug | ladybug/_datacollectionbase.py | BaseCollection.duplicate | def duplicate(self):
"""Return a copy of the current Data Collection."""
collection = self.__class__(self.header.duplicate(), self.values, self.datetimes)
collection._validated_a_period = self._validated_a_period
return collection | python | def duplicate(self):
"""Return a copy of the current Data Collection."""
collection = self.__class__(self.header.duplicate(), self.values, self.datetimes)
collection._validated_a_period = self._validated_a_period
return collection | [
"def",
"duplicate",
"(",
"self",
")",
":",
"collection",
"=",
"self",
".",
"__class__",
"(",
"self",
".",
"header",
".",
"duplicate",
"(",
")",
",",
"self",
".",
"values",
",",
"self",
".",
"datetimes",
")",
"collection",
".",
"_validated_a_period",
"=",... | Return a copy of the current Data Collection. | [
"Return",
"a",
"copy",
"of",
"the",
"current",
"Data",
"Collection",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/_datacollectionbase.py#L348-L352 | train |
ladybug-tools/ladybug | ladybug/_datacollectionbase.py | BaseCollection.to_json | def to_json(self):
"""Convert Data Collection to a dictionary."""
return {
'header': self.header.to_json(),
'values': self._values,
'datetimes': self.datetimes,
'validated_a_period': self._validated_a_period
} | python | def to_json(self):
"""Convert Data Collection to a dictionary."""
return {
'header': self.header.to_json(),
'values': self._values,
'datetimes': self.datetimes,
'validated_a_period': self._validated_a_period
} | [
"def",
"to_json",
"(",
"self",
")",
":",
"return",
"{",
"'header'",
":",
"self",
".",
"header",
".",
"to_json",
"(",
")",
",",
"'values'",
":",
"self",
".",
"_values",
",",
"'datetimes'",
":",
"self",
".",
"datetimes",
",",
"'validated_a_period'",
":",
... | Convert Data Collection to a dictionary. | [
"Convert",
"Data",
"Collection",
"to",
"a",
"dictionary",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/_datacollectionbase.py#L354-L361 | train |
ladybug-tools/ladybug | ladybug/_datacollectionbase.py | BaseCollection.filter_collections_by_statement | def filter_collections_by_statement(data_collections, statement):
"""Generate a filtered data collections according to a conditional statement.
Args:
data_collections: A list of aligned Data Collections to be evaluated
against the statement.
statement: A conditio... | python | def filter_collections_by_statement(data_collections, statement):
"""Generate a filtered data collections according to a conditional statement.
Args:
data_collections: A list of aligned Data Collections to be evaluated
against the statement.
statement: A conditio... | [
"def",
"filter_collections_by_statement",
"(",
"data_collections",
",",
"statement",
")",
":",
"pattern",
"=",
"BaseCollection",
".",
"pattern_from_collections_and_statement",
"(",
"data_collections",
",",
"statement",
")",
"collections",
"=",
"[",
"coll",
".",
"filter_... | Generate a filtered data collections according to a conditional statement.
Args:
data_collections: A list of aligned Data Collections to be evaluated
against the statement.
statement: A conditional statement as a string (e.g. a>25 and a%5==0).
The variabl... | [
"Generate",
"a",
"filtered",
"data",
"collections",
"according",
"to",
"a",
"conditional",
"statement",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/_datacollectionbase.py#L364-L380 | train |
ladybug-tools/ladybug | ladybug/_datacollectionbase.py | BaseCollection.pattern_from_collections_and_statement | def pattern_from_collections_and_statement(data_collections, statement):
"""Generate a list of booleans from data collections and a conditional statement.
Args:
data_collections: A list of aligned Data Collections to be evaluated
against the statement.
statement:... | python | def pattern_from_collections_and_statement(data_collections, statement):
"""Generate a list of booleans from data collections and a conditional statement.
Args:
data_collections: A list of aligned Data Collections to be evaluated
against the statement.
statement:... | [
"def",
"pattern_from_collections_and_statement",
"(",
"data_collections",
",",
"statement",
")",
":",
"BaseCollection",
".",
"are_collections_aligned",
"(",
"data_collections",
")",
"correct_var",
"=",
"BaseCollection",
".",
"_check_conditional_statement",
"(",
"statement",
... | Generate a list of booleans from data collections and a conditional statement.
Args:
data_collections: A list of aligned Data Collections to be evaluated
against the statement.
statement: A conditional statement as a string (e.g. a>25 and a%5==0).
The var... | [
"Generate",
"a",
"list",
"of",
"booleans",
"from",
"data",
"collections",
"and",
"a",
"conditional",
"statement",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/_datacollectionbase.py#L383-L415 | train |
ladybug-tools/ladybug | ladybug/_datacollectionbase.py | BaseCollection.are_collections_aligned | def are_collections_aligned(data_collections, raise_exception=True):
"""Test if a series of Data Collections are aligned with one another.
Aligned Data Collections are of the same Data Collection class, have the
same number of values and have matching datetimes.
Args:
data_... | python | def are_collections_aligned(data_collections, raise_exception=True):
"""Test if a series of Data Collections are aligned with one another.
Aligned Data Collections are of the same Data Collection class, have the
same number of values and have matching datetimes.
Args:
data_... | [
"def",
"are_collections_aligned",
"(",
"data_collections",
",",
"raise_exception",
"=",
"True",
")",
":",
"if",
"len",
"(",
"data_collections",
")",
">",
"1",
":",
"first_coll",
"=",
"data_collections",
"[",
"0",
"]",
"for",
"coll",
"in",
"data_collections",
"... | Test if a series of Data Collections are aligned with one another.
Aligned Data Collections are of the same Data Collection class, have the
same number of values and have matching datetimes.
Args:
data_collections: A list of Data Collections for which you want to
te... | [
"Test",
"if",
"a",
"series",
"of",
"Data",
"Collections",
"are",
"aligned",
"with",
"one",
"another",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/_datacollectionbase.py#L418-L441 | train |
ladybug-tools/ladybug | ladybug/_datacollectionbase.py | BaseCollection.compute_function_aligned | def compute_function_aligned(funct, data_collections, data_type, unit):
"""Compute a function with a list of aligned data collections or individual values.
Args:
funct: A function with a single numerical value as output and one or
more numerical values as input.
... | python | def compute_function_aligned(funct, data_collections, data_type, unit):
"""Compute a function with a list of aligned data collections or individual values.
Args:
funct: A function with a single numerical value as output and one or
more numerical values as input.
... | [
"def",
"compute_function_aligned",
"(",
"funct",
",",
"data_collections",
",",
"data_type",
",",
"unit",
")",
":",
"data_colls",
"=",
"[",
"]",
"for",
"i",
",",
"func_input",
"in",
"enumerate",
"(",
"data_collections",
")",
":",
"if",
"isinstance",
"(",
"fun... | Compute a function with a list of aligned data collections or individual values.
Args:
funct: A function with a single numerical value as output and one or
more numerical values as input.
data_collections: A list with a length equal to the number of arguments
... | [
"Compute",
"a",
"function",
"with",
"a",
"list",
"of",
"aligned",
"data",
"collections",
"or",
"individual",
"values",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/_datacollectionbase.py#L444-L500 | train |
ladybug-tools/ladybug | ladybug/_datacollectionbase.py | BaseCollection._check_conditional_statement | def _check_conditional_statement(statement, num_collections):
"""Method to check conditional statements to be sure that they are valid.
Args:
statement: A conditional statement as a string (e.g. a>25 and a%5==0).
The variable should always be named as 'a' (without quotations... | python | def _check_conditional_statement(statement, num_collections):
"""Method to check conditional statements to be sure that they are valid.
Args:
statement: A conditional statement as a string (e.g. a>25 and a%5==0).
The variable should always be named as 'a' (without quotations... | [
"def",
"_check_conditional_statement",
"(",
"statement",
",",
"num_collections",
")",
":",
"correct_var",
"=",
"list",
"(",
"ascii_lowercase",
")",
"[",
":",
"num_collections",
"]",
"st_statement",
"=",
"BaseCollection",
".",
"_remove_operators",
"(",
"statement",
"... | Method to check conditional statements to be sure that they are valid.
Args:
statement: A conditional statement as a string (e.g. a>25 and a%5==0).
The variable should always be named as 'a' (without quotations).
num_collections: An integer representing the number of dat... | [
"Method",
"to",
"check",
"conditional",
"statements",
"to",
"be",
"sure",
"that",
"they",
"are",
"valid",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/_datacollectionbase.py#L503-L532 | train |
ladybug-tools/ladybug | ladybug/_datacollectionbase.py | BaseCollection._filter_by_statement | def _filter_by_statement(self, statement):
"""Filter the data collection based on a conditional statement."""
self.__class__._check_conditional_statement(statement, 1)
_filt_values, _filt_datetimes = [], []
for i, a in enumerate(self._values):
if eval(statement, {'a': a}):
... | python | def _filter_by_statement(self, statement):
"""Filter the data collection based on a conditional statement."""
self.__class__._check_conditional_statement(statement, 1)
_filt_values, _filt_datetimes = [], []
for i, a in enumerate(self._values):
if eval(statement, {'a': a}):
... | [
"def",
"_filter_by_statement",
"(",
"self",
",",
"statement",
")",
":",
"self",
".",
"__class__",
".",
"_check_conditional_statement",
"(",
"statement",
",",
"1",
")",
"_filt_values",
",",
"_filt_datetimes",
"=",
"[",
"]",
",",
"[",
"]",
"for",
"i",
",",
"... | Filter the data collection based on a conditional statement. | [
"Filter",
"the",
"data",
"collection",
"based",
"on",
"a",
"conditional",
"statement",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/_datacollectionbase.py#L552-L560 | train |
ladybug-tools/ladybug | ladybug/_datacollectionbase.py | BaseCollection._filter_by_pattern | def _filter_by_pattern(self, pattern):
"""Filter the Filter the Data Collection based on a list of booleans."""
try:
_len = len(pattern)
except TypeError:
raise TypeError("pattern is not a list of Booleans. Got {}".format(
type(pattern)))
_filt_val... | python | def _filter_by_pattern(self, pattern):
"""Filter the Filter the Data Collection based on a list of booleans."""
try:
_len = len(pattern)
except TypeError:
raise TypeError("pattern is not a list of Booleans. Got {}".format(
type(pattern)))
_filt_val... | [
"def",
"_filter_by_pattern",
"(",
"self",
",",
"pattern",
")",
":",
"try",
":",
"_len",
"=",
"len",
"(",
"pattern",
")",
"except",
"TypeError",
":",
"raise",
"TypeError",
"(",
"\"pattern is not a list of Booleans. Got {}\"",
".",
"format",
"(",
"type",
"(",
"p... | Filter the Filter the Data Collection based on a list of booleans. | [
"Filter",
"the",
"Filter",
"the",
"Data",
"Collection",
"based",
"on",
"a",
"list",
"of",
"booleans",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/_datacollectionbase.py#L562-L571 | train |
ladybug-tools/ladybug | ladybug/_datacollectionbase.py | BaseCollection._check_aligned_header | def _check_aligned_header(self, data_type, unit):
"""Check the header inputs whenever get_aligned_collection is called."""
if data_type is not None:
assert isinstance(data_type, DataTypeBase), \
'data_type must be a Ladybug DataType. Got {}'.format(type(data_type))
... | python | def _check_aligned_header(self, data_type, unit):
"""Check the header inputs whenever get_aligned_collection is called."""
if data_type is not None:
assert isinstance(data_type, DataTypeBase), \
'data_type must be a Ladybug DataType. Got {}'.format(type(data_type))
... | [
"def",
"_check_aligned_header",
"(",
"self",
",",
"data_type",
",",
"unit",
")",
":",
"if",
"data_type",
"is",
"not",
"None",
":",
"assert",
"isinstance",
"(",
"data_type",
",",
"DataTypeBase",
")",
",",
"'data_type must be a Ladybug DataType. Got {}'",
".",
"form... | Check the header inputs whenever get_aligned_collection is called. | [
"Check",
"the",
"header",
"inputs",
"whenever",
"get_aligned_collection",
"is",
"called",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/_datacollectionbase.py#L583-L593 | train |
ladybug-tools/ladybug | ladybug/_datacollectionbase.py | BaseCollection._check_aligned_value | def _check_aligned_value(self, value):
"""Check the value input whenever get_aligned_collection is called."""
if isinstance(value, Iterable) and not isinstance(
value, (str, dict, bytes, bytearray)):
assert len(value) == len(self._values), "Length of value ({}) must match "\
... | python | def _check_aligned_value(self, value):
"""Check the value input whenever get_aligned_collection is called."""
if isinstance(value, Iterable) and not isinstance(
value, (str, dict, bytes, bytearray)):
assert len(value) == len(self._values), "Length of value ({}) must match "\
... | [
"def",
"_check_aligned_value",
"(",
"self",
",",
"value",
")",
":",
"if",
"isinstance",
"(",
"value",
",",
"Iterable",
")",
"and",
"not",
"isinstance",
"(",
"value",
",",
"(",
"str",
",",
"dict",
",",
"bytes",
",",
"bytearray",
")",
")",
":",
"assert",... | Check the value input whenever get_aligned_collection is called. | [
"Check",
"the",
"value",
"input",
"whenever",
"get_aligned_collection",
"is",
"called",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/_datacollectionbase.py#L595-L605 | train |
ladybug-tools/ladybug | ladybug/dt.py | DateTime.from_json | def from_json(cls, data):
"""Creat datetime from a dictionary.
Args:
data: {
'month': A value for month between 1-12. (Defualt: 1)
'day': A value for day between 1-31. (Defualt: 1)
'hour': A value for hour between 0-23. (Defualt: 0)
... | python | def from_json(cls, data):
"""Creat datetime from a dictionary.
Args:
data: {
'month': A value for month between 1-12. (Defualt: 1)
'day': A value for day between 1-31. (Defualt: 1)
'hour': A value for hour between 0-23. (Defualt: 0)
... | [
"def",
"from_json",
"(",
"cls",
",",
"data",
")",
":",
"if",
"'month'",
"not",
"in",
"data",
":",
"data",
"[",
"'month'",
"]",
"=",
"1",
"if",
"'day'",
"not",
"in",
"data",
":",
"data",
"[",
"'day'",
"]",
"=",
"1",
"if",
"'hour'",
"not",
"in",
... | Creat datetime from a dictionary.
Args:
data: {
'month': A value for month between 1-12. (Defualt: 1)
'day': A value for day between 1-31. (Defualt: 1)
'hour': A value for hour between 0-23. (Defualt: 0)
'minute': A value for month bet... | [
"Creat",
"datetime",
"from",
"a",
"dictionary",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/dt.py#L43-L70 | train |
ladybug-tools/ladybug | ladybug/dt.py | DateTime.from_hoy | def from_hoy(cls, hoy, leap_year=False):
"""Create Ladybug Datetime from an hour of the year.
Args:
hoy: A float value 0 <= and < 8760
"""
return cls.from_moy(round(hoy * 60), leap_year) | python | def from_hoy(cls, hoy, leap_year=False):
"""Create Ladybug Datetime from an hour of the year.
Args:
hoy: A float value 0 <= and < 8760
"""
return cls.from_moy(round(hoy * 60), leap_year) | [
"def",
"from_hoy",
"(",
"cls",
",",
"hoy",
",",
"leap_year",
"=",
"False",
")",
":",
"return",
"cls",
".",
"from_moy",
"(",
"round",
"(",
"hoy",
"*",
"60",
")",
",",
"leap_year",
")"
] | Create Ladybug Datetime from an hour of the year.
Args:
hoy: A float value 0 <= and < 8760 | [
"Create",
"Ladybug",
"Datetime",
"from",
"an",
"hour",
"of",
"the",
"year",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/dt.py#L73-L79 | train |
ladybug-tools/ladybug | ladybug/dt.py | DateTime.from_moy | def from_moy(cls, moy, leap_year=False):
"""Create Ladybug Datetime from a minute of the year.
Args:
moy: An integer value 0 <= and < 525600
"""
if not leap_year:
num_of_minutes_until_month = (0, 44640, 84960, 129600, 172800, 217440,
... | python | def from_moy(cls, moy, leap_year=False):
"""Create Ladybug Datetime from a minute of the year.
Args:
moy: An integer value 0 <= and < 525600
"""
if not leap_year:
num_of_minutes_until_month = (0, 44640, 84960, 129600, 172800, 217440,
... | [
"def",
"from_moy",
"(",
"cls",
",",
"moy",
",",
"leap_year",
"=",
"False",
")",
":",
"if",
"not",
"leap_year",
":",
"num_of_minutes_until_month",
"=",
"(",
"0",
",",
"44640",
",",
"84960",
",",
"129600",
",",
"172800",
",",
"217440",
",",
"260640",
","... | Create Ladybug Datetime from a minute of the year.
Args:
moy: An integer value 0 <= and < 525600 | [
"Create",
"Ladybug",
"Datetime",
"from",
"a",
"minute",
"of",
"the",
"year",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/dt.py#L82-L112 | train |
ladybug-tools/ladybug | ladybug/dt.py | DateTime.from_date_time_string | def from_date_time_string(cls, datetime_string, leap_year=False):
"""Create Ladybug DateTime from a DateTime string.
Usage:
dt = DateTime.from_date_time_string("31 Dec 12:00")
"""
dt = datetime.strptime(datetime_string, '%d %b %H:%M')
return cls(dt.month, dt.day, dt... | python | def from_date_time_string(cls, datetime_string, leap_year=False):
"""Create Ladybug DateTime from a DateTime string.
Usage:
dt = DateTime.from_date_time_string("31 Dec 12:00")
"""
dt = datetime.strptime(datetime_string, '%d %b %H:%M')
return cls(dt.month, dt.day, dt... | [
"def",
"from_date_time_string",
"(",
"cls",
",",
"datetime_string",
",",
"leap_year",
"=",
"False",
")",
":",
"dt",
"=",
"datetime",
".",
"strptime",
"(",
"datetime_string",
",",
"'%d %b %H:%M'",
")",
"return",
"cls",
"(",
"dt",
".",
"month",
",",
"dt",
".... | Create Ladybug DateTime from a DateTime string.
Usage:
dt = DateTime.from_date_time_string("31 Dec 12:00") | [
"Create",
"Ladybug",
"DateTime",
"from",
"a",
"DateTime",
"string",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/dt.py#L115-L123 | train |
ladybug-tools/ladybug | ladybug/dt.py | DateTime._calculate_hour_and_minute | def _calculate_hour_and_minute(float_hour):
"""Calculate hour and minutes as integers from a float hour."""
hour, minute = int(float_hour), int(round((float_hour - int(float_hour)) * 60))
if minute == 60:
return hour + 1, 0
else:
return hour, minute | python | def _calculate_hour_and_minute(float_hour):
"""Calculate hour and minutes as integers from a float hour."""
hour, minute = int(float_hour), int(round((float_hour - int(float_hour)) * 60))
if minute == 60:
return hour + 1, 0
else:
return hour, minute | [
"def",
"_calculate_hour_and_minute",
"(",
"float_hour",
")",
":",
"hour",
",",
"minute",
"=",
"int",
"(",
"float_hour",
")",
",",
"int",
"(",
"round",
"(",
"(",
"float_hour",
"-",
"int",
"(",
"float_hour",
")",
")",
"*",
"60",
")",
")",
"if",
"minute",... | Calculate hour and minutes as integers from a float hour. | [
"Calculate",
"hour",
"and",
"minutes",
"as",
"integers",
"from",
"a",
"float",
"hour",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/dt.py#L159-L165 | train |
ladybug-tools/ladybug | ladybug/dt.py | DateTime.add_minute | def add_minute(self, minute):
"""Create a new DateTime after the minutes are added.
Args:
minute: An integer value for minutes.
"""
_moy = self.moy + int(minute)
return self.__class__.from_moy(_moy) | python | def add_minute(self, minute):
"""Create a new DateTime after the minutes are added.
Args:
minute: An integer value for minutes.
"""
_moy = self.moy + int(minute)
return self.__class__.from_moy(_moy) | [
"def",
"add_minute",
"(",
"self",
",",
"minute",
")",
":",
"_moy",
"=",
"self",
".",
"moy",
"+",
"int",
"(",
"minute",
")",
"return",
"self",
".",
"__class__",
".",
"from_moy",
"(",
"_moy",
")"
] | Create a new DateTime after the minutes are added.
Args:
minute: An integer value for minutes. | [
"Create",
"a",
"new",
"DateTime",
"after",
"the",
"minutes",
"are",
"added",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/dt.py#L167-L174 | train |
ladybug-tools/ladybug | ladybug/dt.py | DateTime.to_json | def to_json(self):
"""Get date time as a dictionary."""
return {'year': self.year,
'month': self.month,
'day': self.day,
'hour': self.hour,
'minute': self.minute} | python | def to_json(self):
"""Get date time as a dictionary."""
return {'year': self.year,
'month': self.month,
'day': self.day,
'hour': self.hour,
'minute': self.minute} | [
"def",
"to_json",
"(",
"self",
")",
":",
"return",
"{",
"'year'",
":",
"self",
".",
"year",
",",
"'month'",
":",
"self",
".",
"month",
",",
"'day'",
":",
"self",
".",
"day",
",",
"'hour'",
":",
"self",
".",
"hour",
",",
"'minute'",
":",
"self",
"... | Get date time as a dictionary. | [
"Get",
"date",
"time",
"as",
"a",
"dictionary",
"."
] | c08b7308077a48d5612f644943f92d5b5dade583 | https://github.com/ladybug-tools/ladybug/blob/c08b7308077a48d5612f644943f92d5b5dade583/ladybug/dt.py#L208-L214 | train |
Neurosim-lab/netpyne | netpyne/network/conn.py | fullConn | def fullConn (self, preCellsTags, postCellsTags, connParam):
from .. import sim
''' Generates connections between all pre and post-syn cells '''
if sim.cfg.verbose: print('Generating set of all-to-all connections (rule: %s) ...' % (connParam['label']))
# get list of params that have a lambda function
... | python | def fullConn (self, preCellsTags, postCellsTags, connParam):
from .. import sim
''' Generates connections between all pre and post-syn cells '''
if sim.cfg.verbose: print('Generating set of all-to-all connections (rule: %s) ...' % (connParam['label']))
# get list of params that have a lambda function
... | [
"def",
"fullConn",
"(",
"self",
",",
"preCellsTags",
",",
"postCellsTags",
",",
"connParam",
")",
":",
"from",
".",
".",
"import",
"sim",
"if",
"sim",
".",
"cfg",
".",
"verbose",
":",
"print",
"(",
"'Generating set of all-to-all connections (rule: %s) ...'",
"%"... | Generates connections between all pre and post-syn cells | [
"Generates",
"connections",
"between",
"all",
"pre",
"and",
"post",
"-",
"syn",
"cells"
] | edb67b5098b2e7923d55010ded59ad1bf75c0f18 | https://github.com/Neurosim-lab/netpyne/blob/edb67b5098b2e7923d55010ded59ad1bf75c0f18/netpyne/network/conn.py#L310-L327 | train |
Neurosim-lab/netpyne | netpyne/network/conn.py | fromListConn | def fromListConn (self, preCellsTags, postCellsTags, connParam):
from .. import sim
''' Generates connections between all pre and post-syn cells based list of relative cell ids'''
if sim.cfg.verbose: print('Generating set of connections from list (rule: %s) ...' % (connParam['label']))
orderedPreGids ... | python | def fromListConn (self, preCellsTags, postCellsTags, connParam):
from .. import sim
''' Generates connections between all pre and post-syn cells based list of relative cell ids'''
if sim.cfg.verbose: print('Generating set of connections from list (rule: %s) ...' % (connParam['label']))
orderedPreGids ... | [
"def",
"fromListConn",
"(",
"self",
",",
"preCellsTags",
",",
"postCellsTags",
",",
"connParam",
")",
":",
"from",
".",
".",
"import",
"sim",
"if",
"sim",
".",
"cfg",
".",
"verbose",
":",
"print",
"(",
"'Generating set of connections from list (rule: %s) ...'",
... | Generates connections between all pre and post-syn cells based list of relative cell ids | [
"Generates",
"connections",
"between",
"all",
"pre",
"and",
"post",
"-",
"syn",
"cells",
"based",
"list",
"of",
"relative",
"cell",
"ids"
] | edb67b5098b2e7923d55010ded59ad1bf75c0f18 | https://github.com/Neurosim-lab/netpyne/blob/edb67b5098b2e7923d55010ded59ad1bf75c0f18/netpyne/network/conn.py#L514-L549 | train |
Neurosim-lab/netpyne | netpyne/cell/compartCell.py | CompartCell.setImembPtr | def setImembPtr(self):
"""Set PtrVector to point to the i_membrane_"""
jseg = 0
for sec in list(self.secs.values()):
hSec = sec['hObj']
for iseg, seg in enumerate(hSec):
self.imembPtr.pset(jseg, seg._ref_i_membrane_) # notice the underscore at the end (i... | python | def setImembPtr(self):
"""Set PtrVector to point to the i_membrane_"""
jseg = 0
for sec in list(self.secs.values()):
hSec = sec['hObj']
for iseg, seg in enumerate(hSec):
self.imembPtr.pset(jseg, seg._ref_i_membrane_) # notice the underscore at the end (i... | [
"def",
"setImembPtr",
"(",
"self",
")",
":",
"jseg",
"=",
"0",
"for",
"sec",
"in",
"list",
"(",
"self",
".",
"secs",
".",
"values",
"(",
")",
")",
":",
"hSec",
"=",
"sec",
"[",
"'hObj'",
"]",
"for",
"iseg",
",",
"seg",
"in",
"enumerate",
"(",
"... | Set PtrVector to point to the i_membrane_ | [
"Set",
"PtrVector",
"to",
"point",
"to",
"the",
"i_membrane_"
] | edb67b5098b2e7923d55010ded59ad1bf75c0f18 | https://github.com/Neurosim-lab/netpyne/blob/edb67b5098b2e7923d55010ded59ad1bf75c0f18/netpyne/cell/compartCell.py#L1245-L1252 | train |
Neurosim-lab/netpyne | examples/RL_arm/main.py | saveWeights | def saveWeights(sim):
''' Save the weights for each plastic synapse '''
with open(sim.weightsfilename,'w') as fid:
for weightdata in sim.allWeights:
fid.write('%0.0f' % weightdata[0]) # Time
for i in range(1,len(weightdata)): fid.write('\t%0.8f' % weightdata[i])
fid.w... | python | def saveWeights(sim):
''' Save the weights for each plastic synapse '''
with open(sim.weightsfilename,'w') as fid:
for weightdata in sim.allWeights:
fid.write('%0.0f' % weightdata[0]) # Time
for i in range(1,len(weightdata)): fid.write('\t%0.8f' % weightdata[i])
fid.w... | [
"def",
"saveWeights",
"(",
"sim",
")",
":",
"with",
"open",
"(",
"sim",
".",
"weightsfilename",
",",
"'w'",
")",
"as",
"fid",
":",
"for",
"weightdata",
"in",
"sim",
".",
"allWeights",
":",
"fid",
".",
"write",
"(",
"'%0.0f'",
"%",
"weightdata",
"[",
... | Save the weights for each plastic synapse | [
"Save",
"the",
"weights",
"for",
"each",
"plastic",
"synapse"
] | edb67b5098b2e7923d55010ded59ad1bf75c0f18 | https://github.com/Neurosim-lab/netpyne/blob/edb67b5098b2e7923d55010ded59ad1bf75c0f18/examples/RL_arm/main.py#L127-L134 | train |
Neurosim-lab/netpyne | netpyne/specs/utils.py | validateFunction | def validateFunction(strFunc, netParamsVars):
''' returns True if "strFunc" can be evaluated'''
from math import exp, log, sqrt, sin, cos, tan, asin, acos, atan, sinh, cosh, tanh, pi, e
rand = h.Random()
stringFuncRandMethods = ['binomial', 'discunif', 'erlang', 'geometric', 'hypergeo',
'lognor... | python | def validateFunction(strFunc, netParamsVars):
''' returns True if "strFunc" can be evaluated'''
from math import exp, log, sqrt, sin, cos, tan, asin, acos, atan, sinh, cosh, tanh, pi, e
rand = h.Random()
stringFuncRandMethods = ['binomial', 'discunif', 'erlang', 'geometric', 'hypergeo',
'lognor... | [
"def",
"validateFunction",
"(",
"strFunc",
",",
"netParamsVars",
")",
":",
"from",
"math",
"import",
"exp",
",",
"log",
",",
"sqrt",
",",
"sin",
",",
"cos",
",",
"tan",
",",
"asin",
",",
"acos",
",",
"atan",
",",
"sinh",
",",
"cosh",
",",
"tanh",
"... | returns True if "strFunc" can be evaluated | [
"returns",
"True",
"if",
"strFunc",
"can",
"be",
"evaluated"
] | edb67b5098b2e7923d55010ded59ad1bf75c0f18 | https://github.com/Neurosim-lab/netpyne/blob/edb67b5098b2e7923d55010ded59ad1bf75c0f18/netpyne/specs/utils.py#L17-L50 | train |
Neurosim-lab/netpyne | netpyne/support/filter.py | bandpass | def bandpass(data, freqmin, freqmax, df, corners=4, zerophase=True):
"""
Butterworth-Bandpass Filter.
Filter data from ``freqmin`` to ``freqmax`` using ``corners``
corners.
The filter uses :func:`scipy.signal.iirfilter` (for design)
and :func:`scipy.signal.sosfilt` (for applying the filter).
... | python | def bandpass(data, freqmin, freqmax, df, corners=4, zerophase=True):
"""
Butterworth-Bandpass Filter.
Filter data from ``freqmin`` to ``freqmax`` using ``corners``
corners.
The filter uses :func:`scipy.signal.iirfilter` (for design)
and :func:`scipy.signal.sosfilt` (for applying the filter).
... | [
"def",
"bandpass",
"(",
"data",
",",
"freqmin",
",",
"freqmax",
",",
"df",
",",
"corners",
"=",
"4",
",",
"zerophase",
"=",
"True",
")",
":",
"fe",
"=",
"0.5",
"*",
"df",
"low",
"=",
"freqmin",
"/",
"fe",
"high",
"=",
"freqmax",
"/",
"fe",
"if",
... | Butterworth-Bandpass Filter.
Filter data from ``freqmin`` to ``freqmax`` using ``corners``
corners.
The filter uses :func:`scipy.signal.iirfilter` (for design)
and :func:`scipy.signal.sosfilt` (for applying the filter).
:type data: numpy.ndarray
:param data: Data to filter.
:param freqmin:... | [
"Butterworth",
"-",
"Bandpass",
"Filter",
"."
] | edb67b5098b2e7923d55010ded59ad1bf75c0f18 | https://github.com/Neurosim-lab/netpyne/blob/edb67b5098b2e7923d55010ded59ad1bf75c0f18/netpyne/support/filter.py#L45-L86 | train |
Neurosim-lab/netpyne | netpyne/support/filter.py | bandstop | def bandstop(data, freqmin, freqmax, df, corners=4, zerophase=False):
"""
Butterworth-Bandstop Filter.
Filter data removing data between frequencies ``freqmin`` and ``freqmax``
using ``corners`` corners.
The filter uses :func:`scipy.signal.iirfilter` (for design)
and :func:`scipy.signal.sosfilt... | python | def bandstop(data, freqmin, freqmax, df, corners=4, zerophase=False):
"""
Butterworth-Bandstop Filter.
Filter data removing data between frequencies ``freqmin`` and ``freqmax``
using ``corners`` corners.
The filter uses :func:`scipy.signal.iirfilter` (for design)
and :func:`scipy.signal.sosfilt... | [
"def",
"bandstop",
"(",
"data",
",",
"freqmin",
",",
"freqmax",
",",
"df",
",",
"corners",
"=",
"4",
",",
"zerophase",
"=",
"False",
")",
":",
"fe",
"=",
"0.5",
"*",
"df",
"low",
"=",
"freqmin",
"/",
"fe",
"high",
"=",
"freqmax",
"/",
"fe",
"if",... | Butterworth-Bandstop Filter.
Filter data removing data between frequencies ``freqmin`` and ``freqmax``
using ``corners`` corners.
The filter uses :func:`scipy.signal.iirfilter` (for design)
and :func:`scipy.signal.sosfilt` (for applying the filter).
:type data: numpy.ndarray
:param data: Data ... | [
"Butterworth",
"-",
"Bandstop",
"Filter",
"."
] | edb67b5098b2e7923d55010ded59ad1bf75c0f18 | https://github.com/Neurosim-lab/netpyne/blob/edb67b5098b2e7923d55010ded59ad1bf75c0f18/netpyne/support/filter.py#L89-L128 | train |
Neurosim-lab/netpyne | netpyne/support/filter.py | lowpass | def lowpass(data, freq, df, corners=4, zerophase=False):
"""
Butterworth-Lowpass Filter.
Filter data removing data over certain frequency ``freq`` using ``corners``
corners.
The filter uses :func:`scipy.signal.iirfilter` (for design)
and :func:`scipy.signal.sosfilt` (for applying the filter).
... | python | def lowpass(data, freq, df, corners=4, zerophase=False):
"""
Butterworth-Lowpass Filter.
Filter data removing data over certain frequency ``freq`` using ``corners``
corners.
The filter uses :func:`scipy.signal.iirfilter` (for design)
and :func:`scipy.signal.sosfilt` (for applying the filter).
... | [
"def",
"lowpass",
"(",
"data",
",",
"freq",
",",
"df",
",",
"corners",
"=",
"4",
",",
"zerophase",
"=",
"False",
")",
":",
"fe",
"=",
"0.5",
"*",
"df",
"f",
"=",
"freq",
"/",
"fe",
"if",
"f",
">",
"1",
":",
"f",
"=",
"1.0",
"msg",
"=",
"\"S... | Butterworth-Lowpass Filter.
Filter data removing data over certain frequency ``freq`` using ``corners``
corners.
The filter uses :func:`scipy.signal.iirfilter` (for design)
and :func:`scipy.signal.sosfilt` (for applying the filter).
:type data: numpy.ndarray
:param data: Data to filter.
:p... | [
"Butterworth",
"-",
"Lowpass",
"Filter",
"."
] | edb67b5098b2e7923d55010ded59ad1bf75c0f18 | https://github.com/Neurosim-lab/netpyne/blob/edb67b5098b2e7923d55010ded59ad1bf75c0f18/netpyne/support/filter.py#L131-L165 | train |
Neurosim-lab/netpyne | netpyne/support/filter.py | integer_decimation | def integer_decimation(data, decimation_factor):
"""
Downsampling by applying a simple integer decimation.
Make sure that no signal is present in frequency bands above the new
Nyquist frequency (samp_rate/2/decimation_factor), e.g. by applying a
lowpass filter beforehand!
New sampling rate is o... | python | def integer_decimation(data, decimation_factor):
"""
Downsampling by applying a simple integer decimation.
Make sure that no signal is present in frequency bands above the new
Nyquist frequency (samp_rate/2/decimation_factor), e.g. by applying a
lowpass filter beforehand!
New sampling rate is o... | [
"def",
"integer_decimation",
"(",
"data",
",",
"decimation_factor",
")",
":",
"if",
"not",
"isinstance",
"(",
"decimation_factor",
",",
"int",
")",
":",
"msg",
"=",
"\"Decimation_factor must be an integer!\"",
"raise",
"TypeError",
"(",
"msg",
")",
"data",
"=",
... | Downsampling by applying a simple integer decimation.
Make sure that no signal is present in frequency bands above the new
Nyquist frequency (samp_rate/2/decimation_factor), e.g. by applying a
lowpass filter beforehand!
New sampling rate is old sampling rate divided by decimation_factor.
:type dat... | [
"Downsampling",
"by",
"applying",
"a",
"simple",
"integer",
"decimation",
"."
] | edb67b5098b2e7923d55010ded59ad1bf75c0f18 | https://github.com/Neurosim-lab/netpyne/blob/edb67b5098b2e7923d55010ded59ad1bf75c0f18/netpyne/support/filter.py#L336-L356 | train |
Neurosim-lab/netpyne | netpyne/conversion/sonataImport.py | _distributeCells | def _distributeCells(numCellsPop):
''' distribute cells across compute nodes using round-robin'''
from .. import sim
hostCells = {}
for i in range(sim.nhosts):
hostCells[i] = []
for i in range(numCellsPop):
hostCells[sim.nextHost].append(i)
sim.next... | python | def _distributeCells(numCellsPop):
''' distribute cells across compute nodes using round-robin'''
from .. import sim
hostCells = {}
for i in range(sim.nhosts):
hostCells[i] = []
for i in range(numCellsPop):
hostCells[sim.nextHost].append(i)
sim.next... | [
"def",
"_distributeCells",
"(",
"numCellsPop",
")",
":",
"from",
".",
".",
"import",
"sim",
"hostCells",
"=",
"{",
"}",
"for",
"i",
"in",
"range",
"(",
"sim",
".",
"nhosts",
")",
":",
"hostCells",
"[",
"i",
"]",
"=",
"[",
"]",
"for",
"i",
"in",
"... | distribute cells across compute nodes using round-robin | [
"distribute",
"cells",
"across",
"compute",
"nodes",
"using",
"round",
"-",
"robin"
] | edb67b5098b2e7923d55010ded59ad1bf75c0f18 | https://github.com/Neurosim-lab/netpyne/blob/edb67b5098b2e7923d55010ded59ad1bf75c0f18/netpyne/conversion/sonataImport.py#L82-L99 | train |
Neurosim-lab/netpyne | netpyne/support/csd.py | getCSD | def getCSD (lfps,sampr,minf=0.05,maxf=300,norm=True,vaknin=False,spacing=1.0):
"""
get current source density approximation using set of local field potentials with equidistant spacing
first performs a lowpass filter
lfps is a list or numpy array of LFPs arranged spatially by column
spacing is in microns ... | python | def getCSD (lfps,sampr,minf=0.05,maxf=300,norm=True,vaknin=False,spacing=1.0):
"""
get current source density approximation using set of local field potentials with equidistant spacing
first performs a lowpass filter
lfps is a list or numpy array of LFPs arranged spatially by column
spacing is in microns ... | [
"def",
"getCSD",
"(",
"lfps",
",",
"sampr",
",",
"minf",
"=",
"0.05",
",",
"maxf",
"=",
"300",
",",
"norm",
"=",
"True",
",",
"vaknin",
"=",
"False",
",",
"spacing",
"=",
"1.0",
")",
":",
"datband",
"=",
"getbandpass",
"(",
"lfps",
",",
"sampr",
... | get current source density approximation using set of local field potentials with equidistant spacing
first performs a lowpass filter
lfps is a list or numpy array of LFPs arranged spatially by column
spacing is in microns | [
"get",
"current",
"source",
"density",
"approximation",
"using",
"set",
"of",
"local",
"field",
"potentials",
"with",
"equidistant",
"spacing",
"first",
"performs",
"a",
"lowpass",
"filter",
"lfps",
"is",
"a",
"list",
"or",
"numpy",
"array",
"of",
"LFPs",
"arr... | edb67b5098b2e7923d55010ded59ad1bf75c0f18 | https://github.com/Neurosim-lab/netpyne/blob/edb67b5098b2e7923d55010ded59ad1bf75c0f18/netpyne/support/csd.py#L35-L54 | train |
Neurosim-lab/netpyne | doc/source/code/HHCellFile.py | Cell.createSynapses | def createSynapses(self):
"""Add an exponentially decaying synapse """
synsoma = h.ExpSyn(self.soma(0.5))
synsoma.tau = 2
synsoma.e = 0
syndend = h.ExpSyn(self.dend(0.5))
syndend.tau = 2
syndend.e = 0
self.synlist.append(synsoma) # synlist is defined in Ce... | python | def createSynapses(self):
"""Add an exponentially decaying synapse """
synsoma = h.ExpSyn(self.soma(0.5))
synsoma.tau = 2
synsoma.e = 0
syndend = h.ExpSyn(self.dend(0.5))
syndend.tau = 2
syndend.e = 0
self.synlist.append(synsoma) # synlist is defined in Ce... | [
"def",
"createSynapses",
"(",
"self",
")",
":",
"synsoma",
"=",
"h",
".",
"ExpSyn",
"(",
"self",
".",
"soma",
"(",
"0.5",
")",
")",
"synsoma",
".",
"tau",
"=",
"2",
"synsoma",
".",
"e",
"=",
"0",
"syndend",
"=",
"h",
".",
"ExpSyn",
"(",
"self",
... | Add an exponentially decaying synapse | [
"Add",
"an",
"exponentially",
"decaying",
"synapse"
] | edb67b5098b2e7923d55010ded59ad1bf75c0f18 | https://github.com/Neurosim-lab/netpyne/blob/edb67b5098b2e7923d55010ded59ad1bf75c0f18/doc/source/code/HHCellFile.py#L30-L39 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.