Search is not available for this dataset
identifier
stringlengths
1
155
parameters
stringlengths
2
6.09k
docstring
stringlengths
11
63.4k
docstring_summary
stringlengths
0
63.4k
function
stringlengths
29
99.8k
function_tokens
list
start_point
list
end_point
list
language
stringclasses
1 value
docstring_language
stringlengths
2
7
docstring_language_predictions
stringlengths
18
23
is_langid_reliable
stringclasses
2 values
feature
(self, node="clickhouse1", stress=None, parallel=None)
Check the RBAC functionality of TRUNCATE.
Check the RBAC functionality of TRUNCATE.
def feature(self, node="clickhouse1", stress=None, parallel=None): """Check the RBAC functionality of TRUNCATE. """ self.context.node = self.context.cluster.node(node) if parallel is not None: self.context.parallel = parallel if stress is not None: self.context.stress = stress ...
[ "def", "feature", "(", "self", ",", "node", "=", "\"clickhouse1\"", ",", "stress", "=", "None", ",", "parallel", "=", "None", ")", ":", "self", ".", "context", ".", "node", "=", "self", ".", "context", ".", "cluster", ".", "node", "(", "node", ")", ...
[ 125, 0 ]
[ 143, 77 ]
python
en
['en', 'en', 'en']
True
TestGetVectorIdsBase.test_list_id_in_segment_collection_name_None
(self, connect, collection)
target: get vector ids where collection name is None method: call list_id_in_segment with the collection_name: None expected: exception raised
target: get vector ids where collection name is None method: call list_id_in_segment with the collection_name: None expected: exception raised
def test_list_id_in_segment_collection_name_None(self, connect, collection): ''' target: get vector ids where collection name is None method: call list_id_in_segment with the collection_name: None expected: exception raised ''' collection_name = None name = self.g...
[ "def", "test_list_id_in_segment_collection_name_None", "(", "self", ",", "connect", ",", "collection", ")", ":", "collection_name", "=", "None", "name", "=", "self", ".", "get_valid_name", "(", "connect", ",", "collection", ")", "with", "pytest", ".", "raises", ...
[ 37, 4 ]
[ 46, 82 ]
python
en
['en', 'error', 'th']
False
TestGetVectorIdsBase.test_list_id_in_segment_collection_name_not_existed
(self, connect, collection)
target: get vector ids where collection name does not exist method: call list_id_in_segment with a random collection_name, which is not in db expected: status not ok
target: get vector ids where collection name does not exist method: call list_id_in_segment with a random collection_name, which is not in db expected: status not ok
def test_list_id_in_segment_collection_name_not_existed(self, connect, collection): ''' target: get vector ids where collection name does not exist method: call list_id_in_segment with a random collection_name, which is not in db expected: status not ok ''' collection_nam...
[ "def", "test_list_id_in_segment_collection_name_not_existed", "(", "self", ",", "connect", ",", "collection", ")", ":", "collection_name", "=", "gen_unique_str", "(", "\"not_existed_collection\"", ")", "name", "=", "self", ".", "get_valid_name", "(", "connect", ",", "...
[ 49, 4 ]
[ 58, 30 ]
python
en
['en', 'error', 'th']
False
TestGetVectorIdsBase.test_list_id_in_segment_collection_name_invalid
(self, connect, collection, get_collection_name)
target: get vector ids where collection name is invalid method: call list_id_in_segment with invalid collection_name expected: status not ok
target: get vector ids where collection name is invalid method: call list_id_in_segment with invalid collection_name expected: status not ok
def test_list_id_in_segment_collection_name_invalid(self, connect, collection, get_collection_name): ''' target: get vector ids where collection name is invalid method: call list_id_in_segment with invalid collection_name expected: status not ok ''' collection_name = get_...
[ "def", "test_list_id_in_segment_collection_name_invalid", "(", "self", ",", "connect", ",", "collection", ",", "get_collection_name", ")", ":", "collection_name", "=", "get_collection_name", "name", "=", "self", ".", "get_valid_name", "(", "connect", ",", "collection", ...
[ 68, 4 ]
[ 77, 30 ]
python
en
['en', 'error', 'th']
False
TestGetVectorIdsBase.test_list_id_in_segment_name_None
(self, connect, collection)
target: get vector ids where segment name is None method: call list_id_in_segment with the name: None expected: exception raised
target: get vector ids where segment name is None method: call list_id_in_segment with the name: None expected: exception raised
def test_list_id_in_segment_name_None(self, connect, collection): ''' target: get vector ids where segment name is None method: call list_id_in_segment with the name: None expected: exception raised ''' valid_name = self.get_valid_name(connect, collection) segment...
[ "def", "test_list_id_in_segment_name_None", "(", "self", ",", "connect", ",", "collection", ")", ":", "valid_name", "=", "self", ".", "get_valid_name", "(", "connect", ",", "collection", ")", "segment", "=", "None", "with", "pytest", ".", "raises", "(", "Excep...
[ 80, 4 ]
[ 89, 80 ]
python
en
['en', 'error', 'th']
False
TestGetVectorIdsBase.test_list_id_in_segment_name_not_existed
(self, connect, collection)
target: get vector ids where segment name does not exist method: call list_id_in_segment with a random segment name expected: status not ok
target: get vector ids where segment name does not exist method: call list_id_in_segment with a random segment name expected: status not ok
def test_list_id_in_segment_name_not_existed(self, connect, collection): ''' target: get vector ids where segment name does not exist method: call list_id_in_segment with a random segment name expected: status not ok ''' valid_name = self.get_valid_name(connect, collectio...
[ "def", "test_list_id_in_segment_name_not_existed", "(", "self", ",", "connect", ",", "collection", ")", ":", "valid_name", "=", "self", ".", "get_valid_name", "(", "connect", ",", "collection", ")", "segment", "=", "gen_unique_str", "(", "\"not_existed_segment\"", "...
[ 92, 4 ]
[ 102, 30 ]
python
en
['en', 'error', 'th']
False
TestGetVectorIdsBase.test_list_id_in_segment_without_index_A
(self, connect, collection)
target: get vector ids when there is no index method: call list_id_in_segment and check if the segment contains vectors expected: status ok
target: get vector ids when there is no index method: call list_id_in_segment and check if the segment contains vectors expected: status ok
def test_list_id_in_segment_without_index_A(self, connect, collection): ''' target: get vector ids when there is no index method: call list_id_in_segment and check if the segment contains vectors expected: status ok ''' vectors = gen_vector(10, dim) status, ids = ...
[ "def", "test_list_id_in_segment_without_index_A", "(", "self", ",", "connect", ",", "collection", ")", ":", "vectors", "=", "gen_vector", "(", "10", ",", "dim", ")", "status", ",", "ids", "=", "connect", ".", "insert", "(", "collection", ",", "vectors", ")",...
[ 105, 4 ]
[ 122, 42 ]
python
en
['en', 'error', 'th']
False
TestGetVectorIdsBase.test_list_id_in_segment_without_index_B
(self, connect, collection)
target: get vector ids when there is no index but with partition method: create partition, add vectors to it and call list_id_in_segment, check if the segment contains vectors expected: status ok
target: get vector ids when there is no index but with partition method: create partition, add vectors to it and call list_id_in_segment, check if the segment contains vectors expected: status ok
def test_list_id_in_segment_without_index_B(self, connect, collection): ''' target: get vector ids when there is no index but with partition method: create partition, add vectors to it and call list_id_in_segment, check if the segment contains vectors expected: status ok ''' ...
[ "def", "test_list_id_in_segment_without_index_B", "(", "self", ",", "connect", ",", "collection", ")", ":", "status", "=", "connect", ".", "create_partition", "(", "collection", ",", "tag", ")", "assert", "status", ".", "OK", "(", ")", "vectors", "=", "gen_vec...
[ 126, 4 ]
[ 146, 42 ]
python
en
['en', 'error', 'th']
False
TestGetVectorIdsBase.test_list_id_in_segment_with_index_A
(self, connect, collection, get_simple_index)
target: get vector ids when there is index method: call list_id_in_segment and check if the segment contains vectors expected: status ok
target: get vector ids when there is index method: call list_id_in_segment and check if the segment contains vectors expected: status ok
def test_list_id_in_segment_with_index_A(self, connect, collection, get_simple_index): ''' target: get vector ids when there is index method: call list_id_in_segment and check if the segment contains vectors expected: status ok ''' index_param = get_simple_index["index_pa...
[ "def", "test_list_id_in_segment_with_index_A", "(", "self", ",", "connect", ",", "collection", ",", "get_simple_index", ")", ":", "index_param", "=", "get_simple_index", "[", "\"index_param\"", "]", "index_type", "=", "get_simple_index", "[", "\"index_type\"", "]", "s...
[ 161, 4 ]
[ 182, 42 ]
python
en
['en', 'error', 'th']
False
TestGetVectorIdsBase.test_list_id_in_segment_with_index_B
(self, connect, collection, get_simple_index)
target: get vector ids when there is index and with partition method: create partition, add vectors to it and call list_id_in_segment, check if the segment contains vectors expected: status ok
target: get vector ids when there is index and with partition method: create partition, add vectors to it and call list_id_in_segment, check if the segment contains vectors expected: status ok
def test_list_id_in_segment_with_index_B(self, connect, collection, get_simple_index): ''' target: get vector ids when there is index and with partition method: create partition, add vectors to it and call list_id_in_segment, check if the segment contains vectors expected: status ok ...
[ "def", "test_list_id_in_segment_with_index_B", "(", "self", ",", "connect", ",", "collection", ",", "get_simple_index", ")", ":", "status", "=", "connect", ".", "create_partition", "(", "collection", ",", "tag", ")", "assert", "status", ".", "OK", "(", ")", "i...
[ 185, 4 ]
[ 209, 42 ]
python
en
['en', 'error', 'th']
False
TestGetVectorIdsBase.test_list_id_in_segment_after_delete_vectors
(self, connect, collection)
target: get vector ids after vectors are deleted method: add vectors and delete a few, call list_id_in_segment expected: status ok, vector_ids decreased after vectors deleted
target: get vector ids after vectors are deleted method: add vectors and delete a few, call list_id_in_segment expected: status ok, vector_ids decreased after vectors deleted
def test_list_id_in_segment_after_delete_vectors(self, connect, collection): ''' target: get vector ids after vectors are deleted method: add vectors and delete a few, call list_id_in_segment expected: status ok, vector_ids decreased after vectors deleted ''' vectors = ge...
[ "def", "test_list_id_in_segment_after_delete_vectors", "(", "self", ",", "connect", ",", "collection", ")", ":", "vectors", "=", "gen_vector", "(", "2", ",", "dim", ")", "status", ",", "ids", "=", "connect", ".", "insert", "(", "collection", ",", "vectors", ...
[ 212, 4 ]
[ 229, 38 ]
python
en
['en', 'error', 'th']
False
TestGetVectorIdsIP.test_list_id_in_segment_without_index_A
(self, connect, ip_collection)
target: get vector ids when there is no index method: call list_id_in_segment and check if the segment contains vectors expected: status ok
target: get vector ids when there is no index method: call list_id_in_segment and check if the segment contains vectors expected: status ok
def test_list_id_in_segment_without_index_A(self, connect, ip_collection): ''' target: get vector ids when there is no index method: call list_id_in_segment and check if the segment contains vectors expected: status ok ''' vectors = gen_vector(10, dim) status, ids...
[ "def", "test_list_id_in_segment_without_index_A", "(", "self", ",", "connect", ",", "ip_collection", ")", ":", "vectors", "=", "gen_vector", "(", "10", ",", "dim", ")", "status", ",", "ids", "=", "connect", ".", "insert", "(", "ip_collection", ",", "vectors", ...
[ 239, 4 ]
[ 256, 42 ]
python
en
['en', 'error', 'th']
False
TestGetVectorIdsIP.test_list_id_in_segment_without_index_B
(self, connect, ip_collection)
target: get vector ids when there is no index but with partition method: create partition, add vectors to it and call list_id_in_segment, check if the segment contains vectors expected: status ok
target: get vector ids when there is no index but with partition method: create partition, add vectors to it and call list_id_in_segment, check if the segment contains vectors expected: status ok
def test_list_id_in_segment_without_index_B(self, connect, ip_collection): ''' target: get vector ids when there is no index but with partition method: create partition, add vectors to it and call list_id_in_segment, check if the segment contains vectors expected: status ok ''' ...
[ "def", "test_list_id_in_segment_without_index_B", "(", "self", ",", "connect", ",", "ip_collection", ")", ":", "status", "=", "connect", ".", "create_partition", "(", "ip_collection", ",", "tag", ")", "assert", "status", ".", "OK", "(", ")", "vectors", "=", "g...
[ 260, 4 ]
[ 280, 42 ]
python
en
['en', 'error', 'th']
False
TestGetVectorIdsIP.test_list_id_in_segment_with_index_A
(self, connect, ip_collection, get_simple_index)
target: get vector ids when there is index method: call list_id_in_segment and check if the segment contains vectors expected: status ok
target: get vector ids when there is index method: call list_id_in_segment and check if the segment contains vectors expected: status ok
def test_list_id_in_segment_with_index_A(self, connect, ip_collection, get_simple_index): ''' target: get vector ids when there is index method: call list_id_in_segment and check if the segment contains vectors expected: status ok ''' index_param = get_simple_index["index...
[ "def", "test_list_id_in_segment_with_index_A", "(", "self", ",", "connect", ",", "ip_collection", ",", "get_simple_index", ")", ":", "index_param", "=", "get_simple_index", "[", "\"index_param\"", "]", "index_type", "=", "get_simple_index", "[", "\"index_type\"", "]", ...
[ 295, 4 ]
[ 316, 42 ]
python
en
['en', 'error', 'th']
False
TestGetVectorIdsIP.test_list_id_in_segment_with_index_B
(self, connect, ip_collection, get_simple_index)
target: get vector ids when there is index and with partition method: create partition, add vectors to it and call list_id_in_segment, check if the segment contains vectors expected: status ok
target: get vector ids when there is index and with partition method: create partition, add vectors to it and call list_id_in_segment, check if the segment contains vectors expected: status ok
def test_list_id_in_segment_with_index_B(self, connect, ip_collection, get_simple_index): ''' target: get vector ids when there is index and with partition method: create partition, add vectors to it and call list_id_in_segment, check if the segment contains vectors expected: status ok ...
[ "def", "test_list_id_in_segment_with_index_B", "(", "self", ",", "connect", ",", "ip_collection", ",", "get_simple_index", ")", ":", "status", "=", "connect", ".", "create_partition", "(", "ip_collection", ",", "tag", ")", "assert", "status", ".", "OK", "(", ")"...
[ 319, 4 ]
[ 343, 42 ]
python
en
['en', 'error', 'th']
False
TestGetVectorIdsIP.test_list_id_in_segment_after_delete_vectors
(self, connect, ip_collection)
target: get vector ids after vectors are deleted method: add vectors and delete a few, call list_id_in_segment expected: status ok, vector_ids decreased after vectors deleted
target: get vector ids after vectors are deleted method: add vectors and delete a few, call list_id_in_segment expected: status ok, vector_ids decreased after vectors deleted
def test_list_id_in_segment_after_delete_vectors(self, connect, ip_collection): ''' target: get vector ids after vectors are deleted method: add vectors and delete a few, call list_id_in_segment expected: status ok, vector_ids decreased after vectors deleted ''' vectors =...
[ "def", "test_list_id_in_segment_after_delete_vectors", "(", "self", ",", "connect", ",", "ip_collection", ")", ":", "vectors", "=", "gen_vector", "(", "2", ",", "dim", ")", "status", ",", "ids", "=", "connect", ".", "insert", "(", "ip_collection", ",", "vector...
[ 346, 4 ]
[ 363, 38 ]
python
en
['en', 'error', 'th']
False
TestGetVectorIdsJAC.test_list_id_in_segment_without_index_A
(self, connect, jac_collection)
target: get vector ids when there is no index method: call list_id_in_segment and check if the segment contains vectors expected: status ok
target: get vector ids when there is no index method: call list_id_in_segment and check if the segment contains vectors expected: status ok
def test_list_id_in_segment_without_index_A(self, connect, jac_collection): ''' target: get vector ids when there is no index method: call list_id_in_segment and check if the segment contains vectors expected: status ok ''' tmp, vectors = gen_binary_vectors(10, dim) ...
[ "def", "test_list_id_in_segment_without_index_A", "(", "self", ",", "connect", ",", "jac_collection", ")", ":", "tmp", ",", "vectors", "=", "gen_binary_vectors", "(", "10", ",", "dim", ")", "status", ",", "ids", "=", "connect", ".", "insert", "(", "jac_collect...
[ 373, 4 ]
[ 390, 42 ]
python
en
['en', 'error', 'th']
False
TestGetVectorIdsJAC.test_list_id_in_segment_without_index_B
(self, connect, jac_collection)
target: get vector ids when there is no index but with partition method: create partition, add vectors to it and call list_id_in_segment, check if the segment contains vectors expected: status ok
target: get vector ids when there is no index but with partition method: create partition, add vectors to it and call list_id_in_segment, check if the segment contains vectors expected: status ok
def test_list_id_in_segment_without_index_B(self, connect, jac_collection): ''' target: get vector ids when there is no index but with partition method: create partition, add vectors to it and call list_id_in_segment, check if the segment contains vectors expected: status ok ''' ...
[ "def", "test_list_id_in_segment_without_index_B", "(", "self", ",", "connect", ",", "jac_collection", ")", ":", "status", "=", "connect", ".", "create_partition", "(", "jac_collection", ",", "tag", ")", "assert", "status", ".", "OK", "(", ")", "tmp", ",", "vec...
[ 393, 4 ]
[ 413, 42 ]
python
en
['en', 'error', 'th']
False
TestGetVectorIdsJAC.test_list_id_in_segment_with_index_A
(self, connect, jac_collection, get_jaccard_index)
target: get vector ids when there is index method: call list_id_in_segment and check if the segment contains vectors expected: status ok
target: get vector ids when there is index method: call list_id_in_segment and check if the segment contains vectors expected: status ok
def test_list_id_in_segment_with_index_A(self, connect, jac_collection, get_jaccard_index): ''' target: get vector ids when there is index method: call list_id_in_segment and check if the segment contains vectors expected: status ok ''' index_param = get_jaccard_index["in...
[ "def", "test_list_id_in_segment_with_index_A", "(", "self", ",", "connect", ",", "jac_collection", ",", "get_jaccard_index", ")", ":", "index_param", "=", "get_jaccard_index", "[", "\"index_param\"", "]", "index_type", "=", "get_jaccard_index", "[", "\"index_type\"", "]...
[ 427, 4 ]
[ 448, 42 ]
python
en
['en', 'error', 'th']
False
TestGetVectorIdsJAC.test_list_id_in_segment_with_index_B
(self, connect, jac_collection, get_jaccard_index)
target: get vector ids when there is index and with partition method: create partition, add vectors to it and call list_id_in_segment, check if the segment contains vectors expected: status ok
target: get vector ids when there is index and with partition method: create partition, add vectors to it and call list_id_in_segment, check if the segment contains vectors expected: status ok
def test_list_id_in_segment_with_index_B(self, connect, jac_collection, get_jaccard_index): ''' target: get vector ids when there is index and with partition method: create partition, add vectors to it and call list_id_in_segment, check if the segment contains vectors expected: status ok...
[ "def", "test_list_id_in_segment_with_index_B", "(", "self", ",", "connect", ",", "jac_collection", ",", "get_jaccard_index", ")", ":", "status", "=", "connect", ".", "create_partition", "(", "jac_collection", ",", "tag", ")", "assert", "status", ".", "OK", "(", ...
[ 451, 4 ]
[ 475, 42 ]
python
en
['en', 'error', 'th']
False
TestGetVectorIdsJAC.test_list_id_in_segment_after_delete_vectors
(self, connect, jac_collection)
target: get vector ids after vectors are deleted method: add vectors and delete a few, call list_id_in_segment expected: status ok, vector_ids decreased after vectors deleted
target: get vector ids after vectors are deleted method: add vectors and delete a few, call list_id_in_segment expected: status ok, vector_ids decreased after vectors deleted
def test_list_id_in_segment_after_delete_vectors(self, connect, jac_collection): ''' target: get vector ids after vectors are deleted method: add vectors and delete a few, call list_id_in_segment expected: status ok, vector_ids decreased after vectors deleted ''' tmp, vec...
[ "def", "test_list_id_in_segment_after_delete_vectors", "(", "self", ",", "connect", ",", "jac_collection", ")", ":", "tmp", ",", "vectors", "=", "gen_binary_vectors", "(", "2", ",", "dim", ")", "status", ",", "ids", "=", "connect", ".", "insert", "(", "jac_col...
[ 478, 4 ]
[ 495, 38 ]
python
en
['en', 'error', 'th']
False
plain_text
(self)
Check that we can perform LDAP user authentication using `plain text` connection protocol.
Check that we can perform LDAP user authentication using `plain text` connection protocol.
def plain_text(self): """Check that we can perform LDAP user authentication using `plain text` connection protocol. """ servers = { "openldap1": { "host": "openldap1", "enable_tls": "no", "auth_dn_prefix": "cn=", "auth_dn_suffix": ",ou=users,dc=company...
[ "def", "plain_text", "(", "self", ")", ":", "servers", "=", "{", "\"openldap1\"", ":", "{", "\"host\"", ":", "\"openldap1\"", ",", "\"enable_tls\"", ":", "\"no\"", ",", "\"auth_dn_prefix\"", ":", "\"cn=\"", ",", "\"auth_dn_suffix\"", ":", "\",ou=users,dc=company,d...
[ 13, 0 ]
[ 27, 26 ]
python
en
['en', 'en', 'en']
True
plain_text_with_custom_port
(self)
Check that we can perform LDAP user authentication using `plain text` connection protocol with the server that uses custom port.
Check that we can perform LDAP user authentication using `plain text` connection protocol with the server that uses custom port.
def plain_text_with_custom_port(self): """Check that we can perform LDAP user authentication using `plain text` connection protocol with the server that uses custom port. """ servers = { "openldap3": { "host": "openldap3", "port": "3089", "enable_tls": "no", ...
[ "def", "plain_text_with_custom_port", "(", "self", ")", ":", "servers", "=", "{", "\"openldap3\"", ":", "{", "\"host\"", ":", "\"openldap3\"", ",", "\"port\"", ":", "\"3089\"", ",", "\"enable_tls\"", ":", "\"no\"", ",", "\"auth_dn_prefix\"", ":", "\"cn=\"", ",",...
[ 34, 0 ]
[ 50, 26 ]
python
en
['en', 'en', 'en']
True
tls_with_custom_port
(self)
Check that we can perform LDAP user authentication using `TLS` connection protocol with the server that uses custom port.
Check that we can perform LDAP user authentication using `TLS` connection protocol with the server that uses custom port.
def tls_with_custom_port(self): """Check that we can perform LDAP user authentication using `TLS` connection protocol with the server that uses custom port. """ servers = { "openldap4": { "host": "openldap4", "port": "6036", "tls_require_cert": "never", ...
[ "def", "tls_with_custom_port", "(", "self", ")", ":", "servers", "=", "{", "\"openldap4\"", ":", "{", "\"host\"", ":", "\"openldap4\"", ",", "\"port\"", ":", "\"6036\"", ",", "\"tls_require_cert\"", ":", "\"never\"", ",", "\"auth_dn_prefix\"", ":", "\"cn=\"", ",...
[ 57, 0 ]
[ 73, 26 ]
python
en
['en', 'en', 'en']
True
starttls_with_custom_port
(self)
Check that we can perform LDAP user authentication using `StartTLS` connection protocol with the server that uses custom port.
Check that we can perform LDAP user authentication using `StartTLS` connection protocol with the server that uses custom port.
def starttls_with_custom_port(self): """Check that we can perform LDAP user authentication using `StartTLS` connection protocol with the server that uses custom port. """ servers = { "openldap4": { "host": "openldap4", "port": "3089", "enable_tls": "starttls",...
[ "def", "starttls_with_custom_port", "(", "self", ")", ":", "servers", "=", "{", "\"openldap4\"", ":", "{", "\"host\"", ":", "\"openldap4\"", ",", "\"port\"", ":", "\"3089\"", ",", "\"enable_tls\"", ":", "\"starttls\"", ",", "\"tls_require_cert\"", ":", "\"never\""...
[ 80, 0 ]
[ 97, 26 ]
python
en
['en', 'en', 'en']
True
tls_connection
(enable_tls, tls_require_cert)
Try to login using LDAP user authentication over a TLS connection.
Try to login using LDAP user authentication over a TLS connection.
def tls_connection(enable_tls, tls_require_cert): """Try to login using LDAP user authentication over a TLS connection. """ servers = { "openldap2": { "host": "openldap2", "enable_tls": enable_tls, "tls_require_cert": tls_require_cert, "auth_dn_prefix"...
[ "def", "tls_connection", "(", "enable_tls", ",", "tls_require_cert", ")", ":", "servers", "=", "{", "\"openldap2\"", ":", "{", "\"host\"", ":", "\"openldap2\"", ",", "\"enable_tls\"", ":", "enable_tls", ",", "\"tls_require_cert\"", ":", "tls_require_cert", ",", "\...
[ 99, 0 ]
[ 127, 30 ]
python
en
['en', 'en', 'en']
True
tls
(self)
Check that we can perform LDAP user authentication using `TLS` connection protocol.
Check that we can perform LDAP user authentication using `TLS` connection protocol.
def tls(self): """Check that we can perform LDAP user authentication using `TLS` connection protocol. """ for example in self.examples: tls_connection(*example)
[ "def", "tls", "(", "self", ")", ":", "for", "example", "in", "self", ".", "examples", ":", "tls_connection", "(", "*", "example", ")" ]
[ 144, 0 ]
[ 148, 32 ]
python
en
['en', 'en', 'en']
True
tls_enable_tls_default_yes
(self)
Check that the default value for the `enable_tls` is set to `yes`.
Check that the default value for the `enable_tls` is set to `yes`.
def tls_enable_tls_default_yes(self): """Check that the default value for the `enable_tls` is set to `yes`. """ servers = { "openldap2": { "host": "openldap2", "tls_require_cert": "never", "auth_dn_prefix": "cn=", "auth_dn_suffix": ",ou=users,dc=compan...
[ "def", "tls_enable_tls_default_yes", "(", "self", ")", ":", "servers", "=", "{", "\"openldap2\"", ":", "{", "\"host\"", ":", "\"openldap2\"", ",", "\"tls_require_cert\"", ":", "\"never\"", ",", "\"auth_dn_prefix\"", ":", "\"cn=\"", ",", "\"auth_dn_suffix\"", ":", ...
[ 154, 0 ]
[ 168, 26 ]
python
en
['en', 'en', 'en']
True
tls_require_cert_default_demand
(self)
Check that the default value for the `tls_require_cert` is set to `demand`.
Check that the default value for the `tls_require_cert` is set to `demand`.
def tls_require_cert_default_demand(self): """Check that the default value for the `tls_require_cert` is set to `demand`. """ servers = { "openldap2": { "host": "openldap2", "enable_tls": "yes", "port": "636", "auth_dn_prefix": "cn=", "auth...
[ "def", "tls_require_cert_default_demand", "(", "self", ")", ":", "servers", "=", "{", "\"openldap2\"", ":", "{", "\"host\"", ":", "\"openldap2\"", ",", "\"enable_tls\"", ":", "\"yes\"", ",", "\"port\"", ":", "\"636\"", ",", "\"auth_dn_prefix\"", ":", "\"cn=\"", ...
[ 174, 0 ]
[ 189, 26 ]
python
en
['en', 'en', 'en']
True
starttls
(self)
Check that we can perform LDAP user authentication using legacy `StartTLS` connection protocol.
Check that we can perform LDAP user authentication using legacy `StartTLS` connection protocol.
def starttls(self): """Check that we can perform LDAP user authentication using legacy `StartTLS` connection protocol. """ for example in self.examples: tls_connection(*example)
[ "def", "starttls", "(", "self", ")", ":", "for", "example", "in", "self", ".", "examples", ":", "tls_connection", "(", "*", "example", ")" ]
[ 204, 0 ]
[ 208, 32 ]
python
en
['en', 'en', 'en']
True
tls_cipher_suite
(self)
Check that `tls_cipher_suite` parameter can be used specify allowed cipher suites.
Check that `tls_cipher_suite` parameter can be used specify allowed cipher suites.
def tls_cipher_suite(self): """Check that `tls_cipher_suite` parameter can be used specify allowed cipher suites. """ servers = { "openldap4": { "host": "openldap4", "port": "6036", "tls_require_cert": "never", "tls_cipher_suite": "SECURE256:+SECURE128...
[ "def", "tls_cipher_suite", "(", "self", ")", ":", "servers", "=", "{", "\"openldap4\"", ":", "{", "\"host\"", ":", "\"openldap4\"", ",", "\"port\"", ":", "\"6036\"", ",", "\"tls_require_cert\"", ":", "\"never\"", ",", "\"tls_cipher_suite\"", ":", "\"SECURE256:+SEC...
[ 214, 0 ]
[ 231, 26 ]
python
en
['en', 'en', 'en']
True
tls_minimum_protocol_version
(self, version, exitcode, message)
Check that `tls_minimum_protocol_version` parameter can be used specify to specify the minimum protocol version of SSL/TLS.
Check that `tls_minimum_protocol_version` parameter can be used specify to specify the minimum protocol version of SSL/TLS.
def tls_minimum_protocol_version(self, version, exitcode, message): """Check that `tls_minimum_protocol_version` parameter can be used specify to specify the minimum protocol version of SSL/TLS. """ servers = { "openldap4": { "host": "openldap4", "port": "6036", ...
[ "def", "tls_minimum_protocol_version", "(", "self", ",", "version", ",", "exitcode", ",", "message", ")", ":", "servers", "=", "{", "\"openldap4\"", ":", "{", "\"host\"", ":", "\"openldap4\"", ",", "\"port\"", ":", "\"6036\"", ",", "\"tls_require_cert\"", ":", ...
[ 245, 0 ]
[ 280, 26 ]
python
en
['en', 'en', 'en']
True
feature
(self, node="clickhouse1")
Check different LDAP connection protocols.
Check different LDAP connection protocols.
def feature(self, node="clickhouse1"): """Check different LDAP connection protocols. """ self.context.node = self.context.cluster.node(node) for scenario in loads(current_module(), Scenario): scenario()
[ "def", "feature", "(", "self", ",", "node", "=", "\"clickhouse1\"", ")", ":", "self", ".", "context", ".", "node", "=", "self", ".", "context", ".", "cluster", ".", "node", "(", "node", ")", "for", "scenario", "in", "loads", "(", "current_module", "(",...
[ 284, 0 ]
[ 290, 18 ]
python
en
['en', 'fr', 'en']
True
KanikoImage.build
(self)
build docker image from target
build docker image from target
def build(self) -> None: ''' build docker image from target ''' logger.info(f'Building docker image for target: {self._target.info}') logger.info(f"Docker image: {self._image_uri}") # Build docker image with kaniko executor with pushd(self._target.path): try:...
[ "def", "build", "(", "self", ")", "->", "None", ":", "logger", ".", "info", "(", "f'Building docker image for target: {self._target.info}'", ")", "logger", ".", "info", "(", "f\"Docker image: {self._image_uri}\"", ")", "# Build docker image with kaniko executor", "with", ...
[ 81, 4 ]
[ 100, 50 ]
python
en
['en', 'da', 'en']
True
KanikoImage.update_config
(settings:dict)
Update kaniko configuration
Update kaniko configuration
def update_config(settings:dict) -> None: ''' Update kaniko configuration ''' CI_REGISTRY = os.environ.get("CI_REGISTRY") CI_REGISTRY_USER = os.environ.get("CI_REGISTRY_USER") CI_REGISTRY_PASSWORD = os.environ.get("CI_REGISTRY_PASSWORD") if not CI_REGISTRY or not CI_REGI...
[ "def", "update_config", "(", "settings", ":", "dict", ")", "->", "None", ":", "CI_REGISTRY", "=", "os", ".", "environ", ".", "get", "(", "\"CI_REGISTRY\"", ")", "CI_REGISTRY_USER", "=", "os", ".", "environ", ".", "get", "(", "\"CI_REGISTRY_USER\"", ")", "C...
[ 103, 4 ]
[ 128, 14 ]
python
en
['en', 'sn', 'sw']
False
_reduce_geom_precision
(geom, precision=2)
Grom solaris.utils.geo
Grom solaris.utils.geo
def _reduce_geom_precision(geom, precision=2): "Grom solaris.utils.geo" geojson = mapping(geom) geojson['coordinates'] = np.round(np.array(geojson['coordinates']), precision) return shape(geojson)
[ "def", "_reduce_geom_precision", "(", "geom", ",", "precision", "=", "2", ")", ":", "geojson", "=", "mapping", "(", "geom", ")", "geojson", "[", "'coordinates'", "]", "=", "np", ".", "round", "(", "np", ".", "array", "(", "geojson", "[", "'coordinates'",...
[ 12, 0 ]
[ 17, 25 ]
python
en
['en', 'la', 'it']
False
convert_poly_coords
(geom:shape, raster_src:str=None, affine_obj:affine.Affine=None, inverse:bool=False, precision=None)
Adapted from solaris. Converts georeferenced coordinates to pixel coordinates and vice versa
Adapted from solaris. Converts georeferenced coordinates to pixel coordinates and vice versa
def convert_poly_coords(geom:shape, raster_src:str=None, affine_obj:affine.Affine=None, inverse:bool=False, precision=None) -> shape: "Adapted from solaris. Converts georeferenced coordinates to pixel coordinates and vice versa" if not raster_src and not affine_obj: raise ValueEr...
[ "def", "convert_poly_coords", "(", "geom", ":", "shape", ",", "raster_src", ":", "str", "=", "None", ",", "affine_obj", ":", "affine", ".", "Affine", "=", "None", ",", "inverse", ":", "bool", "=", "False", ",", "precision", "=", "None", ")", "->", "sha...
[ 20, 0 ]
[ 63, 20 ]
python
en
['en', 'en', 'en']
True
affine_transform_gdf
(gdf:gpd.GeoDataFrame, affine_obj:affine.Affine, inverse:bool=False, geom_col:str='geometry', precision:int=None)
Adapted from solaris, transforms all geometries in GeoDataFrame to pixel coordinates from Georeferced coordinates and vice versa
Adapted from solaris, transforms all geometries in GeoDataFrame to pixel coordinates from Georeferced coordinates and vice versa
def affine_transform_gdf(gdf:gpd.GeoDataFrame, affine_obj:affine.Affine, inverse:bool=False, geom_col:str='geometry', precision:int=None) -> gpd.GeoDataFrame: """Adapted from solaris, transforms all geometries in GeoDataFrame to pixel coordinates from Georeferced coordinates and vice ve...
[ "def", "affine_transform_gdf", "(", "gdf", ":", "gpd", ".", "GeoDataFrame", ",", "affine_obj", ":", "affine", ".", "Affine", ",", "inverse", ":", "bool", "=", "False", ",", "geom_col", ":", "str", "=", "'geometry'", ",", "precision", ":", "int", "=", "No...
[ 65, 0 ]
[ 80, 14 ]
python
en
['en', 'en', 'en']
True
gdf_to_px
(gdf:gpd.GeoDataFrame, im_path, geom_col:str='geometry', precision:int=None, outpath=None, override_crs=False)
Adapted from https://solaris.readthedocs.io/en/latest/_modules/solaris/vector/polygon.html#geojson_to_px_gdf
Adapted from https://solaris.readthedocs.io/en/latest/_modules/solaris/vector/polygon.html#geojson_to_px_gdf
def gdf_to_px(gdf:gpd.GeoDataFrame, im_path, geom_col:str='geometry', precision:int=None, outpath=None, override_crs=False) -> gpd.GeoDataFrame: "Adapted from https://solaris.readthedocs.io/en/latest/_modules/solaris/vector/polygon.html#geojson_to_px_gdf" with rio.open(im_path) as im: aff...
[ "def", "gdf_to_px", "(", "gdf", ":", "gpd", ".", "GeoDataFrame", ",", "im_path", ",", "geom_col", ":", "str", "=", "'geometry'", ",", "precision", ":", "int", "=", "None", ",", "outpath", "=", "None", ",", "override_crs", "=", "False", ")", "->", "gpd"...
[ 83, 0 ]
[ 101, 26 ]
python
en
['en', 'en', 'en']
True
ObserverModel.forward
(self, image, scales=[])
r"""Generate the V1 representation of an image. Parameters ---------- image : torch.Tensor A tensor containing the image to analyze. We want to operate on this in the pytorch-y way, so we want it to be 4d (batch, channel, height, width). scales : list...
r"""Generate the V1 representation of an image.
def forward(self, image, scales=[]): r"""Generate the V1 representation of an image. Parameters ---------- image : torch.Tensor A tensor containing the image to analyze. We want to operate on this in the pytorch-y way, so we want it to be 4d (batch, c...
[ "def", "forward", "(", "self", ",", "image", ",", "scales", "=", "[", "]", ")", ":", "if", "image", ".", "shape", "[", "1", "]", "!=", "1", ":", "raise", "Exception", "(", "\"Haven't thought about how to handle images with\"", "\" more than 1 channel!\"", ")",...
[ 285, 4 ]
[ 336, 63 ]
python
en
['en', 'en', 'en']
True
ObserverModel._sf_weighting
(self)
Get weights based on sf_weighting. This should then be passed to PoolingWindows, so it can appropriately weight the different scales at each location.
Get weights based on sf_weighting.
def _sf_weighting(self): """Get weights based on sf_weighting. This should then be passed to PoolingWindows, so it can appropriately weight the different scales at each location. """ def log_gaussian(A, sigma, freqs, eccen, intercept, slope): return (A * torch.exp(-...
[ "def", "_sf_weighting", "(", "self", ")", ":", "def", "log_gaussian", "(", "A", ",", "sigma", ",", "freqs", ",", "eccen", ",", "intercept", ",", "slope", ")", ":", "return", "(", "A", "*", "torch", ".", "exp", "(", "-", "(", "(", "torch", ".", "l...
[ 338, 4 ]
[ 356, 52 ]
python
en
['en', 'en', 'en']
True
ObserverModel._modal_frequencies
(self)
Compute modal frequencies (in cpd) of steerable pyramid scales. This sets self.modal_freqs_cpd. In order to weight the spatial frequency representation at each location, need to know the modal frequency of each scale of the pyramid. This computes that by finding the argmax of the radia...
Compute modal frequencies (in cpd) of steerable pyramid scales.
def _modal_frequencies(self): """Compute modal frequencies (in cpd) of steerable pyramid scales. This sets self.modal_freqs_cpd. In order to weight the spatial frequency representation at each location, need to know the modal frequency of each scale of the pyramid. This compute...
[ "def", "_modal_frequencies", "(", "self", ")", ":", "self", ".", "modal_freqs_cpd", "=", "[", "]", "if", "np", ".", "divide", "(", "*", "self", ".", "img_res", ")", ">", "2", "or", "np", ".", "divide", "(", "*", "self", ".", "img_res", ")", "<", ...
[ 358, 4 ]
[ 407, 69 ]
python
en
['en', 'en', 'en']
True
ObserverModel._gen_spatial_masks
(self, n_angles=4)
r"""Generate spatial masks. Create and return masks that allow us to specifically select values from model's representation that correspond to different regions of the image. See ``summarize_representation()`` for an example of how to use them Parameters ---------- ...
r"""Generate spatial masks.
def _gen_spatial_masks(self, n_angles=4): r"""Generate spatial masks. Create and return masks that allow us to specifically select values from model's representation that correspond to different regions of the image. See ``summarize_representation()`` for an example of how to use ...
[ "def", "_gen_spatial_masks", "(", "self", ",", "n_angles", "=", "4", ")", ":", "masks", "=", "{", "}", "for", "i", "in", "range", "(", "self", ".", "num_scales", ")", ":", "ecc", "=", "torch", ".", "ones_like", "(", "self", ".", "PoolingWindows", "."...
[ 409, 4 ]
[ 441, 20 ]
python
en
['en', 'id', 'it']
False
ObserverModel.to
(self, *args, do_windows=True, **kwargs)
r"""Moves and/or casts the parameters and buffers. This can be called as .. function:: to(device=None, dtype=None, non_blocking=False) .. function:: to(dtype, non_blocking=False) .. function:: to(tensor, non_blocking=False) Its signature is similar to :meth:`torch.Tensor.to`...
r"""Moves and/or casts the parameters and buffers.
def to(self, *args, do_windows=True, **kwargs): r"""Moves and/or casts the parameters and buffers. This can be called as .. function:: to(device=None, dtype=None, non_blocking=False) .. function:: to(dtype, non_blocking=False) .. function:: to(tensor, non_blocking=False) ...
[ "def", "to", "(", "self", ",", "*", "args", ",", "do_windows", "=", "True", ",", "*", "*", "kwargs", ")", ":", "self", ".", "complex_steerable_pyramid", ".", "to", "(", "*", "args", ",", "*", "*", "kwargs", ")", "if", "do_windows", ":", "self", "."...
[ 443, 4 ]
[ 487, 19 ]
python
en
['en', 'en', 'en']
True
ObserverModel.plot_windows
(self, ax=None, contour_levels=None, colors='r', subset=True, **kwargs)
r"""Plot the pooling windows on an image. This is just a simple little helper to plot the pooling windows on an existing axis. The use case is overlaying this on top of the image we're pooling (as returned by ``pyrtools.imshow``), and so we require an axis to be passed Any addi...
r"""Plot the pooling windows on an image.
def plot_windows(self, ax=None, contour_levels=None, colors='r', subset=True, **kwargs): r"""Plot the pooling windows on an image. This is just a simple little helper to plot the pooling windows on an existing axis. The use case is overlaying this on top of the imag...
[ "def", "plot_windows", "(", "self", ",", "ax", "=", "None", ",", "contour_levels", "=", "None", ",", "colors", "=", "'r'", ",", "subset", "=", "True", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "PoolingWindows", ".", "plot_windows", "(",...
[ 489, 4 ]
[ 533, 93 ]
python
en
['en', 'en', 'en']
True
ObserverModel.summarize_window_sizes
(self)
r"""Summarize window sizes. This function returns a dictionary summarizing the window sizes at the minimum and maximum eccentricity. Let ``min_window`` be the window whose center is closest to ``self.min_eccentricity`` and ``max_window`` the one whose center is closest to ``self...
r"""Summarize window sizes.
def summarize_window_sizes(self): r"""Summarize window sizes. This function returns a dictionary summarizing the window sizes at the minimum and maximum eccentricity. Let ``min_window`` be the window whose center is closest to ``self.min_eccentricity`` and ``max_window`` the one...
[ "def", "summarize_window_sizes", "(", "self", ")", ":", "return", "self", ".", "PoolingWindows", ".", "summarize_window_sizes", "(", ")" ]
[ 535, 4 ]
[ 553, 59 ]
python
en
['en', 'zu', 'en']
True
ObserverModel.plot_window_widths
(self, units='degrees', figsize=(5, 5), jitter=.25)
r"""Plot the widths of the windows, in degrees or pixels. We plot the width of the window in both angular and radial direction, as well as showing the 'half' and 'full' widths (full is the width of the entire window; half is the width at the half-max value, which is what corresponds to ...
r"""Plot the widths of the windows, in degrees or pixels.
def plot_window_widths(self, units='degrees', figsize=(5, 5), jitter=.25): r"""Plot the widths of the windows, in degrees or pixels. We plot the width of the window in both angular and radial direction, as well as showing the 'half' and 'full' widths (full is the width of the entire win...
[ "def", "plot_window_widths", "(", "self", ",", "units", "=", "'degrees'", ",", "figsize", "=", "(", "5", ",", "5", ")", ",", "jitter", "=", ".25", ")", ":", "fig", "=", "self", ".", "PoolingWindows", ".", "plot_window_widths", "(", "units", ",", "0", ...
[ 555, 4 ]
[ 595, 18 ]
python
en
['en', 'en', 'en']
True
ObserverModel.plot_window_areas
(self, units='degrees', figsize=(5, 5))
r"""Plot the approximate areas of the windows, in degrees or pixels. We plot the approximate area of the window, calculated using 'half' and 'full' widths (full is the width of the entire window; half is the width at the half-max value, which is what corresponds to the scaling value). T...
r"""Plot the approximate areas of the windows, in degrees or pixels.
def plot_window_areas(self, units='degrees', figsize=(5, 5)): r"""Plot the approximate areas of the windows, in degrees or pixels. We plot the approximate area of the window, calculated using 'half' and 'full' widths (full is the width of the entire window; half is the width at the half...
[ "def", "plot_window_areas", "(", "self", ",", "units", "=", "'degrees'", ",", "figsize", "=", "(", "5", ",", "5", ")", ")", ":", "fig", "=", "self", ".", "PoolingWindows", ".", "plot_window_areas", "(", "units", ",", "0", ",", "figsize", ")", "# since ...
[ 597, 4 ]
[ 637, 18 ]
python
en
['en', 'en', 'en']
True
ObserverModel.save_reduced
(self, file_path)
r"""Save the relevant parameters to make saving/loading more efficient. This saves self.state_dict_reduced, which contains the attributes necessary to initialize the model plus a 'model_name' key, which the ``load_reduced`` method uses to determine which model constructor to call ...
r"""Save the relevant parameters to make saving/loading more efficient.
def save_reduced(self, file_path): r"""Save the relevant parameters to make saving/loading more efficient. This saves self.state_dict_reduced, which contains the attributes necessary to initialize the model plus a 'model_name' key, which the ``load_reduced`` method uses to determine whi...
[ "def", "save_reduced", "(", "self", ",", "file_path", ")", ":", "torch", ".", "save", "(", "self", ".", "state_dict_reduced", ",", "file_path", ")" ]
[ 639, 4 ]
[ 653, 54 ]
python
en
['en', 'en', 'en']
True
ObserverModel.load_reduced
(cls, file_path)
r"""Load from the dictionary saved by ``save_reduced``. Parameters ---------- file_path : str The path to load the model object from
r"""Load from the dictionary saved by ``save_reduced``.
def load_reduced(cls, file_path): r"""Load from the dictionary saved by ``save_reduced``. Parameters ---------- file_path : str The path to load the model object from """ state_dict_reduced = torch.load(file_path) return cls.from_state_dict_reduced(st...
[ "def", "load_reduced", "(", "cls", ",", "file_path", ")", ":", "state_dict_reduced", "=", "torch", ".", "load", "(", "file_path", ")", "return", "cls", ".", "from_state_dict_reduced", "(", "state_dict_reduced", ")" ]
[ 656, 4 ]
[ 665, 62 ]
python
en
['en', 'en', 'en']
True
ObserverModel.from_state_dict_reduced
(cls, state_dict_reduced)
r"""Initialize model from ``state_dict_reduced``. Parameters ---------- state_dict_reduced : dict The reduced state dict to load
r"""Initialize model from ``state_dict_reduced``.
def from_state_dict_reduced(cls, state_dict_reduced): r"""Initialize model from ``state_dict_reduced``. Parameters ---------- state_dict_reduced : dict The reduced state dict to load """ state_dict_reduced = state_dict_reduced.copy() model_name = stat...
[ "def", "from_state_dict_reduced", "(", "cls", ",", "state_dict_reduced", ")", ":", "state_dict_reduced", "=", "state_dict_reduced", ".", "copy", "(", ")", "model_name", "=", "state_dict_reduced", ".", "pop", "(", "'model_name'", ")", "# want to remove class if it's here...
[ 668, 4 ]
[ 683, 83 ]
python
en
['en', 'en', 'en']
True
ObserverModel.output_to_representation
(self, data, scales=[])
r"""Convert output to representation. This takes data that looks like the output from the ``forward()`` call (a big 3d tensor) and returns a dictionary whose keys are ``"mean_luminance"`` and ``(scale, orientation)`` tuples). Parameters ---------- data : torch.Tensor ...
r"""Convert output to representation.
def output_to_representation(self, data, scales=[]): r"""Convert output to representation. This takes data that looks like the output from the ``forward()`` call (a big 3d tensor) and returns a dictionary whose keys are ``"mean_luminance"`` and ``(scale, orientation)`` tuples). ...
[ "def", "output_to_representation", "(", "self", ",", "data", ",", "scales", "=", "[", "]", ")", ":", "if", "not", "scales", ":", "scales", "=", "self", ".", "scales", "data_dict", "=", "{", "}", "idx", "=", "0", "for", "k", ",", "n_win", "in", "sel...
[ 685, 4 ]
[ 720, 24 ]
python
en
['en', 'en', 'en']
True
ObserverModel.summarize_representation
(self, data, summary_func='mse', by_angle=False)
r"""Summarize representation by key and (optionally) quadrant. This takes data and summarizes it within each key of the dictionary. The intended use case is to get the mean-squared error (by passing ``data=metamer.representation_error()``) within each orientation and scale. With ``by_an...
r"""Summarize representation by key and (optionally) quadrant.
def summarize_representation(self, data, summary_func='mse', by_angle=False): r"""Summarize representation by key and (optionally) quadrant. This takes data and summarizes it within each key of the dictionary. The intended use case is to get the mean-squared error (by passing ``data=met...
[ "def", "summarize_representation", "(", "self", ",", "data", ",", "summary_func", "=", "'mse'", ",", "by_angle", "=", "False", ")", ":", "data_shape", "=", "data", ".", "shape", "[", ":", "-", "1", "]", "data", "=", "self", ".", "output_to_representation",...
[ 722, 4 ]
[ 790, 25 ]
python
en
['en', 'cy', 'en']
True
ObserverModel._get_title
(cls, title_list, idx, default_title)
r"""Helper function for dealing with the default way we handle title. We have a couple possible ways of handling title in these plotting functions, so this helper function consolidates that. When picking a title, we know we'll either have a list of titles or a single None. ...
r"""Helper function for dealing with the default way we handle title.
def _get_title(cls, title_list, idx, default_title): r"""Helper function for dealing with the default way we handle title. We have a couple possible ways of handling title in these plotting functions, so this helper function consolidates that. When picking a title, we know we'l...
[ "def", "_get_title", "(", "cls", ",", "title_list", ",", "idx", ",", "default_title", ")", ":", "try", ":", "title", "=", "title_list", "[", "idx", "]", "if", "'|'", "in", "title", ":", "if", "title", ".", "index", "(", "'|'", ")", "==", "0", ":", ...
[ 793, 4 ]
[ 839, 20 ]
python
en
['en', 'en', 'en']
True
ObserverModel._representation_for_plotting
(self, data, batch_idx=0)
Transform representation for plotting. Convert the 3d tensor output to a dictionary of 1d arrays containing responses for a single batch_idx. Keys are ``'mean_luminance'`` and ``(scale, orientation)`` tuples. Parameters ---------- data : torch.Tensor The dat...
Transform representation for plotting.
def _representation_for_plotting(self, data, batch_idx=0): """Transform representation for plotting. Convert the 3d tensor output to a dictionary of 1d arrays containing responses for a single batch_idx. Keys are ``'mean_luminance'`` and ``(scale, orientation)`` tuples. Paramet...
[ "def", "_representation_for_plotting", "(", "self", ",", "data", ",", "batch_idx", "=", "0", ")", ":", "data", "=", "self", ".", "output_to_representation", "(", "data", ")", "return", "{", "k", ":", "po", ".", "to_numpy", "(", "v", "[", "batch_idx", "]"...
[ 841, 4 ]
[ 864, 41 ]
python
en
['en', 'sv', 'en']
True
ObserverModel.update_plot
(self, axes, data, batch_idx=0)
r"""Update the information in our representation plot. This is used for creating an animation of the representation over time. In order to create the animation, we need to know how to update the matplotlib Artists, and this provides a simple way of doing that. It relies on the fact that...
r"""Update the information in our representation plot.
def update_plot(self, axes, data, batch_idx=0): r"""Update the information in our representation plot. This is used for creating an animation of the representation over time. In order to create the animation, we need to know how to update the matplotlib Artists, and this provides a simp...
[ "def", "update_plot", "(", "self", ",", "axes", ",", "data", ",", "batch_idx", "=", "0", ")", ":", "stem_artists", "=", "[", "]", "axes", "=", "[", "ax", "for", "ax", "in", "axes", "if", "len", "(", "ax", ".", "containers", ")", "==", "1", "]", ...
[ 866, 4 ]
[ 917, 27 ]
python
en
['en', 'en', 'en']
True
ObserverModel._plot_helper
(self, n_rows, n_cols, figsize=(25, 15), ax=None, title=None, batch_idx=0)
r"""Helper function for plotting that takes care of a lot of the standard stuff. Parameters ---------- n_rows : int The number of rows in the (sub-)figure we're creating n_cols : int The number oc columns in the (sub-)figure we're creating figsize : tuple...
r"""Helper function for plotting that takes care of a lot of the standard stuff.
def _plot_helper(self, n_rows, n_cols, figsize=(25, 15), ax=None, title=None, batch_idx=0): r"""Helper function for plotting that takes care of a lot of the standard stuff. Parameters ---------- n_rows : int The number of rows in the (sub-)figure we're c...
[ "def", "_plot_helper", "(", "self", ",", "n_rows", ",", "n_cols", ",", "figsize", "=", "(", "25", ",", "15", ")", ",", "ax", "=", "None", ",", "title", "=", "None", ",", "batch_idx", "=", "0", ")", ":", "if", "ax", "is", "None", ":", "fig", "="...
[ 919, 4 ]
[ 970, 29 ]
python
en
['en', 'en', 'en']
True
ObserverModel.plot_representation
(self, data, figsize=(25, 15), ylim=None, ax=None, title=None, batch_idx=0)
r"""Plot the representation of the V1 model. Since our PooledV1 model has more statistics than the PooledRGC model, this is a much more complicated plot. We end up creating a grid, showing each band and scale separately, and then a separate plot, off to the side, for the mean pi...
r"""Plot the representation of the V1 model.
def plot_representation(self, data, figsize=(25, 15), ylim=None, ax=None, title=None, batch_idx=0): r"""Plot the representation of the V1 model. Since our PooledV1 model has more statistics than the PooledRGC model, this is a much more complicated plot. We en...
[ "def", "plot_representation", "(", "self", ",", "data", ",", "figsize", "=", "(", "25", ",", "15", ")", ",", "ylim", "=", "None", ",", "ax", "=", "None", ",", "title", "=", "None", ",", "batch_idx", "=", "0", ")", ":", "n_cols", "=", "self", ".",...
[ 972, 4 ]
[ 1050, 24 ]
python
en
['en', 'no', 'en']
True
ObserverModel.plot_representation_image
(self, data, figsize=(22, 11), ax=None, title=None, batch_idx=0, vrange='auto1', zoom=1)
r"""Plot representation as an image, using the weights from PoolingWindows. Our representation is composed of pooled energy at several different scales and orientations, plus the pooled mean pixel intensity. In order to visualize these as images, we take each statistic, multiply it by t...
r"""Plot representation as an image, using the weights from PoolingWindows.
def plot_representation_image(self, data, figsize=(22, 11), ax=None, title=None, batch_idx=0, vrange='auto1', zoom=1): r"""Plot representation as an image, using the weights from PoolingWindows. Our representation is composed of pooled...
[ "def", "plot_representation_image", "(", "self", ",", "data", ",", "figsize", "=", "(", "22", ",", "11", ")", ",", "ax", "=", "None", ",", "title", "=", "None", ",", "batch_idx", "=", "0", ",", "vrange", "=", "'auto1'", ",", "zoom", "=", "1", ")", ...
[ 1052, 4 ]
[ 1137, 24 ]
python
en
['en', 'en', 'en']
True
add
(x, y)
Simple addition function
Simple addition function
def add(x, y): """Simple addition function""" return x + y
[ "def", "add", "(", "x", ",", "y", ")", ":", "return", "x", "+", "y" ]
[ 3, 0 ]
[ 5, 14 ]
python
en
['en', 'en', 'en']
True
subtract
(x, y)
Simple subtraction function
Simple subtraction function
def subtract(x, y): """Simple subtraction function""" return x - y
[ "def", "subtract", "(", "x", ",", "y", ")", ":", "return", "x", "-", "y" ]
[ 8, 0 ]
[ 10, 14 ]
python
en
['en', 'en', 'en']
True
multiply
(x, y)
Simple multiplication function
Simple multiplication function
def multiply(x, y): "Simple multiplication function" return x * y
[ "def", "multiply", "(", "x", ",", "y", ")", ":", "return", "x", "*", "y" ]
[ 13, 0 ]
[ 15, 14 ]
python
en
['fr', 'en', 'en']
True
divide
(x, y)
Simple division function
Simple division function
def divide(x, y): "Simple division function" if y == 0: raise ValueError("Can not divide a number by 0.") return x / y
[ "def", "divide", "(", "x", ",", "y", ")", ":", "if", "y", "==", "0", ":", "raise", "ValueError", "(", "\"Can not divide a number by 0.\"", ")", "return", "x", "/", "y" ]
[ 18, 0 ]
[ 22, 14 ]
python
en
['it', 'en', 'en']
True
BaseEnv.__init__
(self, cost_function, model, dim_action, simulation_horizon, discrete=True, seed=np.random.randint(1e6) )
Base class for epidemic-based environments. Parameters ---------- cost_function: BaseCostFunction A cost function. model: BaseModel An epidemiological model. dim_action: int Dimension of the action space. simulation_horizon: i...
Base class for epidemic-based environments.
def __init__(self, cost_function, model, dim_action, simulation_horizon, discrete=True, seed=np.random.randint(1e6) ): """ Base class for epidemic-based environments. Parameter...
[ "def", "__init__", "(", "self", ",", "cost_function", ",", "model", ",", "dim_action", ",", "simulation_horizon", ",", "discrete", "=", "True", ",", "seed", "=", "np", ".", "random", ".", "randint", "(", "1e6", ")", ")", ":", "# Define model", "self", "....
[ 8, 4 ]
[ 53, 107 ]
python
en
['en', 'error', 'th']
False
BaseEnv.reset
(self)
Reset the environment and the tracking of data. Returns ------- nd.array The initial environment state.
Reset the environment and the tracking of data.
def reset(self): """ Reset the environment and the tracking of data. Returns ------- nd.array The initial environment state. """ pass
[ "def", "reset", "(", "self", ")", ":", "pass" ]
[ 56, 4 ]
[ 66, 12 ]
python
en
['en', 'error', 'th']
False
BaseEnv._update_env_state
(self)
Update the environment state.
Update the environment state.
def _update_env_state(self): """ Update the environment state. """ pass
[ "def", "_update_env_state", "(", "self", ")", ":", "pass" ]
[ 69, 4 ]
[ 74, 12 ]
python
en
['en', 'error', 'th']
False
BaseEnv.run_model
(self)
Run model for one step. Returns ------- nd.array New environment state.
Run model for one step.
def run_model(self): """ Run model for one step. Returns ------- nd.array New environment state. """ return self.model.run_n_steps(self.model_state, 1)
[ "def", "run_model", "(", "self", ")", ":", "return", "self", ".", "model", ".", "run_n_steps", "(", "self", ".", "model_state", ",", "1", ")" ]
[ 80, 4 ]
[ 89, 58 ]
python
en
['en', 'error', 'th']
False
BaseEnv.step
(self, action)
Traditional step function from OpenAI Gym envs. Uses the action to update the environment. Parameters ---------- action: int if discrete, nd.array if continuous. Returns ------- state: nd.array New environment state. cost_aggregated: float ...
Traditional step function from OpenAI Gym envs. Uses the action to update the environment.
def step(self, action): """ Traditional step function from OpenAI Gym envs. Uses the action to update the environment. Parameters ---------- action: int if discrete, nd.array if continuous. Returns ------- state: nd.array New environment stat...
[ "def", "step", "(", "self", ",", "action", ")", ":", "pass" ]
[ 92, 4 ]
[ 112, 12 ]
python
en
['en', 'error', 'th']
False
buildRapidNJ
(rapidnj, refList, coreMat, outPrefix, threads = 1)
Use rapidNJ for more rapid tree building Creates a phylip of core distances, system call to rapidnj executable, loads tree as dendropy object (cleaning quotes in node names), removes temporary files. Args: rapidnj (str) Location of rapidnj executable refList (list) ...
Use rapidNJ for more rapid tree building
def buildRapidNJ(rapidnj, refList, coreMat, outPrefix, threads = 1): """Use rapidNJ for more rapid tree building Creates a phylip of core distances, system call to rapidnj executable, loads tree as dendropy object (cleaning quotes in node names), removes temporary files. Args: rapidnj (str) ...
[ "def", "buildRapidNJ", "(", "rapidnj", ",", "refList", ",", "coreMat", ",", "outPrefix", ",", "threads", "=", "1", ")", ":", "# generate phylip matrix", "phylip_name", "=", "outPrefix", "+", "\"/\"", "+", "os", ".", "path", ".", "basename", "(", "outPrefix",...
[ 26, 0 ]
[ 80, 15 ]
python
en
['en', 'en', 'en']
True
write_tree
(tree, prefix, suffix, overwrite)
Prints a Newick-formatted string to an output file Args: tree (str) Newick-formatted string representation of tree prefix (str) Prefix for output files suffix (str) Suffix for output files overwrite (bool) Whether to overwrite existing...
Prints a Newick-formatted string to an output file
def write_tree(tree, prefix, suffix, overwrite): """Prints a Newick-formatted string to an output file Args: tree (str) Newick-formatted string representation of tree prefix (str) Prefix for output files suffix (str) Suffix for output files ov...
[ "def", "write_tree", "(", "tree", ",", "prefix", ",", "suffix", ",", "overwrite", ")", ":", "tree_filename", "=", "prefix", "+", "\"/\"", "+", "os", ".", "path", ".", "basename", "(", "prefix", ")", "+", "suffix", "if", "overwrite", "or", "not", "os", ...
[ 82, 0 ]
[ 100, 80 ]
python
en
['en', 'en', 'en']
True
load_tree
(prefix, type, distances = 'core')
Checks for existing trees from previous runs. Args: prefix (str) Output prefix used for search type (str) Type of tree (NJ or MST) Returns: tree_string (str) Newick-formatted string of NJ tree
Checks for existing trees from previous runs.
def load_tree(prefix, type, distances = 'core'): """Checks for existing trees from previous runs. Args: prefix (str) Output prefix used for search type (str) Type of tree (NJ or MST) Returns: tree_string (str) Newick-formatted string of NJ tree ...
[ "def", "load_tree", "(", "prefix", ",", "type", ",", "distances", "=", "'core'", ")", ":", "tree_string", "=", "None", "tree_prefix", "=", "os", ".", "path", ".", "join", "(", "prefix", ",", "os", ".", "path", ".", "basename", "(", "prefix", ")", ")"...
[ 102, 0 ]
[ 127, 22 ]
python
en
['en', 'en', 'en']
True
generate_nj_tree
(coreMat, seqLabels, outPrefix, rapidnj, threads)
Generate phylogeny using dendropy or RapidNJ Writes a neighbour joining tree (.nwk) from core distances. Args: coreMat (numpy.array) n x n array of core distances for n samples. seqLabels (list) Processed names of sequences being analysed. outPrefix (str) ...
Generate phylogeny using dendropy or RapidNJ
def generate_nj_tree(coreMat, seqLabels, outPrefix, rapidnj, threads): """Generate phylogeny using dendropy or RapidNJ Writes a neighbour joining tree (.nwk) from core distances. Args: coreMat (numpy.array) n x n array of core distances for n samples. seqLabels (list) ...
[ "def", "generate_nj_tree", "(", "coreMat", ",", "seqLabels", ",", "outPrefix", ",", "rapidnj", ",", "threads", ")", ":", "# Save distances to file", "core_dist_file", "=", "outPrefix", "+", "\"/\"", "+", "os", ".", "path", ".", "basename", "(", "outPrefix", ")...
[ 129, 0 ]
[ 178, 22 ]
python
en
['da', 'en', 'en']
True
mst_to_phylogeny
(mst_network, names, use_gpu = False)
Convert a MST graph to a phylogeny Args: mst_network (network) Minimum spanning tree from :func:`~PopPUNK.network.generate_minimum_spanning_tree` names (list) Names of sequences in network use_gpu (bool) Whether to use GPU-specific libraries for pr...
Convert a MST graph to a phylogeny
def mst_to_phylogeny(mst_network, names, use_gpu = False): """Convert a MST graph to a phylogeny Args: mst_network (network) Minimum spanning tree from :func:`~PopPUNK.network.generate_minimum_spanning_tree` names (list) Names of sequences in network use_g...
[ "def", "mst_to_phylogeny", "(", "mst_network", ",", "names", ",", "use_gpu", "=", "False", ")", ":", "#", "# MST graph -> phylogeny", "#", "use_gpu", "=", "check_and_set_gpu", "(", "use_gpu", ",", "gpu_lib", ")", "# Define sequences names for tree", "taxon_namespace",...
[ 180, 0 ]
[ 252, 22 ]
python
en
['en', 'en', 'en']
True
round_int_inline
(self, func, expected_result, supported, int_type, min, max, node=None)
Check rounding functions with Int128, UInt128, Int256, and UInt256 using inline tests.
Check rounding functions with Int128, UInt128, Int256, and UInt256 using inline tests.
def round_int_inline(self, func, expected_result, supported, int_type, min, max, node=None): """Check rounding functions with Int128, UInt128, Int256, and UInt256 using inline tests. """ if node is None: node = self.context.node if func == 'roundDown': with When(f"I check roundDown wi...
[ "def", "round_int_inline", "(", "self", ",", "func", ",", "expected_result", ",", "supported", ",", "int_type", ",", "min", ",", "max", ",", "node", "=", "None", ")", ":", "if", "node", "is", "None", ":", "node", "=", "self", ".", "context", ".", "no...
[ 20, 0 ]
[ 48, 97 ]
python
en
['en', 'en', 'en']
True
round_int_table
(self, func, expected_result, supported, int_type, min, max, node=None)
Check rounding functions with Int128, UInt128, Int256, and UInt256 using table tests.
Check rounding functions with Int128, UInt128, Int256, and UInt256 using table tests.
def round_int_table(self, func, expected_result, supported, int_type, min, max, node=None): """Check rounding functions with Int128, UInt128, Int256, and UInt256 using table tests. """ table_name = f"table_{getuid()}" if node is None: node = self.context.node with Given("I have a table"):...
[ "def", "round_int_table", "(", "self", ",", "func", ",", "expected_result", ",", "supported", ",", "int_type", ",", "min", ",", "max", ",", "node", "=", "None", ")", ":", "table_name", "=", "f\"table_{getuid()}\"", "if", "node", "is", "None", ":", "node", ...
[ 52, 0 ]
[ 90, 101 ]
python
en
['en', 'en', 'en']
True
round_dec_inline
(self, func, expected_result, supported, node=None)
Check rounding functions with Decimal256 using inline tests.
Check rounding functions with Decimal256 using inline tests.
def round_dec_inline(self, func, expected_result, supported, node=None): """Check rounding functions with Decimal256 using inline tests. """ min = Decimal256_min_max[0] max = Decimal256_min_max[1] if node is None: node = self.context.node if func == 'roundDown': with When(f"I ...
[ "def", "round_dec_inline", "(", "self", ",", "func", ",", "expected_result", ",", "supported", ",", "node", "=", "None", ")", ":", "min", "=", "Decimal256_min_max", "[", "0", "]", "max", "=", "Decimal256_min_max", "[", "1", "]", "if", "node", "is", "None...
[ 94, 0 ]
[ 126, 79 ]
python
en
['en', 'en', 'en']
True
round_dec_table
(self, func, expected_result, supported, node=None)
Check rounding functions with Decimal256 using table tests.
Check rounding functions with Decimal256 using table tests.
def round_dec_table(self, func, expected_result, supported, node=None): """Check rounding functions with Decimal256 using table tests. """ min = Decimal256_min_max[0] max = Decimal256_min_max[1] table_name = f"table_{getuid()}" if node is None: node = self.context.node with Given(...
[ "def", "round_dec_table", "(", "self", ",", "func", ",", "expected_result", ",", "supported", ",", "node", "=", "None", ")", ":", "min", "=", "Decimal256_min_max", "[", "0", "]", "max", "=", "Decimal256_min_max", "[", "1", "]", "table_name", "=", "f\"table...
[ 130, 0 ]
[ 170, 83 ]
python
en
['en', 'en', 'en']
True
feature
(self, node="clickhouse1", mysql_node="mysql1", stress=None, parallel=None)
Check that rounding functions work with extended precision data types.
Check that rounding functions work with extended precision data types.
def feature(self, node="clickhouse1", mysql_node="mysql1", stress=None, parallel=None): """Check that rounding functions work with extended precision data types. """ self.context.node = self.context.cluster.node(node) self.context.mysql_node = self.context.cluster.node(mysql_node) with allow_experi...
[ "def", "feature", "(", "self", ",", "node", "=", "\"clickhouse1\"", ",", "mysql_node", "=", "\"mysql1\"", ",", "stress", "=", "None", ",", "parallel", "=", "None", ")", ":", "self", ".", "context", ".", "node", "=", "self", ".", "context", ".", "cluste...
[ 180, 0 ]
[ 190, 37 ]
python
en
['en', 'en', 'en']
True
row_policy
(self, name, table, node=None)
Create a row policy with a given name on a given table.
Create a row policy with a given name on a given table.
def row_policy(self, name, table, node=None): """Create a row policy with a given name on a given table. """ if node is None: node = self.context.node try: with Given(f"I create row policy {name}"): node.query(f"CREATE ROW POLICY {name} ON {table}") yield finall...
[ "def", "row_policy", "(", "self", ",", "name", ",", "table", ",", "node", "=", "None", ")", ":", "if", "node", "is", "None", ":", "node", "=", "self", ".", "context", ".", "node", "try", ":", "with", "Given", "(", "f\"I create row policy {name}\"", ")"...
[ 68, 0 ]
[ 81, 70 ]
python
en
['en', 'en', 'en']
True
convert_to_database_compatible_value
(value)
Pandas 0.23 broke DataFrame.to_sql, so we workaround it by rolling our own extremely low-tech conversion routine
Pandas 0.23 broke DataFrame.to_sql, so we workaround it by rolling our own extremely low-tech conversion routine
def convert_to_database_compatible_value(value): """Pandas 0.23 broke DataFrame.to_sql, so we workaround it by rolling our own extremely low-tech conversion routine """ if pd.isnull(value): return None if isinstance(value, pd.Timestamp): return value.to_pydatetime() try: ...
[ "def", "convert_to_database_compatible_value", "(", "value", ")", ":", "if", "pd", ".", "isnull", "(", "value", ")", ":", "return", "None", "if", "isinstance", "(", "value", ",", "pd", ".", "Timestamp", ")", ":", "return", "value", ".", "to_pydatetime", "(...
[ 79, 0 ]
[ 90, 20 ]
python
en
['en', 'en', 'en']
True
read_submission
(directory, expected_sequence_names, start_index=0, end_index=-1)
Read all the submissions for all the sequences outlined in the given folder. Each sequence's detections are provided in a file ending with 'detections.json'. Each detections.json file contains a dictionary which has a key 'detections' containing a list of list of detections for each image. Individu...
Read all the submissions for all the sequences outlined in the given folder. Each sequence's detections are provided in a file ending with 'detections.json'. Each detections.json file contains a dictionary which has a key 'detections' containing a list of list of detections for each image. Individu...
def read_submission(directory, expected_sequence_names, start_index=0, end_index=-1): """ Read all the submissions for all the sequences outlined in the given folder. Each sequence's detections are provided in a file ending with 'detections.json'. Each detections.json file contains a dictionary which ha...
[ "def", "read_submission", "(", "directory", ",", "expected_sequence_names", ",", "start_index", "=", "0", ",", "end_index", "=", "-", "1", ")", ":", "sequences", "=", "{", "}", "for", "root", ",", "_", ",", "files", "in", "os", ".", "walk", "(", "direc...
[ 9, 0 ]
[ 48, 5 ]
python
en
['en', 'error', 'th']
False
read_sequence
(sequence_json, start_index=0, end_index=-1)
Read a sequence's detection json file. json file contains a dictionary which has a key 'detections' containing a list of list of detections for each image. Individual detections are given as dictionaries which have the keys: 'img_size': (height x width) 'img_num': int identifying which ...
Read a sequence's detection json file. json file contains a dictionary which has a key 'detections' containing a list of list of detections for each image. Individual detections are given as dictionaries which have the keys: 'img_size': (height x width) 'img_num': int identifying which ...
def read_sequence(sequence_json, start_index=0, end_index=-1): """ Read a sequence's detection json file. json file contains a dictionary which has a key 'detections' containing a list of list of detections for each image. Individual detections are given as dictionaries which have the keys: ...
[ "def", "read_sequence", "(", "sequence_json", ",", "start_index", "=", "0", ",", "end_index", "=", "-", "1", ")", ":", "with", "open", "(", "sequence_json", ",", "'r'", ")", "as", "f", ":", "data_dict", "=", "json", ".", "load", "(", "f", ")", "seque...
[ 51, 0 ]
[ 98, 113 ]
python
en
['en', 'error', 'th']
False
gen_img_pboxes
(img_dets, class_mapping, num_classes=len(class_list.CLASSES), img_idx=-1, sequence_name='unknown')
Generate DetectionInstances for a given image. DetectionInstances will be of sub-class BBoxDetInst or PBoxDetInst. BBoxDetInst is DetectionInstance for standard bounding box detection. PBoxDetInst is DetectionInstance for probabilistic bounding box detection. :param img_dets: list of detections giv...
Generate DetectionInstances for a given image. DetectionInstances will be of sub-class BBoxDetInst or PBoxDetInst. BBoxDetInst is DetectionInstance for standard bounding box detection. PBoxDetInst is DetectionInstance for probabilistic bounding box detection. :param img_dets: list of detections giv...
def gen_img_pboxes(img_dets, class_mapping, num_classes=len(class_list.CLASSES), img_idx=-1, sequence_name='unknown'): """ Generate DetectionInstances for a given image. DetectionInstances will be of sub-class BBoxDetInst or PBoxDetInst. BBoxDetInst is DetectionInstance for standard bounding box detecti...
[ "def", "gen_img_pboxes", "(", "img_dets", ",", "class_mapping", ",", "num_classes", "=", "len", "(", "class_list", ".", "CLASSES", ")", ",", "img_idx", "=", "-", "1", ",", "sequence_name", "=", "'unknown'", ")", ":", "# Handle no detections for the image", "for"...
[ 101, 0 ]
[ 173, 17 ]
python
en
['en', 'error', 'th']
False
is_positive_semi_definite
(mat)
Check if a matrix is positive semi-definite, that is, all it's eigenvalues are positive. All covariance matrices must be positive semi-definite. Only works on symmetric matricies (due to eigh), so check that first :param mat: :return:
Check if a matrix is positive semi-definite, that is, all it's eigenvalues are positive. All covariance matrices must be positive semi-definite. Only works on symmetric matricies (due to eigh), so check that first :param mat: :return:
def is_positive_semi_definite(mat): """ Check if a matrix is positive semi-definite, that is, all it's eigenvalues are positive. All covariance matrices must be positive semi-definite. Only works on symmetric matricies (due to eigh), so check that first :param mat: :return: """ eigvals, ...
[ "def", "is_positive_semi_definite", "(", "mat", ")", ":", "eigvals", ",", "_", "=", "np", ".", "linalg", ".", "eigh", "(", "mat", ")", "return", "np", ".", "all", "(", "eigvals", ">=", "-", "1e-14", ")" ]
[ 176, 0 ]
[ 185, 36 ]
python
en
['en', 'error', 'th']
False
get_palette
(col, col_unique=None, as_dict=True)
Get palette for column. Parameters ---------- col : {'subject_name', 'model', 'scaling', 'cell_type', str} The column to return the palette for. If we don't have a particular palette picked out, the palette will contain the strings 'C0', 'C1', etc, which use the default palette. ...
Get palette for column.
def get_palette(col, col_unique=None, as_dict=True): """Get palette for column. Parameters ---------- col : {'subject_name', 'model', 'scaling', 'cell_type', str} The column to return the palette for. If we don't have a particular palette picked out, the palette will contain the strings...
[ "def", "get_palette", "(", "col", ",", "col_unique", "=", "None", ",", "as_dict", "=", "True", ")", ":", "with", "open", "(", "op", ".", "join", "(", "op", ".", "dirname", "(", "op", ".", "realpath", "(", "__file__", ")", ")", ",", "'..'", ",", "...
[ 38, 0 ]
[ 121, 14 ]
python
da
['fr', 'da', 'en']
False
get_style
(col, col_unique, as_dict=True)
Get style for plotting. Parameters ---------- col : {'trial_type', 'mcmc_model_type', list containing both elements} The column to return the palette for. If we don't have a particular style picked out, we raise an exception. If it's a list containing both elements, we will combine ...
Get style for plotting.
def get_style(col, col_unique, as_dict=True): """Get style for plotting. Parameters ---------- col : {'trial_type', 'mcmc_model_type', list containing both elements} The column to return the palette for. If we don't have a particular style picked out, we raise an exception. If it's a li...
[ "def", "get_style", "(", "col", ",", "col_unique", ",", "as_dict", "=", "True", ")", ":", "def", "_combine_dicts", "(", "style_dict", ",", "style_key", ")", ":", "\"\"\"Combine dicts for multiple style args.\"\"\"", "to_return", "=", "{", "}", "default_val", "=", ...
[ 124, 0 ]
[ 245, 23 ]
python
en
['en', 'en', 'en']
True
get_order
(col, col_unique=[])
Get order to plot something in. For rows, cols, or x. Parameters ---------- col : {'image_name', str} The column to return the palette for. If we don't have a particular order picked out, will just sort col_unique. col_unique : list, optional List of unique values in col. ...
Get order to plot something in.
def get_order(col, col_unique=[]): """Get order to plot something in. For rows, cols, or x. Parameters ---------- col : {'image_name', str} The column to return the palette for. If we don't have a particular order picked out, will just sort col_unique. col_unique : list, option...
[ "def", "get_order", "(", "col", ",", "col_unique", "=", "[", "]", ")", ":", "with", "open", "(", "op", ".", "join", "(", "op", ".", "dirname", "(", "op", ".", "realpath", "(", "__file__", ")", ")", ",", "'..'", ",", "'config.yml'", ")", ")", "as"...
[ 248, 0 ]
[ 283, 20 ]
python
en
['en', 'jv', 'en']
True
myLogFormat
(y, pos)
formatter that only shows the required number of decimal points this is for use with log-scaled axes, and so assumes that everything greater than 1 is an integer and so has no decimal points to use (or equivalently, with `axis.xaxis`): ``` from matplotlib import ticker axis.yaxis.set_major_for...
formatter that only shows the required number of decimal points
def myLogFormat(y, pos): """formatter that only shows the required number of decimal points this is for use with log-scaled axes, and so assumes that everything greater than 1 is an integer and so has no decimal points to use (or equivalently, with `axis.xaxis`): ``` from matplotlib import tic...
[ "def", "myLogFormat", "(", "y", ",", "pos", ")", ":", "# Find the number of decimal places required", "if", "y", "<", "1", ":", "# because the string representation of a float always starts \"0.\"", "decimalplaces", "=", "len", "(", "str", "(", "y", ")", ")", "-", "...
[ 286, 0 ]
[ 309, 33 ]
python
en
['en', 'en', 'en']
True
_marker_adjust
(axes, marker_adjust, label_map)
Helper function to adjust markers after the fact. Pretty hacky. Parameters ---------- axes : list List of axes containing the markers to adjust marker_adjust : dict Dictionary with keys identifying the style level and values describing how to adjust the markers. Can contain the ...
Helper function to adjust markers after the fact. Pretty hacky.
def _marker_adjust(axes, marker_adjust, label_map): """Helper function to adjust markers after the fact. Pretty hacky. Parameters ---------- axes : list List of axes containing the markers to adjust marker_adjust : dict Dictionary with keys identifying the style level and values des...
[ "def", "_marker_adjust", "(", "axes", ",", "marker_adjust", ",", "label_map", ")", ":", "def", "_adjust_one_marker", "(", "line", ",", "fc", "=", "None", ",", "ec", "=", "None", ",", "ew", "=", "None", ",", "s", "=", "None", ",", "marker", "=", "None...
[ 312, 0 ]
[ 373, 18 ]
python
en
['en', 'en', 'en']
True
_remap_image_names
(df, **extra_cols)
Prepare image names for plotting. This function remaps the image names in df to drop the parts that are duplicated across images ('symmetric_' and '_range_-.05,.95_size-2048,2600'), as well as grabbing the correct order Parameters ---------- df : pd.DataFrame DataFrame containing the b...
Prepare image names for plotting.
def _remap_image_names(df, **extra_cols): """Prepare image names for plotting. This function remaps the image names in df to drop the parts that are duplicated across images ('symmetric_' and '_range_-.05,.95_size-2048,2600'), as well as grabbing the correct order Parameters ---------- df ...
[ "def", "_remap_image_names", "(", "df", ",", "*", "*", "extra_cols", ")", ":", "with", "open", "(", "op", ".", "join", "(", "op", ".", "dirname", "(", "op", ".", "realpath", "(", "__file__", ")", ")", ",", "'..'", ",", "'config.yml'", ")", ")", "as...
[ 376, 0 ]
[ 437, 13 ]
python
en
['en', 'no', 'en']
True
_psychophysical_curve_ticks
(df, axes, logscale_xaxis=False, height=5, col=None)
Set ticks appropriately for psychophysical curve plots. This assumes scaling is on the x-axis (named exactly that) and proportion correct is on the y-axis (name unconstrained). This sets major yticks at .5 and 1, as well as minor ones at .4, .6, .7, .8, .9. For xticks, we try to determine a reasonable ...
Set ticks appropriately for psychophysical curve plots.
def _psychophysical_curve_ticks(df, axes, logscale_xaxis=False, height=5, col=None): """Set ticks appropriately for psychophysical curve plots. This assumes scaling is on the x-axis (named exactly that) and proportion correct is on the y-axis (name unconstrained). This sets ...
[ "def", "_psychophysical_curve_ticks", "(", "df", ",", "axes", ",", "logscale_xaxis", "=", "False", ",", "height", "=", "5", ",", "col", "=", "None", ")", ":", "# it's difficult to come up with good tick values. this finds a somewhat", "# reasonable number of ticks in reason...
[ 440, 0 ]
[ 500, 73 ]
python
en
['en', 'da', 'en']
True
_add_legend
(df, fig=None, hue=None, style=None, palette={}, final_markers={}, dashes_dict={}, legend_content='full', tabular_trial_type_legend=False)
Add legend, making use of custom hue and style. Since we modify the markers after the fact, we can't rely on seaborn's built-in legend-generator. Instead, we create our own, based on how seaborn does it, showing both hue and style in separable manner. Parameters ---------- df : pd.DataFrame ...
Add legend, making use of custom hue and style.
def _add_legend(df, fig=None, hue=None, style=None, palette={}, final_markers={}, dashes_dict={}, legend_content='full', tabular_trial_type_legend=False): """Add legend, making use of custom hue and style. Since we modify the markers after the fact, we can't rely on seaborn's ...
[ "def", "_add_legend", "(", "df", ",", "fig", "=", "None", ",", "hue", "=", "None", ",", "style", "=", "None", ",", "palette", "=", "{", "}", ",", "final_markers", "=", "{", "}", ",", "dashes_dict", "=", "{", "}", ",", "legend_content", "=", "'full'...
[ 503, 0 ]
[ 619, 64 ]
python
en
['en', 'en', 'en']
True
_jitter_data
(data, jitter)
Optionally jitter data some amount. jitter can be None / False (in which case no jittering is done), a number (in which case we add uniform noise with a min of -jitter, max of jitter), or True (in which case we do the uniform thing with min/max of -.1/.1) based on seaborn.linearmodels._RegressionPlott...
Optionally jitter data some amount.
def _jitter_data(data, jitter): """Optionally jitter data some amount. jitter can be None / False (in which case no jittering is done), a number (in which case we add uniform noise with a min of -jitter, max of jitter), or True (in which case we do the uniform thing with min/max of -.1/.1) based o...
[ "def", "_jitter_data", "(", "data", ",", "jitter", ")", ":", "if", "jitter", "is", "None", "or", "jitter", "is", "False", ":", "return", "data", "else", ":", "if", "jitter", "is", "True", ":", "jitter", "=", ".1", "return", "data", "+", "np", ".", ...
[ 622, 0 ]
[ 637, 67 ]
python
en
['en', 'ny', 'en']
True
is_numeric
(s)
Check whether data s is numeric. s should be something that can be converted to an array: list, Series, array, column from a DataFrame, etc this is based on the function seaborn.categorical._CategoricalPlotter.infer_orient.is_not_numeric Parameters ---------- s : data to check ...
Check whether data s is numeric.
def is_numeric(s): """Check whether data s is numeric. s should be something that can be converted to an array: list, Series, array, column from a DataFrame, etc this is based on the function seaborn.categorical._CategoricalPlotter.infer_orient.is_not_numeric Parameters ---------- s :...
[ "def", "is_numeric", "(", "s", ")", ":", "try", ":", "np", ".", "asarray", "(", "s", ",", "dtype", "=", "np", ".", "float", ")", "except", "ValueError", ":", "return", "False", "return", "True" ]
[ 640, 0 ]
[ 664, 15 ]
python
en
['en', 'en', 'en']
True
_map_dataframe_prep
(data, x, y, estimator, x_jitter, x_dodge, x_order, ci=68)
Prepare dataframe for plotting. Several of the plotting functions are called by map_dataframe and need a bit of prep work before plotting. These include: - computing the central trend - computing the CIs - jittering, dodging, or ordering the x values Parameters ---------- data : pd.Dat...
Prepare dataframe for plotting.
def _map_dataframe_prep(data, x, y, estimator, x_jitter, x_dodge, x_order, ci=68): """Prepare dataframe for plotting. Several of the plotting functions are called by map_dataframe and need a bit of prep work before plotting. These include: - computing the central trend - com...
[ "def", "_map_dataframe_prep", "(", "data", ",", "x", ",", "y", ",", "estimator", ",", "x_jitter", ",", "x_dodge", ",", "x_order", ",", "ci", "=", "68", ")", ":", "if", "ci", "==", "'hdi'", ":", "plot_data", "=", "data", ".", "query", "(", "\"hdi==50\...
[ 667, 0 ]
[ 752, 49 ]
python
en
['en', 'no', 'en']
True
scatter_ci_dist
(x, y, ci=68, x_jitter=None, join=False, estimator=np.median, draw_ctr_pts=True, ci_mode='lines', ci_alpha=.2, size=5, x_dodge=None, all_labels=None, like_pointplot=False, style=None, dashes_dict={}, markers={}, **kwargs)
Plot center points and specified CIs, for use with map_dataframe. based on seaborn.linearmodels.scatterplot. CIs are taken from a distribution in this function. Therefore, it's assumed that the values being passed to it are values from a bootstrap distribution or a Bayesian posterior. seaborn.pointplot...
Plot center points and specified CIs, for use with map_dataframe.
def scatter_ci_dist(x, y, ci=68, x_jitter=None, join=False, estimator=np.median, draw_ctr_pts=True, ci_mode='lines', ci_alpha=.2, size=5, x_dodge=None, all_labels=None, like_pointplot=False, style=None, dashes_dict={}, markers={}, **kwargs)...
[ "def", "scatter_ci_dist", "(", "x", ",", "y", ",", "ci", "=", "68", ",", "x_jitter", "=", "None", ",", "join", "=", "False", ",", "estimator", "=", "np", ".", "median", ",", "draw_ctr_pts", "=", "True", ",", "ci_mode", "=", "'lines'", ",", "ci_alpha"...
[ 755, 0 ]
[ 954, 27 ]
python
en
['en', 'en', 'en']
True
map_flat_line
(x, y, data, linestyles='--', colors='k', ax=None, **kwargs)
Plot a flat line across every axis in a FacetGrid. For use with seaborn's map_dataframe, this will plot a horizontal or vertical line across all axes in a FacetGrid. Parameters ---------- x, y : str, float, or list of floats One of these must be a float (or list of floats), one a str. The ...
Plot a flat line across every axis in a FacetGrid.
def map_flat_line(x, y, data, linestyles='--', colors='k', ax=None, **kwargs): """Plot a flat line across every axis in a FacetGrid. For use with seaborn's map_dataframe, this will plot a horizontal or vertical line across all axes in a FacetGrid. Parameters ---------- x, y : str, float, or li...
[ "def", "map_flat_line", "(", "x", ",", "y", ",", "data", ",", "linestyles", "=", "'--'", ",", "colors", "=", "'k'", ",", "ax", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "ax", "is", "None", ":", "ax", "=", "plt", ".", "gca", "(", "...
[ 957, 0 ]
[ 1028, 16 ]
python
en
['en', 'en', 'en']
True
get_log_ax_lims
(vals, base=10)
Get good limits for log-scale axis. Since several plotting functions have trouble automatically doing this. Parameters ---------- vals : array_like The values plotted on the axis. base : float, optional The base of the axis Returns ------- lims : tuple tuple of...
Get good limits for log-scale axis.
def get_log_ax_lims(vals, base=10): """Get good limits for log-scale axis. Since several plotting functions have trouble automatically doing this. Parameters ---------- vals : array_like The values plotted on the axis. base : float, optional The base of the axis Returns ...
[ "def", "get_log_ax_lims", "(", "vals", ",", "base", "=", "10", ")", ":", "i_min", "=", "50", "while", "base", "**", "i_min", ">", "vals", ".", "min", "(", ")", ":", "i_min", "-=", "1", "i_max", "=", "-", "50", "while", "base", "**", "i_max", "<",...
[ 1031, 0 ]
[ 1057, 35 ]
python
en
['da', 'en', 'en']
True
title_experiment_summary_plots
(g, expt_df, summary_text, post_text='')
Handle suptitle for FacetGrids summarizing experiment. We want to handle the suptitle for these FacetGrids in a standard way: - Add suptitle that describes contents (what subjects, sessions, comparison) - Make sure it's visible Currently, used by: run_length_plot, compare_loss_and_performance_...
Handle suptitle for FacetGrids summarizing experiment.
def title_experiment_summary_plots(g, expt_df, summary_text, post_text=''): """Handle suptitle for FacetGrids summarizing experiment. We want to handle the suptitle for these FacetGrids in a standard way: - Add suptitle that describes contents (what subjects, sessions, comparison) - Make sure i...
[ "def", "title_experiment_summary_plots", "(", "g", ",", "expt_df", ",", "summary_text", ",", "post_text", "=", "''", ")", ":", "if", "expt_df", ".", "subject_name", ".", "nunique", "(", ")", ">", "1", ":", "subj_str", "=", "'all subjects'", "else", ":", "s...
[ 1060, 0 ]
[ 1139, 12 ]
python
en
['en', 'fr', 'en']
True
_label_and_title_psychophysical_curve_plot
(g, df, summary_text, ci=None, hdi=None)
Label and title plot. Does some changes to titles and labels to make the plots pretty. Parameters ---------- g : sns.FacetGrid FacetGrid containing the plot df : pd.DataFrame Dataframe contanining the plotted data summary_text : str String summarizing what's shown in th...
Label and title plot.
def _label_and_title_psychophysical_curve_plot(g, df, summary_text, ci=None, hdi=None): """Label and title plot. Does some changes to titles and labels to make the plots pretty. Parameters ---------- g : sns.FacetGrid FacetGrid containing the plot df : pd.DataFrame Dataframe co...
[ "def", "_label_and_title_psychophysical_curve_plot", "(", "g", ",", "df", ",", "summary_text", ",", "ci", "=", "None", ",", "hdi", "=", "None", ")", ":", "if", "ci", "is", "not", "None", ":", "ci_txt", "=", "f\"{ci}% CI\"", "elif", "hdi", "is", "not", "N...
[ 1142, 0 ]
[ 1194, 59 ]
python
en
['en', 'en', 'en']
True