query
stringlengths
9
3.4k
document
stringlengths
9
87.4k
metadata
dict
negatives
listlengths
4
101
negative_scores
listlengths
4
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Test the failure of the function for returning the desired residue data container. The function tested is pipe_control.mol_res_spin.return_residue().
def test_return_residue_pipe_fail(self): # Try to get a residue from a missing data pipe. self.assertRaises(RelaxNoPipeError, mol_res_spin.return_residue, selection=':2', pipe='new')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_return_residue(self):\n\n # Ask for a few residues.\n res1 = mol_res_spin.return_residue(':1')\n res2 = mol_res_spin.return_residue(selection=':2')\n res4 = mol_res_spin.return_residue(selection=':4', pipe='orig')\n res5 = mol_res_spin.return_residue(selection='#RNA:-5',...
[ "0.8170825", "0.738827", "0.7088673", "0.6640738", "0.64614236", "0.6410077", "0.6326799", "0.628192", "0.6172335", "0.6162224", "0.61231905", "0.60759443", "0.6006672", "0.59830487", "0.5976972", "0.588619", "0.58454573", "0.5789694", "0.56599325", "0.55045515", "0.5500338",...
0.748504
1
Test the function for returning the desired residue data container. The function tested is pipe_control.mol_res_spin.return_single_residue_info().
def test_return_single_residue_info(self): # Ask for a few residues. res1 = mol_res_spin.return_single_residue_info('1') res2 = mol_res_spin.return_single_residue_info('2,Glu') res4 = mol_res_spin.return_single_residue_info('Pro,4') res5 = mol_res_spin.return_single_residue_info...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_return_residue(self):\n\n # Ask for a few residues.\n res1 = mol_res_spin.return_residue(':1')\n res2 = mol_res_spin.return_residue(selection=':2')\n res4 = mol_res_spin.return_residue(selection=':4', pipe='orig')\n res5 = mol_res_spin.return_residue(selection='#RNA:-5',...
[ "0.7970382", "0.7181199", "0.6772322", "0.61946106", "0.618991", "0.60239536", "0.59026784", "0.5900764", "0.5900667", "0.5892051", "0.57719076", "0.5698098", "0.56888527", "0.5679066", "0.5602712", "0.55790323", "0.55473787", "0.55005234", "0.5484408", "0.544164", "0.542363"...
0.8470204
0
Test the failure of the function for returning the desired residue data container. The function tested is pipe_control.mol_res_spin.return_single_residue_info().
def test_return_single_residue_info_fail(self): # Ask for a few residues. self.assertRaises(RelaxError, mol_res_spin.return_single_residue_info, '1,2') self.assertRaises(RelaxError, mol_res_spin.return_single_residue_info, '1,Glu,Pro') self.assertRaises(RelaxError, mol_res_spin.return_s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_return_single_residue_info(self):\n\n # Ask for a few residues.\n res1 = mol_res_spin.return_single_residue_info('1')\n res2 = mol_res_spin.return_single_residue_info('2,Glu')\n res4 = mol_res_spin.return_single_residue_info('Pro,4')\n res5 = mol_res_spin.return_single_r...
[ "0.79661804", "0.7835014", "0.69599706", "0.63726276", "0.6243398", "0.61490476", "0.60890734", "0.6079709", "0.5994329", "0.59389675", "0.5879574", "0.5872051", "0.57941824", "0.5751928", "0.57405704", "0.5738197", "0.5649554", "0.5574121", "0.5553376", "0.55352575", "0.5525...
0.7993023
0
Test the function for returning the desired spin data container. The function tested is pipe_control.mol_res_spin.return_spin().
def test_return_spin(self): # Ask for a few spins. spin1 = mol_res_spin.return_spin('#Ap4Aase:1') spin2 = mol_res_spin.return_spin(spin_id='#Ap4Aase:2') spin3 = mol_res_spin.return_spin(spin_id='#Ap4Aase:4', pipe='orig') spin4 = mol_res_spin.return_spin(spin_id='#RNA:-5@N5', pip...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_return_spin_pipe_fail(self):\n\n # Try to get a spin from a missing data pipe.\n self.assertRaises(RelaxNoPipeError, mol_res_spin.return_spin, spin_id=':2', pipe='new')", "def test_return_molecule(self):\n\n # Ask for a few molecules.\n mol1 = mol_res_spin.return_molecule('#A...
[ "0.6254745", "0.62498236", "0.62125456", "0.6161361", "0.6015934", "0.597637", "0.58106077", "0.57989025", "0.57807255", "0.5775557", "0.57453865", "0.5677636", "0.56534547", "0.5535556", "0.55239886", "0.53587866", "0.5336745", "0.5311502", "0.52942914", "0.5217297", "0.5215...
0.8249369
0
Test the failure of the function for returning the desired spin data container. The function tested is pipe_control.mol_res_spin.return_spin().
def test_return_spin_pipe_fail(self): # Try to get a spin from a missing data pipe. self.assertRaises(RelaxNoPipeError, mol_res_spin.return_spin, spin_id=':2', pipe='new')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_return_spin(self):\n\n # Ask for a few spins.\n spin1 = mol_res_spin.return_spin('#Ap4Aase:1')\n spin2 = mol_res_spin.return_spin(spin_id='#Ap4Aase:2')\n spin3 = mol_res_spin.return_spin(spin_id='#Ap4Aase:4', pipe='orig')\n spin4 = mol_res_spin.return_spin(spin_id='#RNA:...
[ "0.78494513", "0.66188395", "0.6351322", "0.63377", "0.63215846", "0.62711096", "0.6125446", "0.6110812", "0.59731114", "0.5921803", "0.589555", "0.5886584", "0.572914", "0.5577149", "0.5547649", "0.550307", "0.5490488", "0.5437511", "0.5385294", "0.5323193", "0.52905536", ...
0.7464118
1
Test the proper operation of the spin loop with spin selection. The function tested is pipe_control.mol_res_spin.spin_loop().
def test_spin_loop(self): # Spin data. select = [1, 0] # Loop over the spins. i = 0 for spin in mol_res_spin.spin_loop('@N5'): # Test the selection. self.assertEqual(spin.select, select[i]) # Test the spin names. self.assertEqual...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_spin_loop_no_selection(self):\n\n # Spin data.\n select = [0, 1, 0, 0, 1, 1, 0, 1]\n name = ['NH', 'NH', None, 'C8', 'N5', 'C8', 'N5', '2H']\n\n # Loop over the spins.\n i = 0\n for spin in mol_res_spin.spin_loop():\n # Test the selection.\n ...
[ "0.76839185", "0.7019713", "0.68919516", "0.68854254", "0.65529144", "0.6440893", "0.6163988", "0.59719443", "0.5952859", "0.59403336", "0.5869492", "0.5838458", "0.5775429", "0.5759338", "0.569917", "0.56271356", "0.5577104", "0.55301183", "0.549381", "0.54663414", "0.538889...
0.8171222
0
Test the proper operation of the spin loop with spin selection '|'. The function tested is pipe_control.mol_res_spin.spin_loop().
def test_spin_loop_multiatom(self): # Spin data. select = [0, 1, 1, 0] name = ['NH', 'NH', 'N5', 'N5'] # Loop over the spins. i = 0 for spin in mol_res_spin.spin_loop('@NH|@N5'): # Test the selection. self.assertEqual(spin.select, select[i]) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_spin_loop(self):\n\n # Spin data.\n select = [1, 0]\n\n # Loop over the spins.\n i = 0\n for spin in mol_res_spin.spin_loop('@N5'):\n # Test the selection.\n self.assertEqual(spin.select, select[i])\n\n # Test the spin names.\n ...
[ "0.79278994", "0.73636407", "0.73381263", "0.7112621", "0.6873909", "0.64583564", "0.638243", "0.6248901", "0.5991681", "0.5833193", "0.5816119", "0.5754139", "0.57313025", "0.5710049", "0.56814057", "0.560137", "0.5573722", "0.5518391", "0.54985505", "0.5454692", "0.542185",...
0.6567738
5
Test the proper operation of the spin loop when no data is present. The function tested is pipe_control.mol_res_spin.spin_loop().
def test_spin_loop_no_data(self): # Reset relax. reset() # Add a data pipe to the data store. ds.add(pipe_name='orig', pipe_type='mf') # Loop over the spins. i = 0 for spin in mol_res_spin.spin_loop(): i = i + 1 # Test loop length. ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_spin_loop_no_pipe(self):\n\n # Reset relax.\n reset()\n\n # Function for the problem of catching an error in a generator function.\n def fail_test():\n for spin in mol_res_spin.spin_loop():\n pass\n\n # Test for the no pipe error.\n self....
[ "0.7811089", "0.7292637", "0.7291406", "0.7091763", "0.6846889", "0.6789092", "0.6699432", "0.66825855", "0.66130304", "0.63301605", "0.61651087", "0.6073626", "0.5983543", "0.5924072", "0.5917373", "0.591516", "0.58277524", "0.5808656", "0.5755179", "0.5706209", "0.56306875"...
0.87055194
0
Test the proper operation of the spin loop when no data pipe is present. The function tested is pipe_control.mol_res_spin.spin_loop().
def test_spin_loop_no_pipe(self): # Reset relax. reset() # Function for the problem of catching an error in a generator function. def fail_test(): for spin in mol_res_spin.spin_loop(): pass # Test for the no pipe error. self.assertRaises(Rel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_spin_loop_no_data(self):\n\n # Reset relax.\n reset()\n\n # Add a data pipe to the data store.\n ds.add(pipe_name='orig', pipe_type='mf')\n\n # Loop over the spins.\n i = 0\n for spin in mol_res_spin.spin_loop():\n i = i + 1\n\n # Test loo...
[ "0.8414788", "0.7601054", "0.7113457", "0.7043407", "0.7001332", "0.673422", "0.66587317", "0.653782", "0.64508295", "0.6446371", "0.62323546", "0.5766039", "0.5760466", "0.57546294", "0.5717464", "0.5711903", "0.57100135", "0.5633577", "0.5567761", "0.55639905", "0.55532223"...
0.83668333
1
Test the proper operation of the spin loop when no selection is present. The function tested is pipe_control.mol_res_spin.spin_loop().
def test_spin_loop_no_selection(self): # Spin data. select = [0, 1, 0, 0, 1, 1, 0, 1] name = ['NH', 'NH', None, 'C8', 'N5', 'C8', 'N5', '2H'] # Loop over the spins. i = 0 for spin in mol_res_spin.spin_loop(): # Test the selection. self.assertEqua...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_spin_loop(self):\n\n # Spin data.\n select = [1, 0]\n\n # Loop over the spins.\n i = 0\n for spin in mol_res_spin.spin_loop('@N5'):\n # Test the selection.\n self.assertEqual(spin.select, select[i])\n\n # Test the spin names.\n ...
[ "0.75004387", "0.7467984", "0.7230426", "0.6575248", "0.64682966", "0.6366928", "0.629157", "0.61815935", "0.59252053", "0.59217304", "0.59209067", "0.5756598", "0.569629", "0.5623459", "0.55442035", "0.5533466", "0.5505412", "0.5480573", "0.547112", "0.5420042", "0.53915197"...
0.8127604
0
Test the proper operation of the spin loop with wildcard spin selection ''. The function tested is pipe_control.mol_res_spin.spin_loop().
def test_spin_loop_wildcard(self): # Spin data. select = [0, 1, 1, 0] name = ['NH', 'NH', 'N5', 'N5'] # Loop over the spins. i = 0 for spin in mol_res_spin.spin_loop('@N*'): # Test the selection. self.assertEqual(spin.select, select[i]) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_spin_loop(self):\n\n # Spin data.\n select = [1, 0]\n\n # Loop over the spins.\n i = 0\n for spin in mol_res_spin.spin_loop('@N5'):\n # Test the selection.\n self.assertEqual(spin.select, select[i])\n\n # Test the spin names.\n ...
[ "0.76207334", "0.74092525", "0.6786517", "0.67461604", "0.6667878", "0.6086697", "0.6002766", "0.5998333", "0.5985406", "0.58735466", "0.58593804", "0.5647808", "0.5585266", "0.5514325", "0.550792", "0.54545707", "0.543505", "0.54324937", "0.5399342", "0.5395513", "0.53469473...
0.8172461
0
Test boolean and in molresspin selections.
def test_boolean_and_selection(self): # The selection loop: sel = list(mol_res_spin.residue_loop("#Ap4Aase:4 & :Pro")) # Test: self.assertEqual(len(sel), 1) for res in sel: self.assert_(res.name == "Pro" and res.num == 4)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_boolean_complex_selection(self):\n\n # The residue selection loop.\n sel = list(mol_res_spin.residue_loop(\"#Ap4Aase:4 & :Pro | #RNA\"))\n\n # Residue names and numbers.\n names = ['Pro', None, None]\n numbers = [4, -5, -4]\n\n # The residues.\n self.assert...
[ "0.70032185", "0.6886894", "0.6886894", "0.62776476", "0.62746215", "0.62711465", "0.61798936", "0.6083441", "0.5987472", "0.59555334", "0.59517634", "0.5910961", "0.585857", "0.58579606", "0.5849827", "0.58383787", "0.58287346", "0.5822584", "0.5805983", "0.57605493", "0.575...
0.7390658
0
Test complex boolean molresspin selections.
def test_boolean_complex_selection(self): # The residue selection loop. sel = list(mol_res_spin.residue_loop("#Ap4Aase:4 & :Pro | #RNA")) # Residue names and numbers. names = ['Pro', None, None] numbers = [4, -5, -4] # The residues. self.assertEqual(len(sel), 3...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_boolean_and_selection(self):\n\n # The selection loop:\n sel = list(mol_res_spin.residue_loop(\"#Ap4Aase:4 & :Pro\"))\n\n # Test:\n self.assertEqual(len(sel), 1)\n for res in sel:\n self.assert_(res.name == \"Pro\" and res.num == 4)", "def boolean_func(exper...
[ "0.66458935", "0.64277714", "0.62511396", "0.6227797", "0.61286384", "0.5731911", "0.5731911", "0.5623282", "0.5538769", "0.5524149", "0.54843676", "0.5470526", "0.54597956", "0.53990823", "0.53824186", "0.5378115", "0.53747463", "0.5374542", "0.5369208", "0.5353589", "0.5331...
0.77207905
0
Test complex boolean molresspin selections with parenthesis.
def fixme_test_boolean_parenthesis_selection(self): # The selection loop: sel = list(mol_res_spin.residue_loop("(#Ap4Aase & :Pro) | (#RNA & :-4)")) # Test: self.assertEqual(len(sel), 2) for res in sel: self.assert_(res.num in [-4, 4])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_boolean_complex_selection(self):\n\n # The residue selection loop.\n sel = list(mol_res_spin.residue_loop(\"#Ap4Aase:4 & :Pro | #RNA\"))\n\n # Residue names and numbers.\n names = ['Pro', None, None]\n numbers = [4, -5, -4]\n\n # The residues.\n self.assert...
[ "0.72196627", "0.622446", "0.617506", "0.6151499", "0.6054697", "0.5972477", "0.595188", "0.59008986", "0.5731449", "0.571927", "0.56771934", "0.5491429", "0.54325634", "0.5403343", "0.537575", "0.5369136", "0.53508174", "0.5343714", "0.53357446", "0.53322315", "0.53228456", ...
0.65406233
1
Return the list of accessibility services
def get_accessibility_services(self): result = [] services = self.find_tags("service") for s in services: for action in s.findall("./intent-filter/action"): if "android.accessibilityservice.AccessibilityService" in action.attrib.values(): result.ap...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def available_services(self) -> list[str]:\r\n return self.services", "def get_services(self):\r\n return get_service_list()", "def list_services(ctx):\n pass", "def getServices(self):\n pass", "def services(self):\n return self.agent.http.get(\n lambda x: ...
[ "0.68534184", "0.6790268", "0.67288893", "0.6717567", "0.6657605", "0.6592076", "0.6433918", "0.6382641", "0.6368458", "0.633186", "0.6297952", "0.628866", "0.627553", "0.62480915", "0.6243383", "0.62318575", "0.61614", "0.61078346", "0.6070793", "0.60232335", "0.5990591", ...
0.8399575
0
Return the list of accessibility services
def get_administrator_receivers(self): result = [] services = self.find_tags("receiver") for s in services: for action in s.findall("./intent-filter/action"): if "android.app.action.DEVICE_ADMIN_ENABLED" in action.attrib.values(): result.append(s.a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_accessibility_services(self):\n result = []\n services = self.find_tags(\"service\")\n for s in services:\n for action in s.findall(\"./intent-filter/action\"):\n if \"android.accessibilityservice.AccessibilityService\" in action.attrib.values():\n ...
[ "0.8399575", "0.68534184", "0.6790268", "0.67288893", "0.6717567", "0.6657605", "0.6592076", "0.6433918", "0.6382641", "0.6368458", "0.633186", "0.6297952", "0.628866", "0.627553", "0.62480915", "0.6243383", "0.62318575", "0.61614", "0.61078346", "0.6070793", "0.60232335", ...
0.0
-1
Return courier_type field as a representation.
def to_representation(self, instance): return instance.courier_type
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_complex_type(self):\n import numpy\n return numpy.complex128", "def type(self):\n if self._type is None:\n self._type = repr(self.t)\n return self._type", "def get_dtype(col):\n dtype = col.dtype\n\n if isinstance(dtype, CategoricalDtype):\n col = col...
[ "0.6486205", "0.615645", "0.6019429", "0.60141975", "0.60050386", "0.5982129", "0.59765273", "0.59747857", "0.5848326", "0.58467203", "0.5842888", "0.5832162", "0.58162147", "0.578082", "0.57736826", "0.57470566", "0.56982577", "0.56823003", "0.5671127", "0.5664471", "0.56587...
0.5860837
8
Return region field as a representation.
def to_representation(self, instance): return instance.region
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def region(self):\n # type: () -> string_types\n return self._region", "def region(self) -> str:\n return self.__region", "def __repr__(self: RcnRegion) -> str:\n return f\"RcnRegion.{self.name}\"", "def region(self):\n return self._region", "def region(self):\n re...
[ "0.6821899", "0.6763117", "0.67216176", "0.6716908", "0.6716908", "0.6671237", "0.6656148", "0.6619242", "0.6594691", "0.65667427", "0.6521952", "0.65041155", "0.65041155", "0.65041155", "0.65041155", "0.65041155", "0.65041155", "0.6379895", "0.63188833", "0.63188833", "0.631...
0.7870258
0
Save a new instance to the database.
def create(self, validated_data): region = CourierRegions.objects.create( courier_id=Courier.objects.get(courier_id=validated_data['courier_id']), region=validated_data['region'] ) return region
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _write_to_db(self, instance: DBModelInstance) -> None:\n self.db.session.add(instance)\n self.db.session.commit()", "def save(self):\n \n db.session.add(self)\n db.session.commit()", "def save_to_db(self):\n db.session.add(self)\n db.session.commit()", "de...
[ "0.82036686", "0.8164637", "0.8156815", "0.8156815", "0.8156815", "0.8156815", "0.81085813", "0.8088127", "0.8088127", "0.8088127", "0.8088127", "0.8088127", "0.8088127", "0.8088127", "0.8088127", "0.8088127", "0.8088127", "0.8088127", "0.8047626", "0.7957635", "0.7858651", ...
0.0
-1
Save a new instance to the database.
def create(self, validated_data): w_h = WorkingHours.objects.create( courier_id=Courier.objects.get(courier_id=validated_data['courier_id']), work_start=validated_data['working_hours'][:5], work_end=validated_data['working_hours'][6:] ) return w_h
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _write_to_db(self, instance: DBModelInstance) -> None:\n self.db.session.add(instance)\n self.db.session.commit()", "def save(self):\n \n db.session.add(self)\n db.session.commit()", "def save_to_db(self):\n db.session.add(self)\n db.session.commit()", "de...
[ "0.82036686", "0.8164637", "0.8156815", "0.8156815", "0.8156815", "0.8156815", "0.81085813", "0.8088127", "0.8088127", "0.8088127", "0.8088127", "0.8088127", "0.8088127", "0.8088127", "0.8088127", "0.8088127", "0.8088127", "0.8088127", "0.8047626", "0.7957635", "0.7858651", ...
0.0
-1
Save a new instance to the database.
def create(self, validated_data): d_h = DeliveryHours.objects.create( order_id=Order.objects.get(order_id=validated_data['order_id']), delivery_start=validated_data['delivery_hours'][:5], delivery_end=validated_data['delivery_hours'][6:] ) return d_h
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _write_to_db(self, instance: DBModelInstance) -> None:\n self.db.session.add(instance)\n self.db.session.commit()", "def save(self):\n \n db.session.add(self)\n db.session.commit()", "def save_to_db(self):\n db.session.add(self)\n db.session.commit()", "de...
[ "0.82038593", "0.8164796", "0.8157097", "0.8157097", "0.8157097", "0.8157097", "0.8108775", "0.808835", "0.808835", "0.808835", "0.808835", "0.808835", "0.808835", "0.808835", "0.808835", "0.808835", "0.808835", "0.808835", "0.80479497", "0.79576", "0.7858863", "0.7736452",...
0.0
-1
Save new CourierRegion instances to the database.
def save_regions(validated_data): for region in validated_data['regions']: new_region = CourierRegionsSerializer(data={ 'courier_id': validated_data['courier_id'], 'region': region }) if not new_region.is_valid(): raise Validat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create(self, validated_data):\n\n region = CourierRegions.objects.create(\n courier_id=Courier.objects.get(courier_id=validated_data['courier_id']),\n region=validated_data['region']\n )\n return region", "def save(self, f):\n self.f = f\n for region i...
[ "0.64264625", "0.5719807", "0.56590676", "0.54390705", "0.54215187", "0.5370093", "0.53380907", "0.53348017", "0.530663", "0.52896005", "0.52896005", "0.5281476", "0.52535737", "0.52535737", "0.52535737", "0.52535737", "0.52434415", "0.5241482", "0.5241482", "0.5241482", "0.5...
0.7319758
0
Save new WorkingHours instances to the database.
def save_hours(validated_data): for w_h in validated_data['working_hours']: new_w_h = WorkingHoursSerializer(data={ 'courier_id': validated_data['courier_id'], 'working_hours': w_h }) if not new_w_h.is_valid(): raise Validation...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_hours(validated_data):\n\n for d_h in validated_data['delivery_hours']:\n new_d_h = DeliveryHoursSerializer(data={\n 'order_id': validated_data['order_id'],\n 'delivery_hours': d_h\n })\n if not new_d_h.is_valid():\n rais...
[ "0.6595605", "0.6511643", "0.6050262", "0.6011547", "0.580755", "0.580755", "0.580755", "0.580755", "0.57043535", "0.5699419", "0.56891483", "0.56619227", "0.5596039", "0.5595059", "0.5548948", "0.55391455", "0.55391455", "0.55391455", "0.55391455", "0.55391455", "0.55391455"...
0.7561775
0
Save a new instance to the database.
def create(self, validated_data): new_courier = Courier( courier_id=validated_data['courier_id'], courier_type=validated_data['courier_type'] ) new_courier.save() self.save_hours(validated_data) self.save_regions(validated_data) return new_courier
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _write_to_db(self, instance: DBModelInstance) -> None:\n self.db.session.add(instance)\n self.db.session.commit()", "def save(self):\n \n db.session.add(self)\n db.session.commit()", "def save_to_db(self):\n db.session.add(self)\n db.session.commit()", "de...
[ "0.82036686", "0.8164637", "0.8156815", "0.8156815", "0.8156815", "0.8156815", "0.81085813", "0.8088127", "0.8088127", "0.8088127", "0.8088127", "0.8088127", "0.8088127", "0.8088127", "0.8088127", "0.8088127", "0.8088127", "0.8088127", "0.8047626", "0.7957635", "0.7858651", ...
0.0
-1
Update an existing instance and save.
def update(self, instance, validated_data): if 'courier_type' in validated_data.keys(): instance.courier_type = validated_data['courier_type'] instance.save() if 'working_hours' in validated_data.keys(): WorkingHours.objects.filter(courier_id=instance.courier_id).del...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update(self, instance, validated_data):\n pass", "def update(self, instance, validated_data):\n # instance.id = validated_data.get('id', instance.id)\n instance.teeth = validated_data.get('teeth', instance.teeth)\n instance.species = validated_data.get('species', instance.species)...
[ "0.7564434", "0.7265815", "0.7263486", "0.7191226", "0.71909565", "0.7151628", "0.7142503", "0.7063716", "0.7056037", "0.7051953", "0.7051953", "0.7031902", "0.70192325", "0.6981581", "0.6978696", "0.6973921", "0.69628555", "0.69628555", "0.69569516", "0.69452506", "0.6883257...
0.0
-1
Raises ValidationError if the given list of regions is empty, the list otherwise.
def validate_regions(self, value): if len(value) == 0: raise ValidationError('List should not be empty.') return value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_regions(validated_data):\n\n for region in validated_data['regions']:\n new_region = CourierRegionsSerializer(data={\n 'courier_id': validated_data['courier_id'],\n 'region': region\n })\n if not new_region.is_valid():\n ...
[ "0.58792216", "0.58624536", "0.58315694", "0.58029544", "0.5629878", "0.560681", "0.53393847", "0.5311191", "0.5308086", "0.5301234", "0.52908784", "0.5228517", "0.5227655", "0.5113418", "0.510784", "0.50779873", "0.5052461", "0.5052382", "0.5038692", "0.50158596", "0.5013641...
0.81604916
0
Raises ValidationError if the given list of working hours is empty, the list otherwise.
def validate_working_hours(self, value): if len(value) == 0: raise ValidationError('List should not be empty.') return value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_delivery_hours(self, value):\n\n if len(value) == 0:\n raise ValidationError('List should not be empty.')\n return value", "def save_hours(validated_data):\n\n for w_h in validated_data['working_hours']:\n new_w_h = WorkingHoursSerializer(data={\n ...
[ "0.7269126", "0.6866808", "0.6861681", "0.67966706", "0.6211005", "0.6202418", "0.59814394", "0.58779675", "0.5871235", "0.57033545", "0.5618451", "0.55920196", "0.5522947", "0.5502552", "0.5354208", "0.5335648", "0.52977383", "0.525785", "0.5205049", "0.52016556", "0.5159868...
0.8444958
0
Raises ValidationError if the request body contains unexpected fields.
def run_validation(self, data=empty): # no idea why there is no such built in feature in DRF if data is not empty: unknown = set(data) - set(self.fields) if unknown: errors = ['Unknown field: {}'.format(f) for f in unknown] raise ValidationError({...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_invalid_body_parameters(self, body):\n self._login_as_staff()\n response = self.patch_request(body)\n assert response.status_code == 400", "def _validate(self, body):\n if not body:\n raise exception.BadRequest(\"The request contains an empty body\")\n\n if ...
[ "0.71563065", "0.7143478", "0.692088", "0.6735163", "0.6489339", "0.64386034", "0.64323974", "0.6428578", "0.6358199", "0.63555485", "0.6341984", "0.6337503", "0.62512153", "0.6228987", "0.6201926", "0.61715084", "0.6144717", "0.6141178", "0.6126661", "0.61246574", "0.6118206...
0.58812124
39
Save new instances of DeliveryHours to the database.
def save_hours(validated_data): for d_h in validated_data['delivery_hours']: new_d_h = DeliveryHoursSerializer(data={ 'order_id': validated_data['order_id'], 'delivery_hours': d_h }) if not new_d_h.is_valid(): raise ValidationE...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create(self, validated_data):\n\n d_h = DeliveryHours.objects.create(\n order_id=Order.objects.get(order_id=validated_data['order_id']),\n delivery_start=validated_data['delivery_hours'][:5],\n delivery_end=validated_data['delivery_hours'][6:]\n )\n return ...
[ "0.6799848", "0.65913475", "0.57204527", "0.5639961", "0.56362647", "0.5613045", "0.5545568", "0.54776233", "0.5454978", "0.5431331", "0.5412394", "0.5412394", "0.5412394", "0.5412394", "0.53458804", "0.5314343", "0.5288774", "0.5245218", "0.52222604", "0.5202509", "0.5193683...
0.7650199
0
Save a new instance to the database.
def create(self, validated_data): new_order = Order( order_id=validated_data['order_id'], weight=validated_data['weight'], region=validated_data['region'] ) new_order.save() self.save_hours(validated_data) return new_order
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _write_to_db(self, instance: DBModelInstance) -> None:\n self.db.session.add(instance)\n self.db.session.commit()", "def save(self):\n \n db.session.add(self)\n db.session.commit()", "def save_to_db(self):\n db.session.add(self)\n db.session.commit()", "de...
[ "0.82036686", "0.8164637", "0.8156815", "0.8156815", "0.8156815", "0.8156815", "0.81085813", "0.8088127", "0.8088127", "0.8088127", "0.8088127", "0.8088127", "0.8088127", "0.8088127", "0.8088127", "0.8088127", "0.8088127", "0.8088127", "0.8047626", "0.7957635", "0.7858651", ...
0.0
-1
Raises ValidationError if the given list of delivery hours is empty, the list otherwise.
def validate_delivery_hours(self, value): if len(value) == 0: raise ValidationError('List should not be empty.') return value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_working_hours(self, value):\n\n if len(value) == 0:\n raise ValidationError('List should not be empty.')\n return value", "def save_hours(validated_data):\n\n for d_h in validated_data['delivery_hours']:\n new_d_h = DeliveryHoursSerializer(data={\n ...
[ "0.70854056", "0.6905043", "0.6794095", "0.66818875", "0.631159", "0.58860403", "0.58774155", "0.56794053", "0.5401232", "0.53009903", "0.52992254", "0.5283572", "0.52385384", "0.52176595", "0.51481444", "0.5120775", "0.5075307", "0.506215", "0.505264", "0.5031269", "0.501651...
0.83690053
0
Raises ValidationError if the request body contains unexpected fields.
def run_validation(self, data=empty): if data is not empty: unknown = set(data) - set(self.fields) if unknown: errors = ['Unknown field: {}'.format(f) for f in unknown] raise ValidationError({api_settings.NON_FIELD_ERRORS_KEY: errors}) return supe...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_invalid_body_parameters(self, body):\n self._login_as_staff()\n response = self.patch_request(body)\n assert response.status_code == 400", "def _validate(self, body):\n if not body:\n raise exception.BadRequest(\"The request contains an empty body\")\n\n if ...
[ "0.71563065", "0.7143478", "0.692088", "0.6735163", "0.6489339", "0.64386034", "0.64323974", "0.6428578", "0.6358199", "0.63555485", "0.6341984", "0.6337503", "0.62512153", "0.6228987", "0.6201926", "0.61715084", "0.6144717", "0.6141178", "0.6126661", "0.61246574", "0.6118206...
0.55053574
92
Assign orders to a given courier.
def create(self, validated_data): courier_obj = validated_data['courier_id'] assigned_orders = Order.objects.filter(courier_id=courier_obj, complete_time__isnull=True) if assigned_orders.exists(): # if current delivery is not over, return uncompleted orders response = { ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def orders(self, orders):\n\n self._orders = orders", "def orders(self, orders):\n\n self._orders = orders", "def set_coefs_order(self, order):\n # Attach an epistasis model.\n self.order = order\n self.add_epistasis()\n self.epistasis.data.values = np.zeros(self.epist...
[ "0.57342046", "0.57342046", "0.5671593", "0.5608808", "0.55052537", "0.5336174", "0.5332351", "0.5332351", "0.5280335", "0.5280335", "0.5280028", "0.5245321", "0.5210045", "0.51828367", "0.5163213", "0.51535404", "0.51506305", "0.5145227", "0.5136289", "0.5136289", "0.5136289...
0.44290462
74
Raises ValidationError if the request body contains unexpected fields.
def validate(self, attrs): unknown = set(self.initial_data) - set(self.fields) if unknown: raise ValidationError('Unknown field(s): {}'.format('', ''.join(unknown))) return attrs
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_invalid_body_parameters(self, body):\n self._login_as_staff()\n response = self.patch_request(body)\n assert response.status_code == 400", "def _validate(self, body):\n if not body:\n raise exception.BadRequest(\"The request contains an empty body\")\n\n if ...
[ "0.71563065", "0.7143478", "0.692088", "0.6735163", "0.6489339", "0.64386034", "0.64323974", "0.6428578", "0.6358199", "0.63555485", "0.6341984", "0.6337503", "0.62512153", "0.6228987", "0.6201926", "0.61715084", "0.6144717", "0.6141178", "0.6126661", "0.61246574", "0.6118206...
0.54817533
100
Mark given order as completed and increases related courier's earning if current delivery is over.
def create(self, validated_data): order_obj = Order.objects.get(order_id=validated_data['order_id']) order_obj.complete_time = validated_data['complete_time'] order_obj.save() # if current delivery is over, add earnings if not Order.objects.filter(courier_id=order_obj.courier_i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mark_completed(self, order_id=None):\n self.status = \"paid\"\n if order_id and not self.order_id:\n self.order_id = order_id\n print(\"Order completed\")\n self.save()", "def order_finish(self):\r\n logger.info(f'Remaining qty:{self.quantity-self.filled_quantity...
[ "0.7115944", "0.65188056", "0.63519084", "0.6026853", "0.59948623", "0.5960341", "0.58357316", "0.57971895", "0.56998575", "0.56283593", "0.5623195", "0.5612759", "0.5612759", "0.5612759", "0.5559784", "0.5555224", "0.55308384", "0.5526902", "0.55223775", "0.5503282", "0.5503...
0.5629139
9
Raises ValidationError if order with given id does not exist, is not assigned to any courier or is already completed.
def validate_order_id(self, value): if not Order.objects.filter(order_id=value).exists(): raise ValidationError(f'Order with id {value} does not exist.') order_obj = Order.objects.get(order_id=value) if order_obj.assign_time is None: raise ValidationError(f'Order with id...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate(self, attrs):\n\n errors = {}\n order_obj = Order.objects.get(order_id=attrs['order_id'])\n if order_obj.courier_id.courier_id != attrs['courier_id'].courier_id:\n errors['order_id'] = f'Order with id {order_obj.order_id} is assigned to another courier.'\n unknow...
[ "0.6367057", "0.61440265", "0.60556054", "0.5945867", "0.58446044", "0.57476765", "0.57366914", "0.5560988", "0.54352444", "0.5427547", "0.54036677", "0.53682196", "0.53528076", "0.5352244", "0.53520465", "0.53500265", "0.5327493", "0.53269213", "0.53213036", "0.53162146", "0...
0.8479572
0
Raises ValidationError of the order with the given id is assigned to another courier, specified complete_time is greater than order's assign_time or there are unexpected fields in the request body.
def validate(self, attrs): errors = {} order_obj = Order.objects.get(order_id=attrs['order_id']) if order_obj.courier_id.courier_id != attrs['courier_id'].courier_id: errors['order_id'] = f'Order with id {order_obj.order_id} is assigned to another courier.' unknown = set(sel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_order_id(self, value):\n\n if not Order.objects.filter(order_id=value).exists():\n raise ValidationError(f'Order with id {value} does not exist.')\n order_obj = Order.objects.get(order_id=value)\n if order_obj.assign_time is None:\n raise ValidationError(f'Or...
[ "0.7156292", "0.63136715", "0.5466236", "0.53860146", "0.52171755", "0.5214629", "0.5198121", "0.5026115", "0.5020451", "0.49440423", "0.49169457", "0.48243418", "0.4787714", "0.47877014", "0.47723362", "0.4748931", "0.4731741", "0.46965528", "0.46746913", "0.4651812", "0.464...
0.69398975
1
Returns a single entry in the generated dataset. Return a bunch of random values as an example.
def row_generator(x, H, W, C): return {'frame_id': x, 'frame_data': np.random.randint(0, 10, dtype=np.uint8, size=(H, W, C))}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getRandom(self):\n \n return self.data[random.randint(0, len(self.data) - 1)]", "def getRandom(self):\n return random.choice(self.data)", "def randomRow(self):\r\n l = []\r\n for row in self.data:\r\n l.append(row)\r\n return random.choice(l)", "def ge...
[ "0.6710937", "0.6699718", "0.6537949", "0.64686054", "0.6440445", "0.6439815", "0.6246304", "0.62280905", "0.61741596", "0.6161315", "0.6138543", "0.61140835", "0.6086445", "0.60771036", "0.6075611", "0.6065098", "0.6062155", "0.6038981", "0.6028018", "0.60002375", "0.5990621...
0.0
-1
Saves a memory, x.
def encode(self, x): # Pad out if len(self.memory) < self.capacity: self.memory.append(None) # Remember self.memory[self.position] = x self.position = int((self.position + 1) % self.capacity)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def savefile(self, x, o):\n self.sep('save')\n with open(o, 'w') as f:\n f.write(x)\n sys.exit('all done (%s bytes).. saved as %s' % (len(x), o))", "def save_memory(self, filename):\n \n\n with open(filename + '/obses.npy', 'wb') as f:\n np.save(f, self.obses)...
[ "0.661321", "0.6199178", "0.61638105", "0.6142827", "0.6013084", "0.5942242", "0.5910202", "0.5820138", "0.5730391", "0.5720858", "0.57114774", "0.5685187", "0.5661498", "0.5660701", "0.56581867", "0.5656959", "0.56225663", "0.5608321", "0.5604391", "0.5580106", "0.5578358", ...
0.609972
4
Randomly sample `n` memories
def sample(self, n): idx = np.random.randint(0, len(self.memory), size=n) return [self.memory[i] for i in idx]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sample(n, seed= 0):\n data = list(range(n))\n while True:\n np.random.seed(seed)\n np.random.shuffle(data)\n yield from data", "def sample(self, n):\n raise NotImplementedError", "def sample_batch(memory, n):\n batch = rnd.sample(memory, n) # List containing tuples\n ...
[ "0.75761276", "0.7508017", "0.74692214", "0.7464645", "0.74448174", "0.7441827", "0.73945725", "0.734842", "0.71837", "0.7161568", "0.71080214", "0.7107572", "0.7095622", "0.7086794", "0.7068867", "0.70568603", "0.70141", "0.7003059", "0.69959825", "0.69918495", "0.69673544",...
0.8171086
0
Saves a priority weight and a memory, x.
def encode(self, weight, x): # Sanity weight = float(weight) if np.isclose(weight, 0.0): raise ValueError("w must be > 0") # Pad out if len(self.memory) < self.capacity: self.memory.append(None) self.priority.append(None) # Remember ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_weights(self, the_path):\n torch.save(self.model.state_dict(), the_path)", "def save(self, weight_path, vocab_path, output_path, binary=False):\n w2v_save_model(weight_path.encode(\"ascii\"),\n vocab_path.encode(\"ascii\"), \n output_path.encode(...
[ "0.55070525", "0.5479773", "0.54729784", "0.54729784", "0.539775", "0.53781176", "0.53729707", "0.5255315", "0.5204153", "0.51955986", "0.51532245", "0.5136106", "0.51347286", "0.5108663", "0.5106836", "0.5048806", "0.5046801", "0.50428057", "0.50421166", "0.5030649", "0.5026...
0.68081224
0
A wieghted sample of n memories
def sample(self, n): # Est probs from priority weights summed = sum(self.weight) + self.eps self.probs = [w / summed for w in self.priority] # Wieghted sample return np.random.choice(self.memory, size=n, p=self.probs).tolist()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_samples(self, n_samples):", "def generate_samples(self, n_samples):", "def sample(self, n):\n idx = np.random.randint(0, len(self.memory), size=n)\n return [self.memory[i] for i in idx]", "def sample(self, n):\n raise NotImplementedError", "def sample(self, n=1):\n ...
[ "0.7382827", "0.7382827", "0.7142945", "0.7120932", "0.699244", "0.6988327", "0.68088275", "0.6714524", "0.65344375", "0.65145004", "0.64302224", "0.6410242", "0.64098626", "0.637732", "0.6367377", "0.63631177", "0.63408345", "0.6314813", "0.6302227", "0.62922007", "0.6196453...
0.71244526
3
When we XOR elements, the ideal case to maximize the result is to have the XOR operands to have different bits for each position. An operation can remove a bit but cannot add one, so the goal is to remove all bits shared between array elements. Therefore, the solution is to perform OR on all elements.
def max_xor(A): return reduce(lambda x, y: x | y, A)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def xor(self):\n\n \"\"\" fisrt i pick element we need to xor each other and put theme in list\"\"\"\n bits_to_xor = []\n for i in self.xor_input:\n bits_to_xor.append(self.state[i])\n\n \"\"\" next xor the list elemet usin reduce with lambda func.\"\"\"\n...
[ "0.7474404", "0.7227875", "0.71612287", "0.71068895", "0.71062714", "0.6935171", "0.69207716", "0.6826871", "0.66807395", "0.6589879", "0.6547784", "0.6523073", "0.64804363", "0.64760613", "0.6439925", "0.64305127", "0.6383687", "0.6372895", "0.6336047", "0.63346505", "0.6327...
0.72547776
1
Update values in the array, to match their corresponding type, make sure the value is legal.
def _match_val_type(vals, bounds): vals_new = [] for i, bound in enumerate(bounds): _type = bound['_type'] if _type == "choice": # Find the closest integer in the array, vals_bounds # pylint: disable=cell-var-from-loop vals_new.append(min(bound['_value'], key...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def enforce_valuecheck(cls, val):\n if val:\n cls.__setitem__ = cls._setitem \n cls.__array_wrap__ = cls._array_wrap\n else:\n cls.__setitem__ = array.__setitem__\n cls.__array_wrap__ = array.__array_wrap__", "def _check_type(self, new_value):\n ra...
[ "0.6558256", "0.62737715", "0.6026674", "0.6002651", "0.5997339", "0.5921652", "0.5896006", "0.5893438", "0.58869845", "0.58062476", "0.5762819", "0.5733526", "0.5699823", "0.56924605", "0.56693536", "0.5662141", "0.5661952", "0.5655517", "0.5626991", "0.5582663", "0.55766344...
0.0
-1
A function to find the maximum of the acquisition function It uses a combination of random sampling (cheap) and the 'LBFGSB' optimization method. First by sampling ``num_warmup`` points at random, and then running LBFGSB from ``num_starting_points`` random starting points.
def acq_max(f_acq, gp, y_max, bounds, space, num_warmup, num_starting_points): # Warm up with random points x_tries = [space.random_sample() for _ in range(int(num_warmup))] ys = f_acq(x_tries, gp=gp, y_max=y_max) x_max = x_tries[ys.argmax()] max_acq = ys.max() # Explore the pa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def acq_max(ac, gp, y_max, bounds, random_state, n_warmup=100000, n_iter=250):\n\n # Warm up with random points\n x_tries = random_state.uniform(bounds[:, 0], bounds[:, 1],\n size=(n_warmup, bounds.shape[0]))\n ys = ac(x_tries, gp=gp, y_max=y_max)\n x_max = x_tries[ys....
[ "0.62064785", "0.58723736", "0.58493215", "0.5803944", "0.5755144", "0.56878924", "0.5686157", "0.56028587", "0.55518836", "0.5547421", "0.553826", "0.5501719", "0.5482462", "0.54465926", "0.5444505", "0.54270524", "0.5395608", "0.5392558", "0.5367147", "0.53619885", "0.53508...
0.6244207
0
Upper Confidence Bound (UCB) utility function
def _ucb(x, gp, kappa): with warnings.catch_warnings(): warnings.simplefilter("ignore") mean, std = gp.predict(x, return_std=True) return mean + kappa * std
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _ucb(self, s, k):\n if self.confidence_method == 'ucb-standard':\n ucb_factor = self._ucb_standard_factor(s, k)\n return self.mu[k][s] + ucb_factor\n elif self.confidence_method == 'ucb-standard-relaxed':\n ucb_factor = self._ucb_standard_factor(s, k) - self.ucb_eps\n return self.mu[k...
[ "0.6992317", "0.6674039", "0.66245663", "0.6566002", "0.6520581", "0.64875233", "0.64875233", "0.64202017", "0.6360865", "0.6321332", "0.6283501", "0.6280488", "0.6280488", "0.6207781", "0.61973965", "0.61973965", "0.61637783", "0.6103145", "0.6103145", "0.5929752", "0.588958...
0.60484886
19
Expected Improvement (EI) utility function
def _ei(x, gp, y_max, xi): with warnings.catch_warnings(): warnings.simplefilter("ignore") mean, std = gp.predict(x, return_std=True) z = (mean - y_max - xi)/std return (mean - y_max - xi) * norm.cdf(z) + std * norm.pdf(z)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _expected_inputs():", "def experiment3():\n raise FAKE_ERROR", "def expected(x, y):", "def expected(x, y):", "def expected(x, y):", "def test_change_provisioned_throughput_usual_case():", "def test_create_unexpected_problem(self):\n pass", "def _expected_inputs():\n return 1", ...
[ "0.6556199", "0.62118715", "0.6149419", "0.6149419", "0.6149419", "0.6034302", "0.6023946", "0.6023345", "0.6000466", "0.5943699", "0.5942267", "0.5891634", "0.58835393", "0.58281875", "0.58138615", "0.5776068", "0.5775869", "0.5775869", "0.5754015", "0.57419175", "0.5737303"...
0.0
-1
Possibility Of Improvement (POI) utility function
def _poi(x, gp, y_max, xi): with warnings.catch_warnings(): warnings.simplefilter("ignore") mean, std = gp.predict(x, return_std=True) z = (mean - y_max - xi)/std return norm.cdf(z)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_POI(self, location_list, moore_range):\n\n for r in range(len(location_list)):\n\n x = location_list[r][0]\n y = location_list[r][1]\n\n coordinates = []\n for i in range(moore_range):\n for j in range(moore_range):\n if x+i > 0 and len(self.grid_...
[ "0.5698189", "0.56355613", "0.53840846", "0.536521", "0.53135455", "0.52214134", "0.52092123", "0.52030206", "0.51916534", "0.5132247", "0.51293755", "0.50819117", "0.5057626", "0.5044003", "0.5012398", "0.50025433", "0.5001758", "0.49940285", "0.49913308", "0.497202", "0.496...
0.50307685
14
Set all default values and start the step counter. If you want to run multiple trials with the same game you must explicitly call reset and if you are using bbopt agents you must pass a new _name_.
def reset(self, name=None, *agents, **named_agents): self.name = (self.name if name is None else name) self.env = {"game": self} self.i = 0 self.set_defaults(self.agents) self.add_agents(*agents, **named_agents) return self
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start(self, total: int, name: str = None):\n\n # Clean the run\n self.test_run = RunElements()\n\n if name is not None:\n self.test_run.name = name\n\n self.test_run.total = total\n\n # Init the start run date\n from datetime import datetime\n self.te...
[ "0.6537875", "0.6239453", "0.5956907", "0.57858336", "0.57760304", "0.57760304", "0.5774393", "0.5761878", "0.573783", "0.57337576", "0.572438", "0.5703894", "0.5703594", "0.56340945", "0.5619564", "0.55742717", "0.5537968", "0.5514695", "0.548379", "0.5452598", "0.54435635",...
0.58080703
3
Set the defaults for the given agents.
def set_defaults(self, agents): for a in agents: for k, v in a.get_defaults().items(): self.env[k] = v
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_agents(self, agents):\n if self.single_agent_mode:\n raise ValueError(\n \"Setting agent in single agent mode or human mode is not allowed.\"\n )\n\n self.agents = agents\n # If at least one agent needs raw data, we set self.allow_raw_data = True\n ...
[ "0.7123729", "0.6784273", "0.67001903", "0.6271799", "0.61820745", "0.6158705", "0.6158705", "0.6158705", "0.59732956", "0.59680927", "0.59333277", "0.58075494", "0.5709466", "0.56820816", "0.5672702", "0.567123", "0.56681", "0.564538", "0.5598141", "0.55943185", "0.5541246",...
0.8821057
0
Add the given agents/variables to the game.
def add_agents(*_coconut_match_args, **_coconut_match_kwargs): _coconut_match_check_2 = False _coconut_match_set_name_self = _coconut_sentinel _coconut_match_set_name_agents = _coconut_sentinel _coconut_match_set_name__set_defaults = _coconut_sentinel _coconut_match_set_name_name...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_variables(self, variables):\n for variable in variables:\n self.variables.append(variable)", "def add_to_simulation(self,agent):\n self.agents[agent.name] = agent\n self.network.add_node(agent)\n \n #agent given a grid queue at initialization\n grid_qu...
[ "0.6344226", "0.6052576", "0.6029992", "0.59840566", "0.57786566", "0.57367676", "0.5720258", "0.5711132", "0.565347", "0.5633712", "0.56207824", "0.5576194", "0.5569814", "0.55281496", "0.55243075", "0.5455733", "0.54406923", "0.5374558", "0.536636", "0.5339504", "0.53347415...
0.0
-1
Create a deep copy of the game.
def copy(self): new_game = Game(self.name, *self.agents, independent_update=self.independent_update, default_run_kwargs=self.default_run_kwargs, _set_defaults=False) new_game.i = self.i new_game.env = self.env_copy() new_game.env["game"] = new_game return new_game
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def copy(self):\n # create a new game and adjust it\n game_copy = Game()\n game_copy.turn_number = self.turn_number\n # copy player characters\n game_copy.player1 = Class.copy_monster(self.player1)\n game_copy.player2 = Class.copy_monster(self.player2)\n # reference...
[ "0.79710436", "0.76304597", "0.7624862", "0.7530829", "0.735413", "0.7306646", "0.7019784", "0.6898342", "0.6871119", "0.67451036", "0.6714296", "0.6711205", "0.6701819", "0.6690582", "0.6682592", "0.66806793", "0.6680429", "0.66452944", "0.66334337", "0.66334337", "0.6633433...
0.86879694
0
Create a deep copy with new agents.
def copy_with_agents(self, *agents, **named_agents): return self.copy().add_agents(*agents, **named_agents)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def copy(self):\n new_game = Game(self.name, *self.agents, independent_update=self.independent_update, default_run_kwargs=self.default_run_kwargs, _set_defaults=False)\n new_game.i = self.i\n new_game.env = self.env_copy()\n new_game.env[\"game\"] = new_game\n return new_game", ...
[ "0.64163107", "0.6415633", "0.6331236", "0.630281", "0.6287885", "0.6160814", "0.61473835", "0.6124182", "0.6101197", "0.6057805", "0.60413456", "0.602687", "0.5934685", "0.59219915", "0.5908063", "0.588306", "0.5876571", "0.5862516", "0.5856848", "0.58544517", "0.5850434", ...
0.67792404
0
Equivalent to .copy().reset(args, kwargs).
def clone(self, *args, **kwargs): return self.copy().reset(*args, **kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset(*args):", "def reset(*args):", "def reset(*args):", "def reset(self, *args, **kwargs):", "def reset(self, *args):\n raise NotImplementedError", "def reset(self, *args, **kwargs):\n ...", "def reset(self, **kwargs):\n for k, v in kwargs.items():\n setattr(self, ...
[ "0.7387241", "0.7387241", "0.7387241", "0.70620394", "0.68944395", "0.6861086", "0.67391557", "0.6706456", "0.6441948", "0.6430577", "0.6393383", "0.63583297", "0.63236713", "0.63117933", "0.6244504", "0.6244504", "0.6244504", "0.6244504", "0.6244504", "0.6244504", "0.6244504...
0.7875659
0
Add an agent to be called at interval _period_.
def attach(self, agent, period, name=None): if isinstance(agent, Agent): agent = agent.clone(name=name, period=period) else: agent = Agent(name, agent, period=period) self.agents.append(agent) return self
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def newperiod(self, period):\n logger.debug(u\"{} New Period\".format(self.joueur))\n self.currentperiod = RepetitionsEXPERIENCE_NOM_COURT(period)\n self.le2mserv.gestionnaire_base.ajouter(self.currentperiod)\n self.repetitions.append(self.currentperiod)\n yield (self.remote.call...
[ "0.63139504", "0.5614659", "0.5556661", "0.54355025", "0.5423074", "0.5197547", "0.51729447", "0.5061283", "0.5061283", "0.5060387", "0.504039", "0.50223863", "0.5007248", "0.498901", "0.49737817", "0.4944588", "0.49106753", "0.48939013", "0.48071665", "0.47930655", "0.478684...
0.64388436
0
Perform one full step of action selection.
def step(self): updating_env = {} if self.independent_update else self.env for a in self.agents: if self.i % a.period == 0: action = a(self.env) if a.name is not None: updating_env[a.name] = action if self.independent_update: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def select_action(self):\n pass", "def perform_step(self, action):\n pass", "def choose_action(self):\r\n pass", "def select_action(self, state):", "def select_action(self, state):\n pass", "def chooseAction(self):\n print \"nothing\"\n pass", "def step(self, a...
[ "0.7613646", "0.7546346", "0.73345476", "0.7294785", "0.7240225", "0.7239332", "0.7198726", "0.7043319", "0.6989192", "0.69389737", "0.69323885", "0.68227607", "0.6752335", "0.6746938", "0.6735803", "0.67225367", "0.670929", "0.670929", "0.6681697", "0.6654639", "0.6606508", ...
0.0
-1
Get a copy of the environment without the game.
def env_copy(self, env=None): new_env = (clean_env(self.env) if env is None else env) for a in self.agents: for copy_name, copy_func in a.copiers.items(): _coconut_match_to_1 = new_env _coconut_match_check_3 = False _coconut_match_set_name_val ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clone(self):\n return Environment(self.local_variables, self.local_types)", "def get_env_copy(self):\n if self._env:\n return cloudpickle.loads(cloudpickle.dumps(self._env))\n else:\n return None", "def snapshot():\n return Env(os.environ)", "def copy(sel...
[ "0.7264281", "0.6938961", "0.673083", "0.6677482", "0.6186581", "0.6186581", "0.61851823", "0.6149314", "0.61143965", "0.6102495", "0.60619986", "0.6061919", "0.6012602", "0.5948327", "0.5925403", "0.58771855", "0.5873079", "0.5869495", "0.5811715", "0.57918173", "0.5769533",...
0.573807
22
Apply all relevant copiers for the given name to val.
def copy_var(self, name, val): return self.env_copy({name: val})[name]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def apply(self, nameList, ctlFunc = lambda s, d: True):\n nameMap = self.transform(nameList)\n for src, dst in nameMap.items():\n if ctlFunc(src, dst):\n os.rename(src, dst)", "def collect(self, name_to_arr):\n raise NotImplementedError", "def invoke(self, op):\n ...
[ "0.45778036", "0.43417755", "0.4304802", "0.4294516", "0.4207937", "0.41862413", "0.41281107", "0.411962", "0.4097238", "0.40670815", "0.40624136", "0.40540287", "0.40497252", "0.40347156", "0.40284804", "0.4018405", "0.4010493", "0.4001985", "0.39933982", "0.39705566", "0.39...
0.0
-1
Exactly base_run but includes default_run_kwargs.
def run(self, max_steps=_sentinel, stop_at_equilibrium=_sentinel, use_tqdm=_sentinel, ensure_all_agents_run=_sentinel): run_kwargs = self.default_run_kwargs.copy() if max_steps is not self._sentinel: run_kwargs["max_steps"] = max_steps if stop_at_equilibrium is not self._sentinel: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run(self, **kwargs):", "def run(self, **kwargs):\n pass", "def run(self, *args, **kwargs):\n pass", "def run(self, **kwargs: Any) -> None:\n raise NotImplementedError", "def test_with_defaults(self, _):\n result = self.run()\n return self._handle_test_result(result)", "def ...
[ "0.6579317", "0.64507556", "0.620264", "0.617488", "0.6113276", "0.61063653", "0.6086408", "0.6086408", "0.6072939", "0.6067173", "0.60145223", "0.5965127", "0.59395444", "0.59364635", "0.5894508", "0.5872491", "0.57461816", "0.5694729", "0.56878316", "0.5639522", "0.56390077...
0.0
-1
Run iterative action selection for _max_steps_ or until equilibrium is reached if _stop_at_equilibrium_.
def base_run(self, max_steps=None, stop_at_equilibrium=False, use_tqdm=True, ensure_all_agents_run=True): if max_steps is None and not stop_at_equilibrium: raise ValueError("run needs either max_steps not None or stop_at_equilibrium True") if stop_at_equilibrium: prev_env = self....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run(self, max_steps: Optional[int] = None):\n step_count = 0\n max_exceeded = False\n log.info(f\"Starting exploration at {hex(self.simgr.active[0].addr)}\")\n while not max_exceeded and not self.simgr.complete():\n if len(self.simgr.active) == 0:\n log.war...
[ "0.6296464", "0.6040132", "0.5977998", "0.5754107", "0.56560564", "0.5620944", "0.54821754", "0.548009", "0.54243356", "0.5329013", "0.5317058", "0.52521926", "0.52232265", "0.5180346", "0.5173381", "0.514013", "0.51346976", "0.51335865", "0.50885445", "0.50440264", "0.503641...
0.594794
3
Gather final parameters, running every agent again if _ensure_all_agents_run_.
def finalize(self, ensure_all_agents_run=True): self.final_step = True try: if ensure_all_agents_run: for _ in range(self.max_period): self.step() return self.env_copy() finally: self.final_step = False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_all_agent(self):\n for a in self.agents:\n soft_update(a.target_actor, a.actor, self.tau)\n soft_update(a.target_critic, a.critic, self.tau)\n self.num_iteration += 1", "def _apply_params(self):\n config = self.get_startup_config()\n # Pass true to _se...
[ "0.63572925", "0.58247304", "0.5736279", "0.5681283", "0.5670931", "0.5564711", "0.55375224", "0.5520162", "0.54561305", "0.53911257", "0.53798974", "0.5360203", "0.53507215", "0.5349996", "0.53491586", "0.53387153", "0.533229", "0.5301695", "0.5299479", "0.5296466", "0.52879...
0.66002065
0
Plot _xs_ vs. _ys_ on the given axis with automatic or custom label names and _kwargs_ passed to plot. One of _xs_ or _ys_ may be None to replace with a sequence and must otherwise be a variable name, list, or function of the env.
def plot(self, ax, xs, ys, xlabel=None, ylabel=None, label=None, alpha=0.6, **kwargs): if xs is None and ys is None: raise ValueError("both of xs and ys cannot be None") if isinstance(xs, Str): xs_list = self.env[xs] elif callable(xs): xs_list = xs(self.env) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot(x, y, ns, **kwargs):\n if isinstance(x, str):\n x = [x]\n if isinstance(y, str):\n y = [y]\n \n def data_lookup(arr):\n arr_data = []\n arr_label = []\n for a_ in arr:\n if isinstance(a_, str):\n arr_label.append(a_)\n ...
[ "0.67550695", "0.6138962", "0.6067398", "0.6053372", "0.59938", "0.59759384", "0.597428", "0.5972828", "0.5935644", "0.5918692", "0.5905465", "0.5859092", "0.5807438", "0.5805799", "0.5759312", "0.5742589", "0.57250696", "0.57136345", "0.5699154", "0.56960934", "0.56851363", ...
0.7535068
0
Obtains a ready to use style_transfer model file.
def get_pretrained_model(destination): url = "https://storage.googleapis.com/download.magenta.tensorflow.org/models/ \ arbitrary_style_transfer.tar.gz" os.system("curl -o arbitrary_style_transfer.tar.gz {0}".format(url)) with tarfile.open("arbitrary_style_transfer.tar.gz") as tar: if not...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_style():\n\n style = os.path.join(os.path.dirname(__file__), \"templates\", \"style.css\")\n with open(style, \"r\") as opencss:\n return opencss.read().strip()", "def get_model_and_assets():\n\n return common.read_model('cloth_corner.xml'),common.ASSETS", "def _get_model():\n with ope...
[ "0.5762988", "0.56735617", "0.5595069", "0.55804044", "0.5348759", "0.5340475", "0.5333773", "0.5213094", "0.52033925", "0.5180057", "0.51697576", "0.51513886", "0.5150505", "0.5148918", "0.5148204", "0.5123702", "0.510021", "0.50826496", "0.5067555", "0.50636643", "0.5043299...
0.6710467
0
Initialize with a lightfield in np.uint8 format. Optionally pass width and height of the canvas and sensitivity to the mouse.
def __init__(self, lf, width= None, height= None, sensitivity=2): super().__init__(size=(width, height)) # Adjustable dimensions of the canvas and mouse sensitivity self.width = width or lf.shape[-2] self.height = height or lf.shape[-3] self.dim = lf.ndim self.se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, width, height):\n self.width = width\n self.height = height\n self.pixels = []\n self.r = 255\n self.g = 0\n self.b = 0\n self.pointSize = 30\n self.vr = 255\n self.vg = 200\n self.vb = 200\n self.glclear()", "def __i...
[ "0.57412136", "0.5677878", "0.5673382", "0.5629524", "0.55770236", "0.54769325", "0.54700756", "0.5453247", "0.5440439", "0.5382337", "0.53306824", "0.5293759", "0.5290555", "0.52754855", "0.5219319", "0.5217659", "0.52054334", "0.5137539", "0.51299554", "0.51256675", "0.5121...
0.72030973
0
Converts lightfield to np.uint8 with a white background and no alpha channel.
def convert_lf(self, lf): lf = np.float32(lf) if np.max(lf) > 1: lf = lf/256 lf = np.uint8(lf*256) if lf.shape[-1] > 3: lf[lf[:,:,:,:,3] == 0] = (255,255,255,0) #convert alpha to white. lf = lf[:,:,:,:,:3] # while lf.ndim < 6: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_uint8(f):\n from numpy import array, clip, uint8\n\n img = array(clip(f,0,255),uint8)\n return img", "def to_uint8(image):\n\tnp.clip(image, 0, 255, out=image)\n\treturn image.astype(np.uint8)", "def float32_to_uint8(inputs):\n return np.uint8(np.clip(np.round(inputs * 255), 0, 255))", "de...
[ "0.68301535", "0.66983664", "0.65882623", "0.64155966", "0.594869", "0.592428", "0.5862508", "0.5862508", "0.5721261", "0.57063997", "0.5657134", "0.56439483", "0.5588113", "0.5578203", "0.5555673", "0.55530274", "0.54991704", "0.54975706", "0.5489271", "0.54839927", "0.54407...
0.6405364
4
Creates a downsampled version of the lightfield for fast rendering when dragging
def downsample_lf(self, converted_lf): #For simplicity, we use every xth and yth pixel, instead of more complicated downsampling methods. DOWNSAMPLE_DIMS = (150, 150) # make output shape of each image less than these dimensions. step_size_x = int(converted_lf.shape[2]/DOWNSAMPLE_DIMS[0])+1 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, lf, width= None, height= None, sensitivity=2):\n super().__init__(size=(width, height))\n \n # Adjustable dimensions of the canvas and mouse sensitivity\n self.width = width or lf.shape[-2]\n self.height = height or lf.shape[-3]\n self.dim = lf.ndim\n ...
[ "0.6677831", "0.5521749", "0.5468912", "0.5435668", "0.5366701", "0.53488237", "0.5338624", "0.53239614", "0.53061754", "0.52855045", "0.52810764", "0.5236515", "0.5223209", "0.52158475", "0.5215231", "0.5215231", "0.5210316", "0.51868254", "0.5168859", "0.515881", "0.5132155...
0.49122146
48
Applies cv2.resize to each image of the lightfield (6dim)
def resize_lightfield(raw_lightfield, desired_size): # -> lightfield if raw_lightfield.ndim == 6: n_depth, n_cols, n_rows, *_ = raw_lightfield.shape output_lightfield = np.empty([n_depth, n_cols, n_rows] + list(desired_size)[::-1] + [3], dtype=np.uint8) for k, depth in enumerate(raw_lightf...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_image(fl):\n #print(\"processing of images\")\n print(fl)\n img = cv2.imread(fl, cv2.IMREAD_COLOR)\n resized_img = cv2.resize(img, (146, 243), interpolation=cv2.INTER_CUBIC)\n return resized_img", "def resizeImages(img_path,size=(50,50)):\n image = cv2.imread(img_path)\n resized ...
[ "0.6966502", "0.6862376", "0.6512721", "0.6415095", "0.6333766", "0.62988776", "0.6276172", "0.627098", "0.62702346", "0.62640584", "0.62184846", "0.6149587", "0.6065171", "0.6062927", "0.6053445", "0.6053445", "0.60356414", "0.6007041", "0.59975797", "0.5984891", "0.59809804...
0.7499734
0
Creates a mission instance and append it to self.pendingMissions.
def create_mission(self, missionType, insertMode=InsertMode.Append, duration=-1.0, **missionParameters): if missionType not in self.mission_types(): raise ValueError("Cannot create a " + missionType + " for this aircraft.") with self.lock: if self...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start(self):\n\t\tpm = PendingMission(mission_id=self.mission_id, kingdom_id=self.kingdom_id)\n\t\tpm.save()\n\t\t\n\t\treturn pm", "def _add(self, mission):\n\t\tif mission.url not in self.pool:\n\t\t\tself.add_child(mission)\n\t\t\tself.pool[mission.url] = mission", "def execute_mission(self):\n\n ...
[ "0.6725539", "0.65166247", "0.6410594", "0.6080763", "0.5992849", "0.59163344", "0.5906432", "0.55863726", "0.5561548", "0.5487413", "0.52339923", "0.52303076", "0.516617", "0.51566476", "0.51332045", "0.51320595", "0.5105025", "0.5067188", "0.50134295", "0.4959583", "0.49499...
0.6345971
3
Returns either a new id or an error if impossible.
def new_mission_id(self): newMissionId = self.lastMissionId + 1 if newMissionId in self.missions.keys(): # This should never happen but TODO strengthen it just in case raise RuntimeError("Id of newly created mission already exists.") return newMissionId
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def newId():\n global lastId\n lastId += 1\n return 'id%d' % lastId", "def generate_a_new_primary_id():\n primary_id = str(uuid())\n response = client.query(\n KeyConditionExpression=Key('id').eq(primary_id)\n )\n if response[\"Items\"] == []:\n return primary_id\n else:\n ...
[ "0.6958756", "0.6849629", "0.6780738", "0.660999", "0.6598348", "0.6515851", "0.6355783", "0.6355783", "0.631555", "0.6308556", "0.6261798", "0.6250714", "0.6224159", "0.6199575", "0.6197145", "0.6174544", "0.6174544", "0.6174544", "0.6174544", "0.6174544", "0.6174544", "0....
0.63075185
10
Convenience function for converting unpickled mission into mission instances.
def reload_missions(unpickledMissions): for missionId, params in unpickledMissions.items(): # A true file format would be nice if missionId == 'pendingMissions': self.pendingMissions = params continue ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deserialize(cls, serd):\r\n return cls(*serd)", "def from_serializable(self, _):\n\n assert False, \"Not implemented\"", "def from_serializable(self, _):\n\n assert False, \"not implemented\"", "def _deserialize(cls, *args):\n return cls(*args)", "def loads(cls, data: str) -...
[ "0.53312004", "0.53231305", "0.5300342", "0.5205318", "0.516451", "0.51606286", "0.51114714", "0.5066639", "0.5066639", "0.5059862", "0.50490946", "0.50444037", "0.50308233", "0.50265086", "0.5026082", "0.50245154", "0.50166994", "0.50164783", "0.5004725", "0.49910545", "0.49...
0.66441584
0
Return current mission of the UAV (First in the MISSION_STATUS list)
def current_mission(self): try: return self.missions[self.status.mission_task_list[0]] except KeyError: return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mission(self) -> Optional[Mission]:\n # XXX: This currently can be `None`\n return self._mission", "def _select_mission(self):\n if wait_until(self.emulator.is_ui_element_on_screen, ui_element=self.mission_selector_ui):\n logger.debug(f\"Selecting Epic Quest's mission: {self.m...
[ "0.6453036", "0.5754468", "0.566482", "0.5642156", "0.5633182", "0.55878025", "0.55187774", "0.54879326", "0.5467559", "0.5432458", "0.5419924", "0.5392557", "0.5386191", "0.5379635", "0.53663546", "0.53264517", "0.53114265", "0.5309297", "0.5300201", "0.52791274", "0.5263213...
0.7763624
0
Returns mission instances waiting to be authorized.
def get_pending_missions(self): res = []; for missionId in self.pendingMissions: res.append(self.missions[missionId]) return res;
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_all_finished_missions(self):\n self.lock.acquire()\n result = self.__Session.query(Mission).filter_by(status=3).all()\n self.lock.release()\n return result", "def get_pending_instances(self):\n return [instance for instance in self.instances.itervalues()...
[ "0.6458847", "0.6429118", "0.59033716", "0.5839291", "0.5772119", "0.57523173", "0.57442504", "0.55812573", "0.5453152", "0.54161006", "0.539817", "0.532769", "0.5317852", "0.5277706", "0.52659917", "0.5244693", "0.52418125", "0.5226842", "0.5189649", "0.51636565", "0.5156569...
0.5613463
7
Effectively sends a message to the aircraft with the mission.
def authorize_mission(self, missionId): print('Authorizing mission', missionId, 'for aircraft', self.id); if self.pendingMissions[0] != missionId: # Error, pendingMission is a fifo. Cannot authorized mission other # than the first one in the list. if missionId in self...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def msg(self, message, **kwargs):\n self.crafter.msg(message, {\"type\": \"crafting\"})", "def send_message(self, message):\n pass", "def sendMessage(self):\n #print('sendMessage\\r')\n self.pub.publish(Twist(linear=self.linearVector, angular=self.angularVector))", "def send(self,...
[ "0.7096539", "0.67297244", "0.6647759", "0.66430813", "0.66201043", "0.6618148", "0.6599953", "0.659871", "0.6576239", "0.6552405", "0.6552405", "0.6552405", "0.6548948", "0.6517222", "0.64823836", "0.64381874", "0.64368165", "0.6417102", "0.6412376", "0.6411487", "0.6411316"...
0.0
-1
Sends a message to aircraft to add the mission, and removes it from pending mission list.
def do_validate_mission(self, missionId): messageInterface.send(self.missions[missionId].build_message()) # if missionReceived: self.pendingMissions.pop(0); if self.outputBackupFile is not None: with open(self.outputBackupFile, "ab") as f: pickle.dump({'pendi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def execute_mission(self):\n\n self.pendingMissions = []\n messageInterface.send(self.currentMission.build_message())", "def acceptMission(self, idMission):\r\n found = False\r\n for m in self.missions:\r\n if m.getId() == int(idMission):\r\n found = True\r\n...
[ "0.6676255", "0.62046313", "0.6060555", "0.58366466", "0.57652545", "0.54939854", "0.537888", "0.5328158", "0.5274882", "0.5273589", "0.52374923", "0.5200469", "0.51825595", "0.51492417", "0.5086411", "0.50716436", "0.5057806", "0.5052343", "0.50415266", "0.50088197", "0.4995...
0.5223407
11
Removes a mission from self.pendingMissions without sending it to the aircraft.
def reject_mission(self, missionId): print('Rejecting mission', missionId, 'for aircraft', self.id); self.pendingMissions.remove(missionId) if self.outputBackupFile is not None: with open(self.outputBackupFile, "ab") as f: pickle.dump({'pendingMissions' : self.pending...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove(self, pool_name, *missions):\n\t\tpool = getattr(self, pool_name)\n\n\t\t# check mission state\n\t\tmissions = [m for m in missions if m.state not in (\"ANALYZING\", \"DOWNLOADING\")]\n\n\t\tfor mission in missions:\n\t\t\tdel pool[mission.url]\n\n\t\tself.cleanup()\n\t\tself.bubble(\"MISSION_LIST_REARR...
[ "0.6742761", "0.6493032", "0.62579316", "0.6030683", "0.59712803", "0.5816333", "0.57373405", "0.56957203", "0.55815095", "0.5552496", "0.5463226", "0.54363286", "0.5421029", "0.5399139", "0.5335216", "0.5306899", "0.52801126", "0.5279806", "0.5276704", "0.5248654", "0.523948...
0.71302354
0
Execute last mission in self.pendingMission To be removed when a real management is implemented
def execute_mission(self): self.pendingMissions = [] messageInterface.send(self.currentMission.build_message())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clear_mission(self):\n cmds = self.vehicle.commands\n self.vehicle.commands.clear()\n self.vehicle.flush()\n\n # After clearing the mission, we MUST re-download the mission from the \n # vehicle before vehicle.commands can be used again.\n # See https://github.com/dron...
[ "0.59472746", "0.5922551", "0.58533317", "0.5841672", "0.57032734", "0.567079", "0.5670382", "0.5663894", "0.5635181", "0.5568485", "0.5553974", "0.5549903", "0.55493927", "0.55345213", "0.55327535", "0.55241054", "0.55047387", "0.5479589", "0.5467998", "0.5403099", "0.53952"...
0.8171932
0
Recognizes faces in given image using a trained KNN classifier
def model(cp_list,cp_now): global record distance_threshold = 0.5 model_path = "trained_knn_model.clf" # Load a trained KNN model (if one was passed in) with open(model_path, 'rb') as f: knn_clf = pickle.load(f) for X_img in cp_list: # Load image file and find fac...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def recognize_faces(x_img,\n knn_clf=None,\n model_path=None,\n distance_threshold=0.3):\n print(\"Start recognize\")\n # Making a check\n if knn_clf is None and model_path is None:\n raise Exception(\"Must supply knn classifier either though...
[ "0.77550876", "0.75428885", "0.7375749", "0.7374013", "0.7353862", "0.73482585", "0.7172565", "0.715228", "0.7131715", "0.71167624", "0.70770067", "0.69371593", "0.69186586", "0.6877429", "0.684402", "0.6839461", "0.6835812", "0.6753209", "0.6740097", "0.67068845", "0.6688762...
0.0
-1
For each connection incoming to the current neuron, multiply the activation of the source neuron by delta
def calculate_gradients(self, neuron_idx, delta): return {idx: self.net.neurons[link.source_neuron_idx].activation * delta for (idx, link) in self.neuron_links[neuron_idx][0]}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_weights(self):\n activation, activation_p = self.feedforward()\n # initialize delta_weights\n delta_w = np.zeros(2)\n # simultaneous calculate delta_weights\n for i, element in enumerate(self.y):\n delta_w += (activation[i]-element)*(activation_p[i])*self.X[...
[ "0.640839", "0.636345", "0.6313031", "0.6273738", "0.626916", "0.6262535", "0.6209291", "0.61244166", "0.6094532", "0.6080038", "0.6061869", "0.60613334", "0.6029066", "0.60126704", "0.59933007", "0.59771097", "0.5976843", "0.59726787", "0.5964418", "0.5952827", "0.5932576", ...
0.60301554
12
visualisation of the input image interest points
def viz1(img, interest_points, color='r'): x = [a[1] for a in interest_points] #blob detection x axis y = [a[0] for a in interest_points] #blob detection y axis s = [a[2] for a in interest_points] #blob detected at sigma plt.imshow(img, cmap='gray') #adding the input image to plot for x, y, s in zip(x, y, s)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_image_sequence(self):\r\n\r\n imv = pg.ImageView()\r\n\r\n imv.show()\r\n\r\n imv.setImage(self.imageData)\r\n\r\n self.layout.addWidget(imv, 0, 0)\r\n\r\n\r\n\r\n avgImage = np.mean(self.imageData, axis=0)\r\n\r\n ima = pg.ImageView()\r\n\r\n ima.setImage(...
[ "0.640478", "0.63847405", "0.63375556", "0.6287032", "0.62815773", "0.62655914", "0.62209034", "0.6200891", "0.6193365", "0.61490846", "0.6137267", "0.6074347", "0.60507184", "0.6024846", "0.6012585", "0.6002759", "0.59989774", "0.5996514", "0.5971851", "0.59677815", "0.59248...
0.7920742
0
sum of squared differences between values in patch1, patch2
def count_difference(patch1, patch2): return np.sum(np.square(patch1 - patch2))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sum_of_squared_errors(P1,P2):\r\n return sum(euclidean_distance_3(p1,p2) for (p1,p2) in zip(P1,P2))", "def sum_of_squared_errors(P1,P2):\r\n return sum(euclidean_distance_2(p1,p2) for (p1,p2) in zip(P1,P2))", "def lsumdiffsquared(x,y):\r\n sds = 0\r\n for i in range(len(x)):\r\n sds = sd...
[ "0.64779776", "0.64131725", "0.64053327", "0.6281641", "0.6239101", "0.6176397", "0.6149316", "0.6146877", "0.6091206", "0.6080922", "0.6026293", "0.60062623", "0.59793645", "0.59259605", "0.5902211", "0.5887385", "0.5883692", "0.58622724", "0.5851945", "0.58446634", "0.57766...
0.71716875
0
calculates all differences between features in two images and looking for the best matches filters the matches with difference lower or equal to threshold
def match2(img1, img2, coordinates1, coordinates2, PATCH_SIZE): possible_matches = pd.DataFrame(columns=['feature1', 'feature2', 'diff']) # iteration through all the possible pairs of features from img1 and img2 for (feature1, feature2) in product(coordinates1, coordinates2): patch1 = make_patch(feature1, PATCH_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def apply_feature_matching(desc1: np.ndarray, desc2: np.ndarray,\n match_calculator: Callable[[list, list], float]) -> list:\n\n # Check descriptors dimensions are 2\n assert desc1.ndim == 2, \"Descriptor 1 shape is not 2\"\n assert desc2.ndim == 2, \"Descriptor 2 shape is not 2\...
[ "0.720819", "0.71327496", "0.7099693", "0.669751", "0.66654724", "0.6653938", "0.6580145", "0.6480495", "0.6446135", "0.64119065", "0.6407737", "0.637686", "0.63641155", "0.63494474", "0.63486856", "0.63310766", "0.6314357", "0.6308354", "0.630553", "0.63027436", "0.62981975"...
0.69057393
3
returns a list of coordinates that are their best matches both lefttoright and righttoleft
def match3(img1, img2, coordinates1, coordinates2, PATCH_SIZE, threshold=0.7): #creating patches for all points from img1 and img2 coord1_patches = [make_patch(coordinate, PATCH_SIZE, img1) for coordinate in coordinates1] coord2_patches = [make_patch(coordinate, PATCH_SIZE, img2) for coordinate in coordinates2] #...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def squareSearch( self, tTopLeft, tBottomRight, function, argsList ): #by LOQ\n\t\ttPaintedList = []\n\t\tresult = None\n\t\tfor x in range(tTopLeft[0], tBottomRight[0]+1):\n\t\t\tfor y in range(tTopLeft[1], tBottomRight[1]+1, -1): # edead: added -1, not sure why it didn't work before\n\t\t\t\tresult, bPaintPlot, ...
[ "0.6306889", "0.6269362", "0.6245228", "0.62230194", "0.62059367", "0.6058234", "0.6048335", "0.6038003", "0.6031063", "0.59902644", "0.59875417", "0.5977457", "0.5977241", "0.5971195", "0.59408545", "0.59291446", "0.5883519", "0.58814394", "0.58705986", "0.5866219", "0.58502...
0.0
-1
Used to provide statistics of the feature matching
def statistics(img1_blobs, img2_blobs, matches): statistics = {} statistics['#Interest Points in img1'] = len(img1_blobs) statistics['#Interest Points in img2'] = len(img2_blobs) statistics['Accepted Matches'] = len(matches) dissimilarity = [match[2] for match in matches] statistics['Mean of accepted matches'] =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_statistics(self):", "def get_feature_statistics(results):\n to_be_deleted = []\n\n for result in results:\n if len(result.subset) != 6:\n to_be_deleted.append(result)\n\n length = len(results)\n feature_labels = datapoint_features\n statistics = {}\n\n for label in...
[ "0.6867412", "0.67033225", "0.6672618", "0.6593359", "0.6573829", "0.6451946", "0.644889", "0.6402578", "0.62315124", "0.60831827", "0.60485744", "0.60403514", "0.60318154", "0.6018085", "0.6008345", "0.59858763", "0.5985413", "0.5965936", "0.59554505", "0.5938314", "0.593117...
0.6389583
8
visualisation of the feature matches of the two input images
def viz2(img1, interest_points1, img2, interest_points2, matches, PATCH_SIZE, threshold, min_sigma, max_sigma, num_sigma): fig = plt.figure(figsize=(10,5)) ax1 = fig.add_subplot(121) ax2 = fig.add_subplot(122) #adding the two images to axes ax1.imshow(img1, cmap='gray') ax2.imshow(img2, cmap='gray') posi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def drawMatches(img1, kp1, img2, kp2, matches):\n\n # Create a new output image that concatenates the two images together\n # (a.k.a) a montage\n rows1 = img1.shape[0]\n cols1 = img1.shape[1]\n rows2 = img2.shape[0]\n cols2 = img2.shape[1]\n\n out = np.zeros((max([rows1,rows2]),cols1+cols2,3),...
[ "0.72223604", "0.7210352", "0.71759593", "0.70562077", "0.6995943", "0.6994183", "0.69791126", "0.6944235", "0.6933909", "0.69263995", "0.6851522", "0.6807834", "0.6802697", "0.67325956", "0.672665", "0.6671003", "0.6659896", "0.66307634", "0.66003436", "0.6581556", "0.657181...
0.6730212
14
Returns an interface generator for |interface|. Called once for each interface that is not a callback function.
def InterfaceGenerator(self, interface, common_prefix, super_interface_name, source_filter): return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def interface(self):\n\n data = ['[Interface]']\n for item in INTERFACE_KEYS:\n value = getattr(self, item, None)\n if value:\n data.append(value)\n\n return '''\n'''.join(data)", "def from_interface(cls,interface,*args,**kargs):\n conf = Configura...
[ "0.5531334", "0.5525865", "0.5515438", "0.5429782", "0.53885365", "0.528917", "0.5258199", "0.5203507", "0.51787335", "0.5171712", "0.5062256", "0.50554425", "0.5033998", "0.50218827", "0.50152045", "0.49968714", "0.49968714", "0.49968714", "0.49968714", "0.49968714", "0.4996...
0.75885934
1
Processes an interface that is a callback function.
def ProcessCallback(self, interface, info): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _ProcessCallback(self, interface, info, file_path):\n self._dart_callback_file_paths.append(file_path)\n code = self._emitters.FileEmitter(file_path)\n\n code.Emit(self._templates.Load('callback.darttemplate'))\n code.Emit('typedef $TYPE $NAME($PARAMS);\\n',\n NAME=interface.id,\n ...
[ "0.7388945", "0.7388945", "0.6996998", "0.6519538", "0.64906186", "0.6338862", "0.63003725", "0.6191194", "0.6136016", "0.61295897", "0.60569656", "0.59520614", "0.5946387", "0.59059787", "0.5898366", "0.58923596", "0.58829063", "0.5862582", "0.57494104", "0.5743533", "0.5733...
0.8318254
1
Generates a typedef for the callback interface.
def _ProcessCallback(self, interface, info, file_path): self._dart_callback_file_paths.append(file_path) code = self._emitters.FileEmitter(file_path) code.Emit(self._templates.Load('callback.darttemplate')) code.Emit('typedef $TYPE $NAME($PARAMS);\n', NAME=interface.id, TYPE...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gen_stub(cls: Any, klass: str = None):\n name = cls.contract_event_name\n # Create a new `TypedDict' definition\n tname = f'{name}MessageData'\n type_str = f\"{tname} = TypedDict('{tname}', {cls.schema.build_annotations()})\"\n return re.sub(r\"'?(typing|zv|builtin).(\\w*)'?\", r'\\2', type_str)...
[ "0.5992075", "0.573953", "0.5597767", "0.5544411", "0.54924864", "0.54742986", "0.544249", "0.5441919", "0.5394369", "0.5379396", "0.5371248", "0.53518313", "0.5293954", "0.52628696", "0.5260927", "0.5225873", "0.52097815", "0.5184423", "0.5177892", "0.5174608", "0.51654506",...
0.59032494
2
Generates a lib file from a template and a list of files. Additional keyword arguments are passed to the template. Typically called from self.GenerateLibraries.
def _GenerateLibFile(self, lib_template, lib_file_path, file_paths, **template_args): # Load template. template = self._templates.Load(lib_template) # Generate the .lib file. lib_file_contents = self._emitters.FileEmitter(lib_file_path) # Emit the list of #source directives. ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main(\n files: List[Path] = typer.Argument(default=None, dir_okay=False, exists=True),\n template: Optional[str] = typer.Option(\n None, '--template', help='Name of template file'\n ),\n logo: Optional[str] = typer.Option(None, '--logo', help='Name of logo file'),\n logo_width: Optional[s...
[ "0.62458265", "0.6209271", "0.576154", "0.5760894", "0.56814146", "0.56250805", "0.56250805", "0.5602158", "0.5560846", "0.55587965", "0.55550075", "0.54758096", "0.54517764", "0.5416102", "0.5375398", "0.53513515", "0.5331048", "0.5306458", "0.52994704", "0.52932733", "0.525...
0.7688387
1
Returns a set of names (strings) for members defined in a base class.
def _BaseDefines(self, interface): def WalkParentChain(interface): if interface.parents: # Only consider primary parent, secondary parents are not on the # implementation class inheritance chain. parent = interface.parents[0] if generator.IsDartCollectionType(parent.type.id): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all_names(cls) -> List[str]:\n return list(member_name for member_name in cls.__members__.keys())", "def base_field_names(self):\n return self._base_field_names()", "def get_members():", "def __iter__(self):\n return (base.__name__ for base in self.bases)", "def getmembers(klass, m...
[ "0.73714197", "0.6842522", "0.67449003", "0.6648812", "0.6644145", "0.65229374", "0.65202487", "0.64956546", "0.64860773", "0.62948424", "0.6289807", "0.6250491", "0.6231375", "0.62225986", "0.62115324", "0.6156694", "0.6103977", "0.60956585", "0.6071582", "0.60612726", "0.60...
0.0
-1
Handle interfaces which must be hoisted to a common JSO base class
def ProcessMixins(self, mixins): self._mixins = mixins
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def interfaces(self):", "def interfaces(self):", "def target_interfaces(self):", "def target_interfaces(self):", "def source_interfaces(self):", "def source_interfaces(self):", "def __dispatch__(interface, *args, **kwds):\n # Override in subclasses.\n return None", "def __init__(self, i...
[ "0.6795294", "0.6795294", "0.64289284", "0.64289284", "0.63053995", "0.63053995", "0.625303", "0.6079358", "0.60775906", "0.60730344", "0.596415", "0.59501296", "0.5941285", "0.5941285", "0.5925071", "0.5912999", "0.5848995", "0.58429646", "0.58429646", "0.58429646", "0.58312...
0.0
-1
(tuple of int) > list of int
def checkio(numbers_array): return sorted(numbers_array, key=abs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_list_of_int2(self):\n pass", "def ints(xs: Iterable) -> list[int]:\n return lmap(int, xs)", "def enumerate(x) -> List[Tuple[int, any]]:\n pass", "def _to_tuple(values: Union[int, Iterable[int]]) -> Tuple[int, ...]:\n try:\n return tuple(values)\n except TypeError:\n ret...
[ "0.7457348", "0.73328656", "0.71052635", "0.6862712", "0.674535", "0.65563023", "0.6482003", "0.6469235", "0.64556104", "0.62995285", "0.6281323", "0.6251934", "0.6230251", "0.6192311", "0.6160767", "0.6140819", "0.6115585", "0.6094271", "0.6090769", "0.60679245", "0.60536647...
0.0
-1
Prints integers 1 through 100 sequentially in a ten by ten grid.
def ten_by_ten(): n=1 while n<=100: if n%10 == 0: print n else: print n, n +=1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_grid():\n print_line()\n for line in range(2):\n for post in range(4):\n print_post()\n print_line()", "def main():\n num_label = 1\n print('Printing ten random integers...')\n for i in range(NUM_RANDOM):\n print(str(num_label) + '):' + ' ' + str(random.ra...
[ "0.6569543", "0.65679497", "0.65646607", "0.6375016", "0.6352492", "0.63101375", "0.63097316", "0.6271304", "0.62634146", "0.62566876", "0.6251355", "0.6243986", "0.61811495", "0.61799407", "0.6137668", "0.6136843", "0.6128697", "0.61076075", "0.6107073", "0.6088797", "0.6087...
0.7224331
0
Plot only the discontinuities (threshold minjump).
def discontour( X: ArrayLike, Y: ArrayLike, Z: ArrayLike, min_jump: float | None = None, min_contour_length: float | None = None, color: str | None = None, linestyle: str | None = None, alpha: float | None = None, ax: plt.Axes | None = None, ): x, y, Z = _get_xy_from_meshgrid(X, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def correctOverflows(self):\n plt.figure(11)\n plt.clf()\n plt.plot(self.raw['METROLOGY_DATA'].data.field('TIME'),\n self.raw['METROLOGY_DATA'].data.field('DELTAL') )\n plt.hlines([np.median(self.raw['METROLOGY_DATA'].data.field('DELTAL')),\n np....
[ "0.5878892", "0.5799819", "0.57256097", "0.5641487", "0.5587996", "0.5580949", "0.54756176", "0.54238796", "0.5406325", "0.5395504", "0.53905535", "0.53540117", "0.5336111", "0.5312041", "0.5300851", "0.53000534", "0.52965117", "0.5270959", "0.5264748", "0.5262121", "0.525097...
0.5528275
6
Initiates potential matrixes. v has boundary values and initial guess of 9 everywhere else vNew is a copy of v vExact is the exact analytical solution, 10 everywhere
def initiateVMatrixes(): global v, vNew, vExact # Initialize the grid to 0 v = np.zeros((n+1, n+1)) # matrix of v, index are i: row, j:column # Set the boundary conditions for i in range(1,n): v[0,i] = 10 v[n,i] = 10 v[i,0] = 10 v[i,n] = 10 # Exact solution...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate():\n global v, vNew, n, stepsToToleranceArray\n stepsToToleranceArray = []\n for n in nArray:\n print('Currently working with n = ', n)\n initiateVMatrixes()\n step = 0\n toleranceAcqurired = False\n while not toleranceAcqurired:\n step+=1\n ...
[ "0.6296358", "0.6104716", "0.59339637", "0.5927703", "0.5892736", "0.58395153", "0.58070314", "0.58070314", "0.5806339", "0.5777011", "0.5720289", "0.5665781", "0.55881447", "0.5543292", "0.55227625", "0.552212", "0.55061567", "0.5506091", "0.5480284", "0.5473143", "0.5467505...
0.81041306
0
One checkerrelax iteration. v[i,j] is set as the avarage of its neighbours.
def relax_checker(): checker = 2 global v, vNew, n for check in range(0,2): for x in range(1,n): for y in range(1,n): if (x*(n+1) + y) % 2 == check: v[x,y] = (v[x-1][y] + v[x+1][y] + v[x][y-1] + v[x][y+1])*0.25
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def relaxVertex(self, v):\r\n for arc in self.graph.getAdj(v):\r\n neighbour = arc.getExtremityNode()\r\n if neighbour in self.closed_set:\r\n continue\r\n self.nb_relax_edges += 1\r\n new_dist = self.dists_so_far[v] + arc.getWeight()\r\n ...
[ "0.58130586", "0.5767384", "0.5755898", "0.56656975", "0.55695224", "0.5568701", "0.54769075", "0.5428179", "0.532105", "0.5316448", "0.5302247", "0.529143", "0.5271398", "0.5224567", "0.52211946", "0.52183616", "0.5149348", "0.5143607", "0.51420367", "0.512446", "0.5123433",...
0.64761513
0
Main calculation function that first initalizes with initiateVMatrixes() and then uses relax() until v is within tolerance. 1. Iterate for n = 5, 10 2. Iterate for the range of n in nArray
def calculate(): global v, vNew, n, stepsToToleranceArray stepsToToleranceArray = [] for n in nArray: print('Currently working with n = ', n) initiateVMatrixes() step = 0 toleranceAcqurired = False while not toleranceAcqurired: step+=1 relax_ch...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initiateVMatrixes():\n global v, vNew, vExact\n # Initialize the grid to 0\n v = np.zeros((n+1, n+1)) # matrix of v, index are i: row, j:column\n # Set the boundary conditions\n for i in range(1,n):\n v[0,i] = 10\n v[n,i] = 10\n v[i,0] = 10\n v[i,n] = 10\n #...
[ "0.72669476", "0.6188595", "0.617031", "0.6000074", "0.5868834", "0.58029294", "0.5790344", "0.57772875", "0.5773755", "0.5764524", "0.56795913", "0.5678016", "0.5666207", "0.56653416", "0.5660726", "0.5638518", "0.5625004", "0.5608089", "0.56063926", "0.56031847", "0.5598390...
0.84747493
0
Set lamp intensity in the range [0, 255]
def set_intensity(self, value): self._spectra._set_intensity(self._name, value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setLum ( self, newlum ):\n if isinstance( newlum, int ):\n newlum /= 100\n if newlum > 1.0:\n newlum = 1.0\n if newlum < 0.0:\n newlum = 0.0\n self.l = newlum\n self.hsl[2] = newlum\n self.hsla[2] = newlum\n self.updateFromHsl(...
[ "0.6964496", "0.63056415", "0.6125189", "0.6003263", "0.5950201", "0.59406114", "0.5883176", "0.5873168", "0.58662814", "0.5791942", "0.5753206", "0.5749067", "0.5714888", "0.57111955", "0.56980145", "0.5697827", "0.56953377", "0.5693024", "0.56886524", "0.5638608", "0.563401...
0.5315991
64
Produce a sequence of IOTool commands to enable and disable given Spectra lamps. Keyword arguments must be lamp names, as specified in the scope configuration. The values specified must be True to enable that lamp, False to disable, or None to do nothing (unspecified lamps are also not altered).
def _iotool_lamp_commands(self, **lamps): commands = [] for lamp, enabled in lamps.items(): if enabled is None: continue pin = self._spconfig.IOTOOL_LAMP_PINS[lamp] if enabled: commands.append(self._iotool.commands.set_high(pin)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lamps(self, **lamp_parameters):\n self._set_state(lamp_parameters.items())", "def all_lamps_slow():\n HOUSE = pre_process.get_house()\n\n for id_num, lamp in HOUSE.lamps.items():\n lamp.turn_on()\n lamp.set_transition_time(500)\n lamp.set_brigthness(254)\n lamp.send_c...
[ "0.5408981", "0.5334635", "0.4870005", "0.48662877", "0.48420778", "0.48191276", "0.48072937", "0.47955528", "0.47886992", "0.4721579", "0.46996623", "0.46858644", "0.46583447", "0.46001318", "0.46000558", "0.45971966", "0.45952561", "0.45923606", "0.45860842", "0.4581945", "...
0.7597153
0
Return a dict mapping lamp names to tuples of (peak_wavelength, bandwidth), in nm, where bandwidth is the minimum width required to contain 75% of the spectral intensity of the lamp output.
def get_lamp_specs(self): return {lamp: self._LAMP_SPECS[lamp] for lamp in self._available_lamps}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stubb_fitlers(wave_min=350., wave_max=1050):\n throughPath = os.path.join(getPackageDir('throughputs'), 'baseline')\n bps = {}\n lsstKeys = ['u', 'y']\n bps = {}\n for key in lsstKeys:\n bp = np.loadtxt(os.path.join(throughPath, 'total_'+key+'.dat'),\n dtype=zip(['w...
[ "0.601255", "0.5668921", "0.56192625", "0.5610423", "0.5600852", "0.5598455", "0.5598455", "0.55850786", "0.5564336", "0.548778", "0.5483454", "0.5475823", "0.5408421", "0.5390249", "0.5387245", "0.5372645", "0.5349552", "0.53355616", "0.5279677", "0.52596873", "0.52552986", ...
0.54686236
12
Set a number of lamp parameters at once using keyword arguments, e.g. spectra.lamps(red_enabled=True, red_intensity=255, blue_enabled=False) Intensity values must be in the range [0, 255]. Valid lamp names can be retrieved with get_lamp_specs().
def lamps(self, **lamp_parameters): self._set_state(lamp_parameters.items())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setParameters(self, lam=45, **ukwargs):\n\t\tEvolutionStrategy1p1.setParameters(self, **ukwargs)\n\t\tself.lam = lam\n\t\tif ukwargs: logger.info('Unused arguments: %s' % (ukwargs))", "def setLSLimits(*args):\n args[0].Limit.LSLimit.ls_limit = args[1]", "def setLCLimits(*args):\n args[0].Limit.LCLimi...
[ "0.6750617", "0.64525014", "0.60727084", "0.60697347", "0.5997909", "0.58803946", "0.57326317", "0.57204014", "0.56676894", "0.5609716", "0.56088686", "0.5593763", "0.5560277", "0.5505796", "0.5471875", "0.54498017", "0.5446686", "0.54387254", "0.543406", "0.5431726", "0.5406...
0.7872269
0