query stringlengths 9 9.05k | document stringlengths 10 222k | metadata dict | negatives listlengths 30 30 | negative_scores listlengths 30 30 | document_score stringlengths 4 10 | document_rank stringclasses 2
values |
|---|---|---|---|---|---|---|
Validate the existence of the merge column. Raises FileInputError If merge column is missing from either the solar or the wind meta data. | def _validate_merge_col_exists(self):
msg = ("Cannot hybridize: merge column {!r} missing from the "
"{} meta data! ({!r})")
mc = ColNameFormatter.fmt(MERGE_COLUMN)
for cols, fp, res in zip([self.__solar_cols, self.__wind_cols],
[self.solar_fpath,... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _validate_merge_col_overlaps(self):\n mc = ColNameFormatter.fmt(MERGE_COLUMN)\n merge_col = self.solar_meta.columns[self.__solar_cols == mc].item()\n solar_vals = set(self.solar_meta[merge_col].values)\n merge_col = self.wind_meta.columns[self.__wind_cols == mc].item()\n wind... | [
"0.76253545",
"0.73640174",
"0.62562627",
"0.6013806",
"0.5722931",
"0.55756134",
"0.55333537",
"0.54672325",
"0.54014504",
"0.53762054",
"0.53385216",
"0.5281806",
"0.51769006",
"0.5145505",
"0.5139461",
"0.5096193",
"0.50933117",
"0.500145",
"0.49952263",
"0.49803758",
"0.4... | 0.8852241 | 0 |
Validate the existence of unique values in the merge column. Raises FileInputError If merge column contains duplicate values in either the solar or the wind meta data. | def _validate_unique_merge_col(self):
msg = ("Duplicate {}s were found. This is likely due to resource "
"class binning, which is not supported at this time. "
"Please re-run supply curve aggregation without "
"resource class binning and ensure there are no duplicate... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _validate_merge_col_exists(self):\n msg = (\"Cannot hybridize: merge column {!r} missing from the \"\n \"{} meta data! ({!r})\")\n\n mc = ColNameFormatter.fmt(MERGE_COLUMN)\n for cols, fp, res in zip([self.__solar_cols, self.__wind_cols],\n [se... | [
"0.7891415",
"0.7614765",
"0.61395323",
"0.60878676",
"0.60165447",
"0.58810294",
"0.57699454",
"0.5652946",
"0.5633896",
"0.5575958",
"0.552",
"0.54288876",
"0.54203135",
"0.5384327",
"0.53775144",
"0.5341186",
"0.53313047",
"0.53311586",
"0.5328971",
"0.5324311",
"0.5319076... | 0.86776817 | 0 |
Validate the existence of overlap in the merge column values. Raises FileInputError If merge column values do not overlap between the tow input files. | def _validate_merge_col_overlaps(self):
mc = ColNameFormatter.fmt(MERGE_COLUMN)
merge_col = self.solar_meta.columns[self.__solar_cols == mc].item()
solar_vals = set(self.solar_meta[merge_col].values)
merge_col = self.wind_meta.columns[self.__wind_cols == mc].item()
wind_vals = se... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _validate_merge_col_exists(self):\n msg = (\"Cannot hybridize: merge column {!r} missing from the \"\n \"{} meta data! ({!r})\")\n\n mc = ColNameFormatter.fmt(MERGE_COLUMN)\n for cols, fp, res in zip([self.__solar_cols, self.__wind_cols],\n [se... | [
"0.7486741",
"0.7176547",
"0.61411387",
"0.6102821",
"0.6066776",
"0.60148036",
"0.5996392",
"0.58063793",
"0.5786578",
"0.57224697",
"0.57176906",
"0.56641287",
"0.56431687",
"0.5567696",
"0.55234826",
"0.5494183",
"0.54478794",
"0.5432173",
"0.5406743",
"0.5363546",
"0.5342... | 0.8913541 | 0 |
Validate the input parameters. This method validates that the input limit, fill, and ratio columns are formatted correctly. | def validate_input(self):
self._validate_limits_cols_prefixed()
self._validate_fillna_cols_prefixed()
self._validate_ratio_input() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _validate_ratio_input(self):\n if self._ratio_bounds is None:\n return\n\n self._validate_ratio_bounds()\n self._validate_ratio_type()\n self._validate_ratio_format()\n self._validate_ratio_cols_prefixed()\n self._validate_ratio_cols_exist()",
"def _data_p... | [
"0.7478021",
"0.6782839",
"0.66965306",
"0.6670995",
"0.6557589",
"0.65344125",
"0.6506362",
"0.64263195",
"0.6350137",
"0.63460535",
"0.6289092",
"0.6277632",
"0.6203114",
"0.61995864",
"0.61992794",
"0.61950773",
"0.61806136",
"0.6178662",
"0.6177398",
"0.61739767",
"0.6157... | 0.81627876 | 0 |
Ensure the limits columns are formatted correctly. This check is important because the limiting happens after the meta has been merged (so columns are already prefixed), but before the hybrid columns are computed. As a result, the limits columns _must_ have a valid prefix. Raises InputError If limits columns are not pr... | def _validate_limits_cols_prefixed(self):
for col in self._limits:
self.__validate_col_prefix(
col, (SOLAR_PREFIX, WIND_PREFIX), input_name='limits'
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_input(self):\n self._validate_limits_cols_prefixed()\n self._validate_fillna_cols_prefixed()\n self._validate_ratio_input()",
"def _apply_limits(self):\n for col_name, max_value in self._limits.items():\n if col_name in self._hybrid_meta.columns:\n ... | [
"0.6168966",
"0.6147129",
"0.5990407",
"0.57520354",
"0.57055175",
"0.5515134",
"0.5400735",
"0.53258103",
"0.53224194",
"0.5296111",
"0.5246675",
"0.5204149",
"0.51863134",
"0.51803416",
"0.5161408",
"0.5155913",
"0.51242286",
"0.5114502",
"0.50930727",
"0.507984",
"0.507841... | 0.7808469 | 0 |
Validate the the col starts with the correct prefix. | def __validate_col_prefix(col, prefixes, input_name):
missing = [not col.startswith(p) for p in prefixes]
if all(missing):
msg = ("Input {0} column {1!r} does not start with a valid "
"prefix: {2!r}. Please ensure that the {0} column "
"names specify th... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_strip_column_prefix():\n assert strip_column_prefix(\"ts_some_name\") == \"some_name\"\n assert strip_column_prefix(\"some_name\") == \"some_name\"\n # only the prefix may be stripped\n assert strip_column_prefix(\"ts_some_ts_name\") == \"some_ts_name\"\n assert strip_column_prefix(\"some_t... | [
"0.6688379",
"0.654078",
"0.64288235",
"0.62906516",
"0.61719567",
"0.6143379",
"0.60923874",
"0.59389675",
"0.5857838",
"0.58569133",
"0.58015805",
"0.5760428",
"0.5743992",
"0.57378143",
"0.5709494",
"0.5708788",
"0.5695414",
"0.5652301",
"0.56492895",
"0.5637811",
"0.56210... | 0.81113243 | 0 |
Ensure the fillna columns are formatted correctly. This check is important because the fillna step happens after the meta has been merged (so columns are already prefixed), but before the hybrid columns are computed. As a result, the fillna columns _must_ have a valid prefix. Raises InputError If fillna columns are not... | def _validate_fillna_cols_prefixed(self):
for col in self._fillna:
self.__validate_col_prefix(
col, (SOLAR_PREFIX, WIND_PREFIX), input_name='fillna'
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _fillna_meta_cols(self):\n for col_name, fill_value in self._fillna.items():\n if col_name in self._hybrid_meta.columns:\n self._hybrid_meta[col_name].fillna(fill_value, inplace=True)\n else:\n self.__warn_missing_col(col_name, action='fill')\n\n ... | [
"0.65633696",
"0.6184937",
"0.6091279",
"0.56899893",
"0.5635901",
"0.5519143",
"0.5434985",
"0.5392934",
"0.53909284",
"0.53415644",
"0.5337083",
"0.5316166",
"0.5311866",
"0.5311866",
"0.52905893",
"0.5196157",
"0.51455057",
"0.5129843",
"0.5111977",
"0.50950664",
"0.506936... | 0.82129806 | 0 |
Validate the ratio input parameters. This method validates that the input ratio columns are formatted correctly and exist in the input data. It also verifies that the `ratio_bounds` is correctly formatted. | def _validate_ratio_input(self):
if self._ratio_bounds is None:
return
self._validate_ratio_bounds()
self._validate_ratio_type()
self._validate_ratio_format()
self._validate_ratio_cols_prefixed()
self._validate_ratio_cols_exist() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _validate_ratio_format(self):\n if '/' not in self._ratio:\n msg = (\"Ratio input {} does not contain the '/' character. \"\n \"Please make sure the ratio input is a string in the form \"\n \"'numerator_column_name/denominator_column_name'\")\n e... | [
"0.7760784",
"0.7714941",
"0.75114256",
"0.69338435",
"0.6844013",
"0.628972",
"0.6231458",
"0.6212971",
"0.5856549",
"0.57090014",
"0.56484723",
"0.5637413",
"0.56157666",
"0.55607164",
"0.55572057",
"0.5542727",
"0.55393887",
"0.5529563",
"0.5526014",
"0.548384",
"0.5476128... | 0.86574155 | 0 |
Ensure the ratio value is input correctly. Raises InputError If ratio is not a len 2 container of floats. | def _validate_ratio_bounds(self):
try:
if len(self._ratio_bounds) != 2:
msg = ("Length of input for ratio_bounds is {} - but is "
"required to be of length 2. Please make sure this "
"input is a len 2 container of floats. If you would "
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _validate_ratio_input(self):\n if self._ratio_bounds is None:\n return\n\n self._validate_ratio_bounds()\n self._validate_ratio_type()\n self._validate_ratio_format()\n self._validate_ratio_cols_prefixed()\n self._validate_ratio_cols_exist()",
"def _valida... | [
"0.7179191",
"0.71352416",
"0.70777136",
"0.59361994",
"0.5894756",
"0.5891089",
"0.5772807",
"0.5742806",
"0.5693582",
"0.5680576",
"0.56742924",
"0.56632185",
"0.5654021",
"0.5604917",
"0.5598444",
"0.557949",
"0.55437255",
"0.5521832",
"0.5448689",
"0.54454446",
"0.5440113... | 0.7876612 | 0 |
Ensure that the ratio input is a string. Raises InputError If `ratio` is not a string. | def _validate_ratio_type(self):
if not isinstance(self._ratio, str):
msg = ("Ratio input type {} not understood. Please make sure "
"the ratio input is a string in the form "
"'numerator_column_name/denominator_column_name'. Ratio "
"input: {!... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _validate_ratio_format(self):\n if '/' not in self._ratio:\n msg = (\"Ratio input {} does not contain the '/' character. \"\n \"Please make sure the ratio input is a string in the form \"\n \"'numerator_column_name/denominator_column_name'\")\n e... | [
"0.744509",
"0.6211037",
"0.59779984",
"0.5810558",
"0.56747997",
"0.5636537",
"0.5560869",
"0.54170185",
"0.53851706",
"0.53279436",
"0.5304914",
"0.5284875",
"0.52590173",
"0.5254921",
"0.52378595",
"0.5217926",
"0.52176386",
"0.5211942",
"0.5209529",
"0.52087975",
"0.52081... | 0.8306787 | 0 |
Validate that the ratio input format is correct and can be parsed. Raises InputError If the '/' character is missing or of there are too many '/' characters. | def _validate_ratio_format(self):
if '/' not in self._ratio:
msg = ("Ratio input {} does not contain the '/' character. "
"Please make sure the ratio input is a string in the form "
"'numerator_column_name/denominator_column_name'")
e = msg.format(se... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _validate_ratio_type(self):\n if not isinstance(self._ratio, str):\n msg = (\"Ratio input type {} not understood. Please make sure \"\n \"the ratio input is a string in the form \"\n \"'numerator_column_name/denominator_column_name'. Ratio \"\n ... | [
"0.73980933",
"0.7004482",
"0.6500546",
"0.62572384",
"0.56892586",
"0.55476534",
"0.54579455",
"0.54427433",
"0.54277605",
"0.53751886",
"0.535323",
"0.5218696",
"0.5217071",
"0.5215101",
"0.51954955",
"0.51836604",
"0.51597065",
"0.51439303",
"0.5141729",
"0.5051909",
"0.50... | 0.86093605 | 0 |
Ensure the ratio columns are formatted correctly. This check is important because the ratio limit step happens after the meta has been merged (so columns are already prefixed), but before the hybrid columns are computed. As a result, the ratio columns _must_ have a valid prefix. Raises InputError If ratio columns are n... | def _validate_ratio_cols_prefixed(self):
for col in self._ratio_cols:
self.__validate_col_prefix(
col, (SOLAR_PREFIX, WIND_PREFIX), input_name='ratios'
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _validate_ratio_cols_exist(self):\n\n for col in self._ratio_cols:\n no_prefix_name = \"_\".join(col.split('_')[1:])\n if not self.data.contains_col(no_prefix_name):\n msg = (\"Input ratios column {!r} not found in either meta \"\n \"data! Pleas... | [
"0.7685625",
"0.71891445",
"0.66247326",
"0.6569187",
"0.61756104",
"0.59779066",
"0.58474874",
"0.5542771",
"0.5347169",
"0.5317145",
"0.50159115",
"0.49957514",
"0.49852097",
"0.49845073",
"0.49719888",
"0.497121",
"0.49402085",
"0.49239317",
"0.49203816",
"0.48641172",
"0.... | 0.7826254 | 0 |
Ensure the ratio columns exist if a ratio is specified. Raises FileInputError If ratio columns are not found in the meta data. | def _validate_ratio_cols_exist(self):
for col in self._ratio_cols:
no_prefix_name = "_".join(col.split('_')[1:])
if not self.data.contains_col(no_prefix_name):
msg = ("Input ratios column {!r} not found in either meta "
"data! Please check the inpu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _validate_ratio_format(self):\n if '/' not in self._ratio:\n msg = (\"Ratio input {} does not contain the '/' character. \"\n \"Please make sure the ratio input is a string in the form \"\n \"'numerator_column_name/denominator_column_name'\")\n e... | [
"0.63408744",
"0.6176652",
"0.58006966",
"0.55848163",
"0.5559693",
"0.5524219",
"0.5480099",
"0.5457779",
"0.51162285",
"0.5073963",
"0.50668687",
"0.5056988",
"0.5018335",
"0.49608746",
"0.4938702",
"0.48875266",
"0.48650214",
"0.4860901",
"0.48203823",
"0.46765062",
"0.464... | 0.81428486 | 0 |
Get the ratio columns from the ratio input. | def _ratio_cols(self):
if self._ratio is None:
return []
return self._ratio.strip().split('/') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def collect_columns():\n return ((x, y) for x in range(72) for y in range(x + 9, 81, 9))",
"def get_cols(self, *dims):\n dims_not_found = [d for d in dims if not d in self.dims]\n if dims_not_found:\n raise Exception('Some dims were not found.\\n Dims not found: %s\\n Dims in table: %s' % (str(dims... | [
"0.54899836",
"0.5358057",
"0.5314968",
"0.52934724",
"0.52653146",
"0.5264365",
"0.52301955",
"0.52135116",
"0.51872635",
"0.51785636",
"0.5169397",
"0.51663923",
"0.5161672",
"0.5150261",
"0.5135878",
"0.5129527",
"0.51255095",
"0.5124896",
"0.5120607",
"0.51083803",
"0.510... | 0.82047087 | 0 |
Combine the solar and wind metas and run hybridize methods. | def hybridize(self):
self._format_meta_pre_merge()
self._merge_solar_wind_meta()
self._verify_lat_long_match_post_merge()
self._format_meta_post_merge()
self._fillna_meta_cols()
self._apply_limits()
self._limit_by_ratio()
self._add_hybrid_cols()
se... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _merge_solar_wind_meta(self):\n self._hybrid_meta = self.data.solar_meta.merge(\n self.data.wind_meta,\n on=ColNameFormatter.fmt(MERGE_COLUMN),\n suffixes=[None, '_x'], how=self._merge_type()\n )",
"def generate_heterogeneous_wind_map(self):\n speed_multi... | [
"0.6699857",
"0.5426082",
"0.5372044",
"0.5302775",
"0.52993816",
"0.52730644",
"0.52304137",
"0.52272934",
"0.51999795",
"0.51172775",
"0.51101947",
"0.5091172",
"0.5009114",
"0.49862206",
"0.4984014",
"0.49718684",
"0.49702063",
"0.49685887",
"0.4963761",
"0.49563375",
"0.4... | 0.64069116 | 1 |
Prepare solar and wind meta for merging. | def _format_meta_pre_merge(self):
self.__col_name_map = {
ColNameFormatter.fmt(c): c
for c in self.data.solar_meta.columns.values
}
self._rename_cols(self.data.solar_meta, prefix=SOLAR_PREFIX)
self._rename_cols(self.data.wind_meta, prefix=WIND_PREFIX)
se... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _merge_solar_wind_meta(self):\n self._hybrid_meta = self.data.solar_meta.merge(\n self.data.wind_meta,\n on=ColNameFormatter.fmt(MERGE_COLUMN),\n suffixes=[None, '_x'], how=self._merge_type()\n )",
"def hybridize(self):\n self._format_meta_pre_merge()\n ... | [
"0.67525065",
"0.55829287",
"0.5528745",
"0.55256003",
"0.5521326",
"0.54958826",
"0.5492188",
"0.5481053",
"0.5419373",
"0.5363316",
"0.535917",
"0.535192",
"0.53265697",
"0.527597",
"0.5269263",
"0.5264637",
"0.52577305",
"0.5233705",
"0.5216905",
"0.5204109",
"0.52033246",... | 0.6321617 | 1 |
Replace column names with the ColNameFormatter.fmt is needed. | def _rename_cols(df, prefix):
df.columns = [
ColNameFormatter.fmt(col_name)
if col_name in NON_DUPLICATE_COLS
else '{}{}'.format(prefix, col_name)
for col_name in df.columns.values
] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def wrap_columns_name(self, format_string):\n self._data_frame = self._data_frame.rename(\n columns=lambda column: format_string.format(column)\n )",
"def format_colname(name):\n colnames = [\n \"AV\",\n \"RV\",\n \"EBV\",\n \"CAV1\",\n \"CAV2\",\n ... | [
"0.710182",
"0.648063",
"0.64350593",
"0.64280087",
"0.6376171",
"0.63299614",
"0.60985297",
"0.60671365",
"0.60652447",
"0.5990922",
"0.5990529",
"0.59518194",
"0.58898133",
"0.5738277",
"0.5727653",
"0.5726693",
"0.5723053",
"0.57022375",
"0.56878716",
"0.5682678",
"0.56425... | 0.6797314 | 1 |
Save rep profiles index in hybrid meta for access later. | def _save_rep_prof_index_internally(self):
self.data.solar_meta[self.__solar_rpi_n] = self.data.solar_meta.index
self.data.wind_meta[self.__wind_rpi_n] = self.data.wind_meta.index | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_profile(self):\n self.save()",
"def _init_profiles(self):\n self._profiles = {\n k: np.zeros((len(self.hybrid_time_index), len(self.hybrid_meta)),\n dtype=np.float32)\n for k in OUTPUT_PROFILE_NAMES}",
"def save_meta(self):\n meta = sel... | [
"0.5434506",
"0.53939104",
"0.532488",
"0.5305259",
"0.5287991",
"0.5250987",
"0.5130279",
"0.5096888",
"0.5087576",
"0.5070211",
"0.5039971",
"0.5037104",
"0.4964217",
"0.49620593",
"0.49212074",
"0.49111474",
"0.49088255",
"0.49079517",
"0.49075338",
"0.48831442",
"0.484537... | 0.69237864 | 0 |
Merge the wind and solar meta DataFrames. | def _merge_solar_wind_meta(self):
self._hybrid_meta = self.data.solar_meta.merge(
self.data.wind_meta,
on=ColNameFormatter.fmt(MERGE_COLUMN),
suffixes=[None, '_x'], how=self._merge_type()
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _format_meta_pre_merge(self):\n self.__col_name_map = {\n ColNameFormatter.fmt(c): c\n for c in self.data.solar_meta.columns.values\n }\n\n self._rename_cols(self.data.solar_meta, prefix=SOLAR_PREFIX)\n self._rename_cols(self.data.wind_meta, prefix=WIND_PREFIX)... | [
"0.592785",
"0.59203917",
"0.58379906",
"0.5833099",
"0.57740957",
"0.5714223",
"0.5712128",
"0.56920964",
"0.56850004",
"0.5669409",
"0.5658397",
"0.5574097",
"0.5517199",
"0.5512157",
"0.5503713",
"0.5474197",
"0.544076",
"0.5431407",
"0.54224783",
"0.53756416",
"0.5370005"... | 0.7673206 | 0 |
Determine the type of merge to use for meta based on user input. | def _merge_type(self):
if self._allow_solar_only and self._allow_wind_only:
return 'outer'
elif self._allow_solar_only and not self._allow_wind_only:
return 'left'
elif not self._allow_solar_only and self._allow_wind_only:
return 'right'
return 'inner' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_merge(self) -> Optional[str]:\n return None",
"def MergeLogic(self) -> str:",
"def is_merged(self):\r\n url = '{0}/merge'.format(self.get_url())\r\n\r\n return http.Request('GET', url), resource.parse_boolean",
"def hetero_model_merge(guest_param: dict, guest_meta: dict, host_par... | [
"0.57262874",
"0.5652368",
"0.53079206",
"0.52991885",
"0.52746904",
"0.517375",
"0.51529557",
"0.495985",
"0.49479657",
"0.494657",
"0.49287215",
"0.491906",
"0.48954925",
"0.48817688",
"0.48493266",
"0.48131183",
"0.47897887",
"0.47873193",
"0.47704938",
"0.476286",
"0.4762... | 0.59283715 | 0 |
Format hybrid meta after merging. | def _format_meta_post_merge(self):
duplicate_cols = [n for n in self._hybrid_meta.columns if "_x" in n]
self._propagate_duplicate_cols(duplicate_cols)
self._drop_cols(duplicate_cols)
self._hybrid_meta.rename(self.__col_name_map, inplace=True, axis=1)
self._hybrid_meta.index.name... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hybridize(self):\n self._format_meta_pre_merge()\n self._merge_solar_wind_meta()\n self._verify_lat_long_match_post_merge()\n self._format_meta_post_merge()\n self._fillna_meta_cols()\n self._apply_limits()\n self._limit_by_ratio()\n self._add_hybrid_cols... | [
"0.68595505",
"0.6447473",
"0.61771506",
"0.5997296",
"0.58208466",
"0.57013005",
"0.5621617",
"0.56121767",
"0.55826235",
"0.55358064",
"0.552766",
"0.54231286",
"0.5336731",
"0.53365856",
"0.532005",
"0.5293957",
"0.5198236",
"0.51783425",
"0.513624",
"0.51267177",
"0.51105... | 0.7481591 | 0 |
Drop any remaning duplicate and 'DROPPED_COLUMNS' columns. | def _drop_cols(self, duplicate_cols):
self._hybrid_meta.drop(
duplicate_cols + DROPPED_COLUMNS,
axis=1, inplace=True, errors='ignore'
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_intermediate_columns(dataframe):\n\n combined_dataframe_dropped_cols = dataframe.drop(columns = ['measureland_qualifier_flag_speed',\n 'measureland_qualifier_flag_distance',\n ... | [
"0.7375817",
"0.7249134",
"0.6990249",
"0.68412197",
"0.68239796",
"0.6819955",
"0.6818656",
"0.6742456",
"0.66315895",
"0.6630331",
"0.6588772",
"0.65878165",
"0.64620507",
"0.64617",
"0.64469796",
"0.6427116",
"0.64201057",
"0.6406284",
"0.6405025",
"0.6393079",
"0.63860136... | 0.8000027 | 0 |
Sort the columns of the hybrid meta. | def _sort_hybrid_meta_cols(self):
self.__hybrid_meta_cols = sorted(
[c for c in self._hybrid_meta.columns
if not c.startswith(self._INTERNAL_COL_PREFIX)],
key=self._column_sorting_key
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_sort_columns_raw(self):\n col_sort_orders = self.gridpreference_sort.all().select_related()\n \n return [x.sort_display for x in col_sort_orders]",
"def sort_column(self, column):\n if column == 1: # type\n self.sorted_keys = sorted(self.data_dict.keys(),\n ... | [
"0.6853228",
"0.6610136",
"0.6548424",
"0.6503984",
"0.647215",
"0.6456782",
"0.6277559",
"0.6236531",
"0.6143224",
"0.6070268",
"0.60511625",
"0.60054857",
"0.60013264",
"0.5998635",
"0.597945",
"0.5977298",
"0.5899974",
"0.5885251",
"0.5857842",
"0.58418906",
"0.58398694",
... | 0.87696433 | 0 |
Verify that all the lat/lon values match post merge. | def _verify_lat_long_match_post_merge(self):
lat = self._verify_col_match_post_merge(col_name='latitude')
lon = self._verify_col_match_post_merge(col_name='longitude')
if not lat or not lon:
msg = ("Detected mismatched coordinate values (latitude or "
"longitude) p... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_latlon(self):\n\n for station in list(self.station_list.values()):\n station_def = self.station_definitions[station.name]\n lat = float(station.get_obs('LAT')[0])\n lon = float(station.get_obs('LON')[0])\n lat_diff = abs(lat - station_def['lat'])\n ... | [
"0.64960057",
"0.6018686",
"0.5890709",
"0.58901846",
"0.5885214",
"0.5812051",
"0.5703109",
"0.56671786",
"0.55852556",
"0.5582296",
"0.55656064",
"0.55493987",
"0.55222136",
"0.5499437",
"0.54993445",
"0.5490431",
"0.54901356",
"0.5461806",
"0.54513675",
"0.54222137",
"0.54... | 0.81470615 | 0 |
Verify that all (nonnull) values in a column match post merge. | def _verify_col_match_post_merge(self, col_name):
c1, c2 = col_name, '{}_x'.format(col_name)
if c1 in self._hybrid_meta.columns and c2 in self._hybrid_meta.columns:
compare_df = self._hybrid_meta[
(self._hybrid_meta[c1].notnull())
& (self._hybrid_meta[c2].notn... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _validate_merge_col_overlaps(self):\n mc = ColNameFormatter.fmt(MERGE_COLUMN)\n merge_col = self.solar_meta.columns[self.__solar_cols == mc].item()\n solar_vals = set(self.solar_meta[merge_col].values)\n merge_col = self.wind_meta.columns[self.__wind_cols == mc].item()\n wind... | [
"0.6701123",
"0.6258874",
"0.6128011",
"0.6113528",
"0.602254",
"0.59984547",
"0.59896743",
"0.59611064",
"0.57249576",
"0.56977004",
"0.56589574",
"0.56497085",
"0.56430054",
"0.5617941",
"0.55846447",
"0.5547863",
"0.5539539",
"0.5534496",
"0.55174416",
"0.5504539",
"0.5500... | 0.71386904 | 0 |
Warn that a column the user request an action for is missing. | def __warn_missing_col(col_name, action):
msg = ("Skipping {} values for {!r}: Unable to find column "
"in hybrid meta. Did you forget to prefix with "
"{!r} or {!r}? ")
w = msg.format(action, col_name, SOLAR_PREFIX, WIND_PREFIX)
logger.warning(w)
warn(w, In... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _check_missing_columns(self, df: pd.DataFrame) -> None:\n if any([c not in df.columns for c in REQUIRED_COLUMNS]):\n raise ValueError(\"Missing columns in dataset.\"\n f\"Columns: {df.columns}\"\n f\"Required: {REQUIRED_COLUMNS}\")",
"... | [
"0.6310501",
"0.62986654",
"0.6227882",
"0.6209167",
"0.6183721",
"0.6109864",
"0.59871733",
"0.5870047",
"0.57963955",
"0.57937914",
"0.57719535",
"0.570212",
"0.565182",
"0.5635386",
"0.5619512",
"0.557995",
"0.5579505",
"0.55780494",
"0.5576897",
"0.5507076",
"0.5505349",
... | 0.7885655 | 0 |
Limit the given pair of ratio columns based on input ratio. | def _limit_by_ratio(self):
if self._ratio_bounds is None:
return
numerator_col, denominator_col = self._ratio_cols
min_ratio, max_ratio = sorted(self._ratio_bounds)
overlap_idx = self._hybrid_meta[MERGE_COLUMN].isin(
self.data.merge_col_overlap_values
)... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def swipe_custom_ratio(self, start_pos_x_ratio, start_pos_y_ratio,\n end_pos_x_ratio, end_pos_y_ratio):\n invalid_ratio_tuple = [\n start_pos_x_ratio > 1, start_pos_y_ratio > 1, end_pos_x_ratio > 1,\n end_pos_y_ratio > 1, start_pos_x_ratio < 0, end_pos_x_ratio < 0,\n ... | [
"0.5729248",
"0.56190497",
"0.5363521",
"0.5296813",
"0.52254987",
"0.5183031",
"0.5181692",
"0.517827",
"0.5165655",
"0.5137125",
"0.5101696",
"0.5069789",
"0.50480825",
"0.50145197",
"0.5005661",
"0.49592122",
"0.49052435",
"0.48905343",
"0.48362494",
"0.48283234",
"0.47847... | 0.6698656 | 0 |
Add new hybrid columns using registered hybrid methods. | def _add_hybrid_cols(self):
for new_col_name, method in HYBRID_METHODS.items():
out = method(self)
if out is not None:
try:
self._hybrid_meta[new_col_name] = out
except ValueError as e:
msg = ("Unable to add {!r} col... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hybridize(self):\n self._format_meta_pre_merge()\n self._merge_solar_wind_meta()\n self._verify_lat_long_match_post_merge()\n self._format_meta_post_merge()\n self._fillna_meta_cols()\n self._apply_limits()\n self._limit_by_ratio()\n self._add_hybrid_cols... | [
"0.6093775",
"0.59311414",
"0.5664787",
"0.5634776",
"0.5633163",
"0.56050193",
"0.54822415",
"0.5467835",
"0.54330766",
"0.541532",
"0.5402483",
"0.53684175",
"0.5332309",
"0.5319381",
"0.531418",
"0.53120226",
"0.52878714",
"0.526263",
"0.52580583",
"0.5233867",
"0.5232165"... | 0.84006095 | 0 |
Map hybrid to solar rep indices. Returns | def solar_profile_indices_map(self):
if self._hybrid_meta is None:
return np.array([]), np.array([])
idxs = self._hybrid_meta[self.__solar_rpi_n].astype(int)
idxs = idxs[idxs >= 0]
return idxs.index.values, idxs.values | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def alt_reps_idxs(self):\n\n idxs_grp = self.h5['{}/{}'.format(SETTINGS, ALT_REPS_IDXS)]\n return {name : ds[:] for name, ds in idxs_grp.items()}",
"def wind_profile_indices_map(self):\n if self._hybrid_meta is None:\n return np.array([]), np.array([])\n\n idxs = self._hybr... | [
"0.641984",
"0.60770744",
"0.6043852",
"0.60185426",
"0.57239175",
"0.5719977",
"0.568782",
"0.5641647",
"0.5611209",
"0.55353475",
"0.55059636",
"0.5493457",
"0.5478963",
"0.54751855",
"0.54519737",
"0.54322875",
"0.54119295",
"0.5395029",
"0.5365629",
"0.5354841",
"0.535387... | 0.64991343 | 0 |
Map hybrid to wind rep indices. Returns | def wind_profile_indices_map(self):
if self._hybrid_meta is None:
return np.array([]), np.array([])
idxs = self._hybrid_meta[self.__wind_rpi_n].astype(int)
idxs = idxs[idxs >= 0]
return idxs.index.values, idxs.values | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def solar_profile_indices_map(self):\n\n if self._hybrid_meta is None:\n return np.array([]), np.array([])\n\n idxs = self._hybrid_meta[self.__solar_rpi_n].astype(int)\n idxs = idxs[idxs >= 0]\n\n return idxs.index.values, idxs.values",
"def generateNeighborMap(self):\n ... | [
"0.61448616",
"0.5973025",
"0.59361917",
"0.5891525",
"0.5793482",
"0.5747182",
"0.56658745",
"0.5636715",
"0.5635235",
"0.56321746",
"0.5619861",
"0.560915",
"0.5597039",
"0.55405587",
"0.54661286",
"0.54352736",
"0.54163575",
"0.54098713",
"0.5405598",
"0.53761446",
"0.5360... | 0.7203772 | 0 |
Framework to handle hybridization of SC and corresponding profiles. ``reV`` hybrids computes a "hybrid" wind and solar supply curve, where each supply curve point contains some wind and some solar capacity. Various ratio limits on windtosolar farm properties (e.g. windtosolar capacity) can be applied during the hybridi... | def __init__(self, solar_fpath, wind_fpath, allow_solar_only=False,
allow_wind_only=False, fillna=None, limits=None,
ratio_bounds=None, ratio='solar_capacity/wind_capacity'):
logger.info('Running hybridization of rep profiles with solar_fpath: '
'"{}"'.form... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def TDProfiles(Prof,x,Trx,rb_spec,abs_spec,dr,inu0,bsrMult,base_T,base_P,r0):\n \n iR = Prof['WV Online'].size # range index for a profile into 1D x array\n x2 = np.reshape(x,(iR+1,6))\n xK = x2[0,:] # constants [HSRL Mol HSRL Comb, WV On, WV Off, O2 On ,O2 Off]\n xS = x2[1:,:] # state vector [T... | [
"0.56082165",
"0.5606614",
"0.55929303",
"0.53858304",
"0.5334978",
"0.5308955",
"0.5269956",
"0.5254397",
"0.5252725",
"0.5199206",
"0.51661444",
"0.51595265",
"0.5128234",
"0.50699997",
"0.5037754",
"0.501085",
"0.5004973",
"0.48865652",
"0.4879011",
"0.48693165",
"0.486689... | 0.5764445 | 0 |
Summary for the wind representative profiles. Returns | def wind_meta(self):
return self.data.wind_meta | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_forecast_summary(self):\n sum = {\"prior_var\":[], \"post_var\":[], \"percent_reduction\":[]}\n for forecast in self.prior_forecast.keys():\n pr = self.prior_forecast[forecast]\n pt = self.posterior_forecast[forecast]\n ur = 100.0 * (1.0 - (pt/pr))\n ... | [
"0.58182275",
"0.5813058",
"0.58062196",
"0.57843465",
"0.5760824",
"0.57449645",
"0.5741129",
"0.5725169",
"0.5710606",
"0.55951095",
"0.55671924",
"0.55563986",
"0.5532623",
"0.5493516",
"0.54563886",
"0.5442576",
"0.54306656",
"0.54306656",
"0.54306656",
"0.54306656",
"0.5... | 0.5891586 | 0 |
Get the time index for the solar rep profiles. Returns | def solar_time_index(self):
return self.data.solar_time_index | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def solar_time_index(self):\n if self._solar_time_index is None:\n with Resource(self.solar_fpath) as res:\n self._solar_time_index = res.time_index\n return self._solar_time_index",
"def time(self):\r\n return self._idx",
"def indexTime(self):\n produc... | [
"0.66143996",
"0.63582164",
"0.62169",
"0.61836916",
"0.6114667",
"0.60695803",
"0.6010951",
"0.59389555",
"0.5810855",
"0.5503306",
"0.54938483",
"0.544385",
"0.54156595",
"0.54156595",
"0.54156595",
"0.5408591",
"0.5389596",
"0.53735733",
"0.5326841",
"0.5314179",
"0.528977... | 0.6434821 | 1 |
Get the time index for the wind rep profiles. Returns | def wind_time_index(self):
return self.data.wind_time_index | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def wind_time_index(self):\n if self._wind_time_index is None:\n with Resource(self.wind_fpath) as res:\n self._wind_time_index = res.time_index\n return self._wind_time_index",
"def hybrid_time_index(self):\n return self.data.hybrid_time_index",
"def indexTime(se... | [
"0.7592841",
"0.6276603",
"0.6069263",
"0.60505944",
"0.5897327",
"0.5862702",
"0.56928545",
"0.5662904",
"0.56568897",
"0.5585292",
"0.5510011",
"0.5508156",
"0.54844767",
"0.54597926",
"0.54456675",
"0.5433278",
"0.54217535",
"0.54217535",
"0.54217535",
"0.5379116",
"0.5364... | 0.7500957 | 1 |
Get the time index for the hybrid rep profiles. Returns | def hybrid_time_index(self):
return self.data.hybrid_time_index | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hybrid_time_index(self):\n if self._hybrid_time_index is None:\n self._hybrid_time_index = self.solar_time_index.join(\n self.wind_time_index, how='inner')\n return self._hybrid_time_index",
"def time(self):\r\n return self._idx",
"def wind_time_index(self):\n... | [
"0.66295826",
"0.6247068",
"0.6170808",
"0.616089",
"0.5997463",
"0.5992146",
"0.5607782",
"0.54947007",
"0.5492113",
"0.54870903",
"0.5481849",
"0.5416178",
"0.54062164",
"0.5369737",
"0.53373766",
"0.5309014",
"0.5296561",
"0.52693135",
"0.52514267",
"0.52411443",
"0.523782... | 0.77849245 | 0 |
Run hybridization of profiles and save to disc. | def run(self, fout=None, save_hybrid_meta=True):
self.run_meta()
self.run_profiles()
if fout is not None:
self.save_profiles(fout, save_hybrid_meta=save_hybrid_meta)
logger.info('Hybridization of representative profiles complete!')
return fout | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run_profiles(self):\n\n logger.info('Running hybrid profile calculations.')\n\n self._init_profiles()\n self._compute_hybridized_profile_components()\n self._compute_hybridized_profiles_from_components()\n\n logger.info('Profile hybridization complete.')\n\n return sel... | [
"0.7774856",
"0.67250896",
"0.61599463",
"0.61466944",
"0.5987495",
"0.5983153",
"0.5946732",
"0.5930023",
"0.5914046",
"0.56950074",
"0.559235",
"0.55337167",
"0.54658395",
"0.5426261",
"0.54062206",
"0.529761",
"0.52904516",
"0.5285083",
"0.52809393",
"0.52494735",
"0.52427... | 0.7577967 | 1 |
Compute all hybridized profiles. Returns `Hybridization` Instance of Hybridization object (itself) containing the hybridized profiles as attributes. | def run_profiles(self):
logger.info('Running hybrid profile calculations.')
self._init_profiles()
self._compute_hybridized_profile_components()
self._compute_hybridized_profiles_from_components()
logger.info('Profile hybridization complete.')
return self | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _compute_hybridized_profiles_from_components(self):\n\n hp_name, sp_name, wp_name = OUTPUT_PROFILE_NAMES\n self._profiles[hp_name] = (self._profiles[sp_name]\n + self._profiles[wp_name])",
"def _compute_hybridized_profile_components(self):\n\n for params... | [
"0.733052",
"0.7061389",
"0.62688696",
"0.5916327",
"0.54421306",
"0.54149187",
"0.54028976",
"0.53174865",
"0.5264599",
"0.5244064",
"0.5241793",
"0.5234794",
"0.5228557",
"0.52058893",
"0.5167426",
"0.5083976",
"0.5015077",
"0.49596864",
"0.4946332",
"0.49411702",
"0.493650... | 0.7537133 | 0 |
Initialize the output rep profiles attribute. | def _init_profiles(self):
self._profiles = {
k: np.zeros((len(self.hybrid_time_index), len(self.hybrid_meta)),
dtype=np.float32)
for k in OUTPUT_PROFILE_NAMES} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def profiles(self, profiles):\n\n self._profiles = profiles",
"def profile(self, profile):\n\n self.width = profile['width']\n self.height = profile['height']\n self.crs = profile['crs']\n self.interleave = profile['interleave']\n self.resampling = profile['resampling']"... | [
"0.6229419",
"0.5958581",
"0.5942211",
"0.58191633",
"0.5738705",
"0.5710127",
"0.56795114",
"0.5629888",
"0.5613109",
"0.55939484",
"0.5537498",
"0.549897",
"0.5493992",
"0.5451944",
"0.54345554",
"0.54297125",
"0.5394949",
"0.5347193",
"0.53254014",
"0.5318524",
"0.53174424... | 0.7465345 | 0 |
Compute the resource components of the hybridized profiles. | def _compute_hybridized_profile_components(self):
for params in self.__rep_profile_hybridization_params:
col, (hybrid_idxs, solar_idxs), fpath, p_name, dset_name = params
capacity = self.hybrid_meta.loc[hybrid_idxs, col].values
with Resource(fpath) as res:
d... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _compute_hybridized_profiles_from_components(self):\n\n hp_name, sp_name, wp_name = OUTPUT_PROFILE_NAMES\n self._profiles[hp_name] = (self._profiles[sp_name]\n + self._profiles[wp_name])",
"def run_profiles(self):\n\n logger.info('Running hybrid profile ... | [
"0.7546985",
"0.6542931",
"0.59522486",
"0.53739905",
"0.53605217",
"0.5304197",
"0.52671057",
"0.51267076",
"0.5087561",
"0.49884608",
"0.49627313",
"0.4955488",
"0.4951355",
"0.4930111",
"0.48858455",
"0.48255697",
"0.4788717",
"0.47691756",
"0.4756587",
"0.47513503",
"0.47... | 0.7651577 | 0 |
Zip the rep profile hybridization parameters. | def __rep_profile_hybridization_params(self):
cap_col_names = ['hybrid_solar_capacity', 'hybrid_wind_capacity']
idx_maps = [self.meta_hybridizer.solar_profile_indices_map,
self.meta_hybridizer.wind_profile_indices_map]
fpaths = [self.data.solar_fpath, self.data.wind_fpath]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _compute_hybridized_profiles_from_components(self):\n\n hp_name, sp_name, wp_name = OUTPUT_PROFILE_NAMES\n self._profiles[hp_name] = (self._profiles[sp_name]\n + self._profiles[wp_name])",
"def _compute_hybridized_profile_components(self):\n\n for params... | [
"0.65115",
"0.6004542",
"0.56565815",
"0.5628987",
"0.5279842",
"0.4866302",
"0.48654565",
"0.48481628",
"0.48073152",
"0.47659388",
"0.46941778",
"0.46752405",
"0.46748453",
"0.4633047",
"0.46119785",
"0.45936564",
"0.45915177",
"0.45900583",
"0.45828488",
"0.45590737",
"0.4... | 0.7985571 | 0 |
Compute the hybridized profiles from the resource components. | def _compute_hybridized_profiles_from_components(self):
hp_name, sp_name, wp_name = OUTPUT_PROFILE_NAMES
self._profiles[hp_name] = (self._profiles[sp_name]
+ self._profiles[wp_name]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _compute_hybridized_profile_components(self):\n\n for params in self.__rep_profile_hybridization_params:\n col, (hybrid_idxs, solar_idxs), fpath, p_name, dset_name = params\n capacity = self.hybrid_meta.loc[hybrid_idxs, col].values\n\n with Resource(fpath) as res:\n ... | [
"0.7780478",
"0.6865406",
"0.6113437",
"0.58793914",
"0.53639734",
"0.5281016",
"0.5194652",
"0.5157139",
"0.50896513",
"0.5070324",
"0.49811444",
"0.49413982",
"0.49034274",
"0.486924",
"0.48568314",
"0.48337466",
"0.47968993",
"0.47571585",
"0.47366613",
"0.46830127",
"0.46... | 0.84109247 | 0 |
Initialize an output h5 file for hybrid profiles. | def _init_h5_out(self, fout, save_hybrid_meta=True):
dsets = []
shapes = {}
attrs = {}
chunks = {}
dtypes = {}
for dset, data in self.profiles.items():
dsets.append(dset)
shapes[dset] = data.shape
chunks[dset] = None
attrs[... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _write_h5_out(self, fout, save_hybrid_meta=True):\n\n with Outputs(fout, mode='a') as out:\n if 'meta' in out.datasets and save_hybrid_meta:\n hybrid_meta = to_records_array(self.hybrid_meta)\n out['meta'] = hybrid_meta\n\n for dset, data in self.profi... | [
"0.66504127",
"0.5997457",
"0.58451897",
"0.54948074",
"0.544503",
"0.5399858",
"0.53893876",
"0.5372646",
"0.5320893",
"0.5305936",
"0.5302461",
"0.5301459",
"0.52773494",
"0.52289575",
"0.51936066",
"0.5171951",
"0.5159367",
"0.51521",
"0.51349735",
"0.51283693",
"0.5124489... | 0.7718831 | 0 |
Write hybrid profiles and meta to an output file. | def _write_h5_out(self, fout, save_hybrid_meta=True):
with Outputs(fout, mode='a') as out:
if 'meta' in out.datasets and save_hybrid_meta:
hybrid_meta = to_records_array(self.hybrid_meta)
out['meta'] = hybrid_meta
for dset, data in self.profiles.items():... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_profiles(self, fout, save_hybrid_meta=True):\n\n self._init_h5_out(fout, save_hybrid_meta=save_hybrid_meta)\n self._write_h5_out(fout, save_hybrid_meta=save_hybrid_meta)",
"def _init_h5_out(self, fout, save_hybrid_meta=True):\n dsets = []\n shapes = {}\n attrs = {}\n ... | [
"0.7454778",
"0.6544884",
"0.6490576",
"0.59463924",
"0.586533",
"0.5693251",
"0.56837285",
"0.56087226",
"0.5586065",
"0.5581156",
"0.5552762",
"0.55342555",
"0.55341566",
"0.5525531",
"0.5507492",
"0.5480804",
"0.54617494",
"0.54361516",
"0.5418574",
"0.53643364",
"0.535623... | 0.74464285 | 1 |
Initialize fout and save profiles. | def save_profiles(self, fout, save_hybrid_meta=True):
self._init_h5_out(fout, save_hybrid_meta=save_hybrid_meta)
self._write_h5_out(fout, save_hybrid_meta=save_hybrid_meta) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize():\n pinfo = pathinfo()\n\n if not pinfo:\n raise Error('cannot decide profile directory, $SUZUPROFILEDIR, $APPDATA, or $HOME should be configured.')\n\n # dig profdir\n if not os.path.isdir(pinfo['profiledir']):\n os.mkdir(pinfo['profiledir'])\n\n # test dir\n if not... | [
"0.63533014",
"0.6147274",
"0.60553646",
"0.5978335",
"0.5978315",
"0.5926436",
"0.59156495",
"0.58464986",
"0.5839331",
"0.58250517",
"0.57879347",
"0.5769245",
"0.57497555",
"0.57399356",
"0.5730807",
"0.57220954",
"0.56756866",
"0.56477475",
"0.5641283",
"0.56080055",
"0.5... | 0.64332795 | 0 |
Used to receive and broadcast batches of transactions, should be used if big loads of transactions are sent | def jsonrpc_puttxn_batch(self, txns, broadcast = True):
if ADD_NETWORK_DELAY:
time.sleep(random.uniform(NETWORK_DELAY_MIN, NETWORK_DELAY_MAX))
if self.node.storage.txns_received == 0:
self.node.storage.time_measurement = time.time()
self.node.storage.txns_received +=... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_batch_by_transaction_id_multiple_txn_ids():\n # Add batch that has txn 123\n testResponder = TestResponder()\n\n transaction = transaction_pb2.Transaction(header_signature=\"123\")\n batch = batch_pb2.Batch(\n header_signature=\"abc\", transactions=[transaction])\n testResponder.comp... | [
"0.65977824",
"0.61318886",
"0.60380226",
"0.5896736",
"0.5848239",
"0.5803364",
"0.5795807",
"0.57852525",
"0.5774333",
"0.568867",
"0.5655798",
"0.5655402",
"0.56405264",
"0.5629396",
"0.5606906",
"0.56017846",
"0.5579428",
"0.5577547",
"0.5567849",
"0.5554993",
"0.5493132"... | 0.69003737 | 0 |
Initialisation function. It creates the first population with a reef or RsizeRsize. At first all positions are filled with random individuals. A set of random corals are deleted according to the formula fi not in (f_1 sf1, 1] | def initialisation(Rsize, config, n_global_in, n_global_out, ke):
# Creating population of Rsize*Rsize new random individuals
# population = [[Individual(config, n_global_in, n_global_out)]*Rsize for _ in range(Rsize)]
reef = [Individual(config, n_global_in, n_global_out) for _ in range(Rsize * Rsize)]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_pop(self):\n genes = np.random.randn( self.population_size * self.individual.gene_count )\n self.population = genes.reshape((self.population_size, -1))\n #print(self.population)",
"def __init__(self, *args, **kwargs):\n super(jDE, self).__init__(*args, **kwargs)\n for ... | [
"0.62946165",
"0.612848",
"0.6094642",
"0.58847666",
"0.58328015",
"0.5819835",
"0.5805491",
"0.5748251",
"0.5742962",
"0.5713963",
"0.56911564",
"0.5685762",
"0.56809795",
"0.5641615",
"0.560764",
"0.55735725",
"0.5565507",
"0.5564572",
"0.5547652",
"0.55378807",
"0.55346054... | 0.6360272 | 0 |
Assumes L is a nonempty list of ints Returns the largest element of L that occurs an odd number of times in L. If no such element exists, returns None | def largest_odd_times(L):
occurence = {}
for n in L:
if n in occurence.keys():
occurence[n] += 1
else:
occurence[n] = 1
copy = {}
for k in occurence.keys():
if occurence[k] % 2 != 0:
copy[k] = occurence[k]
if len(copy... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def largest_odd_times(L):\n \n l = []\n for i in set(L):\n if L.count(i) % 2 > 0:\n l.append(i)\n \n if l:\n return max(l)",
"def largest_odd_times(L):\n cnt = {}\n oddnum=[]\n for i in set(L):\n cnt[i] = L.count(i)\n for i,count in cnt.items():\n ... | [
"0.80673987",
"0.790907",
"0.7881813",
"0.78657967",
"0.6914239",
"0.68489873",
"0.68139994",
"0.67810786",
"0.67244804",
"0.6568197",
"0.65584123",
"0.64571756",
"0.64383346",
"0.6334599",
"0.6323804",
"0.6293765",
"0.6289477",
"0.6267105",
"0.62649333",
"0.6184616",
"0.6156... | 0.80455375 | 1 |
Get all saved checkpoint numbers (in the given directory) | def get_checkpoint_list(dirname):
all_ckpts = [
int(_fn.strip('weights_epoch.pt'))
for _fn in os.listdir(dirname) if _fn.endswith('.pt')
]
return all_ckpts | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _checkpoint_numbers(cls, checkpoints_dir):\n dirs = [d for d in listdir(checkpoints_dir) if d.endswith('.checkpoint')]\n return sorted([int(d[:-11]) for d in dirs])",
"def get_checkpoint():\n\timport numpy as np\n\n\tcheckpoint = []\n\tfor directory in directories:\n\t\ttry: # try to find folde... | [
"0.786034",
"0.7154406",
"0.6732954",
"0.6679945",
"0.6653826",
"0.6446148",
"0.62846464",
"0.6045855",
"0.5933614",
"0.5913544",
"0.585394",
"0.5842072",
"0.578392",
"0.5763129",
"0.57452226",
"0.57384986",
"0.5737873",
"0.5661464",
"0.56259614",
"0.5622822",
"0.5622107",
... | 0.7706019 | 1 |
Extract semantic map from logits. | def prepare_semantic(self, logits, height=None, width=None):
with tf.variable_scope("prepare_semantic"):
if height is None:
height = self.params.height
if width is None:
width = self.params.width
logits = tf.image.resize_images(logits, [height,... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _logits_to_predictions(self, logits):\n with ops.name_scope(None, \"predictions\", (logits,)):\n return {\n prediction_key.PredictionKey.LOGITS:\n logits,\n prediction_key.PredictionKey.PROBABILITIES:\n nn.softmax(\n logits, name=prediction_k... | [
"0.55828094",
"0.55128783",
"0.5493309",
"0.5468184",
"0.52424896",
"0.52279264",
"0.52154404",
"0.52106607",
"0.5201373",
"0.51679236",
"0.5159729",
"0.5035811",
"0.49608088",
"0.49428394",
"0.4936749",
"0.4912986",
"0.48933527",
"0.48479202",
"0.48459017",
"0.48338896",
"0.... | 0.5584563 | 0 |
Build outputs of the network | def build_outputs(self):
with tf.variable_scope("build_outputs"):
self.optical_flow = self.__optical_flow_src2_tgt
self.disp = self.baselineNet.disp_tgt
self.semantic = self.__semantic
self.motion_mask = self.prepare_final_motion_mask() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _build_networks(self):\n self.online_convnet = self._create_network(name='Online')\n self.target_convnet = self._create_network(name='Target')\n self._net_outputs = self.online_convnet(self.state_ph, training=True)\n self._q_argmax = tf.argmax(self._net_outputs.q_values, axis=1)[0]\n self._repla... | [
"0.73322904",
"0.6925082",
"0.68243474",
"0.67949796",
"0.66547793",
"0.6574649",
"0.64935106",
"0.649005",
"0.6452229",
"0.64316154",
"0.6412928",
"0.6410136",
"0.6409449",
"0.64050967",
"0.6396543",
"0.63829255",
"0.6363151",
"0.6335156",
"0.63167924",
"0.63127977",
"0.6285... | 0.7618624 | 0 |
Measure cosine distance between a and b | def tf_cosine_distance(self, a, b):
normalize_a = tf.nn.l2_normalize(a, -1)
normalize_b = tf.nn.l2_normalize(b, -1)
cos_similarity = tf.reduce_sum(
tf.multiply(normalize_a, normalize_b), axis=-1, keep_dims=True
)
return (1.0 - cos_similarity) / 2.0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cosine_similarity(a, b):\n cs = dot_product(a, b)/(norm(a) * norm(b))\n return cs",
"def cosine_distance(a, b, axis=1):\n a_norm = np.dot(a,a)**.5\n b_norm = np.sum(b**2, axis=axis)**.5\n return np.dot(b,a)/(a_norm*b_norm)",
"def cosine_sim(a: np.ndarray, \n b: np.ndarray \n ... | [
"0.82778096",
"0.8186116",
"0.7974883",
"0.796121",
"0.7819718",
"0.7817636",
"0.7817636",
"0.7817564",
"0.7815636",
"0.7752678",
"0.76893437",
"0.76646465",
"0.75921243",
"0.74521756",
"0.7425858",
"0.74005866",
"0.73926353",
"0.7368486",
"0.7363347",
"0.734456",
"0.7337519"... | 0.8420072 | 0 |
Prepare masks based on semantic priors | def build_semantic_masks(self):
with tf.variable_scope("build_semantic_masks"):
dynamic_tgt_mask = self.__priors
static_tgt_mask = 1.0 - dynamic_tgt_mask
return dynamic_tgt_mask, static_tgt_mask | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def preprocess(self):\n snr_mask = self._snr_preprocessing()\n flux_mask = self._flux_preprocessing()\n masking_mask = self._mask_preprocessing()\n return snr_mask & flux_mask & masking_mask",
"def preprocess_mask(mask):\n # Project values interval on [0.0; 1.0]\n if mask.max() ... | [
"0.6294984",
"0.6164755",
"0.5899228",
"0.58345824",
"0.5817901",
"0.57972735",
"0.5757405",
"0.5744003",
"0.5722341",
"0.5642885",
"0.5625452",
"0.56192786",
"0.56067705",
"0.55995107",
"0.5570684",
"0.5567884",
"0.55526555",
"0.554503",
"0.5543809",
"0.5525525",
"0.5521006"... | 0.66386116 | 0 |
View all dues owed to/by a friend to a customer | def view_dues_by_friend():
id = _get_id("id")
friend_id = _get_id("friend_id")
separate_dues = dbhandlers.handle_view_dues_by_friend(id, friend_id)
return dumps({"response": separate_dues}) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show_friends():\n\n\n user_id = session['user_id']\n user = User.query.get(user_id)\n friendship = Friendship.query.get(user_id)\n\n return render_template('friends.html', user=user, friendship=friendship)",
"def view_dues():\n id = _get_id(\"id\")\n dues_by_customer = dbhandlers.ha... | [
"0.6122355",
"0.6084778",
"0.5835328",
"0.57889605",
"0.57836115",
"0.5776017",
"0.5775319",
"0.56812805",
"0.5664663",
"0.5663152",
"0.56507987",
"0.5630104",
"0.56083924",
"0.556169",
"0.5525238",
"0.5497949",
"0.54967785",
"0.54858893",
"0.54754955",
"0.54624087",
"0.54589... | 0.6186853 | 0 |
View all dues owed to/from customer | def view_dues():
id = _get_id("id")
dues_by_customer = dbhandlers.handle_view_dues(id)
return dumps({"response": dumps(dues_by_customer)}) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show_all_customers():\n return cr.show_all_customers()",
"def list_subscriptions(self):\n return {'abonnementen': self.customer.abonnementen}",
"def customers(self):\r\n return customers.Customers(self)",
"def get_customer(self):\n try:\n cursor = self.db.cursor()\n ... | [
"0.5904255",
"0.5832976",
"0.5766548",
"0.5749025",
"0.57453924",
"0.5670713",
"0.5654258",
"0.56530994",
"0.5594913",
"0.5546727",
"0.5538875",
"0.5504363",
"0.5474641",
"0.5440313",
"0.54176015",
"0.5408953",
"0.5405764",
"0.53926665",
"0.53501284",
"0.53439665",
"0.5335249... | 0.61387044 | 0 |
Create a new due | def new_due():
_validate_fields(DUE_FIELDS)
dbhandlers.handle_new_due(request.form)
return dumps({"response": "success"}) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_task(self, name, date, isComplete):\n user = User.objects.create(username='userdemo')\n user.set_password('calnote24')\n user.save()\n Task.objects.create(task=name, dueDate=date, isComplete=isComplete, user_id=user.id)",
"def create_todo(todo_text, days):\n time = timezon... | [
"0.63543373",
"0.59950984",
"0.5924723",
"0.59065765",
"0.57558477",
"0.5746886",
"0.56982255",
"0.569172",
"0.5647928",
"0.56274647",
"0.56274647",
"0.56181526",
"0.56078196",
"0.5602609",
"0.55897194",
"0.5585047",
"0.55752087",
"0.5565119",
"0.5560133",
"0.5556835",
"0.555... | 0.7500793 | 0 |
Get a username from a GET request | def _get_username():
username = request.args.get("username")
if not username:
raise NoUserError()
else:
return username | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(self, username):\n return username",
"def _get_username_from_api(self):\n result = self.api_query(action=\"query\", meta=\"userinfo\")\n return result[\"query\"][\"userinfo\"][\"name\"]",
"def get_user_name(url, session=None):\n return get_whole_response_as_json(url, session)['n... | [
"0.7725238",
"0.7555749",
"0.7333097",
"0.7323902",
"0.71794975",
"0.7168585",
"0.7165154",
"0.7165154",
"0.70758",
"0.7014725",
"0.7001049",
"0.69901997",
"0.6977092",
"0.6954689",
"0.69322896",
"0.69300544",
"0.690421",
"0.69030195",
"0.68973064",
"0.68908167",
"0.6886413",... | 0.75835925 | 1 |
Converts from the csv to data frame | def csv_to_df(self, path=None):
# reads the csv file and puts it to the dataframe
df = pd.read_csv(path)
return df | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _csv_to_df(csv_path, headers):\n\n # Assume all columns are strings\n columns_types = {i: str for i, header in enumerate(headers)}\n\n temp_df = pd.read_csv(csv_path, converters=columns_types, skip_blank_lines=False)\n # TODO: check that there are only two columns of type string, then convert to ou... | [
"0.73168486",
"0.7309568",
"0.7307156",
"0.7242401",
"0.7219318",
"0.69612867",
"0.6883978",
"0.6880068",
"0.68637556",
"0.6846858",
"0.6787867",
"0.666581",
"0.66483206",
"0.66464984",
"0.6645637",
"0.66406834",
"0.66058004",
"0.65886426",
"0.65463346",
"0.65332603",
"0.6524... | 0.7452765 | 0 |
Function for plotting the velocity of the skydiver as a function of time | def plot_v(t, v):
p1 = plt.plot(t,v)
plt.xlabel('Time [s]')
plt.ylabel('Velocity [m/s]')
plt.title('Velocity for the skydiver as a function of time')
plt.show()
plt.savefig('Parachute_velocity.png') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_velocity(self):\n \n plt.figure(figsize=[2,6])\n plt.plot(self.velocity_model['vp'],self.velocity_model['depth'],'r',label='vp')\n plt.plot(self.velocity_model['vs'],self.velocity_model['depth'],'b',label='vs')\n\n plt.ylim(np.max(self.velocity_model['depth']),np.min(sel... | [
"0.7086576",
"0.6895582",
"0.68738735",
"0.65765846",
"0.656258",
"0.6483235",
"0.6440773",
"0.6389013",
"0.6327927",
"0.6237084",
"0.6219854",
"0.6215106",
"0.6204449",
"0.6194366",
"0.6175058",
"0.61671126",
"0.61319405",
"0.61071545",
"0.6098143",
"0.6089808",
"0.6059007",... | 0.75832546 | 0 |
Function for plotting the forces when running the program without parachute deployment | def plot_forces(t, v, m, a):
plt.figure()
drag = -m*a*abs(v)*v
grav = [-m*9.81]*len(v)
Boyancy = [1. * 9.81 * 0.1]*len(v) # rho * g * V
Fsum = drag+grav+Boyancy
plt.plot(t, drag, t, grav, t, Boyancy, t, Fsum)
plt.legend(["Drag force", "Gravity force", "Boyancy", "Sum of forces"])
plt.sa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_plot_force(nb_mus):\n # --- Curve graph --- #\n # app = pg.mkQApp(\"force\")\n # remote = []\n # layout = pg.LayoutWidget()\n # layout.resize(800, 800)\n # label = QtGui.QLabel()\n # box = []\n # rplt = []\n # row_count = 0\n # col_span = 4 if nb_mus > 8 else 8\n # for mus... | [
"0.6598274",
"0.6423267",
"0.64204633",
"0.64139664",
"0.6398567",
"0.6378061",
"0.63634306",
"0.6317722",
"0.6247157",
"0.61863434",
"0.618385",
"0.6180544",
"0.61661994",
"0.61546165",
"0.6145741",
"0.613262",
"0.6077126",
"0.6076428",
"0.60635215",
"0.6044243",
"0.60103613... | 0.64935976 | 1 |
Function for plotting the forces when running the program with parachute deployment | def plot_forces_parachute(t, v, dt, tp, m, a_first, a_last):
plt.figure()
drag = zeros(len(v))
for i in range(len(v)):
if(i*dt <= tp):
drag[i] = -m*a_first*abs(v[i])*v[i]
else:
drag[i] = -m*a_last*abs(v[i])*v[i]
grav = [-m*9.81]*len(v)
Boyancy = [1. * 9.81 * 0... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_plot_force(nb_mus):\n # --- Curve graph --- #\n # app = pg.mkQApp(\"force\")\n # remote = []\n # layout = pg.LayoutWidget()\n # layout.resize(800, 800)\n # label = QtGui.QLabel()\n # box = []\n # rplt = []\n # row_count = 0\n # col_span = 4 if nb_mus > 8 else 8\n # for mus... | [
"0.64810973",
"0.6453218",
"0.6385735",
"0.6297726",
"0.6197574",
"0.6183049",
"0.6133729",
"0.6118263",
"0.61047816",
"0.6072789",
"0.60465145",
"0.60335356",
"0.60063076",
"0.59888",
"0.5983309",
"0.5978817",
"0.5970176",
"0.59628695",
"0.5961769",
"0.59381366",
"0.5936437"... | 0.6773594 | 0 |
Function for plotting the vertical position of the skydiver as a function of time | def plot_x(t, x):
plt.figure()
plt.plot(t, x)
plt.title("Vertical position of the skydiver as a function of time")
plt.xlabel("Time t [s]")
plt.ylabel("Height [m]")
plt.savefig('Parachute_position.png') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_v(t, v):\n p1 = plt.plot(t,v)\n plt.xlabel('Time [s]')\n plt.ylabel('Velocity [m/s]')\n plt.title('Velocity for the skydiver as a function of time')\n plt.show()\n plt.savefig('Parachute_velocity.png')",
"def plotTimeDepth(d,v):\n\n dpth,t = getTimeDepth(d,v)\n plt.figure(num=0, ... | [
"0.6453509",
"0.620752",
"0.6137558",
"0.61119145",
"0.5947405",
"0.59293157",
"0.59185404",
"0.59161496",
"0.59156483",
"0.59123474",
"0.5890117",
"0.586268",
"0.585379",
"0.5827984",
"0.58279425",
"0.579338",
"0.57487464",
"0.5748344",
"0.5675589",
"0.56722814",
"0.566215",... | 0.66852516 | 0 |
This is the main solver function for the program. It takes the problem specific variables as arguments, and returns two meshes containing the velocity and time points respectively. | def solver(T, dt, v0, Cd, rho, A, m, Source=None):
a = Cd*rho*A/(2*m) # Set up the constant a for compact code
v = zeros(int(T/dt) + 1) # Create the velocity mesh
v[0] = v0; g = 9.81;#Initial velocity and the value of gravity acceleration
# Description of the functions X(t) and Y(t) is given in the... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def main():\n \n def get_x_input():\n \"\"\"\n This gets the initial x position and velocity values\n Param:none\n Return:Tuple with x pos and vel\n \"\"\"\n # Ask for and validate user input for x pos and vel\n while True:\n try:\n ... | [
"0.6753484",
"0.64625174",
"0.6417056",
"0.6341084",
"0.6270916",
"0.6250796",
"0.62482274",
"0.6211401",
"0.6125116",
"0.6091989",
"0.6086171",
"0.6057079",
"0.6049502",
"0.60347843",
"0.5989213",
"0.59836835",
"0.59629244",
"0.5960114",
"0.59457576",
"0.59297216",
"0.592323... | 0.69082 | 0 |
This is an extension of the main solver function that includes the deployment of the parachute. It requires a separate implementation because the final time is not known, and the constants Cd and A are timedependent. It also returns the position mesh | def solver_parachute(T, dt, v0, tp, Cd, rho, A, m):
# Mesh initialization
v = []; v.append(v0); t=[]; t.append(0);
x = []; x.append(3000.)
def X(t):
return -9.81
def Y(t):
return Cd*rho*A/(2.*m)
# Simulate the same way as solver() untill time tp
while t[-1]... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def solve_prep(self):\n\n par = self.par\n sol = self.sol\n\n # a. retirement\n sol.m_ret = np.zeros((par.T,par.Nm_ret))\n sol.c_ret = np.zeros((par.T,par.Nm_ret))\n sol.a_ret = np.zeros((par.T,par.Nm_ret))\n sol.inv_v_ret = np.zeros((par.T,par.Nm_ret))\n sol... | [
"0.65983653",
"0.62209773",
"0.60683256",
"0.60176325",
"0.590946",
"0.5848692",
"0.5817854",
"0.5797646",
"0.57465684",
"0.573717",
"0.5644472",
"0.5623622",
"0.5592182",
"0.5588064",
"0.55792546",
"0.5565275",
"0.55637085",
"0.55441976",
"0.5536708",
"0.55330366",
"0.549091... | 0.70755446 | 0 |
Test for the solvers ability to reproduce a linear solution by fitting the source term so that a linear solution should indeed be a solution to the differential equation | def test_linear():
import nose.tools as nt
A = -0.11; B = -0.13; g = 9.81; m = 50.; T = 10.; dt = 0.01;
Cd = 1.2; rho = 1.0; A = 0.5;
a = Cd*rho*A/(2.*m)
def exact(t):
return A*t+B
def src(t):
return m*g + m*a*abs(exact(t-dt/2.))*exact(t+dt/2.) + m*A
v, t = solver(T... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_solve_quadratic_fixed(self):\n iden1 = Identity()\n iden2 = Identity()\n iden3 = Identity()\n iden1.x.val = 4\n iden2.x.val = 5\n iden3.x.val = 6\n iden1.x.name = 'x1'\n iden2.x.name = 'x2'\n iden3.x.name = 'x3'\n iden2.x.fixed = False\... | [
"0.68171686",
"0.6730213",
"0.6391799",
"0.628671",
"0.6259073",
"0.6022342",
"0.6019423",
"0.5970712",
"0.59672517",
"0.593821",
"0.5925071",
"0.59170604",
"0.5908066",
"0.58775914",
"0.58577037",
"0.58565664",
"0.5816408",
"0.5806026",
"0.57895774",
"0.5783294",
"0.57784736... | 0.7030945 | 0 |
Test for the terminal velocity with no source term. | def test_terminalVelocity():
import nose.tools as nt
T = 30.; dt = 0.1; g = 9.81; m = 50.;
Cd = 1.2; rho = 1.0; A = 0.5;
a = Cd*rho*A/(2.*m)
v, t = solver(T, dt, -0.1, Cd, rho, A, m)
nt.assert_almost_equal(v[-1], -sqrt(g/a), delta=1e-4) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_terminal(self):\n return self.beta.isEmpty()",
"def is_terminal(self):",
"def is_terminal(item):\n return not PCFG.is_variable(item)",
"def isTerminalRunning(self):\n return self.f4 is 'R'",
"def cmd_velocity(self, vn, ve, vd, heading):\n pass",
"def test_no_input(self)... | [
"0.56164634",
"0.555288",
"0.5427834",
"0.53623176",
"0.5273498",
"0.52085173",
"0.5207084",
"0.5153592",
"0.5126833",
"0.51248926",
"0.5101534",
"0.50888044",
"0.5078354",
"0.5077752",
"0.49858952",
"0.4956581",
"0.49422896",
"0.49175537",
"0.49131313",
"0.4895099",
"0.48938... | 0.6034255 | 0 |
Test for the convergence rates of the solver. The expected result is that the variable r takes the value 2, because the CrankNicolson scheme and the geometric average have errors of order dt2. The final error should then be O(dt2) which gives r=2. | def test_convergenceRates():
dt_start = 1.0; num_dt = 10
E_values = zeros(num_dt)
T = 10.; g = 9.81; m = 50.; Cd = 1.2; rho = 1.0; A = 0.5;
a = Cd*rho*A/(2.*m)
dt = zeros(num_dt); dt[0] = dt_start
for i in range(1,len(dt)):
dt[i] = dt[i-1]/2.
D = -0.39; B = 0.76; C = -0.145... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_trapezoidal_conv_rate():\r\n\tfrom math import exp\r\n\tf = lambda x: 6E8*x-4E6\r\n\tF = lambda x: 3E8*x**2 - 4E6*x #Anti-derivative\r\n\ta = 1.1; b = 1.1002\r\n\tr = convergence_rates(f, F, a, b, 14)\r\n\tprint(r)\r\n\ttol = 0.01\r\n\tmsg = str(r[-4:]) # show last 4 estimated rates\r\n\tassert (abs(r[-1]... | [
"0.656343",
"0.64528203",
"0.6292615",
"0.61919796",
"0.6048861",
"0.59271663",
"0.59056145",
"0.59056145",
"0.5830754",
"0.5823661",
"0.57470983",
"0.5735236",
"0.5724608",
"0.5703797",
"0.5701401",
"0.5699867",
"0.56794935",
"0.5657545",
"0.5656485",
"0.5647621",
"0.5638320... | 0.767306 | 0 |
This method is called every 20 minutes via a cron. Its job is simply to get all the orders made for each supplier and send an email automatically to the supplier if the supplier is configured for it and we are ready to send it (usually at 11am or so) | def _auto_email_send(self):
records = self.search([('send_by', '=', 'mail')])
for supplier in records:
send_at = datetime.combine(fields.Date.today(),
float_to_time(supplier.automatic_email_time, supplier.moment, supplier.tz)).astimezone(pytz.UTC).repl... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def execute(self):\n return LOGGER.info(f\"{datetime.datetime.now()} - Sending EMail to the configured email list\")",
"def send_notifications():\n due_notifications = Notification.query.filter(Notification.delivery_date <= datetime.now(timezone.utc))\n for notification in due_notifications:\n ... | [
"0.62266",
"0.60168934",
"0.6014454",
"0.5983644",
"0.59762514",
"0.59351337",
"0.5897082",
"0.5895402",
"0.58477116",
"0.57848775",
"0.57641447",
"0.5749515",
"0.5744839",
"0.5717567",
"0.56706667",
"0.5631428",
"0.5612533",
"0.5552104",
"0.55383223",
"0.55355674",
"0.551531... | 0.7949377 | 0 |
Processes survey replies and saves entities information into Mysql | def save_entities(self, calculate_score=True, multi_processes=False) -> None:
if self._data.empty:
logger.info(msg=f"No survey replies to be processed.")
return
self._data[cons.SURVEY_REPLY].replace('', np.nan, inplace=True)
self._data[cons.SURVEY_REPLY].replace('--dele... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process_replies(self, process_scores_only=False) -> None:\n if self._data.empty:\n logger.warning(msg=\"No survey replies found.\")\n return\n\n self._data[cons.SURVEY_REPLY].replace('', np.nan, inplace=True)\n self._data[cons.SURVEY_REPLY].replace('--deleted-content-... | [
"0.6222443",
"0.6101475",
"0.59485656",
"0.5909881",
"0.5755757",
"0.56679296",
"0.56659967",
"0.56600887",
"0.5530047",
"0.5481127",
"0.54810476",
"0.5427787",
"0.5412455",
"0.53875107",
"0.5330306",
"0.53182936",
"0.5317369",
"0.52688956",
"0.52677226",
"0.52534807",
"0.521... | 0.6414591 | 0 |
Sample edges by neighborhool expansion. This guarantees that the sampled edges form a connected graph, which may help deeper GNNs that require information from more than one hop. | def sample_edge_neighborhood(adj_list, degrees, n_triplets, sample_size):
edges = np.zeros((sample_size), dtype=np.int32)
# initialize
sample_counts = np.array([d for d in degrees])
picked = np.array([False for _ in range(n_triplets)])
seen = np.array([False for _ in degrees])
for i in range(0... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sample_neighbors(\n g,\n nodes,\n fanout,\n edge_dir=\"in\",\n prob=None,\n replace=False,\n copy_ndata=True,\n copy_edata=True,\n _dist_training=False,\n exclude_edges=None,\n output_device=None,\n):\n if F.device_type(g.device) == \"cpu\" and not g.is_pinned():\n fr... | [
"0.5796927",
"0.57868963",
"0.57758987",
"0.5601291",
"0.55590326",
"0.5493416",
"0.54577",
"0.5424778",
"0.5370916",
"0.53007144",
"0.5299243",
"0.52796453",
"0.52744436",
"0.5263502",
"0.5234428",
"0.52341163",
"0.5229058",
"0.5175482",
"0.51512736",
"0.51459754",
"0.514596... | 0.6470574 | 0 |
Sample edges uniformly from all the edges. | def sample_edge_uniform(adj_list, degrees, n_triplets, sample_size):
all_edges = np.arange(n_triplets)
return np.random.choice(all_edges, sample_size, replace=False) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sample_edges(probs):\n n = len(probs)\n probs = _dist.squareform(probs, force='tovector', checks=False)\n coins = _np.random.sample(probs.shape)\n edges = coins <= probs\n edges = _dist.squareform(edges)\n edges[_np.diag_indices_from(edges)] = 0\n return edges.astype(int)",
"def shuffle(... | [
"0.73400486",
"0.64975595",
"0.63422906",
"0.6237815",
"0.62231123",
"0.6203395",
"0.61399335",
"0.6107857",
"0.5997744",
"0.5933369",
"0.59189117",
"0.5918462",
"0.58827114",
"0.5878863",
"0.586862",
"0.5808916",
"0.5751268",
"0.5744433",
"0.57257783",
"0.56760824",
"0.56663... | 0.7437286 | 0 |
Compute the log(sum(exp(x), dim)) in a numerically stable manner | def log_sum_exp(x, dim=0):
max_x = torch.max(x, dim)[0]
new_x = x - max_x.unsqueeze(dim).expand_as(x)
return max_x + (new_x.exp().sum(dim)).log() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def log_sum_exp(x):\n # TF ordering\n axis = len(x.shape) - 1\n m = paddle.max(x, axis=axis)\n m2 = paddle.max(x, axis=axis, keepdim=True)\n return m + paddle.log(paddle.sum(paddle.exp(x - m2), axis=axis))",
"def log_sum_exp(x):\n x_max = x.max()\n return torch.log(torch.sum(torch.exp(x - x_... | [
"0.8737637",
"0.8632534",
"0.85753256",
"0.85753256",
"0.8486226",
"0.8419485",
"0.83770806",
"0.8366393",
"0.836031",
"0.82517153",
"0.8069758",
"0.80121034",
"0.7989599",
"0.78910834",
"0.7879209",
"0.78198904",
"0.7758573",
"0.7745692",
"0.7745692",
"0.7743928",
"0.7681906... | 0.864414 | 1 |
Compute the log(mean(exp(x), dim)) in a numerically stable manner | def log_mean_exp(x, dim):
return log_sum_exp(x, dim) - np.log(x.size(dim)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def log_mean_exp(y):\n # init\n batch_size = y.size(0)\n sample_size = y.size(1)\n\n # log_mean_exp\n max_sample = torch.max(y, dim=1)[0]\n reshaped_max_sample = max_sample.view(batch_size, -1)\n log_mean_exp = torch.log(torch.mean(torch.exp(y - reshaped_max_sample), dim=1)) + max_sample\n ... | [
"0.8120643",
"0.807634",
"0.79836255",
"0.7971374",
"0.7971374",
"0.7897602",
"0.7857478",
"0.78487056",
"0.7808672",
"0.78054875",
"0.7617721",
"0.75351834",
"0.7526225",
"0.7488208",
"0.7466935",
"0.7418741",
"0.73794657",
"0.7338103",
"0.7338103",
"0.72932273",
"0.7258506"... | 0.89213103 | 0 |
Opens pledge.txt and converts to a list, each item is a word in the order it appears in the original file. returns the list. | def get_pledge_list():
with open('pledge.txt',"r") as handler:
pledge_list = handler.read().split()
return pledge_list | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_pledge_list():\n with open('pledge.txt') as f:\n pledge_list = f.read().split()\n\n #Eliminate punctuation from the end of words\n pledge_list_noPunct = [word if word[-1] in ascii_letters else word[:-1] for word in pledge_list]\n\n return pledge_list_noPunct",
"def get_word_lis... | [
"0.7856784",
"0.7260817",
"0.69512784",
"0.67902046",
"0.676131",
"0.6758653",
"0.6588355",
"0.6552462",
"0.6476962",
"0.64757603",
"0.64286673",
"0.64114463",
"0.6410067",
"0.6401976",
"0.6382446",
"0.63777256",
"0.635458",
"0.6310156",
"0.6306098",
"0.62992245",
"0.62782604... | 0.80675536 | 0 |
build a queue from the content of a string | def build_string_queue(string: str) -> Queue:
ret = Queue()
i = 0
for idx, ch in enumerate(reversed(string)):
ret.push(ch)
i += 1
if i % 3 == 0:
if len(string) - 1 - idx == 0:
continue
ret.push(",")
i = 0
return ret | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def instantiate_queue(self):\n serialized_queue = self.cache.get('queue')\n queue = ast.literal_eval(serialized_queue.decode('utf-8'))\n return queue",
"def extract_string_from_queue(queue: Queue) -> str:\n ret = StringBuilder(\"\")\n while not queue.empty():\n ret += queue.peek... | [
"0.6451194",
"0.627558",
"0.6136702",
"0.6056667",
"0.5913625",
"0.5668414",
"0.56162924",
"0.56116295",
"0.560234",
"0.5532819",
"0.5528084",
"0.5510189",
"0.54442525",
"0.5424159",
"0.5416795",
"0.5393007",
"0.5389321",
"0.5389321",
"0.5389321",
"0.5389321",
"0.537141",
"... | 0.7750332 | 0 |
Return ``True`` if the given value can be converted into the target type T, ``False`` otherwise. | def accepts(cls, value: Any) -> bool:
try:
cls.convert(value)
return True
except ValueError:
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _can_cast_to(self, value, cast_type):\n try:\n _ = cast_type(value)\n return True\n except ValueError:\n return False",
"def _check_value_type(self, value):\n if value is not None and self.value_type is not None:\n valid = isinstance(value, self.value_type)\n ... | [
"0.757522",
"0.6580984",
"0.65423495",
"0.65152246",
"0.6495233",
"0.64682686",
"0.6454903",
"0.6143859",
"0.5972706",
"0.58623713",
"0.57964987",
"0.5773074",
"0.5762597",
"0.5724451",
"0.5719068",
"0.571412",
"0.5702632",
"0.5701279",
"0.56835765",
"0.56786984",
"0.5678313"... | 0.7657965 | 0 |
Convert the given optional source value of type T into a string. | def format(cls, value: Optional[T]) -> str:
return str(value) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def string(self, value):\n # respect {None}\n if value is None:\n # by leaving it alone\n return None\n # my value knows\n return str(value)",
"def to_string(value: Any) -> str:\n return StringConverter.to_string_with_default(value, '')",
"def make_strin... | [
"0.673568",
"0.66666853",
"0.6416762",
"0.6343266",
"0.6272284",
"0.61784476",
"0.61568743",
"0.6065792",
"0.6059015",
"0.60131145",
"0.5952933",
"0.5948245",
"0.5822248",
"0.57798487",
"0.5771554",
"0.5764329",
"0.5728926",
"0.5702374",
"0.56868845",
"0.56770915",
"0.5656058... | 0.721353 | 0 |
Deserialize the given JSON value into a value of target type T. | def from_json(cls, value: Any) -> Optional[T]:
return cls.convert(value) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def decode_typed_json(json_value: str) -> tp.Any:\n def type_check(dct: tp.Dict[tp.Any, tp.Any]) -> tp.Any:\n val: tp.Any = dct.get(\"__custom_key_type__\")\n if val is not None:\n dct.pop(\"__custom_key_type__\")\n if val == \"int\":\n dct = {int(key): val for... | [
"0.6918004",
"0.6709094",
"0.66292405",
"0.6623994",
"0.66079015",
"0.6601179",
"0.6598827",
"0.6563815",
"0.6557816",
"0.655484",
"0.64939713",
"0.6426596",
"0.6417449",
"0.64030993",
"0.6351258",
"0.62919825",
"0.6276884",
"0.62765706",
"0.62647086",
"0.62563",
"0.6241945",... | 0.80409926 | 0 |
Serialize the given value of type T into a JSON value. | def to_json(cls, value: Optional[T]) -> Any:
return cls.format(value) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def json_serialize(value):\n if value is None or isinstance(value, (int, long, float, basestring, bool)):\n return value\n elif isinstance(value, (list, tuple, set)):\n return [json_serialize(v) for v in value]\n elif isinstance(value, dict):\n for k, v in value.items():\n ... | [
"0.7203046",
"0.69475234",
"0.6928027",
"0.6839082",
"0.68019545",
"0.6800521",
"0.67654306",
"0.6765192",
"0.65758896",
"0.65730053",
"0.65374374",
"0.6531739",
"0.64562494",
"0.64136684",
"0.6373712",
"0.6369193",
"0.6334914",
"0.6321473",
"0.62963283",
"0.6292491",
"0.6261... | 0.76362026 | 0 |
Convert the given value to a list of variable name patterns. | def convert(cls, value: Any) -> Optional[VarNames]:
# Can be optional
if value is None:
return None
if isinstance(value, str):
return to_list(value)
if not isinstance(value, list):
raise ValueError('Variable name pattern can only be a string or a'
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_name_list(msh, varname):\n return [str(chartostring(v)) for v in msh.variables[varname]]",
"def variable_parser(var_list, prefix):\r\n ret_list = []\r\n for var in var_list:\r\n varname = var.name\r\n varprefix = varname.split('/')[0]\r\n if varprefix == prefix:\r\n ret_list.append(var... | [
"0.60307586",
"0.6016824",
"0.5976056",
"0.5717711",
"0.5678098",
"0.5635771",
"0.5606402",
"0.55246556",
"0.5390427",
"0.53806514",
"0.528457",
"0.52564764",
"0.5253537",
"0.5233108",
"0.52266645",
"0.52171093",
"0.5173055",
"0.506539",
"0.5055579",
"0.5054486",
"0.50240403"... | 0.713611 | 0 |
Create a fake, randomised transaction. | def create_random_transaction() -> dict:
cust_dtls = _get_cust_dtls()
source_cust = _random_customer(cust_dtls)
print(f"Source Customer: {source_cust}")
print(f"Source Customer Type: {type(source_cust)}")
rand_amt = _random_amount(int(source_cust[1]))
print(f"Random Amt: {type(rand_amt)}")
t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_fake_transaction_data(date=None,\n transaction_type=None,\n transaction_type_raw=None,\n spent_currency=None,\n spent_amount=None,\n source_peer=None,\n ... | [
"0.684953",
"0.65359026",
"0.6401605",
"0.6385741",
"0.63214934",
"0.6292699",
"0.62541234",
"0.62423116",
"0.6181607",
"0.61680144",
"0.61567515",
"0.6142957",
"0.61186516",
"0.6095692",
"0.6069462",
"0.60566556",
"0.60497975",
"0.6026385",
"0.6026385",
"0.59540504",
"0.5953... | 0.6779719 | 1 |
Returns a file from the media directory | def media(filename):
media_path = flask.current_app.instance_path + '/media'
return flask.send_from_directory(media_path, filename) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def media(self, path):\n path = \"/media/%s%s\" % (self.session.root, format_path(path))\n\n url, params, headers = self.request(path, method='GET')\n\n return self.rest_client.GET(url, headers)",
"def get_media_directory():\n\treturn _paths[_MEDIA_DIRECTORY_KEY]",
"def get_media(self, url... | [
"0.7082274",
"0.7039301",
"0.6822227",
"0.6779399",
"0.66947216",
"0.66181415",
"0.6583108",
"0.64687455",
"0.6432569",
"0.64167213",
"0.6390002",
"0.63835955",
"0.6337327",
"0.63260484",
"0.6296481",
"0.6278703",
"0.6259783",
"0.624752",
"0.6230333",
"0.621626",
"0.62146103"... | 0.7416882 | 0 |
Displays the data entry form. The data entry form uses the config.database.fields to show the entries | def form():
with Config() as config:
F = create_form_type(config.database.fields)
f: flask_wtf.FlaskForm = F()
if f.validate_on_submit():
with db.Connection(config) as con:
con.write_entry(**f.data)
return flask.redirect(flask.url_for('ui.map'))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def displayInput(self):\n\n ## Before changes are committed the user can see all changes made\n print(\"\\nCurrent Record:\\n===============\\nName: \" + self.first_name.title() + \" \" + self.last_name.title() + \"\\nCompany: \" + self.company_name.title() + \"\\nAddress: \" + self.address.title() +... | [
"0.6211128",
"0.620501",
"0.60293615",
"0.5927361",
"0.5901993",
"0.5854246",
"0.5823437",
"0.579463",
"0.57934755",
"0.5750943",
"0.57090324",
"0.5685355",
"0.56320524",
"0.5600682",
"0.5581603",
"0.55799305",
"0.5579296",
"0.55479354",
"0.5541722",
"0.5541722",
"0.55411255"... | 0.6482582 | 0 |
Returns all sites as geojson objects | def sites_geojson():
with Config() as config:
with db.Connection(config) as con:
features = con.features()
features = list(features)
return flask.jsonify(features) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gmaps_sites(request):\n sites = nc.get_nodes_by_type(nc.graphdb.manager, 'Site')\n site_list = []\n for site in sites:\n try:\n site = {\n 'name': site['name'],\n 'url': helpers.get_node_url(site['handle_id']),\n 'lng': float(str(site.get(... | [
"0.72224677",
"0.65186965",
"0.6432505",
"0.6424302",
"0.6275285",
"0.6248475",
"0.621506",
"0.61669296",
"0.6118034",
"0.6114593",
"0.6113359",
"0.6107469",
"0.60085535",
"0.5961256",
"0.5926796",
"0.59059906",
"0.59059703",
"0.5886024",
"0.58742326",
"0.5832067",
"0.5799145... | 0.7438331 | 0 |
Subscribe a new callable observer Defaults to appending at the end of the queue. | def subscribe(self, func, insert=False):
if insert:
self.observers.appendleft(func)
else:
self.observers.append(func) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subscribe():\n def func_wrapper(func):\n queue.observe_on(scheduler).subscribe(func)\n return func\n return func_wrapper",
"def subscribe(observer):",
"def subscribe(observer):",
"def subscribe(self, observer):\n if observer not in self._observers:\n self._observers.... | [
"0.6897234",
"0.67936146",
"0.67936146",
"0.6757661",
"0.669204",
"0.6525059",
"0.64331925",
"0.63760674",
"0.6151612",
"0.6115292",
"0.60303295",
"0.6023766",
"0.6023766",
"0.6023766",
"0.60093874",
"0.59534097",
"0.5944537",
"0.5918193",
"0.59172744",
"0.5905332",
"0.586196... | 0.74423504 | 0 |
Notify observers Calls observers and passes underlying object as argument | def notify(self):
for observer in self.observers:
observer(self.obj) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def notifyObservers(self):",
"def notify(self, arg=None):\n for observer in self._observers:\n observer.notify(arg)",
"def notify(self, observable, *args, **kwargs) -> None:",
"def notify(self, event):\n for o in self.observers:\n o.on_notify(event)",
"def _notify(self, ... | [
"0.77601534",
"0.76573575",
"0.74955195",
"0.7206361",
"0.7107865",
"0.70441115",
"0.70413786",
"0.6960351",
"0.6960351",
"0.6725351",
"0.6694429",
"0.66548383",
"0.66286397",
"0.657247",
"0.657247",
"0.6487004",
"0.6372589",
"0.62651974",
"0.6244569",
"0.62441695",
"0.623384... | 0.79741853 | 0 |
Find all numbers between start and stop which sum of squares of divisors is a square | def list_squared(start, stop):
result = []
for num in range(start, stop):
divisors = set(chain.from_iterable((
[i, num/i] for i in range(1, int(math.sqrt(num)) + 1)
if num % i == 0
)))
divisor_squares = [x*x for x in divisors]
divisor_squares_sum = sum(di... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_squares(self):\n\t\tself.squares = [x for x in range(self.low, self.high + 1) if sqrt(x) == int(sqrt(x))]",
"def squares(s):\n\n \"*** YOUR CODE HERE ***\"\n return [int(x**(1/2)) for x in s if x**(1/2) == round(x**(1/2))]",
"def squares(s):\n \"*** YOUR CODE HERE ***\"\n result = []\n ... | [
"0.72973394",
"0.6704841",
"0.66218007",
"0.6563445",
"0.65047306",
"0.6458653",
"0.6452756",
"0.6444918",
"0.6398149",
"0.6331602",
"0.63223386",
"0.6317814",
"0.6301305",
"0.628313",
"0.62282014",
"0.621746",
"0.62029743",
"0.61973894",
"0.61680746",
"0.61661094",
"0.613076... | 0.7754704 | 0 |
filter points based on h,v FOV | def fov_setting(points, x, y, z, dist, h_fov, v_fov):
if h_fov[1] == 180 and h_fov[0] == -180 and v_fov[1] == 2.0 and v_fov[0] == -24.9:
return points
if h_fov[1] == 180 and h_fov[0] == -180:
return points[in_v_range_points(dist, z, v_fov)]
elif v_fov[1] == 2.0 and v_fov[0] == -24.9:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def points_basic_filter(self, points):\n assert points.shape[1] == 3, points.shape # [N,3]\n x, y, z = points[:, 0], points[:, 1], points[:, 2]\n d = np.sqrt(x ** 2 + y ** 2 + z ** 2) # this is much faster than d = np.sqrt(np.power(points,2).sum(1))\n\n # extract in-range fov points\n ... | [
"0.65984607",
"0.6208342",
"0.6165863",
"0.5866134",
"0.5835562",
"0.5815956",
"0.5768847",
"0.5681219",
"0.56345403",
"0.55471087",
"0.5536232",
"0.54909563",
"0.548782",
"0.5474398",
"0.5388312",
"0.53781426",
"0.53769773",
"0.53252023",
"0.53172106",
"0.5313038",
"0.530234... | 0.7127581 | 0 |
Write array to raster on window | def write_window(img, ds, window):
new_img = np.array([img[:, :, i] for i in range(img.shape[2])])
ds.write(new_img, window=window) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def export_array(in_array, output_path):\n global proj, geotrans, row, col\n proj = band.GetProjection()\n geotrans = band.GetGeoTransform()\n row = band.RasterYSize\n col = band.RasterXSize\n driver = gdal.GetDriverByName(\"GTiff\")\n outdata = driver.Create(output_path, col,... | [
"0.6169919",
"0.6090882",
"0.60301495",
"0.5983952",
"0.5915765",
"0.5887552",
"0.58112264",
"0.57149637",
"0.5649522",
"0.5638501",
"0.5624661",
"0.5617981",
"0.5606588",
"0.5598558",
"0.5598548",
"0.55978644",
"0.5560823",
"0.55517834",
"0.5526472",
"0.54885113",
"0.5472305... | 0.66258705 | 0 |
Match histograms of an image using another one as reference | def match_histograms(src_path, dst_path, size=128, step_size=128, *, reference_path):
with rasterio.open(src_path) as src:
profile = src.profile.copy()
windows = list(
sliding_windows(
(size, size), (step_size, step_size), src.width, src.height, whole=False
)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cs4243_histmatch(ori_image, refer_image):\n \n ##your code here ###\n\n # get cdf of ori and ref image\n grey_level = 256\n ori_hist, ori_cum_hist, ori_res_image, ori_uni_hist = cs4243_histequ(ori_image, grey_level)\n ref_hist, ref_cum_hist, ref_res_image, ref_uni_hist = cs4243_histequ(refer_... | [
"0.758653",
"0.6996292",
"0.69163746",
"0.68769395",
"0.68026936",
"0.6782051",
"0.67681533",
"0.6748748",
"0.6712102",
"0.66739404",
"0.6607414",
"0.660288",
"0.6596795",
"0.6563109",
"0.6556718",
"0.65373516",
"0.65214133",
"0.65180826",
"0.6460384",
"0.64298314",
"0.640824... | 0.70199376 | 1 |
ap = voc_ap(rec, prec, [use_07_metric]) Compute VOC AP given precision and recall. If use_07_metric is true, uses the | def voc_ap(rec, prec, use_07_metric=False):
# print('voc_ap() - use_07_metric:=' + str(use_07_metric))
if use_07_metric:
# 11 point metric
ap = 0.
for t in np.arange(0., 1.1, 0.1):
if np.sum(rec >= t) == 0:
p = 0
else:
p = np.max(pr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def voc_ap(rec, prec, use_07_metric=False):\r\n if use_07_metric:\r\n # 11 point metric\r\n ap = 0.\r\n for t in np.arange(0., 1.1, 0.1):\r\n if np.sum(rec >= t) == 0:\r\n p = 0\r\n else:\r\n p = np.max(prec[rec >= t])\r\n ap = ap + p / 11.\r\n else:\r\n # correct AP calc... | [
"0.8903165",
"0.88715625",
"0.88673437",
"0.88570327",
"0.8561422",
"0.84179753",
"0.7944763",
"0.7526416",
"0.71714365",
"0.7015985",
"0.7013666",
"0.7002134",
"0.6999062",
"0.6999062",
"0.6833704",
"0.6457287",
"0.63985777",
"0.6324673",
"0.5971732",
"0.5847991",
"0.5787536... | 0.8998729 | 0 |
U = user variables I = initial intepretation bij/trans/clues = subset of user variables w/ specific cost. | def cost_puzzle(U, I, cost_clue):
litsU = set(abs(l) for l in U) | set(-abs(l) for l in U)
assert all(i in U or -i in U for i in I), "Making sure all literals are in user defined variables"
def cost_lit(lit):
if lit not in litsU:
raise CostFunctionError(U, lit)
elif lit in cost_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cost_function(self, u):\n # enforce that the input is a numpy array\n u = np.asarray(u)\n\n # Reshape the control input to (mxT). Vector input is required for some optimization libraries\n T = int(len(u)/2)\n u = u.reshape((2,T))\n\n J = - self.rho(u)\n\n return... | [
"0.606873",
"0.57958084",
"0.57844496",
"0.5744703",
"0.57204044",
"0.57078105",
"0.56329995",
"0.56325763",
"0.5573972",
"0.55207825",
"0.5512119",
"0.54992336",
"0.5494747",
"0.54839796",
"0.546734",
"0.54461044",
"0.5428345",
"0.54275733",
"0.54147416",
"0.53504807",
"0.53... | 0.6218578 | 0 |
Create the _version.py file with __version__ declared | def create_version_file(version='unknown', gitmeta=''):
fname = join(dirname(abspath(__file__)), 'MHLogin', '_version.py')
f = open(fname, 'wb')
f.write(VERSION_PY % {'version': version, 'gitmeta': gitmeta, })
f.close() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _save_version_file(cls, hivemind_version, git_revision, git_date):\n with open(\"hive/version.py\", 'w') as version_file:\n version_file.write(\"# generated by setup.py\\n\")\n version_file.write(\"# contents will be overwritten\\n\")\n version_file.write(\"VERSION = '{}... | [
"0.76683813",
"0.7303086",
"0.7303086",
"0.72702074",
"0.72198075",
"0.71000963",
"0.7061401",
"0.7059151",
"0.7012229",
"0.69742644",
"0.6929797",
"0.6849979",
"0.6843362",
"0.6807946",
"0.67796063",
"0.67722434",
"0.6718198",
"0.6711972",
"0.66860586",
"0.66787803",
"0.6664... | 0.79093987 | 0 |
Process git tag and return cleaned version, gitmeta | def process_git_tag(regex, inputtag):
try:
gitre = re.compile(regex)
match = gitre.search(inputtag)
groups = match.groupdict()
version = groups.get('version', '.unknown')
date = groups.get('date', '')
gitmeta = groups.get('gitmeta', '')
if date:
version = '.'.join([version, ''.join(date.split('-'))])... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_version_from_git(opts):\n\tstdout = opts.tag or Popen(gitargs, stdout=PIPE).communicate()[0].rstrip('\\n')\n\n\tversion, gitmeta = process_git_tag(opts.regex, stdout)\n\n\treturn version, gitmeta",
"def get_ver():\n import subprocess\n\n proc = subprocess.run(\n [\"git\", \"describe\"], stdo... | [
"0.7472493",
"0.6702657",
"0.6570797",
"0.6358735",
"0.63545257",
"0.6348913",
"0.6303235",
"0.6299952",
"0.6296468",
"0.62874204",
"0.626695",
"0.624566",
"0.6193887",
"0.61351204",
"0.6063291",
"0.6030149",
"0.58693385",
"0.58551174",
"0.58497804",
"0.5829347",
"0.58044225"... | 0.8154936 | 0 |
Returns the address this sources field refers to (used by some derived classses) | def address(self):
return self._ref_address | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def src(self) -> 'Data_Address':\n return Data_Address(self._info.sha, self._info.spa)",
"def getAddressSourceInfo(self, address: ghidra.program.model.address.Address) -> ghidra.program.database.mem.AddressSourceInfo:\n ...",
"def _get_address(self):\n return self.__address",
"def Address(se... | [
"0.64388365",
"0.6423206",
"0.640764",
"0.6358693",
"0.6332778",
"0.62338066",
"0.616614",
"0.6051878",
"0.60261065",
"0.6021217",
"0.60093147",
"0.5997753",
"0.5984553",
"0.59731644",
"0.596247",
"0.596221",
"0.596221",
"0.59273225",
"0.59273225",
"0.59273225",
"0.59273225",... | 0.68966264 | 0 |
For tasks that require chunking, this is the number of chunk units this field represents. By default, this is just the number of sources. Other heuristics might consider the number of bytes or lines in the combined source files. | def num_chunking_units(self):
if self._source_paths:
return len(self._source_paths)
return 1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_num_chunks(self) -> int:",
"def total_chunks(self) -> global___Expression:",
"def __len__(self):\n return self._num_samples_per_file * len(self._files) // self._world_size",
"def chunk_size(self) -> global___Expression:",
"def number_of_batches(self):\n return int(np.floor(len(self.file_p... | [
"0.7258694",
"0.68500423",
"0.6638917",
"0.66196454",
"0.6247718",
"0.6238255",
"0.61370933",
"0.6122308",
"0.6098279",
"0.60685116",
"0.6066673",
"0.60026807",
"0.59894174",
"0.59763205",
"0.5956303",
"0.5952481",
"0.59385705",
"0.5935836",
"0.59268993",
"0.5920993",
"0.5910... | 0.84120846 | 0 |
All sources joined with ``self.rel_path``. | def relative_to_buildroot(self):
return [os.path.join(self.rel_path, source) for source in self.source_paths] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sources_absolute_paths(self):\r\n abs_target_base = os.path.join(get_buildroot(), self.target_base)\r\n for src in self.sources:\r\n yield os.path.join(abs_target_base, src)",
"def sources(self):\n return self._sources",
"def sources_relative_to_buildroot(self):\r\n for src in self.sou... | [
"0.6916912",
"0.6839604",
"0.67698145",
"0.6714724",
"0.66342765",
"0.65904397",
"0.6588623",
"0.65738827",
"0.6571272",
"0.64069533",
"0.62800133",
"0.62268984",
"0.61915344",
"0.6183212",
"0.61215514",
"0.6107943",
"0.60908014",
"0.60908014",
"0.60869944",
"0.6063127",
"0.6... | 0.6932989 | 0 |
A subclass must provide an implementation of _compute_fingerprint that can return a valid fingerprint even if the sources aren't unpacked yet. | def _compute_fingerprint(self):
if not self._populated:
raise self.NotPopulatedError()
return super(DeferredSourcesField, self)._compute_fingerprint() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fingerprint(self, algorithm):",
"def _fingerprint(self):\n hasher = hashlib.md5()\n source = inspect.getsource(self._func)\n hasher.update(source.encode('utf-8'))\n\n return hasher.hexdigest()",
"def compute_fingerprint(self):\n\t\t# initialize tensorflow session\n\t\tsess = tf.... | [
"0.6652865",
"0.63300306",
"0.6176648",
"0.60133046",
"0.58862156",
"0.5847165",
"0.56861335",
"0.56062365",
"0.56042504",
"0.5528631",
"0.5425086",
"0.54230994",
"0.53990144",
"0.5344105",
"0.53254896",
"0.5298037",
"0.5292873",
"0.52730966",
"0.52552164",
"0.52372557",
"0.5... | 0.7655897 | 0 |
Get tradingview economic calendar | def get_tradingview_ecocal(width, height, show_copyright):
return_data = ''
theme = get_sa_theme()
tradingview_copyright = ''
if str(width) == '0':
width = '"100%"'
if str(height) == '0':
height = '"100%"'
if str(show_copyright) == '1':
tradingview_copyright = ''+\
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _trading_calendar(bundle=DEFAULT_BUNDLE):\n bundle_data = bundles.load(bundle)\n return bundle_data.equity_daily_bar_reader.trading_calendar",
"def getCalendar(self):\n return aq_parent(aq_inner(self))",
"def calendar_for_event_description(ed):\n return icemac.ab.calendar.interfaces.ICalend... | [
"0.72212064",
"0.63345045",
"0.6243876",
"0.6185566",
"0.61311287",
"0.6019469",
"0.60111356",
"0.59343964",
"0.5913226",
"0.5897882",
"0.5870405",
"0.58306146",
"0.58306146",
"0.5771214",
"0.5728142",
"0.56678045",
"0.565062",
"0.565062",
"0.5634609",
"0.56311834",
"0.561672... | 0.72937256 | 0 |
Checks existence and reads the source id from the source file in the path directory | def is_source_created(path, suffix=""):
source_id = None
try:
with open("%s%ssource%s" % (path, os.sep, suffix)) as source_file:
source_id = source_file.readline().strip()
try:
source_id = bigml.api.get_source_id(source_id)
return True, source_id
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _read_sourced_path(self, line):\n # type: (str)->tp.Optional[str]\n if line.startswith('source '):\n sline = [x.strip() for x in line.split()]\n sline.pop(0)\n path = ' '.join(sline)\n if not os.path.isabs(path):\n current_root = self._ro... | [
"0.6384938",
"0.63135606",
"0.6144532",
"0.6133886",
"0.61129606",
"0.60700506",
"0.6031397",
"0.6027285",
"0.59995455",
"0.5951139",
"0.5888599",
"0.5857367",
"0.5838262",
"0.5835156",
"0.580514",
"0.5794617",
"0.5785461",
"0.57822883",
"0.57775164",
"0.5767401",
"0.5745721"... | 0.67552423 | 0 |
Checks existence and reads the dataset id from the dataset file in the path directory | def is_dataset_created(path, suffix=""):
dataset_id = None
try:
with open("%s%sdataset%s" % (path, os.sep, suffix)) as dataset_file:
dataset_id = dataset_file.readline().strip()
try:
dataset_id = bigml.api.get_dataset_id(dataset_id)
return True, da... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_existing_dataset(path: str):\n x_path = os.path.join(path, IMG_DIR)\n y_path = os.path.join(path, MSK_DIR)\n\n if os.path.isdir(x_path) and os.path.isdir(y_path):\n _, _, x_files = next(os.walk(x_path))\n _, _, y_files = next(os.walk(y_path))\n x = len(x_files)\n y = ... | [
"0.66187066",
"0.6478126",
"0.6401326",
"0.638078",
"0.63305753",
"0.63129246",
"0.62441784",
"0.6169872",
"0.6161744",
"0.61127746",
"0.6069349",
"0.6016886",
"0.60165423",
"0.5962095",
"0.59497964",
"0.5947771",
"0.59452504",
"0.5945126",
"0.5938802",
"0.59289765",
"0.59091... | 0.69702667 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.