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 |
|---|---|---|---|---|---|---|
Time and Sales (timesales) is typically used for charting purposes. It captures pricing across a time slice at predefined intervals. Tick data is also available through this endpoint. This results in a very large data set for highvolume symbols, so the time slice needs to be much smaller to keep downloads time reasonab... | def get_time_and_sales(
self,
symbol: str,
interval: str = None,
start: date = None,
end: date = None,
session_filter: str = None,
) -> List[TimesalesData]:
url = "/v1/markets/timesales"
params = {
"symbol": symbol,
"interval": ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def time_series(self, **kwargs) -> \"TimeSeriesList\":\n return self._cognite_client.time_series.list(asset_ids=[self.id], **kwargs)",
"def TimeSeries(*args, **kwargs):\n if args or kwargs:\n underride(kwargs, dtype=float)\n series = pd.Series(*args, **kwargs)\n else:\n series =... | [
"0.5807932",
"0.5797269",
"0.5753054",
"0.5739826",
"0.5684772",
"0.5665279",
"0.5652751",
"0.5614185",
"0.5612198",
"0.5609425",
"0.5589688",
"0.54824275",
"0.54701644",
"0.5460368",
"0.5451779",
"0.545142",
"0.5396125",
"0.5374036",
"0.5369084",
"0.5363802",
"0.53624034",
... | 0.69572663 | 0 |
The ETB list contains securities that are able to be sold short with a Tradier Brokerage account. The list is quite comprehensive and can result in a long download response time. | def get_etb_list(self) -> List[Security]:
url = "/v1/markets/etb"
data = self.get(url, {})
res = MarketsAPIResponse(**data)
return res.securities.security | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_trades(exer_date):\n exer_date = ael.date(str(exer_date))\n exer_trades = []\n all_trades = ael.Trade.select()\n for t in all_trades:\n if t.time > 0 and ael.date_from_time(t.time) == exer_date:\n if (t.type in ('Exercise', 'Assign') and\n t.insaddr.instype ... | [
"0.54185027",
"0.5409205",
"0.53413796",
"0.53011405",
"0.5201379",
"0.5191846",
"0.51729816",
"0.51596797",
"0.51294446",
"0.5049577",
"0.50341195",
"0.50038606",
"0.49721926",
"0.4963339",
"0.49559736",
"0.4936452",
"0.48996666",
"0.48804897",
"0.48687986",
"0.48561192",
"0... | 0.6414284 | 0 |
Get the market calendar for the current or given month. This can be used to plan ahead regarding strategies. However, the Get Intraday Status should be used to determine the current status of the market. | def get_calendar(self, month: int = None, year: int = None) -> List[Hours]:
url = "/v1/markets/calendar"
params = {"month": month, "year": year}
data = self.get(url, params)
res = MarketsAPIResponse(**data)
return res.calendar.days.day | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show_cal(request, year=None, month=None):\n if year == None:\n # get the current comic as a starting point\n lToday = Comic.objects.filter(published=True).order_by('-date')[0].date\n year = lToday.year\n month = lToday.month\n\n return calendar(request, year, month)",
"def _... | [
"0.6231964",
"0.58270496",
"0.5682296",
"0.55288494",
"0.55109036",
"0.54254043",
"0.53313065",
"0.5323233",
"0.53189135",
"0.53189135",
"0.53159016",
"0.526393",
"0.526393",
"0.5250265",
"0.52264535",
"0.52133083",
"0.5213269",
"0.52114356",
"0.5211283",
"0.5167239",
"0.5161... | 0.63648134 | 0 |
Function creates a scatter plot via the values place in linespace() | def make_scatter():
x = np.linspace(4, 8, 6)
y = np.sin(x)
plt.plot(x, y, 'o', color='black');
plt.show() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def coords_plot(self):\n self.load_coords()\n x = []\n y = []\n px = [] \n for item in self.coords:\n if item[1] >52.10 and item[1] <52.4 and item[2]>20.8 and item [2] <21.4:\n x.append(item[1])\n y.append(item[2])\n ... | [
"0.6838802",
"0.68265283",
"0.68261343",
"0.6815635",
"0.6791185",
"0.6754904",
"0.6642359",
"0.66342926",
"0.66077435",
"0.6585656",
"0.6562111",
"0.6537003",
"0.63818043",
"0.6372816",
"0.635367",
"0.63518655",
"0.63253367",
"0.63246024",
"0.6259631",
"0.6219022",
"0.620030... | 0.68942404 | 0 |
Convert a floating point state into a numpy array in format ready to pass to a NN. | def state_as_x(cls,
state: float) -> np.array:
xs = np.array([state])
return xs.reshape([1, xs.shape[0]]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def decode_state(buffer: Any) -> np.ndarray:\n state_flat = np.frombuffer(buffer, dtype=np.float32)\n assert state_flat.size == STATE_SIZE\n return state_flat",
"def process_state(self, state):\n return torch.tensor(state, dtype=torch.float, device=self.device)",
"def convertToFloatArray(boolea... | [
"0.6866928",
"0.66086614",
"0.61911845",
"0.61669564",
"0.6079869",
"0.6074639",
"0.6044245",
"0.60306215",
"0.6001148",
"0.58469874",
"0.57996607",
"0.5780742",
"0.57374096",
"0.571943",
"0.57066727",
"0.57058287",
"0.5687106",
"0.5680834",
"0.5677483",
"0.5665326",
"0.56626... | 0.7416551 | 0 |
The dimensions of the state space | def state_space_dimension(cls) -> int:
return 1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_state_sizes(self):\n ds = self.builder.nodes[self.ds_inputs[0]]\n return [[ds.xdim]]",
"def state_size(self):\n return [tf.TensorShape([self.dmodel]),tf.TensorShape([self.dmodel]),tf.TensorShape([self.dmodel])]",
"def dimensions():",
"def getStatesDim(self):\n return 2",
"def s... | [
"0.8423389",
"0.82284695",
"0.79854786",
"0.79771006",
"0.79737556",
"0.7876916",
"0.7775952",
"0.7669488",
"0.75545925",
"0.75545925",
"0.75523424",
"0.75457513",
"0.75332695",
"0.75037086",
"0.75029606",
"0.7493004",
"0.7490185",
"0.7488054",
"0.7459124",
"0.74562573",
"0.7... | 0.831058 | 1 |
The reward for transitioning to the given state | def reward(self,
state: float) -> float:
raise NotImplementedError | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reward(self):\n if self._state is None:\n return 0\n return self.reward_fn(self._state)",
"def get_reward(self, state, action, next_state, absorbing):\n raise NotImplementedError",
"def get_reward(self, state, action, next_state):\n assert action in self.get_possible_... | [
"0.8112991",
"0.7909676",
"0.78946626",
"0.77792746",
"0.7738385",
"0.7716818",
"0.7712142",
"0.7710507",
"0.770556",
"0.7682717",
"0.7676672",
"0.765781",
"0.76548517",
"0.76503605",
"0.7610591",
"0.7591277",
"0.75668514",
"0.7560238",
"0.7545207",
"0.75403035",
"0.7525456",... | 0.8516007 | 0 |
What is the minimum value of 1D state space | def state_min(self) -> float:
raise NotImplementedError | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_state_observed_min(self):\n minValues = numpy.zeros(self.get_num_variables())\n i = 0\n for v in self.variables:\n minValues[i] = v.get_min_value()\n i += 1\n return minValues",
"def call(self, state):\n x = tf.cast(state, tf.float32)\n x = self.fla... | [
"0.73479986",
"0.65477455",
"0.6533969",
"0.6530269",
"0.6501678",
"0.6498272",
"0.6472517",
"0.64713794",
"0.63939166",
"0.63618916",
"0.63535166",
"0.63425153",
"0.6335175",
"0.6334244",
"0.6330323",
"0.6319312",
"0.63006467",
"0.62639445",
"0.6220449",
"0.62189215",
"0.615... | 0.7984347 | 0 |
What is the maximum value of 1D state space | def state_max(self) -> float:
raise NotImplementedError | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def value(self, state):\n return np.amax(self.q_values(state))",
"def get_state_observed_max(self):\n maxValues = numpy.zeros(self.get_num_variables())\n i = 0\n for v in self.variables:\n maxValues[i] = v.get_max_value()\n i += 1\n return maxValues",
"d... | [
"0.7324334",
"0.7092528",
"0.669573",
"0.65897846",
"0.65406847",
"0.64511967",
"0.6447762",
"0.6444075",
"0.640259",
"0.6390478",
"0.6386007",
"0.63753605",
"0.6373763",
"0.6328871",
"0.63153136",
"0.63127965",
"0.6306555",
"0.63013524",
"0.62864304",
"0.6277458",
"0.626008"... | 0.80544597 | 0 |
What is the discrete step increment used to traverse state space (by actions) | def state_step(self) -> float:
raise NotImplementedError | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def step(self, state):",
"def _step(self, action):\n transitions = self.query_model(self.s, action)\n prob, next_s, r, is_terminal = transitions[categorical_sample(\n (t[0] for t in transitions), self.rng)]\n\n next_s = np.asarray(next_s)\n for i in range(len(self.s) - 1):\... | [
"0.7593283",
"0.71023536",
"0.70907927",
"0.7004125",
"0.69893974",
"0.6870397",
"0.6857954",
"0.68104935",
"0.680258",
"0.6797943",
"0.6785821",
"0.6779936",
"0.6757122",
"0.67495185",
"0.67359626",
"0.67331207",
"0.67309034",
"0.6729114",
"0.6711958",
"0.6710844",
"0.664173... | 0.7243996 | 1 |
Show a plot of the reward function between the max and min states | def plot(self) -> None:
if self.__fig is None:
self.__fig = plt.figure()
xv = []
yv = []
for x in np.arange(self.state_min(), self.state_max(), self.state_step()):
xv.append(x)
yv.append(self.reward(x))
ax = self.__fig.gca()
ax.set_xla... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plotLoss():\n # ssr\n ssr = np.log(gradientDescent(X, y)[1])\n # number of iterations \n iterations = np.log(np.arange(1, len(ssr) + 1, 1))\n # plot reduction of ssr\n plt.plot(iterations, ssr)\n # xlabel\n plt.xlabel(\"Iteration\")\n # ylabel\n plt.ylabel(\"SSR\")\n # title\n ... | [
"0.6332632",
"0.62936443",
"0.60674137",
"0.5987954",
"0.5964884",
"0.59578055",
"0.59397984",
"0.59135634",
"0.58494157",
"0.58303285",
"0.58127296",
"0.5777709",
"0.5774025",
"0.57603854",
"0.57592577",
"0.5744541",
"0.57239693",
"0.56788516",
"0.56570524",
"0.5655139",
"0.... | 0.6916599 | 0 |
Restore a model parameters from the given path | def restore_model(self, path):
# if cuda is not available load everything to cpu
if not self.use_cuda:
state = torch.load(path, map_location=lambda storage, loc: storage)
else:
state = torch.load(path)
self.net.load_state_dict(state['state_dict'])
self.opt... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _restore(self, a_path):\n super(RDPAnalyzer, self)._restore(a_path)\n self._model._restore()",
"def restore_model_params(self, in_dict):\n\n self.trained_model_params = in_dict['model_params']",
"def restore(self):\n if os.path.isfile( \\\n os.path.join(self.network_p... | [
"0.7280775",
"0.70463604",
"0.69179475",
"0.6853754",
"0.67630786",
"0.6755178",
"0.67294055",
"0.6723913",
"0.6720265",
"0.66519505",
"0.6644404",
"0.65408",
"0.6539188",
"0.6433369",
"0.6430186",
"0.63873863",
"0.6383961",
"0.6378415",
"0.63748425",
"0.63297415",
"0.6311199... | 0.7062745 | 1 |
Save checkpoint if a new best is achieved | def save_checkpoint(state, is_best, filename='checkpoint/chpt.tar'):
if is_best:
print ("=> Saving a new best")
torch.save(state, filename) # save checkpoint
else:
print ("=> Validation Accuracy did not improve") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_checkpoint(self):\n if not self.save_ckpt:\n return\n\n lookup = None\n is_best = False\n checkpoint = self.create_checkpoint()\n\n # save best only or not?\n if self.save_best_only:\n if self.valid_dataloader:\n for item in [s... | [
"0.8096263",
"0.798015",
"0.79522806",
"0.7908702",
"0.782125",
"0.780626",
"0.77791244",
"0.77383244",
"0.7613291",
"0.74717957",
"0.73519814",
"0.734903",
"0.7322664",
"0.7297379",
"0.7287243",
"0.72757596",
"0.7275599",
"0.7263411",
"0.7251957",
"0.72405446",
"0.72156465",... | 0.8415175 | 0 |
creates a list with options, takes out previously attempted guesses and compared to the code impossible guesses, resulting in less options to choose | def compareWithAll(lijst, previouslist, feedback = 0):
global usedcombos
results = []
if feedback == 2: #to make sure there's a 2 letter combination with gaps
for i in previouslist:
for letter1, letter2 in lijst:
if letter1 in i and letter2 in i:
r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def NewFeedbackSystem(guess, correct, semicorrect, lijst):\n\n global allcombos\n global usedcombos\n global all_right\n\n\n feedback = correct + semicorrect\n\n usedcombos.append(guess)\n\n if not allright: #needs an extra way to AT LEAST get the same feedback as previous one\n\n if feedb... | [
"0.68641925",
"0.61880255",
"0.61880255",
"0.61880255",
"0.61880255",
"0.6175726",
"0.60669386",
"0.60667694",
"0.60519004",
"0.6033047",
"0.59924954",
"0.5978682",
"0.59764504",
"0.58780754",
"0.58575827",
"0.5841121",
"0.5838716",
"0.58180505",
"0.579832",
"0.57755363",
"0.... | 0.6642198 | 1 |
creates a list with all 1269 options for the AI to choose from the first time around | def Allcombos():
global allcombos
allcombos = []
results = product("ABCDEF", repeat=4)
allcombos = resulttolist(results)
return AIguessing(allcombos) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _choose_best_option(self):",
"def slot_choke(self):\n if self.choke:\n _choke = [1 for x in range(8)]\n else:\n _choke = [random.randint(0,4) for x in range(8)]\n \n return _choke",
"def get_chosen_options(user):\n user_profile = user.get_profile()\n... | [
"0.59972984",
"0.599424",
"0.5949988",
"0.59092057",
"0.5876885",
"0.57940155",
"0.575229",
"0.5752277",
"0.5705689",
"0.569777",
"0.56958395",
"0.56956154",
"0.56738514",
"0.56668955",
"0.564934",
"0.564934",
"0.564934",
"0.564934",
"0.5645424",
"0.56324995",
"0.5609867",
... | 0.6071066 | 0 |
Creme de la creme, this system checks the amount of feedback given and creates a list with the possible options according to that feedback | def NewFeedbackSystem(guess, correct, semicorrect, lijst):
global allcombos
global usedcombos
global all_right
feedback = correct + semicorrect
usedcombos.append(guess)
if not allright: #needs an extra way to AT LEAST get the same feedback as previous one
if feedback == 4: #takes a... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_combination_and_rate_function(self):\n\n def create_combination_and_rate(_):\n\n self.console.children = []\n\n selection = wd.HBox()\n\n selection_widgets = list()\n if not 0 in (dropdown.value for dropdown in self.selectors.children):\n\n ... | [
"0.60203457",
"0.5947579",
"0.58652717",
"0.58639926",
"0.5858958",
"0.58414567",
"0.5688718",
"0.5656689",
"0.56431186",
"0.5545582",
"0.55432034",
"0.5478279",
"0.5454521",
"0.54179966",
"0.5398828",
"0.53985435",
"0.53922117",
"0.53889763",
"0.53812575",
"0.53408766",
"0.5... | 0.64131945 | 0 |
Plot training loss and validation loss. | def plot_loss(stats):
plt.plot(stats['train_loss_ind'], stats['train_loss'], label='Training loss')
plt.plot(stats['val_loss_ind'], stats['val_loss'], label='Validation loss')
plt.legend()
plt.xlabel('Number of iterations')
plt.ylabel('Loss')
plt.show() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_loss(training_errors, validation_errors):\n plt.xscale('Log')\n plt.xlabel('Epochs')\n plt.ylabel('Mean Actual Error')\n plt.plot(training_errors, label = \"Training Error\", \\\n color = 'blue')\n plt.plot(validation_errors, label = \"Validation Error\", \\\n color = 'red')\n... | [
"0.8492791",
"0.83355016",
"0.8239477",
"0.81876945",
"0.807501",
"0.7887663",
"0.78762305",
"0.77675664",
"0.77561146",
"0.77079487",
"0.7699081",
"0.76071095",
"0.7606021",
"0.75533175",
"0.7493136",
"0.749115",
"0.74713856",
"0.7455033",
"0.7434732",
"0.74282473",
"0.74281... | 0.8361324 | 1 |
Return the Job Execution time (in sec) for completed jobs or return None for noncompleted jobs Note, for Jobs from SL > 6.0.0, this was not defined and will always return None | def execution_time_sec(self):
if self.job_started_at is not None:
if self.job_completed_at is not None:
return (self.job_completed_at -
self.job_started_at).total_seconds()
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_time(self):\n # if the job is being processed or the CC had a crash return None\n if self.status <= 0:\n return None\n\n if self.status in (STATUS_FINISHED, 21):\n return self.resultTime\n\n return None",
"d... | [
"0.7645764",
"0.7135704",
"0.7089696",
"0.70411503",
"0.69594383",
"0.6778434",
"0.6741409",
"0.6741409",
"0.65523815",
"0.6404028",
"0.6402107",
"0.63952106",
"0.6221999",
"0.617851",
"0.6170105",
"0.6162836",
"0.61324644",
"0.6124755",
"0.60572016",
"0.6051501",
"0.6050076"... | 0.7868252 | 0 |
Convert from SMRT Link Service Error JSON response to `SMRTServiceBaseError` instance | def from_d(d):
return SMRTServiceBaseError(
d['httpCode'], d['errorType'], d['message']) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _create_error_response(self, error):\n status = error.status\n try:\n body = json.loads(error.body)\n except Exception:\n body = {}\n if status in [403, 429]:\n # Parse differently if the error message came from kong\n errors = [ApiError(N... | [
"0.6404701",
"0.6357439",
"0.6344327",
"0.62454784",
"0.6188729",
"0.61665994",
"0.60594136",
"0.6031745",
"0.6008455",
"0.59471136",
"0.5946649",
"0.5913572",
"0.59126943",
"0.5882031",
"0.58587986",
"0.5852993",
"0.5847247",
"0.5846196",
"0.58334005",
"0.5812317",
"0.580874... | 0.739877 | 0 |
Convert from Service JSON response to `ServiceEntryPoint` instance | def from_d(d):
i = _to_resource_id(d['datasetId'])
return ServiceEntryPoint(
to_ascii(d['entryId']), to_ascii(d['fileTypeId']), i) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_d(d):\n return JobEntryPoint(d['jobId'], d['datasetUUID'], d['datasetType'])",
"def _json_to_endpoint(self, endpoint_json):\n try:\n return Endpoint(endpoint_json[ID_KEY], endpoint_json[EndpointKeys.POLICY_ID_KEY],\n endpoint_json[EndpointKeys.HOSTNAME... | [
"0.5150705",
"0.51032376",
"0.49014518",
"0.48814648",
"0.48094264",
"0.47735533",
"0.47376588",
"0.47340393",
"0.47310132",
"0.46436682",
"0.4635985",
"0.46354443",
"0.46118343",
"0.46073398",
"0.45892712",
"0.45892712",
"0.45892712",
"0.45842347",
"0.4562214",
"0.45590737",
... | 0.68218786 | 0 |
Convert from Service JSON response to `JobEntryPoint` instance | def from_d(d):
return JobEntryPoint(d['jobId'], d['datasetUUID'], d['datasetType']) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_full_job_page(self, response, job_dict):\n return Job(job_dict)",
"def parse_full_job_page(self, response, job_dict):\n job_dict['description']=BeautifulSoup(response.xpath('//*[@id=\"page\"]/div[1]').get()).get_text()\n job_dict['organisation']=response.xpath('//*[@id=\"page\"]/di... | [
"0.6233543",
"0.5481005",
"0.5463672",
"0.5458375",
"0.5389816",
"0.5350363",
"0.53357494",
"0.5132683",
"0.5065379",
"0.5041597",
"0.49880916",
"0.4985915",
"0.49399605",
"0.49092594",
"0.48968846",
"0.48868445",
"0.4874662",
"0.4872049",
"0.4835883",
"0.48341116",
"0.482476... | 0.7089311 | 0 |
Initialise coroutine, socket and poller Returns True if coroutine init method returns True, otherwise False | def init(self):
# Define coroutine and executes its init method
if self.coroutine is None:
return False
if self.coroutine.init() == False:
return False
self.done = False
return self.init_connections() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def init(self) -> None:",
"async def init(self) -> None:",
"def init_connections(self):\n context = zmq.Context()\n self.sock_reply = context.socket(zmq.REQ)\n self.sock_reply.connect(self.sock_consumer_url)\n # Informs prev_stage that I am ready to work\n self.sock_rep... | [
"0.6311863",
"0.6311863",
"0.6304957",
"0.6157248",
"0.613787",
"0.60167134",
"0.5922672",
"0.5878408",
"0.5864879",
"0.5851018",
"0.5826158",
"0.5814352",
"0.5804754",
"0.5802895",
"0.5777722",
"0.57511944",
"0.57323587",
"0.57224876",
"0.5717826",
"0.5696364",
"0.5694732",
... | 0.8121594 | 0 |
All the partitions of n into k positive integers. | def partitions(n, k):
if k == 1:
yield (n,)
return
for i in range(1, n):
for p in partitions(n-i, k-1):
yield (i,) + p | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def partition(n, k=None, zeros=False):\n if not zeros or k is None:\n for i in ordered_partitions(n, k):\n yield tuple(i)\n else:\n for m in range(1, k + 1):\n for i in ordered_partitions(n, m):\n i = tuple(i)\n yield (0,)*(k - len(i)) + i",
... | [
"0.815625",
"0.7741824",
"0.77257764",
"0.7703174",
"0.76438427",
"0.75647265",
"0.74891716",
"0.7487173",
"0.7431728",
"0.74189156",
"0.7317477",
"0.7089825",
"0.70172256",
"0.69004613",
"0.6857951",
"0.68272954",
"0.68138933",
"0.6808645",
"0.6808645",
"0.6802657",
"0.67678... | 0.8764198 | 0 |
Checks if the shape resulting from removing the given solid is valid. If it is, returns True and removes the solid from its internal representation. Otherwise returns false and the internal representation is unchanged | def remove_if_valid(self, solid):
assert isinstance(solid, TopoDS_Solid)
_solid = Solid(solid)
affected_lists = [l for l in self._xz_intersections + self._yz_intersections if _solid in l]
bad_lists = [l for l in affected_lists if len(l) == 1]
if bad_lists:
return Fals... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def solid(self):\r\n return not not self.prototype.solid",
"def solid(self):\r\n return not not self.model.prototype.solid",
"def is_valid(self):\n if len(self.exterior) < 3:\n return False\n return self.to_shapely_polygon().is_valid",
"def is_solid(self, world=None):\n... | [
"0.6648199",
"0.6635969",
"0.5991318",
"0.59347063",
"0.57435995",
"0.5663807",
"0.5602503",
"0.5588618",
"0.5521896",
"0.54105324",
"0.53777754",
"0.53765774",
"0.5331534",
"0.53008854",
"0.5280453",
"0.52592486",
"0.517499",
"0.51429147",
"0.5101849",
"0.5045268",
"0.503154... | 0.8079224 | 0 |
Get the lexer instance from the filename | def _getLexerInstance(filename):
if filename is None:
return lexers.TextLexer(stripnl=False, stripall=False)
# Fast lookup first
ext = os.path.splitext(filename)[1]
cls = EXTENSION_TO_LEXER.get(ext)
if cls is not None:
return cls(stripnl=False, stripall=False)
# Slow lookup for... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_lexer_fromfile(sfilename):\n\n try:\n lexer_ = lexers.get_lexer_for_filename(sfilename)\n except:\n # no lexer found.\n lexer_ = None\n return lexer_",
"def pick_lexer(filename, contents):\n if filename in [\"LICENSE\", \"COPYING\", \"README\"]:\n return lexers.Tex... | [
"0.79539335",
"0.761449",
"0.7207926",
"0.714838",
"0.66601145",
"0.64317083",
"0.64238983",
"0.6398226",
"0.61315805",
"0.6088204",
"0.6076071",
"0.60298586",
"0.60028017",
"0.59720045",
"0.59665525",
"0.5944145",
"0.5803863",
"0.5769906",
"0.5762581",
"0.57174003",
"0.56674... | 0.8265511 | 0 |
Returns allowed grant types. | def allowed_grant_types(self):
return [
'authorization_code', 'implicit', 'password', 'client_credentials', 'refresh_token'
] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def grant_types(self) -> Sequence[str]:\n return pulumi.get(self, \"grant_types\")",
"def get_requested_grants(settings):\n if ('requested_grants' in settings and\n settings['requested_grants'] not in ['None', None]):\n return settings['requested_grants'].split(',')\n else:\n ... | [
"0.8598268",
"0.6576825",
"0.65127087",
"0.62613016",
"0.62613016",
"0.62613016",
"0.6241674",
"0.62399155",
"0.6219879",
"0.6208872",
"0.6180142",
"0.61035347",
"0.6089577",
"0.6012306",
"0.6012306",
"0.60042715",
"0.5964991",
"0.59435135",
"0.5939238",
"0.59010404",
"0.5890... | 0.7897901 | 1 |
Resize the given image to a thumbnail of 500px max | def resize(img):
size = (500, 500)
img.thumbnail(size)
return img | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resize_image(image, size=(926, 617)):\n\n im = Image.open(image)\n im.convert('RGB')\n im.thumbnail(size)\n thumb_io = BytesIO()\n im.save(thumb_io, 'JPEG', quality=85)\n thumbnail = File(thumb_io, name=image.name)\n return thumbnail",
"def resize_image(image, max_dimension):\n max_si... | [
"0.79976904",
"0.7806062",
"0.7693586",
"0.7453692",
"0.7385396",
"0.73802024",
"0.7220762",
"0.7092707",
"0.70627075",
"0.7028267",
"0.70226866",
"0.6991919",
"0.6941653",
"0.69116217",
"0.6894536",
"0.6875651",
"0.68707263",
"0.68707263",
"0.6869021",
"0.686223",
"0.6853168... | 0.8827085 | 0 |
Makes the given image symetrical along a vertical axis going through the center of the image Left side | def sym_left_img(img):
cropped = img.crop(box=(0, 0, img.width / 2, img.height))
mirror = cropped.transpose(Image.FLIP_LEFT_RIGHT)
combine = Image.new('RGB', (cropped.width * 2, cropped.height), 'white')
combine.paste(cropped, (0, 0, cropped.width, cropped.height))
combine.paste(mirror, (cropped.wid... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def align(img, left_eye, right_eye):\n left_eye_x, left_eye_y = left_eye\n right_eye_x, right_eye_y = right_eye\n point_3rd, direction = (left_eye, -1) if left_eye_y > right_eye_y else (right_eye, 1)\n\n # np.linalg.norm is being used for euclidean distance\n a = np.linalg.norm(np.array(left_eye) - ... | [
"0.6810545",
"0.6370081",
"0.6363877",
"0.6363877",
"0.62962395",
"0.6287988",
"0.62482077",
"0.6234372",
"0.62124956",
"0.6167884",
"0.60937744",
"0.6077493",
"0.6054392",
"0.60531276",
"0.6041996",
"0.601933",
"0.6016188",
"0.5999255",
"0.59981805",
"0.59607226",
"0.5957148... | 0.67462647 | 1 |
Makes the given image symetrical along a vertical axis going through the center of the image Right side | def sym_right_img(img):
img = img.transpose(Image.FLIP_LEFT_RIGHT)
return sym_left_img(img) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def flip_vertical(image: Image) -> Image:\r\n flipped_image = copy(image)\r\n middle_pixel = get_width(flipped_image) // 2\r\n width = get_width(flipped_image)\r\n height = get_height(flipped_image)\r\n \r\n for x in range(middle_pixel):\r\n for y in range(height):\r\n r,g,b = g... | [
"0.658821",
"0.65648276",
"0.64459777",
"0.6380066",
"0.6380066",
"0.6323033",
"0.62750906",
"0.6186318",
"0.6182689",
"0.61563516",
"0.6114739",
"0.6031185",
"0.60177726",
"0.5920488",
"0.5884214",
"0.5832142",
"0.5830083",
"0.582041",
"0.5798179",
"0.5793667",
"0.5793667",
... | 0.68249315 | 0 |
fethces friends from facebook using the oauth_token fethched by djangosocialauth. Note user isn't a user it's a UserSocialAuth if using social auth, or a SocialAccount if using allauth | def fetch_friends(self, user, paginate=False):
if USING_ALLAUTH:
social_app = SocialApp.objects.get_current('facebook')
oauth_token = SocialToken.objects.get(account=user, app=social_app).token
else:
social_auth_backend = FacebookBackend()
# Get the acce... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_friends(graph, location_id=\"\", is_user=\"\"):\n user = graph.get_object(\"me\")\n fql = \"SELECT uid, name, profile_url, pic_small, current_location, mutual_friend_count FROM user WHERE uid IN (SELECT uid1 FROM friend WHERE uid2 = \" + user[\"id\"] + \")\"\n if location_id:\n fql += \" AND current_... | [
"0.63095725",
"0.6301002",
"0.624202",
"0.62234473",
"0.6185674",
"0.6144926",
"0.61159587",
"0.6019337",
"0.59726",
"0.5944312",
"0.5919021",
"0.5909905",
"0.59006923",
"0.58309364",
"0.5789643",
"0.57782394",
"0.57516766",
"0.57334036",
"0.57146245",
"0.5704354",
"0.5698666... | 0.688501 | 0 |
Count the number of almost prime numbers in the range [a,b] | def count_almost_prime(a, b, primes_list):
count = 0
for num in range(a, b+1):
count += check_almost_prime(num, primes_list)
return count | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def try_formula(a, b):\n n = 0\n while True:\n x = (n**2) + (a*n) + b\n if not is_prime(x):\n break\n n += 1\n return n",
"def solution(a_limit: int = 1000, b_limit: int = 1000) -> int:\n longest = [0, 0, 0] # length, a, b\n for a in range((a_limit * -1) + 1, a_lim... | [
"0.71973157",
"0.7024004",
"0.69028527",
"0.68252915",
"0.6784352",
"0.6738959",
"0.66527146",
"0.6529368",
"0.65057594",
"0.64760405",
"0.647034",
"0.64359033",
"0.6416745",
"0.6386784",
"0.63088304",
"0.62763923",
"0.6239173",
"0.6232673",
"0.62195665",
"0.62171096",
"0.621... | 0.8704284 | 0 |
This function deals with the zombie animations | def zombie_animation(self, delta_time: float = 1/60):
# Figure out if we need to flip face left or right
if self.change_x < 0 and self.character_face_direction == constants.RIGHT_FACING:
self.character_face_direction = constants.LEFT_FACING
elif self.change_x > 0 and self.character_f... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def animate(self):\r\n #current time\r\n now = pygame.time.get_ticks()\r\n\r\n #when walking right\r\n if self.walkingr:\r\n #if enough time has passed, change image\r\n if now - self.last_update > 350:\r\n self.last_update = now\r\n i... | [
"0.6348606",
"0.6347632",
"0.6306834",
"0.62728566",
"0.6246081",
"0.61030734",
"0.60696095",
"0.6038901",
"0.6032245",
"0.5988998",
"0.595981",
"0.5915954",
"0.5913905",
"0.5848479",
"0.5848479",
"0.5848479",
"0.5848479",
"0.5848479",
"0.5848479",
"0.5848479",
"0.5848479",
... | 0.6916668 | 0 |
Query google scholar. This method queries google scholar and returns a list of citations. | def query(searchstr, outformat=FORMAT_BIBTEX, allresults=False):
logging.debug("Query: {sstring}".format(sstring=searchstr))
searchstr = '/scholar?q='+quote(searchstr)
url = GOOGLE_SCHOLAR_URL + searchstr
header = HEADERS
header['Cookie'] = header['Cookie'] + ":CF=%d" % outformat
request = Reque... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def google(query, num_results=1):\n\tif not API_KEY:\n\t\traise ConfigException(\"Require API_KEY for googleapi. Reload after setting.\")\n\td = { \"q\" : query.encode(\"utf-8\"), \"key\" : API_KEY, \"cx\" : CSE_ID, \"num\" : num_results,\n\t\t\"fields\" : \"spelling/correctedQuery,items(title,link,snippet)\" }\n\... | [
"0.6250749",
"0.60770196",
"0.59892666",
"0.59222996",
"0.5777499",
"0.57542264",
"0.5742359",
"0.57366425",
"0.5735477",
"0.57350194",
"0.5654673",
"0.5626965",
"0.55190295",
"0.5457895",
"0.5393104",
"0.53750455",
"0.5344303",
"0.5326731",
"0.5318554",
"0.5253322",
"0.52392... | 0.68588835 | 0 |
Return a list of reference links from the html. | def get_links(html, outformat):
if outformat == FORMAT_BIBTEX:
refre = re.compile(r'<a href="(/scholar\.bib\?[^"]*)')
elif outformat == FORMAT_ENDNOTE:
refre = re.compile(r'<a href="(/scholar\.enw\?[^"]*)"')
elif outformat == FORMAT_REFMAN:
refre = re.compile(r'<a href="(/scholar\.ri... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_links(html):\r\n\twebpage_regex = re.compile('<a[^>]+href=[\"\\'](.*?)[\"\\']',re.IGNORECASE)\r\n\t# list of all links from the webpage\r\n\treturn webpage_regex.findall(html)",
"def get_links(html):\n # a regular expression to extract all links from thr webpage\n webpage_regex = re.compile('<a[^>]... | [
"0.7349961",
"0.73155344",
"0.72970295",
"0.72167593",
"0.7153675",
"0.7007424",
"0.6929784",
"0.69296694",
"0.6897006",
"0.6660045",
"0.6646792",
"0.6644072",
"0.6642479",
"0.662727",
"0.66090417",
"0.6608457",
"0.66022533",
"0.65905523",
"0.6563315",
"0.6550075",
"0.6547747... | 0.7399393 | 0 |
Convert a pdf file to text and return the text. This method requires pdftotext to be installed. | def convert_pdf_to_txt(pdf):
stdout = subprocess.Popen(["pdftotext", "-q", pdf, "-"],
stdout=subprocess.PIPE).communicate()[0]
return stdout | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_to_text(self) -> str:\r\n import pdftotext\r\n with open(self.pdf_path, \"rb\") as f:\r\n pdf = pdftotext.PDF(f)\r\n pdf = \"\\n\\n\".join(pdf)\r\n return pdf",
"def pdf_to_text(file_object):\n pdfData = file_object.read()\n tf = tempfile.NamedTemporar... | [
"0.8712109",
"0.8306904",
"0.8170671",
"0.80921304",
"0.79898155",
"0.79613286",
"0.79591984",
"0.79271126",
"0.77415824",
"0.7579731",
"0.7511442",
"0.7280071",
"0.727019",
"0.72693336",
"0.7176518",
"0.6949168",
"0.69177",
"0.6886448",
"0.67950404",
"0.6771168",
"0.6569767"... | 0.84516096 | 1 |
Look a pdf up on google scholar and return bibtex items. | def pdflookup(pdf, allresults, outformat):
txt = convert_pdf_to_txt(pdf)
# remove all non alphanumeric characters
txt = re.sub("\W", " ", txt)
words = txt.strip().split()[:20]
gsquery = " ".join(words)
bibtexlist = query(gsquery, outformat, allresults)
return bibtexlist | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def query(searchstr, outformat=FORMAT_BIBTEX, allresults=False):\n logging.debug(\"Query: {sstring}\".format(sstring=searchstr))\n searchstr = '/scholar?q='+quote(searchstr)\n url = GOOGLE_SCHOLAR_URL + searchstr\n header = HEADERS\n header['Cookie'] = header['Cookie'] + \":CF=%d\" % outformat\n ... | [
"0.6808588",
"0.61482686",
"0.61278075",
"0.6038411",
"0.59641856",
"0.5948032",
"0.59478223",
"0.59356487",
"0.5897624",
"0.58938557",
"0.58894867",
"0.57563543",
"0.5675553",
"0.5662382",
"0.56284887",
"0.56152385",
"0.5586374",
"0.55199856",
"0.5428546",
"0.54257345",
"0.5... | 0.77171427 | 0 |
Return element from bibitem or None. | def _get_bib_element(bibitem, element):
lst = [i.strip() for i in bibitem.split("\n")]
for i in lst:
if i.startswith(element):
value = i.split("=", 1)[-1]
value = value.strip()
while value.endswith(','):
value = value[:-1]
while value.start... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getItem(self) -> Optional[items.Item]:\n return None if self.__itemRef is None else self.__itemRef()",
"def __getitem__(self, item):\n return self.elements[item]",
"def find(self,item):\n sig = str(item)\n try:\n return self.index[sig]\n except:\n re... | [
"0.6635344",
"0.6342957",
"0.63146085",
"0.62345576",
"0.61197186",
"0.60696214",
"0.60379153",
"0.5940722",
"0.5913112",
"0.5909597",
"0.58673203",
"0.58673203",
"0.5837205",
"0.5829939",
"0.579123",
"0.5773559",
"0.576635",
"0.57567275",
"0.5737192",
"0.5734811",
"0.5734708... | 0.68748015 | 0 |
Attempt to rename pdf according to bibitem. | def rename_file(pdf, bibitem):
year = _get_bib_element(bibitem, "year")
author = _get_bib_element(bibitem, "author")
if author:
author = author.split(",")[0]
title = _get_bib_element(bibitem, "title")
l = []
for i in year, author, title:
if i:
l.append(i)
filename... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_pdf(\n bib, pdf=None, bin_pdf=None, filename=None,\n arxiv=False, replace=False,\n ):\n if isinstance(bib, str):\n e = bm.find(key=bib)\n bib = bm.find(bibcode=bib) if e is None else e\n if bib is None:\n raise ValueError('BibTex entry is not in Bibmanager databa... | [
"0.59104365",
"0.58995575",
"0.5739395",
"0.5653235",
"0.5631637",
"0.5616473",
"0.56111777",
"0.5498427",
"0.5495907",
"0.5437631",
"0.5418278",
"0.5333366",
"0.52868384",
"0.52853644",
"0.5255663",
"0.52069855",
"0.51592964",
"0.5157669",
"0.5147316",
"0.5137793",
"0.512140... | 0.8231692 | 0 |
Will add deltam32 and sin2theta23 to be plotted, given that this is the more standard way of presenting these results. | def add_deltam32_sin2theta23(self):
# Get the deltam21 value used in the fits
deltam21 = self.scan_file_dict['results'][0][
'params']['deltam21']['value'][0]
# Sort the bins
for i, bin_name in enumerate(self.all_bin_names):
if bin_name == 'theta23':
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def animate_tangent_angles_equal(self):\n\n # \\theta_i and \\theta_r\n self.play(FadeIn(self.tex_derive_ti_tr[0]), FadeIn(self.tex_derive_ti_tr[2]))\n self.wait(self.wait_time)\n\n # mirror reflection\n self.play(FadeIn(self.text_mirror), FadeIn(self.tex_derive_ti_tr[1]))\n ... | [
"0.6194593",
"0.6039436",
"0.59952396",
"0.58618915",
"0.5800733",
"0.5720279",
"0.5651765",
"0.56442297",
"0.55574334",
"0.55467814",
"0.5531222",
"0.55123454",
"0.5490581",
"0.5482271",
"0.5478315",
"0.5446403",
"0.54458344",
"0.54450256",
"0.5414256",
"0.5388217",
"0.53851... | 0.6456817 | 0 |
Will organise the Asimov scans in to the metrics and the params with the appropriate wrong hypothesis to true hypothesis and true hypothesis to wrong hypothesis fits. Also extracts the minimiser info and saves it to the same object. | def organise_scans(self):
self.wh_to_th = {}
self.th_to_wh = {}
wh_to_th_metrics = []
th_to_wh_metrics = []
wh_to_th_params = {}
th_to_wh_params = {}
wh_to_th_minim_info = {}
th_to_wh_minim_info = {}
wh_to_th_minim_info['time'] = []
wh_to_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_fit_information_plots(self):\n import matplotlib.pyplot as plt\n plt.rcParams['text.usetex'] = True\n\n outdir = os.path.join(self.outdir, 'MinimiserPlots')\n mkdir(outdir)\n maintitle = self.make_main_title(end='Minimiser Information')\n if self.test_type == 'ana... | [
"0.56383544",
"0.5585369",
"0.55641526",
"0.5483929",
"0.5480312",
"0.5412903",
"0.5360565",
"0.5357296",
"0.5342532",
"0.5303023",
"0.52995163",
"0.5280738",
"0.52788365",
"0.526256",
"0.5249786",
"0.5230074",
"0.5229839",
"0.5188799",
"0.518303",
"0.51747257",
"0.51473373",... | 0.70400584 | 0 |
Function to extract the fit information relevant to the systematic tests for the given datakey. The labels are needed to check that the truth was recovered as it may not be in these systematic tests. This should be the .dict of the Labels object. | def systtest_fit_extract(self, fit_data, datakey, labels):
# Find which hypothesis is the best fit.
h0_fit = fit_data['h0_fit_to_%s'%datakey]
h1_fit = fit_data['h1_fit_to_%s'%datakey]
if h0_fit['metric_val'] > h1_fit['metric_val']:
bestfit = 'h1'
altfit = 'h0'
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_systtest_plots(self):\n for injkey in self.data_sets.keys():\n data = {}\n for testsyst in self.data_sets[injkey].keys():\n data[testsyst] = {}\n if len(self.data_sets[injkey][testsyst].keys()) == 2:\n # This is the case of doin... | [
"0.5636078",
"0.5565165",
"0.5489305",
"0.5384428",
"0.53632164",
"0.5326926",
"0.532487",
"0.52840525",
"0.5283307",
"0.52821434",
"0.5200216",
"0.51998",
"0.5140889",
"0.5132197",
"0.5099245",
"0.5099136",
"0.5067812",
"0.506079",
"0.5052308",
"0.50448006",
"0.5044204",
"... | 0.75667214 | 0 |
Make the systematic test plots where a systematically wrong hypothesis is injected. | def make_injwrong_systtests_plots(self, data, injkey):
# TODO
raise ValueError(
"Postprocessing for systematic tests where a systematically "
"wrong hypothesis is injected is not implemented yet."
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_plotting():\n specs = _read_schrodinger('tests/test_data/{}.inp'.format(PROBLEM))\n xint, yint = _interpolate(specs['interpolxydecs'][:, 0],\n specs['interpolxydecs'][:, 1], specs['xopt'])\n\n energies = np.loadtxt('tests/test_data/energies_{}.ref'.format(PROBLEM))\n ... | [
"0.6689347",
"0.6662834",
"0.6578377",
"0.6432216",
"0.61816466",
"0.6133246",
"0.60753226",
"0.60732275",
"0.607191",
"0.6064356",
"0.6063041",
"0.596364",
"0.59374225",
"0.5933647",
"0.5918506",
"0.5902383",
"0.58964807",
"0.5894433",
"0.5864685",
"0.585787",
"0.5853332",
... | 0.7658411 | 0 |
Make the N1 test plots showing the importance of the systematics. | def make_nminusone_systtests_plots(self, data, injkey):
import matplotlib.pyplot as plt
plt.rcParams['text.usetex'] = True
mkdir(self.outdir)
maintitle = self.make_main_title(end='N-1 Systematic Test')
subtitle = r"For True %s\end{center}"%(
self.tex_axis_label(injk... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def testNonLinearity():\n vis = VISinformation()\n data = np.linspace(1, vis['fullwellcapacity'], 10000)\n nonlin = CCDnonLinearityModel(data.copy())\n\n txt = '%s' % datetime.datetime.isoformat(datetime.datetime.now())\n\n fig = plt.figure(frameon=False)\n\n left, width = 0.1, 0.8\n rect1 = [... | [
"0.6143109",
"0.61051875",
"0.6084817",
"0.6063127",
"0.60393506",
"0.59633434",
"0.59044087",
"0.5896639",
"0.5885795",
"0.58026594",
"0.57949686",
"0.57890093",
"0.57688576",
"0.5748228",
"0.5735949",
"0.57227045",
"0.5721311",
"0.57161343",
"0.5715171",
"0.5678649",
"0.566... | 0.64490014 | 0 |
Store the baseline fits in the systematic tests to self. | def organise_baseline_data(self):
self.baseline_data = {}
for injkey in self.data_sets.keys():
data = {}
baseline_result = self.data_sets[injkey].pop('full_syst_baseline')
datakey = baseline_result.keys()[0]
baseline_data = self.systtest_fit_extract(
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setBaseline(self, baseline):\n self.baseline = AmpObject(baseline, 'limb')",
"def baseline(self, baseline: List[PredictionsDatapoints]):\n\n self._baseline = baseline",
"def run_baseline(self, **_):\n raise NotImplementedError(\n \"'.run_baseline()' is only allowed for Model... | [
"0.65550834",
"0.62446475",
"0.5909911",
"0.57753074",
"0.5712508",
"0.5671434",
"0.56105757",
"0.5590034",
"0.5499408",
"0.5484689",
"0.5479233",
"0.54500896",
"0.5436",
"0.5425227",
"0.5412295",
"0.5354147",
"0.53215027",
"0.5296857",
"0.5285762",
"0.5272281",
"0.52705806",... | 0.6871819 | 0 |
Extract fit info from a file. | def extract_fit(self, fpath, keys=None):
try:
info = from_file(fpath)
except:
raise RuntimeError("Cannot read from file located at %s."%fpath)
if keys is None:
return info
if isinstance(keys, str):
keys = [keys]
for key in info.keys... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_file(file_name):\n fits_file = fits.open(file_name)\n\n header = fits_file[0].header\n image_data = fits_file[1].data\n\n segmentation_data = fits_file[2].data\n\n header_keywords = {'CRVAL3': 0, 'CRPIX3': 0, 'CD3_3': 0}\n # clause to differentiate between CDELT3 and CD3_3\n\n for hdr... | [
"0.6148278",
"0.60460293",
"0.5966397",
"0.5903164",
"0.58949184",
"0.5865305",
"0.58625656",
"0.58326477",
"0.5752613",
"0.57474583",
"0.56728673",
"0.5564491",
"0.55606425",
"0.55283386",
"0.552605",
"0.55124635",
"0.55014104",
"0.5491703",
"0.5472544",
"0.54668206",
"0.545... | 0.6514454 | 0 |
Returns the hypo from the fiducial/fithypothesis key | def get_hypo_from_fiducial_hypo_key(self, fhkey):
return fhkey.split('_')[0] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_fid_from_fiducial_hypo_key(self, fhkey):\n return fhkey.split('_')[-2]",
"def get_hypixel_key(self):\n key = self.bot_data_file[\"apiKeys\"][\"hypixel\"]\n if self.check_empty_key(key):\n return key\n else:\n print(\"ERROR GETTING THE HYPIXEL KEY (get you... | [
"0.7042078",
"0.6051914",
"0.5687437",
"0.5564087",
"0.5549174",
"0.5363302",
"0.5317577",
"0.5279895",
"0.5266221",
"0.5224591",
"0.52060044",
"0.5150866",
"0.5101742",
"0.50710994",
"0.5069106",
"0.50170875",
"0.5003114",
"0.5000154",
"0.49796987",
"0.49648806",
"0.49646154... | 0.8455484 | 0 |
Returns the fid from the fiducial/fithypothesis key | def get_fid_from_fiducial_hypo_key(self, fhkey):
return fhkey.split('_')[-2] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_fid(self, tsuid):\n\n # Checks inputs\n check_type(value=tsuid, allowed_types=str, var_name=\"tsuid\", raise_exception=True)\n\n if tsuid == \"\":\n self.session.log.error(\"tsuid must not be empty\")\n raise ValueError(\"tsuid must not be empty\")\n\n resp... | [
"0.62090856",
"0.6164848",
"0.61471796",
"0.5853615",
"0.57064277",
"0.56438327",
"0.5643254",
"0.5615777",
"0.5588011",
"0.55563736",
"0.55325574",
"0.5516967",
"0.551695",
"0.54946053",
"0.54553396",
"0.5408806",
"0.5359252",
"0.5309296",
"0.52805996",
"0.52805996",
"0.5274... | 0.7672814 | 0 |
Parses the string for the Gaussian priors that comes from the config summary file in the logdir. This should account for dimensions though has only been proven with "deg" and "ev 2". | def extract_gaussian(self, prior_string, units):
if units == 'dimensionless':
parse_string = ('gaussian prior: stddev=(.*)'
' , maximum at (.*)')
bits = re.match(
parse_string,
prior_string,
re.M|re.I
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_gp_hyperparam_priors(s):\n # define some regular expressions to parse the strings\n f = r'[0-9]*\\.?[0-9]*(?:e[+-]?[0-9]+)?'\n r1 = re.compile(r'^ *({f}) *$'.format(f=f))\n r3 = re.compile(r'^ *({f}) +({f}) +({f}) *$'.format(f=f))\n # take a string and return a numpy array or raise an exce... | [
"0.58327496",
"0.51241314",
"0.5098863",
"0.50902706",
"0.5065955",
"0.5044276",
"0.49648437",
"0.49457562",
"0.4935429",
"0.48948944",
"0.48073503",
"0.4761841",
"0.47295067",
"0.4725387",
"0.47253662",
"0.47206172",
"0.47117037",
"0.4699517",
"0.46907508",
"0.46903658",
"0.... | 0.5845101 | 0 |
Sets the inj param units in to self. Typically it will do this by finding one of the fit parameters and extracting it. This requires that it is in the fitted parameters and that you scanned in the same units as was fit. If this is not the case you must set it in the arguments to the script. | def set_inj_param_units(self, inj_param_units):
if inj_param_units is None:
# If the inj param units are not specified they should
# be found from the units attached to the fitted parameters.
# There are two known exceptions.
if self.inj_param_name == 'sin2theta23... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setUnits(self, *args):\n return _libsbml.Parameter_setUnits(self, *args)",
"def __init__(self, encut, magmom, ldaul, Uparam, Jparam, name=\"DFTCL_settings\"):\n\n cl_settings = {\"ISPIN\": 2, \"MAGMOM\": magmom, \"SAXIS\": None, \"LSORBIT\": None, \"LNONCOLLINEAR\": None}\n df... | [
"0.6068878",
"0.5826318",
"0.57285136",
"0.56931216",
"0.56646466",
"0.55801815",
"0.5569963",
"0.55504596",
"0.5538115",
"0.5523723",
"0.55142486",
"0.55109596",
"0.5494721",
"0.5489996",
"0.5462595",
"0.54440856",
"0.54271245",
"0.542106",
"0.54126924",
"0.5402045",
"0.5370... | 0.7441221 | 0 |
Return the injected params, if they exist | def get_injected_params(self):
if 'data_params' in self.all_params.keys():
if self.all_params['data_params'] is not None:
data_params = {}
for pkey in self.all_params['data_params'].keys():
data_params[pkey] = \
self.all_par... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_params(self):\n pass",
"def injection_parameters(self):\n\n return self._injection_parameters",
"def get_params(self):\n\n return None",
"def get_params(self):\n\n return None",
"def get_params(self):\n\n return None",
"def getParams(self):\n return self.__pa... | [
"0.7040532",
"0.6933346",
"0.6885644",
"0.6885644",
"0.6885644",
"0.68313396",
"0.68180513",
"0.6791685",
"0.677708",
"0.67654556",
"0.67386156",
"0.67386156",
"0.6723107",
"0.6719152",
"0.6712145",
"0.6712145",
"0.6712145",
"0.6705307",
"0.6690056",
"0.65921324",
"0.6484487"... | 0.7788491 | 0 |
Calculates the Asimov significance from the sets of metrics. | def deltachi2_significance(self, wh_to_th_metrics,
th_to_wh_metrics,
truth_recovered=None):
if isinstance(wh_to_th_metrics, list):
wh_to_th_metrics = np.array(wh_to_th_metrics)
th_to_wh_metrics = np.array... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculateStatisticalSignificance():\n ##tau HCS pearson\n ml_model_perf = pickle.load(open(\"pickles/ml_model_perf.pkl\", \"rb\"))\n null_model_perf = pickle.load(open(\"pickles/null_model_perf.pkl\", \"rb\"))\n null_dapi_perf = pickle.load(open(\"pickles/single_channel_DAPI_null_model_perf.pkl\", ... | [
"0.6055013",
"0.57818335",
"0.5569194",
"0.554202",
"0.5539733",
"0.5512171",
"0.54749346",
"0.54459643",
"0.54169804",
"0.5363785",
"0.53624004",
"0.5361514",
"0.5295904",
"0.524629",
"0.5227828",
"0.5209129",
"0.52083546",
"0.51943994",
"0.5183763",
"0.5171991",
"0.51637495... | 0.5797069 | 1 |
Makes the Asimov significance plots. | def make_asimov_significance_plots(self):
import matplotlib.pyplot as plt
plt.rcParams['text.usetex'] = True
outdir = os.path.join(self.outdir, 'Significances')
mkdir(outdir)
maintitle = self.make_main_title(
end='Asimov Analysis Significances',
end_center... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_plots(self):\n shutil.rmtree(self.param.path, ignore_errors=True)\n os.makedirs(self.param.path)\n\n ids = list(range(len(self.signs)))\n\n \"\"\"True positives\"\"\"\n values, kinds = self.get_evaluations(ids)\n plots.create_plot(\n kinds,\n ... | [
"0.62175536",
"0.6149533",
"0.6044954",
"0.5995976",
"0.5853242",
"0.584491",
"0.5844668",
"0.58296216",
"0.5824248",
"0.57804275",
"0.57694584",
"0.57552695",
"0.5737695",
"0.5731887",
"0.5727042",
"0.5723606",
"0.57157564",
"0.5714528",
"0.5711735",
"0.57078296",
"0.5704428... | 0.7620538 | 0 |
Makes the plots of the fitted parameters in the injected parameter scans. The combined argument will plot these on the same canvas for the same hypothesis fit. | def make_asimov_fit_parameter_plots(self, combined=False):
import matplotlib.pyplot as plt
plt.rcParams['text.usetex'] = True
if combined:
outdir = os.path.join(self.outdir, 'CombinedBestFits')
else:
outdir = os.path.join(self.outdir, 'IndividualBestFits'... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plotFittingResults(self):\n _listFitQ = [tmp.getValue() for tmp in self.getDataOutput().getScatteringFitQ()]\n _listFitValues = [tmp.getValue() for tmp in self.getDataOutput().getScatteringFitValues()]\n _listExpQ = [tmp.getValue() for tmp in self.getDataInput().getExperimentalDataQ()]\n ... | [
"0.65914667",
"0.6534625",
"0.65341896",
"0.6533847",
"0.634996",
"0.6324342",
"0.6202312",
"0.61991334",
"0.6190726",
"0.6122431",
"0.60763067",
"0.6072267",
"0.60224307",
"0.5987232",
"0.59761333",
"0.5975777",
"0.59733486",
"0.5962458",
"0.59519637",
"0.59337205",
"0.59098... | 0.7098036 | 0 |
Make posterior plots. With combined=False they will be saved each time but with combined=True they will be saved on a single canvas for each fiducial/hypothesis combination. | def make_posterior_plots(self, combined=False):
import matplotlib.pyplot as plt
plt.rcParams['text.usetex'] = True
if combined:
outdir = os.path.join(self.outdir, 'CombinedPosteriors')
maintitle = self.make_main_title(end='Posteriors')
else:
outdir = ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_overlaid_posterior_plots(self, combined=False):\n import matplotlib.pyplot as plt\n plt.rcParams['text.usetex'] = True\n\n if combined:\n outdir = os.path.join(self.outdir, 'CombinedOverlaidPosteriors')\n maintitle = self.make_main_title(end='Posteriors')\n ... | [
"0.74730843",
"0.6388205",
"0.6096105",
"0.6023261",
"0.5946506",
"0.59338456",
"0.5932454",
"0.5894951",
"0.5857747",
"0.5852538",
"0.57995677",
"0.5785452",
"0.5773033",
"0.5745911",
"0.5707015",
"0.56753314",
"0.5663379",
"0.56222683",
"0.5617493",
"0.5613788",
"0.5603672"... | 0.79286015 | 0 |
Make overlaid posterior plots. Overlaid here means that a plot will be made with each of the h0 and h1 returned values on the same plot for each of the fiducial h0 and h1 pseudos. With combined=False they will be saved each time but with combined=True they will be saved on a single canvas for each fiducial hypothesis. | def make_overlaid_posterior_plots(self, combined=False):
import matplotlib.pyplot as plt
plt.rcParams['text.usetex'] = True
if combined:
outdir = os.path.join(self.outdir, 'CombinedOverlaidPosteriors')
maintitle = self.make_main_title(end='Posteriors')
else:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_posterior_plots(self, combined=False):\n import matplotlib.pyplot as plt\n plt.rcParams['text.usetex'] = True\n\n if combined:\n outdir = os.path.join(self.outdir, 'CombinedPosteriors')\n maintitle = self.make_main_title(end='Posteriors')\n else:\n ... | [
"0.71271616",
"0.6167686",
"0.58615416",
"0.56704944",
"0.56096697",
"0.55676943",
"0.55562794",
"0.5541259",
"0.55295223",
"0.5515821",
"0.5469884",
"0.5421335",
"0.53405416",
"0.53282386",
"0.53164136",
"0.5308097",
"0.5286346",
"0.52856743",
"0.52549064",
"0.5253522",
"0.5... | 0.8037199 | 0 |
Add lines to show the injected and fiducial fit lines where appropriate | def add_inj_fid_lines(self, injkey, systkey, fhkey, smalllabel=False):
import matplotlib.pyplot as plt
plt.rcParams['text.usetex'] = True
h0_params, h1_params = self.get_resulting_hypo_params(
injkey=injkey
)
data_params = self.get_injected_params()
# Add inje... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup_lines(self):\n self.center_lines()\n self.space_lines()",
"def plot_overall_footnotes(xpos, ha, va, fs, dfs, standard=\"ANSI N42.55\"):\n\n #$\\dagger$ is for the Spatial Resolution, Dynamic Range, Noise (NEQ), Flatness of Field, and Aspect Ratio\n y_legend = 0.2\n dy = 0.02\n ... | [
"0.5933017",
"0.5721563",
"0.5642796",
"0.55967325",
"0.55795264",
"0.5552847",
"0.5537625",
"0.5526157",
"0.55253017",
"0.55098045",
"0.54379493",
"0.54352295",
"0.54297775",
"0.54244816",
"0.54170513",
"0.53756773",
"0.5360322",
"0.5342772",
"0.53390414",
"0.5313935",
"0.52... | 0.68575996 | 0 |
Calculate the pvalue for the given dataset based on the given critical value with an associated error. The calculation involves asking in how many trials the test statistic was "beyond" the critical value. The threshold of beyond will depend on whether the given distribution is the best fit or the alternate fit. The de... | def calc_p_value(self, llrdist, critical_value, greater=True,
median_p_value=False, llrbest=None):
if greater:
misid_trials = float(np.sum(llrdist > critical_value))
else:
misid_trials = float(np.sum(llrdist < critical_value))
p_value = misid_trials/s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tpr_at_confidence(self, threshold):\r\n\r\n return numpy.sum(self.test_confidences[numpy.logical_not(self.test_errors)] >= threshold) / float(numpy.sum(numpy.logical_not(self.test_errors)))",
"def fpr_at_confidence(self, threshold):\r\n\r\n return numpy.sum(self.test_confidences[self.test_error... | [
"0.5432129",
"0.5427351",
"0.54255474",
"0.54063946",
"0.5402504",
"0.537162",
"0.5318438",
"0.5303804",
"0.5302024",
"0.5302024",
"0.5299212",
"0.51950485",
"0.51269853",
"0.51217854",
"0.51175594",
"0.51120615",
"0.50911576",
"0.5062698",
"0.50558466",
"0.5045101",
"0.50447... | 0.65782464 | 0 |
Plot the llr histograms. The `greater` argument is intended to be used the same as in the p value function above. | def plot_llr_histograms(self, llrarrays, llrhistmax, binning, colors,
labels, best_name, alt_name, critical_value,
critical_label, critical_height, llrhist,
critical_color='k', plot_scaling_factor=1.55,
great... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_pnl_hist(pnls, title, var, lgnd, report):\n fig, ax = plt.subplots(1, figsize=(16, 8))\n _ = plt.hist(pnls, bins=64)\n\n # add a vertical line for the VaR\n _ = plt.axvline(x=var, color='r', linestyle='--')\n\n # add title and labels\n _ = plt.legend(labels=[lgnd])\n _ = plt.xlabel('P... | [
"0.6609189",
"0.629777",
"0.6252887",
"0.6092889",
"0.6047242",
"0.60393673",
"0.5993443",
"0.5950996",
"0.59296036",
"0.59029347",
"0.59002006",
"0.5848813",
"0.58239883",
"0.5822626",
"0.5821612",
"0.579915",
"0.5798698",
"0.57964593",
"0.5771918",
"0.5768629",
"0.5734236",... | 0.70000404 | 0 |
Make llr plots. Takes the data and makes llr distributions. These are then saved to the requested outdir within a folder labelled "LLRDistributions". The extra_points and extra_points_labels arguments can be used to specify extra points to be added to the plot for e.g. other fit llr values. | def make_llr_plots(self):
import matplotlib.pyplot as plt
plt.rcParams['text.usetex'] = True
outdir = os.path.join(self.outdir, 'LLRDistributions')
mkdir(outdir)
for injkey in self.values.keys():
data = self.values[injkey]
metric_type = data['h0_fit_to_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_all_LLRs(self, outdir):\n\t\t#Iterate over all parameter groups\n\t\tfor group in self.group_names:\n\t\t\tself.plot_group_LLR(groupname=group, outdir=outdir)",
"def plot_group_LLR(self, groupname, outdir):\t\t\n\t\t#Get dimensions of group\n\t\tndim = self.signal[groupname]['dimension']\n\t\t\n\t\t#Get... | [
"0.67140657",
"0.6396338",
"0.58022517",
"0.5763577",
"0.5733781",
"0.5648062",
"0.5593761",
"0.5587608",
"0.55506516",
"0.5549297",
"0.5508653",
"0.54685247",
"0.5468273",
"0.54118407",
"0.53953356",
"0.5392541",
"0.5384058",
"0.53620625",
"0.53362304",
"0.5312375",
"0.52943... | 0.6990413 | 0 |
Make tex files which can be then be compiled in to tables showing the two fiducial fits and, if applicable, how they compare to what was injected. | def make_fiducial_fit_files(self):
outdir = os.path.join(self.outdir, 'FiducialFits')
mkdir(outdir)
paramfilename = self.make_tex_name(end="fiducial_fits")
paramfile = os.path.join(outdir, paramfilename)
self.texfile = open(paramfile, 'w')
self.write_latex_preamble()
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tables(args):\n\n config_file = args.setupfn\n conf_base = os.path.basename(config_file).split('.')[0]\n statfile = os.path.join(args.outputdir,\n \"{}_radvel.stat\".format(conf_base))\n status = load_status(statfile)\n\n assert status.getboolean('mcmc', 'run'), \\\n ... | [
"0.62331927",
"0.6209677",
"0.6149965",
"0.59693635",
"0.5944047",
"0.59259945",
"0.5901659",
"0.5883322",
"0.5836512",
"0.5790518",
"0.57624346",
"0.57525575",
"0.5735076",
"0.5727926",
"0.5690776",
"0.56818247",
"0.567604",
"0.56639755",
"0.5653966",
"0.56498116",
"0.562925... | 0.6306088 | 0 |
Write latex preamble needed to make, in my oftenwrong opinion, nicelooking tex files. | def write_latex_preamble(self):
self.texfile.write(r"\n")
self.texfile.write(r"\documentclass[a4paper,12pt]{article}\n")
self.texfile.write(r"\usepackage{tabu}\n")
self.texfile.write(r"\usepackage{booktabs}\n")
self.texfile.write(r"\usepackage[font=small,labelsep=space]{caption}\... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup_latex_preamble():\n from sage.misc.latex import latex\n latex.add_package_to_preamble_if_available('tikz')\n latex.add_to_mathjax_avoid_list(\"tikz\")\n if latex.has_file(\"tikz.sty\"):\n latex.add_to_preamble(r'\\usetikzlibrary{automata}')",
"def __base_preamble(dir_name):\n prea... | [
"0.7202312",
"0.71188986",
"0.6434057",
"0.62589735",
"0.61339813",
"0.60744655",
"0.60561156",
"0.6036786",
"0.60327476",
"0.578783",
"0.5779226",
"0.5745776",
"0.5742848",
"0.5595822",
"0.5540219",
"0.54850787",
"0.5449751",
"0.537079",
"0.53673536",
"0.5342288",
"0.5326755... | 0.8231961 | 0 |
Set up the beginning of the table for the tex output files. Currently will make tables for the output fiducial fit params and the chi2 values only. | def setup_latex_table(self, tabletype, injected):
self.texfile.write(r"\\renewcommand{\\arraystretch}{1.6}\n")
self.texfile.write(r"\n")
self.texfile.write(r"\\begin{table}[t!]\n")
self.texfile.write(r" \\begin{center}\n")
if tabletype == 'fiducial_fit_params':
if in... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tables(args):\n\n config_file = args.setupfn\n conf_base = os.path.basename(config_file).split('.')[0]\n statfile = os.path.join(args.outputdir,\n \"{}_radvel.stat\".format(conf_base))\n status = load_status(statfile)\n\n assert status.getboolean('mcmc', 'run'), \\\n ... | [
"0.6860911",
"0.6642165",
"0.6495025",
"0.6458208",
"0.6394799",
"0.6358085",
"0.63112044",
"0.6301058",
"0.6125447",
"0.6121442",
"0.60424423",
"0.60236824",
"0.5997964",
"0.59850955",
"0.5945684",
"0.5932976",
"0.587341",
"0.5865962",
"0.5845794",
"0.58440167",
"0.58385974"... | 0.74213517 | 0 |
Checks the pickles in the case of hypo_testing analysis | def check_analysis_pickle_files(self):
# Make sure that there have been no more trials run since this
# last processing. To do this, get the number of output files
for basename in nsort(os.listdir(self.logdir)):
m = self.labels.subdir_re.match(basename)
if m is None or 'p... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_systtests_pickle_files(self):\n # Make sure that there have been no more new scan points run since this\n # last processing. To do this, get the number of output directories\n # Compare this to the number in the pickle files.\n self.num_systematics = {}\n for basename i... | [
"0.61595225",
"0.5877578",
"0.5655869",
"0.55692726",
"0.55656546",
"0.55463165",
"0.55251133",
"0.5512051",
"0.55097383",
"0.5499148",
"0.54520625",
"0.5447905",
"0.5418987",
"0.53755426",
"0.5366291",
"0.5360186",
"0.5349945",
"0.53401595",
"0.5326346",
"0.5318878",
"0.5317... | 0.6292501 | 0 |
Checks the pickles in the case of injparamscan analysis | def check_injparamscan_pickle_files(self):
# Make sure that there have been no more new scan points run since this
# last processing. To do this, get the number of output directories
# Compare this to the number in the pickle files.
self.num_scan_points = 0
for basename in nsort(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _check_params(self):\n pass",
"def _check_params(self):\n\t\tstrange_param_helper = False\n\t\tfor param in self.params:\n\t\t\n\t\t\t# It could be that the param encapsulates several values (e.g., \"FLUX_RADIUS(10)\")\n\t\t\t# So we have to dissect this\n\t\t\tmatch = re.compile(\"(\\w*)\\(\\d*\\)\")... | [
"0.56779563",
"0.56642294",
"0.5533163",
"0.5519379",
"0.5509197",
"0.54343057",
"0.5412787",
"0.5310399",
"0.52720374",
"0.525676",
"0.5247465",
"0.5236283",
"0.52153146",
"0.5205202",
"0.51902384",
"0.51752806",
"0.5171276",
"0.51191604",
"0.5109415",
"0.51025164",
"0.50885... | 0.6733134 | 0 |
Checks the pickles in the case of systtests analysis | def check_systtests_pickle_files(self):
# Make sure that there have been no more new scan points run since this
# last processing. To do this, get the number of output directories
# Compare this to the number in the pickle files.
self.num_systematics = {}
for basename in nsort(os... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_analysis_pickle_files(self):\n # Make sure that there have been no more trials run since this\n # last processing. To do this, get the number of output files\n for basename in nsort(os.listdir(self.logdir)):\n m = self.labels.subdir_re.match(basename)\n if m is ... | [
"0.62867266",
"0.5869777",
"0.57111675",
"0.56638265",
"0.56591",
"0.5642142",
"0.56412804",
"0.5628937",
"0.56001437",
"0.5569801",
"0.5549839",
"0.55452734",
"0.5536951",
"0.5521253",
"0.55084103",
"0.5493605",
"0.5479555",
"0.5473778",
"0.5450664",
"0.54321855",
"0.5425721... | 0.726296 | 0 |
Checks for the expected pickle files in the output directory based on the analysis and test type. If they are there, it is made sure that they are the most up to date they can be. If not, they are regenerated. If they're not even there, then this returns false and the full extract_trials happens, at the end of which th... | def check_pickle_files(self, logdir_content):
if np.all(np.array(
[s in logdir_content for s in self.expected_pickles])):
# Processed output files are there
if self.test_type == 'analysis':
pickle_there = self.check_analysis_pickle_files()
elif... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_analysis_pickle_files(self):\n # Make sure that there have been no more trials run since this\n # last processing. To do this, get the number of output files\n for basename in nsort(os.listdir(self.logdir)):\n m = self.labels.subdir_re.match(basename)\n if m is ... | [
"0.74804336",
"0.68677115",
"0.68520236",
"0.624235",
"0.619025",
"0.619025",
"0.619025",
"0.61825603",
"0.61331385",
"0.61324614",
"0.6076257",
"0.60219663",
"0.6012466",
"0.6005059",
"0.589355",
"0.58896494",
"0.5851822",
"0.58213764",
"0.581834",
"0.5800745",
"0.5793738",
... | 0.7287332 | 1 |
Load from the pickle files created by the function above in a previous run of this script. | def load_from_pickle(self):
if 'data_sets.pckl' in self.expected_pickles:
self.data_sets = from_file(
os.path.join(self.logdir, 'data_sets.pckl')
)
if 'all_params.pckl' in self.expected_pickles:
self.all_params = from_file(
os.path.join... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load(self):\n self.results = pickle_load('results', self.main_dir)",
"def load(self,previous=True):\n\n\t\tincoming = pickle.load(open(self.filename,'rb'))\n\t\t#---reconstitute things that were bootstrapped\n\t\t#---we do not load spots because e.g. paths might have changed slightly in paths.yaml\n\t... | [
"0.7271801",
"0.6919902",
"0.6659956",
"0.65790224",
"0.65736276",
"0.6571005",
"0.65546054",
"0.6509931",
"0.64990234",
"0.6441593",
"0.6414154",
"0.6381304",
"0.6379868",
"0.63749075",
"0.6354041",
"0.6285822",
"0.6247445",
"0.6213039",
"0.62115943",
"0.62074655",
"0.61924"... | 0.72839826 | 0 |
Returns a dictionary that can be used to instantiate a binning object from the output of having run str on the original binning object. | def parse_binning_string(self, binning_string):
if 'MultiDimBinning' in binning_string:
raise ValueError(
'This function is designed to work with OneDimBinning'
' objects. You should separate the MultiDimBinning '
'string in to the separate OneDimBinni... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convertion_binaire_arbre(self):\r\n binary_code = self.root.conversion_binaire('')\r\n binary_dict = {}\r\n binary_code = binary_code.strip().split(\"\\n\")\r\n for element in binary_code:\r\n binary_dict[element.split(\":\")[0]] = element.split(\":\")[1]\r\n retur... | [
"0.63376933",
"0.58302873",
"0.5712815",
"0.5568688",
"0.5550412",
"0.5535233",
"0.5520286",
"0.547328",
"0.5428912",
"0.5312905",
"0.5286711",
"0.52865285",
"0.5265395",
"0.5260644",
"0.52409196",
"0.52212",
"0.51185364",
"0.5117805",
"0.510089",
"0.5096415",
"0.5080026",
... | 0.5917427 | 1 |
Will add a tex to binning dictionaries parsed with the above function. | def add_tex_to_binning(self, binning_dict):
if 'reco' in binning_dict['name']:
sub_string = 'reco'
elif 'true' in binning_dict['name']:
sub_string = 'true'
else:
sub_string = None
if 'energy' in binning_dict['name']:
binning_dict['tex'] = r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def addContent(text):",
"def add_text(text, x, y, rgb = [0, 0, 0], font_name = 'times new roman', size = 32, bold = False, italics = False, merged = False, slot = 0):\r\n \r\n font = pygame.font.SysFont(font_name, size, bold, italics)\r\n text = font.render(text, 1, rgb)\r\n \r\n if slot not in __... | [
"0.6415305",
"0.6120128",
"0.5747497",
"0.57183063",
"0.5609032",
"0.5543305",
"0.55359924",
"0.55032647",
"0.544469",
"0.5406383",
"0.53961784",
"0.5393155",
"0.53639346",
"0.53593594",
"0.53541887",
"0.5306513",
"0.5294787",
"0.5284086",
"0.5268617",
"0.5249339",
"0.5241891... | 0.7917948 | 0 |
Will return the value and units from a string with attached pintstyle units. i.e. the string "0.97 dimensionless" would return a value of 0.97 and units of dimensionless. Both will return as strings. | def parse_pint_string(self, pint_string):
val = pint_string.split(' ')[0]
units = pint_string.split(val+' ')[-1]
return val, units | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _parse(val: str):\n\n if not isinstance(val, str):\n raise TypeError(\"Method requires string input\")\n\n value = re.findall(r'^([-+]?\\d*\\.\\d*(?=\\s)|\\d+(?=\\s))', val)\n if not (value and val[:len(value[0])] == value[0]):\n return val, None\n\n # string starts with value\n va... | [
"0.75771165",
"0.69574887",
"0.6891569",
"0.6826737",
"0.66320306",
"0.65308064",
"0.65029943",
"0.6501026",
"0.6484532",
"0.6426572",
"0.6327252",
"0.6296739",
"0.62433565",
"0.61675125",
"0.60631317",
"0.60510516",
"0.60112405",
"0.6003281",
"0.6000804",
"0.59635186",
"0.59... | 0.75220835 | 1 |
Gets the data i.e. best fit metric and params over the scan. If a best fit was supplied it will also be extracted. If projections were supplied they will be stored after it has been verified they correspond to the variables in the 2D scan. Also stores the metric name to self. | def get_scan_data(self):
self.metric_name = self.scan_file_dict['results'][0]['metric']
data = {}
data['metric_vals'] = []
for result in self.scan_file_dict['results']:
data['metric_vals'].append(result['metric_val'])
for param_key in result['params'].keys():
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _extract_results(self) -> None:\n metric_name = self.metric.name\n for inference_name in ['train', 'test', 'opt']:\n # TODO: Extract information from self.search_results\n data = getattr(self.search_results, f'{inference_name}_metric_dict')[metric_name]\n if all([... | [
"0.5925412",
"0.54684275",
"0.5319413",
"0.52426094",
"0.5241499",
"0.5235758",
"0.5181388",
"0.51337177",
"0.5130021",
"0.5107968",
"0.5096636",
"0.5049843",
"0.50461984",
"0.5035674",
"0.49961236",
"0.49669728",
"0.4961523",
"0.495888",
"0.49494216",
"0.4942658",
"0.4941182... | 0.71103996 | 0 |
Extracts the best fit values from the best fit dictionary if it is not None | def get_best_fit(self, xlabel=None, ylabel=None):
if self.best_fit_data is not None:
if xlabel is not None:
best_fit_x = self.best_fit_data[xlabel]['val']
if ylabel is not None:
best_fit_y = self.best_fit_data[ylabel]['val']
sel... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getFit(self):\n if self.fits.has_key('default'):\n return self.fits['default']\n else:\n return None",
"def loadBestFit(self):\n bestFit, err = [], []\n row = 0\n with open(self.filename) as f:\n for lines in f.readlines():\n ... | [
"0.6548776",
"0.62535185",
"0.6234425",
"0.6166411",
"0.60802174",
"0.6035505",
"0.5889681",
"0.5885216",
"0.58641857",
"0.58259326",
"0.57619596",
"0.5760583",
"0.5660944",
"0.56407833",
"0.56287754",
"0.5622706",
"0.5606297",
"0.5571958",
"0.5533343",
"0.55174035",
"0.55024... | 0.6263292 | 1 |
Gets the projection data stored in self and assigns it as "X" or "Y" based on the passed x and y labels. | def sort_projection_data(self, data_key, xlabel, ylabel):
if self.projection_data is not None:
for i, proj_data in enumerate(self.projection_data):
if self.proj_bin_names[i] == xlabel:
xxvals = self.proj_bin_cens[i]
if 'metric_vals' in data_key... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __getitem__(self, idx):\n x = self.all_transforms(self.data[idx])\n y = self.labels[idx]\n return x, y",
"def coord(self, x, y):\n origin_x = self._raster_meta['transform'][3]\n origin_y = self._raster_meta['transform'][0]\n pixel_x = self._raster_meta['transform'][5... | [
"0.59876734",
"0.59742546",
"0.5865477",
"0.5824351",
"0.58152354",
"0.58072495",
"0.57806873",
"0.5748611",
"0.5747933",
"0.56925255",
"0.5661059",
"0.5647378",
"0.5630256",
"0.56221104",
"0.56188446",
"0.56050706",
"0.55664647",
"0.55655754",
"0.5559141",
"0.5516133",
"0.55... | 0.6477266 | 0 |
Makes the 1D scan plots. The x values as well as their labels/units can be specified here, or else they will be generated from what is stored in self | def plot_1d_scans(self, xvals=None, xlabel=None, xunits=None):
import matplotlib.pyplot as plt
plt.rcParams['text.usetex'] = True
if xvals is None:
xvals = self.all_bin_cens[0]
if xlabel is None:
xlabel = self.all_bin_names[0]
if xunits is None:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_1D_graph(self,datas):\n try:\n self.scan_y_axis=np.array([])\n if not self.plot_1D_ini: #init the datas\n self.plot_1D_ini = True\n\n self.scan_x_axis=np.min(self.scan_parameters.axis_2D_1)*np.ones((self.scan_parameters.Nsteps))\n ... | [
"0.6644594",
"0.61183566",
"0.60672086",
"0.6023758",
"0.59524286",
"0.5894383",
"0.58862007",
"0.58486307",
"0.58323145",
"0.5816988",
"0.5754839",
"0.57425827",
"0.5728998",
"0.5705451",
"0.570219",
"0.56951535",
"0.5677899",
"0.5670512",
"0.5670512",
"0.56543547",
"0.56469... | 0.7530415 | 0 |
Makes the 2D scan plots. The x and y bins as well as their labels/units can be specified here, or else they will be generated from what is stored in self | def plot_2d_scans(self, xbins=None, xlabel=None, xunits=None, xcens=None,
ybins=None, ylabel=None, yunits=None, ycens=None):
import matplotlib.pyplot as plt
plt.rcParams['text.usetex'] = True
if xbins is None:
xbins = self.all_bin_edges[0]
if xlabel is N... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def scan2plot(datafolder, start, end, first, last,\n theta_range, theta_bins, chi_range, chi_bins,\n gamma, delta,\n ci, cj, w, h, SDD, pxl_size, ph, d5i=None,\n fraction=1):\n chi_bins = int(chi_bins) # make sure the input is an int... | [
"0.66608685",
"0.63473773",
"0.6296814",
"0.6275673",
"0.6217716",
"0.61641383",
"0.60815233",
"0.60698354",
"0.5997655",
"0.59975684",
"0.59641445",
"0.5828824",
"0.58157873",
"0.58096063",
"0.58046407",
"0.5774008",
"0.57658654",
"0.5761014",
"0.5740929",
"0.5738022",
"0.57... | 0.7927479 | 0 |
Will add the pseudo experiments contained in self.values[injkey][fhkey] on to whatever is currently in plt. The idea is to overlay them on top of contours, so it will find the appropriate dimensions from xlabel and ylabel. | def add_pseudo_experiments(self, xlabel, ylabel, injkey, fhkey):
import matplotlib.pyplot as plt
plt.rcParams['text.usetex'] = True
xdata = self.values[injkey][fhkey][xlabel]
ydata = self.values[injkey][fhkey][ylabel]
self.make_2d_scatter_plot(
xdata=xdata['vals'],
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_inj_fid_lines(self, injkey, systkey, fhkey, smalllabel=False):\n import matplotlib.pyplot as plt\n plt.rcParams['text.usetex'] = True\n h0_params, h1_params = self.get_resulting_hypo_params(\n injkey=injkey\n )\n data_params = self.get_injected_params()\n ... | [
"0.5932749",
"0.55264795",
"0.54631686",
"0.5407899",
"0.5406889",
"0.54053706",
"0.5312148",
"0.5271846",
"0.5248222",
"0.52249974",
"0.5221811",
"0.51672757",
"0.5151767",
"0.51415175",
"0.51380986",
"0.5114779",
"0.50833344",
"0.50827813",
"0.50716823",
"0.5053716",
"0.503... | 0.7629535 | 0 |
Adds the other contours stored in self.contours_dict to the plot if they exist and if the variables match. | def add_other_contours(self, xlabel, ylabel):
import matplotlib.pyplot as plt
plt.rcParams['text.usetex'] = True
for contour_dict in self.contour_dicts:
if (xlabel in contour_dict['vars']) and \
(ylabel in contour_dict['vars']):
if isinstance(contour_di... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_contours(self, std1, corr1, std2, corr2, **kwargs):\n\n t = np.linspace(np.arccos(corr1), np.arccos(corr2))\n r = np.linspace(std1, std2)\n\n return self.ax.plot(t, r, 'red', linewidth=2)",
"def add_to_plot(self, m=None, **kwargs):\n\n if m is None:\n logger.debug(\... | [
"0.5916088",
"0.5748664",
"0.5647886",
"0.56115025",
"0.54560316",
"0.5301016",
"0.5141471",
"0.51354855",
"0.50482905",
"0.50482905",
"0.50370485",
"0.5035878",
"0.5006762",
"0.49654138",
"0.49621144",
"0.49573603",
"0.49323016",
"0.48814455",
"0.48131633",
"0.4805807",
"0.4... | 0.7698208 | 0 |
Makes a label for the data accounting for detector and selection. If these are not set it will default to IceCube. | def make_data_label(self):
data_label = ""
if self.detector is not None:
data_label += "%s "%self.detector
if self.selection is not None:
data_label += "%s Event Selection"%self.selection
if data_label == "":
data_label = "IceCube"
return data_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def label(self):\r\n raise NotImplementedError",
"def _get_label(self):\n if self.model.name == '':\n return \"KPI\"\n return \"KPI: {} ({})\".format(self.model.name, self.model.objective)",
"def Label(self) -> str:",
"def label(self):\n return ''",
"def rec_default(s... | [
"0.63296264",
"0.62596077",
"0.6249383",
"0.6222487",
"0.6166218",
"0.61249244",
"0.6102576",
"0.6079788",
"0.6079788",
"0.6079788",
"0.6079788",
"0.6079788",
"0.6053153",
"0.60513055",
"0.60513055",
"0.60453486",
"0.6010187",
"0.6001936",
"0.5987295",
"0.5980009",
"0.5954842... | 0.84175277 | 0 |
Make main title accounting for detector and selection. Set end_center to true if you will not be using this with a corresponding fit title | def make_main_title(self, end, end_center=False):
main_title = r"\begin{center}"
if self.detector is not None:
main_title += "%s "%self.detector
if self.selection is not None:
main_title += "%s Event Selection "%self.selection
main_title += end
if end_cent... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def crop_title(self):\n top_line_and_words = self.get_line_and_word_boxes()\n top_line_and_words = [boxes for boxes in self.get_line_and_word_boxes() if boxes.content not in self.ocr_noise]\n if top_line_and_words:\n topleft, bottomright = top_line_and_words[0].position\n ... | [
"0.6361921",
"0.6303799",
"0.62947977",
"0.6008677",
"0.57851106",
"0.5700407",
"0.5696584",
"0.5695662",
"0.5684761",
"0.56713605",
"0.566839",
"0.5650738",
"0.5642533",
"0.55933607",
"0.5590293",
"0.5570986",
"0.5560867",
"0.5547633",
"0.5545038",
"0.5544574",
"0.55168515",... | 0.7789072 | 0 |
Generic 1D histogram plotting function. Set subplots_adjust to True if the title goes over two lines and you need the plot to account for this. | def make_1d_hist_plot(self, data, xlabel, title, ylabel, bins=10,
histtype='bar', color='darkblue', alpha=0.9,
xlabelsize='18', ylabelsize='18',
titlesize=16, label=None, subplots_adjust=True,
subplotnum=None, lw=1, ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_histograms(p_hist, p_hbins, title, figure_path=None):\n\n base_fig_size = 7\n h_fig = base_fig_size\n w_fig = base_fig_size * 4\n\n fig = plt.figure(figsize=(w_fig, h_fig))\n fig.suptitle(title)\n iplot = 0\n\n p_Nx, p_Ny = np.amax(p_hbins, axis=1) + 1\n\n p_hist = np.reshape(p_his... | [
"0.62627107",
"0.62239265",
"0.6064248",
"0.6062732",
"0.5998413",
"0.5998413",
"0.5998413",
"0.5968805",
"0.5953566",
"0.59146076",
"0.5878597",
"0.5854131",
"0.58339065",
"0.58211905",
"0.5820869",
"0.58061105",
"0.5802937",
"0.5794254",
"0.57590634",
"0.5756191",
"0.575216... | 0.6927863 | 0 |
Generic 1D graph plotting function. The x limits will be set as the edges of the xvals unless overwritten. Set this to None to leave it as matplotlib dictates. The y limits will be left alone unless overwritten. | def make_1d_graph(self, xvals, yvals, xlabel, xunits,
ylabel, yunits, nicexlabel=True,
niceylabel=True ,xlims='edges', ylims=None,
linestyle='-', color='darkblue', alpha=0.9,
xlabelsize='18', ylabelsize='18', marker=None,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot(self, plot_limits=None, which_data_rows='all',\r\n which_data_ycols='all', which_parts='all', fixed_inputs=[],\r\n levels=20, samples=0, fignum=None, ax=None, resolution=None,\r\n plot_raw=False,\r\n linecol=Tango.colorsHex['darkBlue'],fillcol=Tango.colorsHex['l... | [
"0.6485056",
"0.63145745",
"0.62213546",
"0.6065079",
"0.6055868",
"0.6054931",
"0.60450286",
"0.60388345",
"0.60251397",
"0.59915364",
"0.5990588",
"0.5977358",
"0.59749585",
"0.59741163",
"0.5955796",
"0.5945236",
"0.59308445",
"0.59199756",
"0.5904594",
"0.5902235",
"0.589... | 0.73218745 | 0 |
Generic 2D histogramstyle plotting function. Set zlabel to contour to make a contour plot instead of a histogram. cmap will be Blues unless explicitly overwritten. If any of the units are set None then the make_label function will just apply self.tex_axis_label to the string passed in either xlabel, ylabel or zlabel. S... | def make_2d_hist_plot(self, zvals, xbins, ybins, xlabel,
ylabel, zlabel, xunits=None, yunits=None,
zunits=None, cmap=None, xticks=None,
yticks=None, xxvals=None, xyvals=None,
yxvals=None, yyvals=None):
import... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _labels_contour(self, obj, *args, fmt=None, **kwargs):\n # Parse input args\n text_kw = {}\n for key in (*kwargs,): # allow dict to change size\n if key not in (\n 'levels', 'colors', 'fontsize', 'inline', 'inline_spacing',\n 'manual', 'rightside_up', 'use_clabeltext',\n ... | [
"0.5941876",
"0.59182435",
"0.5882927",
"0.5783604",
"0.56942695",
"0.5677811",
"0.564295",
"0.5620297",
"0.5551694",
"0.55511874",
"0.5549509",
"0.5548978",
"0.5524462",
"0.5507563",
"0.5503709",
"0.5495775",
"0.5486568",
"0.54782057",
"0.54568225",
"0.5427221",
"0.5424873",... | 0.73704165 | 0 |
Adds annotations to bins of 2D hist. Expects to be able to import PathEffects and will fail if it can't. | def add_annotation_to_2d_hist(self, annotations):
import matplotlib.pyplot as plt
plt.rcParams['text.usetex'] = True
try:
import matplotlib.patheffects as PathEffects
except:
raise ImportError()
for i in range(0, len(annotations)):
for j in ra... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def addHistogram2D(self, name, title, n_bins_x, minimum_x, maximum_x, n_bins_y, minimum_y, maximum_y):\n\t\tself.histograms[ name ] = ROOT.TH2F(name, title, n_bins_x, minimum_x, maximum_x, n_bins_y, minimum_y, maximum_y)",
"def test_format_histograms_two_bins(self):\r\n self.assertEqual(format_histograms_... | [
"0.5888389",
"0.5560298",
"0.55035645",
"0.54431117",
"0.54309326",
"0.524252",
"0.5239554",
"0.52292675",
"0.5180486",
"0.516701",
"0.5163754",
"0.5124673",
"0.5099183",
"0.504256",
"0.5037948",
"0.5035341",
"0.5029076",
"0.50108224",
"0.49997157",
"0.498007",
"0.4947475",
... | 0.76115656 | 0 |
Make file name for tex output files | def make_tex_name(self, end):
tex_name = ""
if hasattr(self, 'labels'):
if self.labels.dict['data_name'] == '':
tex_name += "data_"
else:
tex_name += "true_%s_"%self.labels.dict['data_name']
if self.detector is not None:
tex_nam... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def outname(self,sctn):\n return '%s_%s.html'%(self.basename,sctn)",
"def getOutputFilename(self, filename):\n return filename[:-4] + \".txt\"",
"def MakeTexStr(self):\n if self._latex_str == '':\n self._latex_str += bmr_hdr.format(\n self._filename.replace('.tex'... | [
"0.69431376",
"0.69284415",
"0.6692531",
"0.6520139",
"0.6499096",
"0.6484681",
"0.64658284",
"0.643551",
"0.6427567",
"0.64271116",
"0.6346323",
"0.6344557",
"0.63130623",
"0.62780654",
"0.6237424",
"0.62370497",
"0.62023324",
"0.6198988",
"0.6190018",
"0.61797404",
"0.61651... | 0.7358767 | 0 |
Appends units to a label for plotting. | def make_label(self, label, units):
nice_label = self.tex_axis_label(label)
if not (units == 'dimensionless') and \
(units is not None) and (not units == []):
nice_label += ' (%s)'%self.tex_axis_label(units)
return nice_label | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unit_label(self, unit_label):\n\n self._unit_label = unit_label",
"def unit_label(self, unit_label):\n\n self._unit_label = unit_label",
"def unit_label(self, unit_label):\n\n self._unit_label = unit_label",
"def xaxis(self,label,units):\r\n if units != \"\": label = label + \... | [
"0.70381373",
"0.70381373",
"0.70381373",
"0.7023313",
"0.6791733",
"0.6738754",
"0.6726887",
"0.65149724",
"0.64378643",
"0.64362586",
"0.6355754",
"0.63540727",
"0.63355327",
"0.628389",
"0.62706244",
"0.62698686",
"0.61913335",
"0.6166705",
"0.6145906",
"0.6117424",
"0.608... | 0.778756 | 0 |
Will return a standard marker style for plots similar to above. | def marker_style(self, label):
label = label.lower()
pretty_markers = {}
# NMO
pretty_markers['no'] = 'o'
pretty_markers['io'] = 'o'
# LLR
pretty_markers['true no, llr'] = 'D'
pretty_markers['true io, llr'] = 'D'
# Asimov Fits
pretty_marker... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def marker(self):\r\n return _marker_of(self.api.paramstyle)",
"def get_markerstyles(n=None):\n all_markers = ['o', 'D', 's', '2', '*', 'h', '8', 'v', 'x', '+', 5, 'd', '>', 7, '.', '1', 'p', '3',\n 6, 0, 1, 2, 3, 4, '4', '<', 'H', '^']\n # Note: 0: 'tickleft', 1: 'tickright', 2: '... | [
"0.66262615",
"0.6413862",
"0.6271068",
"0.6214102",
"0.5884928",
"0.58787495",
"0.5839927",
"0.5802169",
"0.5793659",
"0.57475233",
"0.572977",
"0.5662963",
"0.5614811",
"0.5599981",
"0.5526797",
"0.5511069",
"0.5495124",
"0.5492773",
"0.544898",
"0.5447645",
"0.5446655",
... | 0.6914914 | 0 |
Return a file from the server. | def get_file():
fname = get_var(request, "fname")
return open(fname).read() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_file(self, path):\n file = self.get('data_request?id=file¶meters=%s' % path)\n return file",
"def get_file(self, sys_id):\n url = \"{}/file\".format(self._target(sys_id))\n r = self._client.session.get(url, stream=True)\n return r",
"def get_file(self, file_id):\n... | [
"0.76377547",
"0.74229974",
"0.73233753",
"0.72922075",
"0.7162754",
"0.705735",
"0.6985184",
"0.697746",
"0.6939429",
"0.67866474",
"0.66845554",
"0.6684502",
"0.6677772",
"0.6668152",
"0.6665581",
"0.66364133",
"0.65794694",
"0.65625036",
"0.65248036",
"0.65073395",
"0.6482... | 0.743078 | 1 |
Decrements item's value in the dictionary, then removes it entirely if the value is zero. | def remove_from_inventory(self, item):
if item in self.inventory:
self.inventory[item] -= 1
if self.inventory[item] == 0:
del self.inventory[item] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def discard(self, item):\n try:\n counter = self._get(item) - 1\n except KeyError:\n return\n\n if counter <= 0:\n self._del(item)\n else:\n self._set(item, counter)",
"def remove_from_inv(self, item):\n assert item in self.inv\n\n ... | [
"0.7264672",
"0.6691969",
"0.6689295",
"0.6673481",
"0.6667543",
"0.66662663",
"0.65985435",
"0.65209067",
"0.65117365",
"0.649431",
"0.6472762",
"0.6426821",
"0.63527924",
"0.63218147",
"0.631182",
"0.62914985",
"0.62708926",
"0.6269239",
"0.62661314",
"0.62656766",
"0.62038... | 0.6723191 | 1 |
Generates an xbyy world pseudorandomly; represents it as a list of x lists of y length; [i,j]. | def generate_world(x_size, y_size):
def make_blank_world():
"""
Creates an x-by-y list of lists of zeroes.
"""
blank_array = [[Blank() for j in range(y_size + 1)] for i in range(x_size + 1)]
return blank_array
def check_surroundings(x_coord, y_coord, value):
"""
If the variable world has already been... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generator(self, random, args):\r\n locations = [i for i in range(len(self.weights))]\r\n random.shuffle(locations)\r\n return locations",
"def gen_world(num_rows, num_cols):\n world = collections.deque()\n\n # Generate top perimeter.\n world.append([eg.ROCK] * num_cols)\n\n #... | [
"0.6483928",
"0.63846076",
"0.62667",
"0.6217251",
"0.61609775",
"0.6115045",
"0.6074034",
"0.6059301",
"0.602943",
"0.6024061",
"0.60172635",
"0.6014234",
"0.6008224",
"0.59639657",
"0.5955837",
"0.5920709",
"0.59136313",
"0.58865565",
"0.5878005",
"0.58595014",
"0.5816322",... | 0.7216162 | 0 |
If the variable world has already been defined, it checks all x and y coords within one square (aka, checks the 8 surrounding squares) for a given value. If that value is present in 1 or more squares, returns True; else, False. | def check_surroundings(x_coord, y_coord, value):
for i in range(3):
for j in range(3):
examining = world[x_coord - 1 + i][y_coord - 1 + j]
if examining.name == value:
return True
else:
pass
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _is_valid_land(x, y, grid):\n return (x >= 0) and (x < len(grid)) and (y >= 0) and (y < len(grid[0])) and grid[x][y]",
"def square_is(position, expected, world):\n\n result = False\n size = len(world) - 1\n\n if size >= position[0] >= 0 and size >= position[1] >= 0:\n result = world[positi... | [
"0.6923621",
"0.6874705",
"0.6691229",
"0.6607222",
"0.6586094",
"0.6548498",
"0.654123",
"0.6539253",
"0.6537838",
"0.65169126",
"0.6485216",
"0.647967",
"0.6457804",
"0.64500254",
"0.64481795",
"0.6400436",
"0.6391711",
"0.6385541",
"0.6306724",
"0.630531",
"0.628483",
"0... | 0.7621908 | 0 |
Creates a default filters settings. | def init_filters(model: Model, settings: Model) -> None:
filters = [
{"name": "Project", "filtration_type": "drop-down"},
{"name": "Attachments", "filtration_type": "numeric"},
{"name": "Priority", "filtration_type": "drop-down"},
{"name": "Resolved", "filtration_type": "date"},
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_default_filters(fprime_test_api):\n set_event_filter(fprime_test_api, \"COMMAND\", True)\n set_event_filter(fprime_test_api, \"ACTIVITY_LO\", True)\n set_event_filter(fprime_test_api, \"ACTIVITY_HI\", True)\n set_event_filter(fprime_test_api, \"WARNING_LO\", True)\n set_event_filter(fprime_t... | [
"0.64866245",
"0.64842784",
"0.64290845",
"0.6326877",
"0.6318466",
"0.620594",
"0.6167129",
"0.6141263",
"0.6137917",
"0.6096326",
"0.6041673",
"0.6035157",
"0.60348",
"0.59695554",
"0.5958591",
"0.5949699",
"0.58919203",
"0.5874647",
"0.5873281",
"0.5855998",
"0.58270985",
... | 0.7165071 | 0 |
Creates a default predictions table settings. | def init_predictions_table(model: Model, settings: Model) -> None:
names = [
"Issue Key",
"Priority",
"Area of Testing",
"Time to Resolve",
"Summary",
]
for position, name in enumerate(names, 1):
model.objects.create(
name=name, is_default=True, p... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_predictions_table(\n model: Model, settings: int, fields: list\n) -> None:\n\n def _validate_default_fields() -> None:\n \"\"\" Checks that all default fields exist.\n \"\"\"\n default_fields = [\n field\n for field in fields\n if field[\"name\... | [
"0.58788294",
"0.58788127",
"0.58697605",
"0.5833345",
"0.57700706",
"0.5646558",
"0.56268597",
"0.55646074",
"0.5564114",
"0.553025",
"0.5489872",
"0.5489841",
"0.5479846",
"0.538937",
"0.5371385",
"0.5360282",
"0.5346717",
"0.53413445",
"0.5319281",
"0.5308475",
"0.53047025... | 0.77480644 | 0 |
Reads settings and appends it to request. | def read_settings(request_data: list, user: Model) -> None:
# To avoid a circular dependency
from apps.settings.models import UserSettings
user_settings = UserSettings.objects.get(user=user).id
for obj in request_data:
obj["settings"] = user_settings | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cont_settings_(request):\n \n return {\"settings\": settings}",
"def read_settings(self):\n self.settings = read_settings(self.settings_path)",
"def get_settings(self):\n return self.request({\n \"path\": \"/\" + UUID + \"/setting\"\n })",
"def process_settings(self,... | [
"0.617495",
"0.61487275",
"0.59560287",
"0.57708865",
"0.569904",
"0.5627346",
"0.5602178",
"0.55950576",
"0.555576",
"0.5535441",
"0.55109507",
"0.54859006",
"0.5465674",
"0.54568547",
"0.54190606",
"0.53909093",
"0.5389981",
"0.53186214",
"0.52975476",
"0.5284495",
"0.52814... | 0.65334314 | 0 |
Updates predictions table settings. | def update_predictions_table(
model: Model, settings: int, fields: list
) -> None:
def _validate_default_fields() -> None:
""" Checks that all default fields exist.
"""
default_fields = [
field
for field in fields
if field["name"] in DEFAULT_PREDICTIO... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_predictions_table(model: Model, settings: Model) -> None:\n names = [\n \"Issue Key\",\n \"Priority\",\n \"Area of Testing\",\n \"Time to Resolve\",\n \"Summary\",\n ]\n\n for position, name in enumerate(names, 1):\n model.objects.create(\n nam... | [
"0.6175003",
"0.5823503",
"0.5804823",
"0.57714736",
"0.5620576",
"0.5598627",
"0.5513129",
"0.5512739",
"0.5468119",
"0.5390218",
"0.53849834",
"0.53572583",
"0.5331497",
"0.5331116",
"0.5259351",
"0.5250642",
"0.52105343",
"0.52077234",
"0.5185537",
"0.5134399",
"0.5132829"... | 0.71172005 | 0 |
Checks that all default fields exist. | def _validate_default_fields() -> None:
default_fields = [
field
for field in fields
if field["name"] in DEFAULT_PREDICTIONS_TABLE_FIELDS
]
if len(DEFAULT_PREDICTIONS_TABLE_FIELDS) != len(default_fields):
raise NotFilledDefaultFields | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_default_values_as_needed(self):\n if self.verbose:\n click.echo('Updating required default values')\n for field in ARGUMENTS_DEFAULT_VALUES:\n if self.__class__.__name__ in ARGUMENTS_DEFAULT_VALUES[field][1]:\n self.data[field] = ARGUMENTS_DEFAULT_VALUES[f... | [
"0.6785172",
"0.67640036",
"0.66145116",
"0.64149505",
"0.6290433",
"0.6286958",
"0.6263799",
"0.62595856",
"0.62441874",
"0.6219781",
"0.62121505",
"0.6209891",
"0.61872697",
"0.61658293",
"0.6164831",
"0.6109033",
"0.60906994",
"0.60266364",
"0.6026252",
"0.6006877",
"0.598... | 0.8353444 | 0 |
Reads QA Metrics settings. | def get_qa_metrics_settings(user: Model) -> list:
# To avoid a circular dependency
from apps.settings.models import UserSettings, UserQAMetricsFilter
from apps.settings.serializers import UserQAMetricsFilterSerializer
user_settings = UserSettings.objects.get(user=user)
qa_metrics_settings = UserQA... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_metrics(self):\n raise NotImplementedError()",
"def ammeter_settings(self, scalefactor=None, offset=None):\n if scalefactor is not None and offset is not None:\n if self._request('SA', str(scalefactor), str(offset))[0]:\n return scalefactor, offset\n else:\... | [
"0.6085868",
"0.6044417",
"0.5912",
"0.5875278",
"0.5790326",
"0.5696173",
"0.5610436",
"0.5518769",
"0.5385837",
"0.5352083",
"0.5342885",
"0.531132",
"0.5308647",
"0.5290081",
"0.52740335",
"0.5253361",
"0.52450436",
"0.5236111",
"0.52233446",
"0.52091247",
"0.5190823",
"... | 0.65248734 | 0 |
Reads predictions table settings. | def get_predictions_table_settings(user: Model) -> list:
# To avoid a circular dependency
from apps.settings.models import UserSettings, UserPredictionsTable
from apps.settings.serializers import UserPredictionsTableSerializer
user_settings = UserSettings.objects.get(user=user)
qa_metrics_settings... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fetch_predictor_config():\n try:\n f = open(os.path.join(CONFIG['results_path'], CONFIG['predictor_model_dir'], 'config.csv'), 'r')\n f.readline()\n values = f.readline().split(',')\n f.close()\n return int(values[0]), str(values[2]).strip()\n except:\n # If this... | [
"0.5682714",
"0.5593973",
"0.5587034",
"0.5313543",
"0.5227927",
"0.5175241",
"0.5127814",
"0.5116795",
"0.5076708",
"0.5075844",
"0.5025572",
"0.5024749",
"0.50127625",
"0.49658668",
"0.4957252",
"0.49491662",
"0.49355903",
"0.48802587",
"0.48465377",
"0.48452362",
"0.484439... | 0.60339624 | 0 |
Appends resolutions to predictions_table settings if their were not added. | def update_resolutions(request_data: dict, user: Model) -> None:
def _delete_old_resolutions(old_resolutions) -> None:
""" Deletes resolution from predictions_table
if it's not specified in training settings.
Parameters:
----------
old_resolutions:
Resolutions f... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_predictions_table(\n model: Model, settings: int, fields: list\n) -> None:\n\n def _validate_default_fields() -> None:\n \"\"\" Checks that all default fields exist.\n \"\"\"\n default_fields = [\n field\n for field in fields\n if field[\"name\... | [
"0.5421767",
"0.52307594",
"0.5028329",
"0.49395114",
"0.49374145",
"0.4877448",
"0.48751575",
"0.4868329",
"0.4868329",
"0.47682875",
"0.47288063",
"0.47134253",
"0.47080007",
"0.47050992",
"0.46616036",
"0.45992485",
"0.4584751",
"0.45742348",
"0.45624346",
"0.4534579",
"0.... | 0.631596 | 0 |
Deletes resolution from predictions_table if it's not specified in training settings. | def _delete_old_resolutions(old_resolutions) -> None:
for resolution in old_resolutions:
UserPredictionsTable.objects.filter(
settings=user_settings, name=resolution
).delete() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _untrain(self):\n # untrain the mapper\n if self.__mapper is not None:\n self.__mapper.untrain()\n # let base class untrain as well\n super(MappedClassifier, self)._untrain()",
"def update_predictions_table(\n model: Model, settings: int, fields: list\n) -> None:\n\n... | [
"0.5609016",
"0.5577751",
"0.55172443",
"0.5487114",
"0.54756874",
"0.5376667",
"0.52152824",
"0.520584",
"0.5165316",
"0.51630306",
"0.5126673",
"0.5122098",
"0.51201034",
"0.51133114",
"0.5088917",
"0.5088917",
"0.50463104",
"0.50100803",
"0.49901834",
"0.49751484",
"0.4969... | 0.5746226 | 0 |
In this method, we want to check to see if all arguments (except self) are passed in as kwargs. Additionally, we want to have an informative error for when args are passed in incorrectly. The requirement to only use kwargs is a bit of an exotic one and some Python users might not be used to it. Thus, a good error messa... | def check_args(*args: Tuple[Any, ...], **kwargs: Any) -> None:
# We begin by initializing the maximum number of args we will allow at 0. We will iterate
# this if by chance we see an argument whose name is "self".
max_arg_len = 0
# iterate through every parameter passed in
for ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __checkArgs(self, kwargs):\n requiredArgs = self.__class__.__requiredArgs + \\\n self.__class__.__singleCompArgs if self.singleComp else\\\n self.__class__.__requiredArgs + self.__class__.__doubleCompArgs\n for arg in requiredArgs:\n if arg not in kwargs:\n ... | [
"0.8378385",
"0.77203506",
"0.75318027",
"0.74876165",
"0.74336404",
"0.74110144",
"0.73598033",
"0.724189",
"0.72176605",
"0.71550375",
"0.7127701",
"0.7079227",
"0.7071005",
"0.704172",
"0.69410723",
"0.6916919",
"0.6909978",
"0.68734956",
"0.68025917",
"0.67532927",
"0.672... | 0.78046554 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.