text
stringlengths
81
112k
Corresponds to IDD Field `data_period_name_or_description` Args: value (str): value for IDD Field `data_period_name_or_description` if `value` is None it will not be checked against the specification and is assumed to be a missing value Raises: V...
Corresponds to IDD Field `data_period_start_day_of_week` Args: value (str): value for IDD Field `data_period_start_day_of_week` Accepted values are: - Sunday - Monday - Tuesday - Wednesday ...
Corresponds to IDD Field `data_period_start_day` Args: value (str): value for IDD Field `data_period_start_day` if `value` is None it will not be checked against the specification and is assumed to be a missing value Raises: ValueError: if `value...
Corresponds to IDD Field `data_period_end_day` Args: value (str): value for IDD Field `data_period_end_day` if `value` is None it will not be checked against the specification and is assumed to be a missing value Raises: ValueError: if `value` is...
Exports object to its string representation. Args: top (bool): if True appends `internal_name` before values. All non list objects should be exported with value top=True, all list objects, that are embedded in as fields inlist objects should be expor...
Read values. Args: vals (list): list of strings representing values def read(self, vals): """Read values. Args: vals (list): list of strings representing values """ i = 0 count = int(vals[i]) i += 1 for _ in range(count): ...
Read values. Args: vals (list): list of strings representing values def read(self, vals): """Read values. Args: vals (list): list of strings representing values """ i = 0 if len(vals[i]) == 0: self.year = None else: ...
Corresponds to IDD Field `year` Args: value (int): value for IDD Field `year` if `value` is None it will not be checked against the specification and is assumed to be a missing value Raises: ValueError: if `value` is not a valid value def year(s...
Corresponds to IDD Field `month` Args: value (int): value for IDD Field `month` value >= 1 value <= 12 if `value` is None it will not be checked against the specification and is assumed to be a missing value Raises: ...
Corresponds to IDD Field `day` Args: value (int): value for IDD Field `day` value >= 1 value <= 31 if `value` is None it will not be checked against the specification and is assumed to be a missing value Raises: Va...
Corresponds to IDD Field `hour` Args: value (int): value for IDD Field `hour` value >= 1 value <= 24 if `value` is None it will not be checked against the specification and is assumed to be a missing value Raises: ...
Corresponds to IDD Field `minute` Args: value (int): value for IDD Field `minute` value >= 0 value <= 60 if `value` is None it will not be checked against the specification and is assumed to be a missing value Raises: ...
Corresponds to IDD Field `data_source_and_uncertainty_flags` Initial day of weather file is checked by EnergyPlus for validity (as shown below) Each field is checked for "missing" as shown below. Reasonable values, calculated values or the last "good" value is substituted. Args: ...
Corresponds to IDD Field `dry_bulb_temperature` Args: value (float): value for IDD Field `dry_bulb_temperature` Unit: C value > -70.0 value < 70.0 Missing value: 99.9 if `value` is None it will not be checked against th...
Corresponds to IDD Field `dew_point_temperature` Args: value (float): value for IDD Field `dew_point_temperature` Unit: C value > -70.0 value < 70.0 Missing value: 99.9 if `value` is None it will not be checked against ...
Corresponds to IDD Field `relative_humidity` Args: value (int): value for IDD Field `relative_humidity` value >= 0 value <= 110 Missing value: 999 if `value` is None it will not be checked against the specification and ...
Corresponds to IDD Field `atmospheric_station_pressure` Args: value (int): value for IDD Field `atmospheric_station_pressure` Unit: Pa value > 31000 value < 120000 Missing value: 999999 if `value` is None it will not be...
Corresponds to IDD Field `extraterrestrial_horizontal_radiation` Args: value (float): value for IDD Field `extraterrestrial_horizontal_radiation` Unit: Wh/m2 value >= 0.0 Missing value: 9999.0 if `value` is None it will not be checked ...
Corresponds to IDD Field `extraterrestrial_direct_normal_radiation` Args: value (float): value for IDD Field `extraterrestrial_direct_normal_radiation` Unit: Wh/m2 value >= 0.0 Missing value: 9999.0 if `value` is None it will not be ch...
Corresponds to IDD Field `horizontal_infrared_radiation_intensity` Args: value (float): value for IDD Field `horizontal_infrared_radiation_intensity` Unit: Wh/m2 value >= 0.0 Missing value: 9999.0 if `value` is None it will not be chec...
Corresponds to IDD Field `global_horizontal_radiation` Args: value (float): value for IDD Field `global_horizontal_radiation` Unit: Wh/m2 value >= 0.0 Missing value: 9999.0 if `value` is None it will not be checked against the ...
Corresponds to IDD Field `direct_normal_radiation` Args: value (float): value for IDD Field `direct_normal_radiation` Unit: Wh/m2 value >= 0.0 Missing value: 9999.0 if `value` is None it will not be checked against the ...
Corresponds to IDD Field `diffuse_horizontal_radiation` Args: value (float): value for IDD Field `diffuse_horizontal_radiation` Unit: Wh/m2 value >= 0.0 Missing value: 9999.0 if `value` is None it will not be checked against the ...
Corresponds to IDD Field `global_horizontal_illuminance` will be missing if >= 999900 Args: value (float): value for IDD Field `global_horizontal_illuminance` Unit: lux value >= 0.0 Missing value: 999999.0 if `value` is None it...
Corresponds to IDD Field `direct_normal_illuminance` will be missing if >= 999900 Args: value (float): value for IDD Field `direct_normal_illuminance` Unit: lux value >= 0.0 Missing value: 999999.0 if `value` is None it will no...
Corresponds to IDD Field `diffuse_horizontal_illuminance` will be missing if >= 999900 Args: value (float): value for IDD Field `diffuse_horizontal_illuminance` Unit: lux value >= 0.0 Missing value: 999999.0 if `value` is None ...
Corresponds to IDD Field `zenith_luminance` will be missing if >= 9999 Args: value (float): value for IDD Field `zenith_luminance` Unit: Cd/m2 value >= 0.0 Missing value: 9999.0 if `value` is None it will not be checked against...
Corresponds to IDD Field `wind_direction` Args: value (float): value for IDD Field `wind_direction` Unit: degrees value >= 0.0 value <= 360.0 Missing value: 999.0 if `value` is None it will not be checked against the ...
Corresponds to IDD Field `wind_speed` Args: value (float): value for IDD Field `wind_speed` Unit: m/s value >= 0.0 value <= 40.0 Missing value: 999.0 if `value` is None it will not be checked against the ...
Corresponds to IDD Field `total_sky_cover` This is the value for total sky cover (tenths of coverage). (i.e. 1 is 1/10 covered. 10 is total coverage). (Amount of sky dome in tenths covered by clouds or obscuring phenomena at the hour indicated at the time indicated.) Args: ...
Corresponds to IDD Field `opaque_sky_cover` This is the value for opaque sky cover (tenths of coverage). (i.e. 1 is 1/10 covered. 10 is total coverage). (Amount of sky dome in tenths covered by clouds or obscuring phenomena that prevent observing the sky or higher cloud layers at the t...
Corresponds to IDD Field `visibility` This is the value for visibility in km. (Horizontal visibility at the time indicated.) Args: value (float): value for IDD Field `visibility` Unit: km Missing value: 9999.0 if `value` is None it will not be...
Corresponds to IDD Field `ceiling_height` This is the value for ceiling height in m. (77777 is unlimited ceiling height. 88888 is cirroform ceiling.) It is not currently used in EnergyPlus calculations. Args: value (float): value for IDD Field `ceiling_height` ...
Corresponds to IDD Field `present_weather_observation` If the value of the field is 0, then the observed weather codes are taken from the following field. If the value of the field is 9, then "missing" weather is assumed. Since the primary use of these fields (Present Weather Observation...
Corresponds to IDD Field `present_weather_codes` Args: value (int): value for IDD Field `present_weather_codes` if `value` is None it will not be checked against the specification and is assumed to be a missing value Raises: ValueError: if `value...
Corresponds to IDD Field `precipitable_water` Args: value (float): value for IDD Field `precipitable_water` Unit: mm Missing value: 999.0 if `value` is None it will not be checked against the specification and is assumed to be a missin...
Corresponds to IDD Field `aerosol_optical_depth` Args: value (float): value for IDD Field `aerosol_optical_depth` Unit: thousandths Missing value: 0.999 if `value` is None it will not be checked against the specification and is assumed...
Corresponds to IDD Field `snow_depth` Args: value (float): value for IDD Field `snow_depth` Unit: cm Missing value: 999.0 if `value` is None it will not be checked against the specification and is assumed to be a missing value ...
Corresponds to IDD Field `days_since_last_snowfall` Args: value (int): value for IDD Field `days_since_last_snowfall` Missing value: 99 if `value` is None it will not be checked against the specification and is assumed to be a missing value R...
Corresponds to IDD Field `albedo` Args: value (float): value for IDD Field `albedo` Missing value: 999.0 if `value` is None it will not be checked against the specification and is assumed to be a missing value Raises: ValueError: ...
Corresponds to IDD Field `liquid_precipitation_depth` Args: value (float): value for IDD Field `liquid_precipitation_depth` Unit: mm Missing value: 999.0 if `value` is None it will not be checked against the specification and is assume...
Corresponds to IDD Field `liquid_precipitation_quantity` Args: value (float): value for IDD Field `liquid_precipitation_quantity` Unit: hr Missing value: 99.0 if `value` is None it will not be checked against the specification and is a...
Exports object to its string representation. Args: top (bool): if True appends `internal_name` before values. All non list objects should be exported with value top=True, all list objects, that are embedded in as fields inlist objects should be expor...
Appends weather data. Args: data (WeatherData): weather data object def add_weatherdata(self, data): """Appends weather data. Args: data (WeatherData): weather data object """ if not isinstance(data, WeatherData): raise ValueError('Weather ...
Save WeatherData in EPW format to path. Args: path (str): path where EPW file should be saved def save(self, path, check=True): """Save WeatherData in EPW format to path. Args: path (str): path where EPW file should be saved """ with open(path, 'w') as...
Creates an object depending on `internal_name` Args: internal_name (str): IDD name Raises: ValueError: if `internal_name` cannot be matched to a data dictionary object def _create_datadict(cls, internal_name): """Creates an object depending on `internal_name` ...
Read EPW weather data from path. Args: path (str): path to read weather data from def read(self, path): """Read EPW weather data from path. Args: path (str): path to read weather data from """ with open(path, "r") as f: for line in f: ...
Displaying URL in an IPython notebook to allow the user to click and check on information. With thanks to Fernando Perez for putting together the implementation! :param target: the url to display. :type target: string. def display_url(target): """Displaying URL in an IPython notebook to allow the user to c...
Produce an iframe for displaying an item in HTML window. :param target: the target url. :type target: string :param width: the width of the iframe (default 500). :type width: int :param height: the height of the iframe (default 400). :type height: int :param scrolling: whether or not to allo...
Display the contents of a URL in an IPython notebook. :param target: the target url. :type target: string .. seealso:: `iframe_url()` for additional arguments. def display_iframe_url(target, **kwargs): """Display the contents of a URL in an IPython notebook. :param target: the target url...
Display an embedded version of a Google book. :param id: the id of the google book to display. :type id: string :param page: the start page for the book. :type id: string or int. def display_google_book(id, page=None, width=700, height=500, **kwargs): """Display an embedded version of a Google book...
Toggling on and off code in a notebook. :param start_show: Whether to display the code or not on first load (default is False). :type start_show: bool :param message: the message used to toggle display of the code. :type message: string The tip that this idea is based on is from Damian Kao (ht...
Interactive widget for displaying a prediction function based on summing separate basis functions. :param basis: a function handle that calls the basis functions. :type basis: function handle. :param xlim: limits of the x axis to use. :param ylim: limits of the y axis to use. :param wlim: limits for...
Display a series of plots controlled by sliders. The function relies on Python string format functionality to index through a series of plots. def display_plots(filebase, directory=None, width=700, height=500, **kwargs): """Display a series of plots controlled by sliders. The function relies on Python string forma...
Returns the answers to the lab classes. def answer(part, module='mlai2014.json'): """Returns the answers to the lab classes.""" marks = json.load(open(os.path.join(data_directory, module), 'rb')) return marks['Lab ' + str(part+1)]
Gives a latex representation of the assessment. def latex(self): """Gives a latex representation of the assessment.""" output = self.latex_preamble output += self._repr_latex_() output += self.latex_post return output
Gives an html representation of the assessment. def html(self): """Gives an html representation of the assessment.""" output = self.html_preamble output += self._repr_html_() output += self.html_post return output
Returns an pandas empty dataframe object containing rows and columns for marking. This can then be passed to a google doc that is distributed to markers for editing with the mark for each section. def marksheet(self): """Returns an pandas empty dataframe object containing rows and columns for marking. This can...
Compute the total mark for the assessment. def total_marks(self): """Compute the total mark for the assessment.""" total = 0 for answer in self.answers: for number, part in enumerate(answer): if number>0: if part[2]>0: tota...
Download a lab class from the relevant course :param course: the course short name to download the class from. :type course: string :param reference: reference to the course for downloading the class. :type reference: string :param github: github repo for downloading the course from. :type strin...
Read values Args: vals (list): list of strings representing values def read(self, vals): """ Read values Args: vals (list): list of strings representing values """ i = 0 {%- for field in fields %} {%- if field.is_list %} ...
Permutation for randomizing data order. def permute(num): "Permutation for randomizing data order." if permute_data: return np.random.permutation(num) else: logging.warning("Warning not permuting data") return np.arange(num)
Return a class category that shows the encoding def discrete(cats, name='discrete'): """Return a class category that shows the encoding""" import json ks = list(cats) for key in ks: if isinstance(key, bytes): cats[key.decode('utf-8')] = cats.pop(key) return 'discrete(' + json.du...
Ask user for agreeing to data set licenses. def prompt_stdin(prompt): """Ask user for agreeing to data set licenses.""" # raw_input returns the empty string for "enter" yes = set(['yes', 'y']) no = set(['no','n']) try: print(prompt) if sys.version_info>=(3,0): choice = ...
Remove a data set from the cache def clear_cache(dataset_name=None): """Remove a data set from the cache""" dr = data_resources[dataset_name] if 'dirs' in dr: for dirs, files in zip(dr['dirs'], dr['files']): for dir, file in zip(dirs, files): path = os.path.join(data_pat...
Check if the data set is available on the local machine already. def data_available(dataset_name=None): """Check if the data set is available on the local machine already.""" dr = data_resources[dataset_name] if 'dirs' in dr: for dirs, files in zip(dr['dirs'], dr['files']): for dir, fil...
Check with the user that the are happy with terms and conditions for the data set, then download it. def download_data(dataset_name=None, prompt=prompt_stdin): """Check with the user that the are happy with terms and conditions for the data set, then download it.""" dr = data_resources[dataset_name] ...
Write an arff file from a data set loaded in from pods def df2arff(df, dataset_name, pods_data): """Write an arff file from a data set loaded in from pods""" def java_simple_date(date_format): date_format = date_format.replace('%Y', 'yyyy').replace('%m', 'MM').replace('%d', 'dd').replace('%H', 'HH') ...
Take a pods data set and write it as an ARFF file def to_arff(dataset, **kwargs): """Take a pods data set and write it as an ARFF file""" pods_data = dataset(**kwargs) vals = list(kwargs.values()) for i, v in enumerate(vals): if isinstance(v, list): vals[i] = '|'.join(v) els...
Data set of three GPS traces of the same movement on Mt Epomeo in Ischia. Requires gpxpy to run. def epomeo_gpx(data_set='epomeo_gpx', sample_every=4): """Data set of three GPS traces of the same movement on Mt Epomeo in Ischia. Requires gpxpy to run.""" import gpxpy import gpxpy.gpx if not data_availa...
Abstracts from the Proceedings of Machine Learning Research def pmlr(volumes='all', data_set='pmlr'): """Abstracts from the Proceedings of Machine Learning Research""" if not data_available(data_set): download_data(data_set) proceedings_file = open(os.path.join(data_path, data_set, 'procee...
Football data from English games since 1993. This downloads data from football-data.co.uk for the given season. def football_data(season='1617', data_set='football_data'): """Football data from English games since 1993. This downloads data from football-data.co.uk for the given season. """ league_dict = {'E0':...
Yeast ChIP data from Lee et al. def lee_yeast_ChIP(data_set='lee_yeast_ChIP'): """Yeast ChIP data from Lee et al.""" if not data_available(data_set): download_data(data_set) from pandas import read_csv dir_path = os.path.join(data_path, data_set) filename = os.path.join(dir_path, 'binding_b...
Data downloaded from Google trends for given query terms. Warning, if you use this function multiple times in a row you get blocked due to terms of service violations. The function will cache the result of any query in an attempt to avoid this. If you wish to refresh an old query set refresh_data t...
Ohio State University's Run1 motion capture data set. def osu_run1(data_set='osu_run1', sample_every=4): """Ohio State University's Run1 motion capture data set.""" path = os.path.join(data_path, data_set) if not data_available(data_set): import zipfile download_data(data_set) zip =...
Simple classification data in one dimension for illustrating models. def toy_linear_1d_classification(seed=default_seed): """Simple classification data in one dimension for illustrating models.""" def sample_class(f): p = 1. / (1. + np.exp(-f)) c = np.random.binomial(1, p) c = np.where(...
Airline delay data used in Gaussian Processes for Big Data by Hensman, Fusi and Lawrence def airline_delay(data_set='airline_delay', num_train=700000, num_test=100000, seed=default_seed): """Airline delay data used in Gaussian Processes for Big Data by Hensman, Fusi and Lawrence""" if not data_available(data_...
All olympics sprint winning times for multiple output prediction. def olympic_sprints(data_set='rogers_girolami_data'): """All olympics sprint winning times for multiple output prediction.""" X = np.zeros((0, 2)) Y = np.zeros((0, 1)) cats = {} for i, dataset in enumerate([olympic_100m_men, ...
Data set of movies and body count for movies scraped from www.MovieBodyCounts.com created by Simon Garnier and Randy Olson for exploring differences between Python and R. def movie_body_count(data_set='movie_body_count'): """Data set of movies and body count for movies scraped from www.MovieBodyCounts.com created ...
Data set of movies and body count for movies scraped from www.MovieBodyCounts.com created by Simon Garnier and Randy Olson for exploring differences between Python and R. def movie_body_count_r_classify(data_set='movie_body_count'): """Data set of movies and body count for movies scraped from www.MovieBodyCounts.c...
Data set of movie ratings collected by the University of Minnesota and 'cleaned up' for use. def movielens100k(data_set='movielens100k'): """Data set of movie ratings collected by the University of Minnesota and 'cleaned up' for use.""" if not data_available(data_set): import zipfile download_d...
Twenty two observations of the Dwarf planet Ceres as observed by Giueseppe Piazzi and published in the September edition of Monatlicher Correspondenz in 1801. These were the measurements used by Gauss to fit a model of the planets orbit through which the planet was recovered three months later. def ceres(data_set='cer...
Estimates the global horizontal infrared radiation intensity based on drybulb, dewpoint and opaque sky cover. References: Walton, G. N. 1983. Thermal Analysis Research Program Reference Manual. NBSSIR 83- 2655. National Bureau of Standards, p. 21. Clark, G. and C. Allen, "The Estimation of Atmospher...
Download a file from a url and save it to disk. def download_url(url, dir_name='.', save_name=None, store_directory=None, messages=True, suffix=''): """Download a file from a url and save it to disk.""" if sys.version_info>=(3,0): from urllib.parse import quote from urllib.request import urlope...
Get all accesses for a particular user **Parameters:**: - **elementuser_id**: Element User ID - **access_id**: (optional) Access ID - **tenant_id**: Tenant ID - **api_version**: API version to use (default v2.0) **Returns:** requests.Response object extended ...
Logout current session **Parameters:**: - **api_version**: API version to use (default v2.0) **Returns:** requests.Response object extended with cgx_status and cgx_content properties. def logout(self, api_version="v2.0"): """ Logout current session **Parameters...
Interactive login using the `cloudgenix.API` object. This function is more robust and handles SAML and MSP accounts. Expects interactive capability. if this is not available, use `cloudenix.API.post.login` directly. **Parameters:**: - **email**: Email to log in for, will prompt if not entere...
Function to use static AUTH_TOKEN as auth for the constructor instead of full login process. **Parameters:**: - **token**: Static AUTH_TOKEN **Returns:** Bool on success or failure. In addition the function will mutate the `cloudgenix.API` constructor items as needed. ...
Function to update the `cloudgenix.API` object with tenant login info. Run after login or client login. **Returns:** Boolean on success/failure, def interactive_tenant_update_vars(self): """ Function to update the `cloudgenix.API` object with tenant login info. Run after login or client login....
Function to update the `cloudgenix.API` object with profile info. Run after login or client login. **Returns:** Boolean on success/failure, def interactive_update_profile_vars(self): """ Function to update the `cloudgenix.API` object with profile info. Run after login or client login. ...
Present a menu for user to select from ESP/MSP managed clients they have permission to. **Returns:** Tuple with (Boolean success, selected client ID). def interactive_client_choice(self): """ Present a menu for user to select from ESP/MSP managed clients they have permission to. **Ret...
Function to display a quick menu for user input **Parameters:** - **banner:** Text to display before menu - **list_line_format:** Print'ing string with format spots for index + tuple values - **choice_list:** List of tuple values that you want returned if selected (and printed) ...
Login to the CloudGenix API, and see if SAML SSO has occurred. This function is used to check and see if SAML SSO has succeeded while waiting. **Parameters:** - **operator_email:** String with the username to log in with - **request_id:** String containing the SAML 2.0 Request ID f...
Interactive logout - ensures uid/tid cleared so `cloudgenix.API` object/ requests.Session can be re-used. **Parameters:**: - **force**: Bool, force logout API call, even when using a static AUTH_TOKEN. **Returns:** Bool of whether the operation succeeded. def logout(self, force=False): ...
JD (JSON Dump) function. Meant for quick pretty-printing of CloudGenix Response objects. Example: `jd(cgx_sess.get.sites())` **Returns:** No Return, directly prints all output. def jd(api_response): """ JD (JSON Dump) function. Meant for quick pretty-printing of CloudGenix Response ob...
Function to display a quick confirmation for user input **Parameters:** - **prompt:** Text to display before confirm - **default_value:** Default value for no entry **Returns:** 'y', 'n', or Default value. def quick_confirm(prompt, default_value): """ Function to ...
Function to display a quick question for integer user input **Parameters:** - **prompt:** Text / question to display - **default_value:** Default value for no entry - **min_val:** Lowest allowed integer - **max_val:** Highest allowed integer **Returns:** intege...
Function to display a quick question for text input. **Parameters:** - **prompt:** Text / question to display - **default_value:** Default value for no entry **Returns:** text_type() or default_value. def quick_str_input(prompt, default_value): """ Function to dis...
computes bit difference between two nilsisa digests takes params for format, default is hex string but can accept list of 32 length ints Optimized method originally from https://gist.github.com/michelp/6255490 If `threshold` is set, and the comparison will be less than `threshold`, then bail out ea...
implementation of the tran53 hash function def tran_hash(self, a, b, c, n): """implementation of the tran53 hash function""" return (((TRAN[(a+n)&255]^TRAN[b]*(n+n+1))+TRAN[(c)^TRAN[n]])&255)