repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
partition
stringclasses
1 value
oceanprotocol/squid-py
squid_py/aquarius/aquarius.py
Aquarius.validate_metadata
def validate_metadata(self, metadata): """ Validate that the metadata of your ddo is valid. :param metadata: conforming to the Metadata accepted by Ocean Protocol, dict :return: bool """ response = self.requests_session.post( f'{self.url}/validate', ...
python
def validate_metadata(self, metadata): """ Validate that the metadata of your ddo is valid. :param metadata: conforming to the Metadata accepted by Ocean Protocol, dict :return: bool """ response = self.requests_session.post( f'{self.url}/validate', ...
[ "def", "validate_metadata", "(", "self", ",", "metadata", ")", ":", "response", "=", "self", ".", "requests_session", ".", "post", "(", "f'{self.url}/validate'", ",", "data", "=", "json", ".", "dumps", "(", "metadata", ")", ",", "headers", "=", "self", "."...
Validate that the metadata of your ddo is valid. :param metadata: conforming to the Metadata accepted by Ocean Protocol, dict :return: bool
[ "Validate", "that", "the", "metadata", "of", "your", "ddo", "is", "valid", "." ]
43a5b7431627e4c9ab7382ed9eb8153e96ed4483
https://github.com/oceanprotocol/squid-py/blob/43a5b7431627e4c9ab7382ed9eb8153e96ed4483/squid_py/aquarius/aquarius.py#L248-L264
train
oceanprotocol/squid-py
squid_py/agreements/utils.py
get_sla_template_path
def get_sla_template_path(service_type=ServiceTypes.ASSET_ACCESS): """ Get the template for a ServiceType. :param service_type: ServiceTypes :return: Path of the template, str """ if service_type == ServiceTypes.ASSET_ACCESS: name = 'access_sla_template.json' elif service_type == Se...
python
def get_sla_template_path(service_type=ServiceTypes.ASSET_ACCESS): """ Get the template for a ServiceType. :param service_type: ServiceTypes :return: Path of the template, str """ if service_type == ServiceTypes.ASSET_ACCESS: name = 'access_sla_template.json' elif service_type == Se...
[ "def", "get_sla_template_path", "(", "service_type", "=", "ServiceTypes", ".", "ASSET_ACCESS", ")", ":", "if", "service_type", "==", "ServiceTypes", ".", "ASSET_ACCESS", ":", "name", "=", "'access_sla_template.json'", "elif", "service_type", "==", "ServiceTypes", ".",...
Get the template for a ServiceType. :param service_type: ServiceTypes :return: Path of the template, str
[ "Get", "the", "template", "for", "a", "ServiceType", "." ]
43a5b7431627e4c9ab7382ed9eb8153e96ed4483
https://github.com/oceanprotocol/squid-py/blob/43a5b7431627e4c9ab7382ed9eb8153e96ed4483/squid_py/agreements/utils.py#L11-L27
train
oceanprotocol/squid-py
squid_py/ocean/ocean_accounts.py
OceanAccounts.balance
def balance(self, account): """ Return the balance, a tuple with the eth and ocn balance. :param account: Account instance to return the balance of :return: Balance tuple of (eth, ocn) """ return Balance(self._keeper.get_ether_balance(account.address), ...
python
def balance(self, account): """ Return the balance, a tuple with the eth and ocn balance. :param account: Account instance to return the balance of :return: Balance tuple of (eth, ocn) """ return Balance(self._keeper.get_ether_balance(account.address), ...
[ "def", "balance", "(", "self", ",", "account", ")", ":", "return", "Balance", "(", "self", ".", "_keeper", ".", "get_ether_balance", "(", "account", ".", "address", ")", ",", "self", ".", "_keeper", ".", "token", ".", "get_token_balance", "(", "account", ...
Return the balance, a tuple with the eth and ocn balance. :param account: Account instance to return the balance of :return: Balance tuple of (eth, ocn)
[ "Return", "the", "balance", "a", "tuple", "with", "the", "eth", "and", "ocn", "balance", "." ]
43a5b7431627e4c9ab7382ed9eb8153e96ed4483
https://github.com/oceanprotocol/squid-py/blob/43a5b7431627e4c9ab7382ed9eb8153e96ed4483/squid_py/ocean/ocean_accounts.py#L44-L52
train
oceanprotocol/squid-py
squid_py/agreements/register_service_agreement.py
process_agreement_events_consumer
def process_agreement_events_consumer(publisher_address, agreement_id, did, service_agreement, price, consumer_account, condition_ids, consume_callback): """ Process the agreement events during the register of the service agreement for ...
python
def process_agreement_events_consumer(publisher_address, agreement_id, did, service_agreement, price, consumer_account, condition_ids, consume_callback): """ Process the agreement events during the register of the service agreement for ...
[ "def", "process_agreement_events_consumer", "(", "publisher_address", ",", "agreement_id", ",", "did", ",", "service_agreement", ",", "price", ",", "consumer_account", ",", "condition_ids", ",", "consume_callback", ")", ":", "conditions_dict", "=", "service_agreement", ...
Process the agreement events during the register of the service agreement for the consumer side. :param publisher_address: ethereum account address of publisher, hex str :param agreement_id: id of the agreement, hex str :param did: DID, str :param service_agreement: ServiceAgreement instance :param...
[ "Process", "the", "agreement", "events", "during", "the", "register", "of", "the", "service", "agreement", "for", "the", "consumer", "side", "." ]
43a5b7431627e4c9ab7382ed9eb8153e96ed4483
https://github.com/oceanprotocol/squid-py/blob/43a5b7431627e4c9ab7382ed9eb8153e96ed4483/squid_py/agreements/register_service_agreement.py#L54-L96
train
oceanprotocol/squid-py
squid_py/agreements/register_service_agreement.py
process_agreement_events_publisher
def process_agreement_events_publisher(publisher_account, agreement_id, did, service_agreement, price, consumer_address, condition_ids): """ Process the agreement events during the register of the service agreement for the publisher side :param publisher_account: Acco...
python
def process_agreement_events_publisher(publisher_account, agreement_id, did, service_agreement, price, consumer_address, condition_ids): """ Process the agreement events during the register of the service agreement for the publisher side :param publisher_account: Acco...
[ "def", "process_agreement_events_publisher", "(", "publisher_account", ",", "agreement_id", ",", "did", ",", "service_agreement", ",", "price", ",", "consumer_address", ",", "condition_ids", ")", ":", "conditions_dict", "=", "service_agreement", ".", "condition_by_name", ...
Process the agreement events during the register of the service agreement for the publisher side :param publisher_account: Account instance of the publisher :param agreement_id: id of the agreement, hex str :param did: DID, str :param service_agreement: ServiceAgreement instance :param price: Asset...
[ "Process", "the", "agreement", "events", "during", "the", "register", "of", "the", "service", "agreement", "for", "the", "publisher", "side" ]
43a5b7431627e4c9ab7382ed9eb8153e96ed4483
https://github.com/oceanprotocol/squid-py/blob/43a5b7431627e4c9ab7382ed9eb8153e96ed4483/squid_py/agreements/register_service_agreement.py#L130-L171
train
oceanprotocol/squid-py
squid_py/agreements/register_service_agreement.py
execute_pending_service_agreements
def execute_pending_service_agreements(storage_path, account, actor_type, did_resolver_fn): """ Iterates over pending service agreements recorded in the local storage, fetches their service definitions, and subscribes to service agreement events. :param storage_path: storage path for the internal db, ...
python
def execute_pending_service_agreements(storage_path, account, actor_type, did_resolver_fn): """ Iterates over pending service agreements recorded in the local storage, fetches their service definitions, and subscribes to service agreement events. :param storage_path: storage path for the internal db, ...
[ "def", "execute_pending_service_agreements", "(", "storage_path", ",", "account", ",", "actor_type", ",", "did_resolver_fn", ")", ":", "keeper", "=", "Keeper", ".", "get_instance", "(", ")", "for", "(", "agreement_id", ",", "did", ",", "_", ",", "price", ",", ...
Iterates over pending service agreements recorded in the local storage, fetches their service definitions, and subscribes to service agreement events. :param storage_path: storage path for the internal db, str :param account: :param actor_type: :param did_resolver_fn: :return:
[ "Iterates", "over", "pending", "service", "agreements", "recorded", "in", "the", "local", "storage", "fetches", "their", "service", "definitions", "and", "subscribes", "to", "service", "agreement", "events", "." ]
43a5b7431627e4c9ab7382ed9eb8153e96ed4483
https://github.com/oceanprotocol/squid-py/blob/43a5b7431627e4c9ab7382ed9eb8153e96ed4483/squid_py/agreements/register_service_agreement.py#L174-L215
train
oceanprotocol/squid-py
squid_py/keeper/utils.py
generate_multi_value_hash
def generate_multi_value_hash(types, values): """ Return the hash of the given list of values. This is equivalent to packing and hashing values in a solidity smart contract hence the use of `soliditySha3`. :param types: list of solidity types expressed as strings :param values: list of values m...
python
def generate_multi_value_hash(types, values): """ Return the hash of the given list of values. This is equivalent to packing and hashing values in a solidity smart contract hence the use of `soliditySha3`. :param types: list of solidity types expressed as strings :param values: list of values m...
[ "def", "generate_multi_value_hash", "(", "types", ",", "values", ")", ":", "assert", "len", "(", "types", ")", "==", "len", "(", "values", ")", "return", "Web3Provider", ".", "get_web3", "(", ")", ".", "soliditySha3", "(", "types", ",", "values", ")" ]
Return the hash of the given list of values. This is equivalent to packing and hashing values in a solidity smart contract hence the use of `soliditySha3`. :param types: list of solidity types expressed as strings :param values: list of values matching the `types` list :return: bytes
[ "Return", "the", "hash", "of", "the", "given", "list", "of", "values", ".", "This", "is", "equivalent", "to", "packing", "and", "hashing", "values", "in", "a", "solidity", "smart", "contract", "hence", "the", "use", "of", "soliditySha3", "." ]
43a5b7431627e4c9ab7382ed9eb8153e96ed4483
https://github.com/oceanprotocol/squid-py/blob/43a5b7431627e4c9ab7382ed9eb8153e96ed4483/squid_py/keeper/utils.py#L14-L28
train
oceanprotocol/squid-py
squid_py/keeper/utils.py
process_tx_receipt
def process_tx_receipt(tx_hash, event, event_name): """ Wait until the tx receipt is processed. :param tx_hash: hash of the transaction :param event: AttributeDict with the event data. :param event_name: name of the event to subscribe, str :return: """ web3 = Web3Provider.get_web3() ...
python
def process_tx_receipt(tx_hash, event, event_name): """ Wait until the tx receipt is processed. :param tx_hash: hash of the transaction :param event: AttributeDict with the event data. :param event_name: name of the event to subscribe, str :return: """ web3 = Web3Provider.get_web3() ...
[ "def", "process_tx_receipt", "(", "tx_hash", ",", "event", ",", "event_name", ")", ":", "web3", "=", "Web3Provider", ".", "get_web3", "(", ")", "try", ":", "web3", ".", "eth", ".", "waitForTransactionReceipt", "(", "tx_hash", ",", "timeout", "=", "20", ")"...
Wait until the tx receipt is processed. :param tx_hash: hash of the transaction :param event: AttributeDict with the event data. :param event_name: name of the event to subscribe, str :return:
[ "Wait", "until", "the", "tx", "receipt", "is", "processed", "." ]
43a5b7431627e4c9ab7382ed9eb8153e96ed4483
https://github.com/oceanprotocol/squid-py/blob/43a5b7431627e4c9ab7382ed9eb8153e96ed4483/squid_py/keeper/utils.py#L31-L59
train
oceanprotocol/squid-py
squid_py/keeper/conditions/condition_manager.py
ConditionStoreManager.get_condition
def get_condition(self, condition_id): """Retrieve the condition for a condition_id. :param condition_id: id of the condition, str :return: """ condition = self.contract_concise.getCondition(condition_id) if condition and len(condition) == 7: return Condition...
python
def get_condition(self, condition_id): """Retrieve the condition for a condition_id. :param condition_id: id of the condition, str :return: """ condition = self.contract_concise.getCondition(condition_id) if condition and len(condition) == 7: return Condition...
[ "def", "get_condition", "(", "self", ",", "condition_id", ")", ":", "condition", "=", "self", ".", "contract_concise", ".", "getCondition", "(", "condition_id", ")", "if", "condition", "and", "len", "(", "condition", ")", "==", "7", ":", "return", "Condition...
Retrieve the condition for a condition_id. :param condition_id: id of the condition, str :return:
[ "Retrieve", "the", "condition", "for", "a", "condition_id", "." ]
43a5b7431627e4c9ab7382ed9eb8153e96ed4483
https://github.com/oceanprotocol/squid-py/blob/43a5b7431627e4c9ab7382ed9eb8153e96ed4483/squid_py/keeper/conditions/condition_manager.py#L19-L29
train
oceanprotocol/squid-py
squid_py/keeper/conditions/sign.py
SignCondition.fulfill
def fulfill(self, agreement_id, message, account_address, signature, from_account): """ Fulfill the sign conditon. :param agreement_id: id of the agreement, hex str :param message: :param account_address: ethereum account address, hex str :param signature: signed agreeme...
python
def fulfill(self, agreement_id, message, account_address, signature, from_account): """ Fulfill the sign conditon. :param agreement_id: id of the agreement, hex str :param message: :param account_address: ethereum account address, hex str :param signature: signed agreeme...
[ "def", "fulfill", "(", "self", ",", "agreement_id", ",", "message", ",", "account_address", ",", "signature", ",", "from_account", ")", ":", "return", "self", ".", "_fulfill", "(", "agreement_id", ",", "message", ",", "account_address", ",", "signature", ",", ...
Fulfill the sign conditon. :param agreement_id: id of the agreement, hex str :param message: :param account_address: ethereum account address, hex str :param signature: signed agreement hash, hex str :param from_account: Account doing the transaction :return:
[ "Fulfill", "the", "sign", "conditon", "." ]
43a5b7431627e4c9ab7382ed9eb8153e96ed4483
https://github.com/oceanprotocol/squid-py/blob/43a5b7431627e4c9ab7382ed9eb8153e96ed4483/squid_py/keeper/conditions/sign.py#L11-L29
train
oceanprotocol/squid-py
squid_py/ocean/ocean_agreements.py
OceanAgreements.create
def create(self, did, service_definition_id, agreement_id, service_agreement_signature, consumer_address, account): """ Execute the service agreement on-chain using keeper's ServiceAgreement contract. The on-chain executeAgreement method requires the following arguments: ...
python
def create(self, did, service_definition_id, agreement_id, service_agreement_signature, consumer_address, account): """ Execute the service agreement on-chain using keeper's ServiceAgreement contract. The on-chain executeAgreement method requires the following arguments: ...
[ "def", "create", "(", "self", ",", "did", ",", "service_definition_id", ",", "agreement_id", ",", "service_agreement_signature", ",", "consumer_address", ",", "account", ")", ":", "assert", "consumer_address", "and", "Web3Provider", ".", "get_web3", "(", ")", ".",...
Execute the service agreement on-chain using keeper's ServiceAgreement contract. The on-chain executeAgreement method requires the following arguments: templateId, signature, consumer, hashes, timeouts, serviceAgreementId, did. `agreement_message_hash` is necessary to verify the signature. ...
[ "Execute", "the", "service", "agreement", "on", "-", "chain", "using", "keeper", "s", "ServiceAgreement", "contract", "." ]
43a5b7431627e4c9ab7382ed9eb8153e96ed4483
https://github.com/oceanprotocol/squid-py/blob/43a5b7431627e4c9ab7382ed9eb8153e96ed4483/squid_py/ocean/ocean_agreements.py#L126-L252
train
oceanprotocol/squid-py
squid_py/ocean/ocean_agreements.py
OceanAgreements.is_access_granted
def is_access_granted(self, agreement_id, did, consumer_address): """ Check permission for the agreement. Verify on-chain that the `consumer_address` has permission to access the given asset `did` according to the `agreement_id`. :param agreement_id: id of the agreement, hex st...
python
def is_access_granted(self, agreement_id, did, consumer_address): """ Check permission for the agreement. Verify on-chain that the `consumer_address` has permission to access the given asset `did` according to the `agreement_id`. :param agreement_id: id of the agreement, hex st...
[ "def", "is_access_granted", "(", "self", ",", "agreement_id", ",", "did", ",", "consumer_address", ")", ":", "agreement_consumer", "=", "self", ".", "_keeper", ".", "escrow_access_secretstore_template", ".", "get_agreement_consumer", "(", "agreement_id", ")", "if", ...
Check permission for the agreement. Verify on-chain that the `consumer_address` has permission to access the given asset `did` according to the `agreement_id`. :param agreement_id: id of the agreement, hex str :param did: DID, str :param consumer_address: ethereum account addre...
[ "Check", "permission", "for", "the", "agreement", "." ]
43a5b7431627e4c9ab7382ed9eb8153e96ed4483
https://github.com/oceanprotocol/squid-py/blob/43a5b7431627e4c9ab7382ed9eb8153e96ed4483/squid_py/ocean/ocean_agreements.py#L273-L296
train
oceanprotocol/squid-py
squid_py/ocean/ocean_agreements.py
OceanAgreements._verify_service_agreement_signature
def _verify_service_agreement_signature(self, did, agreement_id, service_definition_id, consumer_address, signature, ddo=None): """ Verify service agreement signature. Verify that the given signature is truly signed by the `consumer_address` a...
python
def _verify_service_agreement_signature(self, did, agreement_id, service_definition_id, consumer_address, signature, ddo=None): """ Verify service agreement signature. Verify that the given signature is truly signed by the `consumer_address` a...
[ "def", "_verify_service_agreement_signature", "(", "self", ",", "did", ",", "agreement_id", ",", "service_definition_id", ",", "consumer_address", ",", "signature", ",", "ddo", "=", "None", ")", ":", "if", "not", "ddo", ":", "ddo", "=", "self", ".", "_asset_re...
Verify service agreement signature. Verify that the given signature is truly signed by the `consumer_address` and represents this did's service agreement.. :param did: DID, str :param agreement_id: id of the agreement, hex str :param service_definition_id: identifier of the ser...
[ "Verify", "service", "agreement", "signature", "." ]
43a5b7431627e4c9ab7382ed9eb8153e96ed4483
https://github.com/oceanprotocol/squid-py/blob/43a5b7431627e4c9ab7382ed9eb8153e96ed4483/squid_py/ocean/ocean_agreements.py#L298-L332
train
oceanprotocol/squid-py
squid_py/ocean/ocean_agreements.py
OceanAgreements.status
def status(self, agreement_id): """ Get the status of a service agreement. :param agreement_id: id of the agreement, hex str :return: dict with condition status of each of the agreement's conditions or None if the agreement is invalid. """ condition_ids = self._k...
python
def status(self, agreement_id): """ Get the status of a service agreement. :param agreement_id: id of the agreement, hex str :return: dict with condition status of each of the agreement's conditions or None if the agreement is invalid. """ condition_ids = self._k...
[ "def", "status", "(", "self", ",", "agreement_id", ")", ":", "condition_ids", "=", "self", ".", "_keeper", ".", "agreement_manager", ".", "get_agreement", "(", "agreement_id", ")", ".", "condition_ids", "result", "=", "{", "\"agreementId\"", ":", "agreement_id",...
Get the status of a service agreement. :param agreement_id: id of the agreement, hex str :return: dict with condition status of each of the agreement's conditions or None if the agreement is invalid.
[ "Get", "the", "status", "of", "a", "service", "agreement", "." ]
43a5b7431627e4c9ab7382ed9eb8153e96ed4483
https://github.com/oceanprotocol/squid-py/blob/43a5b7431627e4c9ab7382ed9eb8153e96ed4483/squid_py/ocean/ocean_agreements.py#L343-L359
train
oceanprotocol/squid-py
squid_py/keeper/templates/access_secret_store_template.py
EscrowAccessSecretStoreTemplate.create_agreement
def create_agreement(self, agreement_id, did, condition_ids, time_locks, time_outs, consumer_address, account): """ Create the service agreement. Return true if it is created successfully. :param agreement_id: id of the agreement, hex str :param did: DID, str ...
python
def create_agreement(self, agreement_id, did, condition_ids, time_locks, time_outs, consumer_address, account): """ Create the service agreement. Return true if it is created successfully. :param agreement_id: id of the agreement, hex str :param did: DID, str ...
[ "def", "create_agreement", "(", "self", ",", "agreement_id", ",", "did", ",", "condition_ids", ",", "time_locks", ",", "time_outs", ",", "consumer_address", ",", "account", ")", ":", "logger", ".", "info", "(", "f'Creating agreement {agreement_id} with did={did}, cons...
Create the service agreement. Return true if it is created successfully. :param agreement_id: id of the agreement, hex str :param did: DID, str :param condition_ids: is a list of bytes32 content-addressed Condition IDs, bytes32 :param time_locks: is a list of uint time lock values assoc...
[ "Create", "the", "service", "agreement", ".", "Return", "true", "if", "it", "is", "created", "successfully", "." ]
43a5b7431627e4c9ab7382ed9eb8153e96ed4483
https://github.com/oceanprotocol/squid-py/blob/43a5b7431627e4c9ab7382ed9eb8153e96ed4483/squid_py/keeper/templates/access_secret_store_template.py#L17-L45
train
oceanprotocol/squid-py
squid_py/keeper/templates/access_secret_store_template.py
EscrowAccessSecretStoreTemplate.subscribe_agreement_created
def subscribe_agreement_created(self, agreement_id, timeout, callback, args, wait=False): """ Subscribe to an agreement created. :param agreement_id: id of the agreement, hex str :param timeout: :param callback: :param args: :param wait: if true block the listene...
python
def subscribe_agreement_created(self, agreement_id, timeout, callback, args, wait=False): """ Subscribe to an agreement created. :param agreement_id: id of the agreement, hex str :param timeout: :param callback: :param args: :param wait: if true block the listene...
[ "def", "subscribe_agreement_created", "(", "self", ",", "agreement_id", ",", "timeout", ",", "callback", ",", "args", ",", "wait", "=", "False", ")", ":", "logger", ".", "info", "(", "f'Subscribing {self.AGREEMENT_CREATED_EVENT} event with agreement id {agreement_id}.'", ...
Subscribe to an agreement created. :param agreement_id: id of the agreement, hex str :param timeout: :param callback: :param args: :param wait: if true block the listener until get the event, bool :return:
[ "Subscribe", "to", "an", "agreement", "created", "." ]
43a5b7431627e4c9ab7382ed9eb8153e96ed4483
https://github.com/oceanprotocol/squid-py/blob/43a5b7431627e4c9ab7382ed9eb8153e96ed4483/squid_py/keeper/templates/access_secret_store_template.py#L72-L92
train
oceanprotocol/squid-py
squid_py/keeper/conditions/condition_base.py
ConditionBase.generate_id
def generate_id(self, agreement_id, types, values): """ Generate id for the condition. :param agreement_id: id of the agreement, hex str :param types: list of types :param values: list of values :return: id, str """ values_hash = utils.generate_multi_valu...
python
def generate_id(self, agreement_id, types, values): """ Generate id for the condition. :param agreement_id: id of the agreement, hex str :param types: list of types :param values: list of values :return: id, str """ values_hash = utils.generate_multi_valu...
[ "def", "generate_id", "(", "self", ",", "agreement_id", ",", "types", ",", "values", ")", ":", "values_hash", "=", "utils", ".", "generate_multi_value_hash", "(", "types", ",", "values", ")", "return", "utils", ".", "generate_multi_value_hash", "(", "[", "'byt...
Generate id for the condition. :param agreement_id: id of the agreement, hex str :param types: list of types :param values: list of values :return: id, str
[ "Generate", "id", "for", "the", "condition", "." ]
43a5b7431627e4c9ab7382ed9eb8153e96ed4483
https://github.com/oceanprotocol/squid-py/blob/43a5b7431627e4c9ab7382ed9eb8153e96ed4483/squid_py/keeper/conditions/condition_base.py#L16-L29
train
oceanprotocol/squid-py
squid_py/keeper/conditions/condition_base.py
ConditionBase._fulfill
def _fulfill(self, *args, **kwargs): """ Fulfill the condition. :param args: :param kwargs: :return: true if the condition was successfully fulfilled, bool """ tx_hash = self.send_transaction('fulfill', args, **kwargs) receipt = self.get_tx_receipt(tx_has...
python
def _fulfill(self, *args, **kwargs): """ Fulfill the condition. :param args: :param kwargs: :return: true if the condition was successfully fulfilled, bool """ tx_hash = self.send_transaction('fulfill', args, **kwargs) receipt = self.get_tx_receipt(tx_has...
[ "def", "_fulfill", "(", "self", ",", "*", "args", ",", "**", "kwargs", ")", ":", "tx_hash", "=", "self", ".", "send_transaction", "(", "'fulfill'", ",", "args", ",", "**", "kwargs", ")", "receipt", "=", "self", ".", "get_tx_receipt", "(", "tx_hash", ")...
Fulfill the condition. :param args: :param kwargs: :return: true if the condition was successfully fulfilled, bool
[ "Fulfill", "the", "condition", "." ]
43a5b7431627e4c9ab7382ed9eb8153e96ed4483
https://github.com/oceanprotocol/squid-py/blob/43a5b7431627e4c9ab7382ed9eb8153e96ed4483/squid_py/keeper/conditions/condition_base.py#L31-L41
train
oceanprotocol/squid-py
squid_py/keeper/conditions/condition_base.py
ConditionBase.subscribe_condition_fulfilled
def subscribe_condition_fulfilled(self, agreement_id, timeout, callback, args, timeout_callback=None, wait=False): """ Subscribe to the condition fullfilled event. :param agreement_id: id of the agreement, hex str :param timeout: :param call...
python
def subscribe_condition_fulfilled(self, agreement_id, timeout, callback, args, timeout_callback=None, wait=False): """ Subscribe to the condition fullfilled event. :param agreement_id: id of the agreement, hex str :param timeout: :param call...
[ "def", "subscribe_condition_fulfilled", "(", "self", ",", "agreement_id", ",", "timeout", ",", "callback", ",", "args", ",", "timeout_callback", "=", "None", ",", "wait", "=", "False", ")", ":", "logger", ".", "info", "(", "f'Subscribing {self.FULFILLED_EVENT} eve...
Subscribe to the condition fullfilled event. :param agreement_id: id of the agreement, hex str :param timeout: :param callback: :param args: :param timeout_callback: :param wait: if true block the listener until get the event, bool :return:
[ "Subscribe", "to", "the", "condition", "fullfilled", "event", "." ]
43a5b7431627e4c9ab7382ed9eb8153e96ed4483
https://github.com/oceanprotocol/squid-py/blob/43a5b7431627e4c9ab7382ed9eb8153e96ed4483/squid_py/keeper/conditions/condition_base.py#L62-L85
train
oceanprotocol/squid-py
squid_py/keeper/web3/contract.py
transact_with_contract_function
def transact_with_contract_function( address, web3, function_name=None, transaction=None, contract_abi=None, fn_abi=None, *args, **kwargs): """ Helper function for interacting with a contract function by sending a transaction. This is copied fr...
python
def transact_with_contract_function( address, web3, function_name=None, transaction=None, contract_abi=None, fn_abi=None, *args, **kwargs): """ Helper function for interacting with a contract function by sending a transaction. This is copied fr...
[ "def", "transact_with_contract_function", "(", "address", ",", "web3", ",", "function_name", "=", "None", ",", "transaction", "=", "None", ",", "contract_abi", "=", "None", ",", "fn_abi", "=", "None", ",", "*", "args", ",", "**", "kwargs", ")", ":", "trans...
Helper function for interacting with a contract function by sending a transaction. This is copied from web3 `transact_with_contract_function` so we can use `personal_sendTransaction` when possible.
[ "Helper", "function", "for", "interacting", "with", "a", "contract", "function", "by", "sending", "a", "transaction", ".", "This", "is", "copied", "from", "web3", "transact_with_contract_function", "so", "we", "can", "use", "personal_sendTransaction", "when", "possi...
43a5b7431627e4c9ab7382ed9eb8153e96ed4483
https://github.com/oceanprotocol/squid-py/blob/43a5b7431627e4c9ab7382ed9eb8153e96ed4483/squid_py/keeper/web3/contract.py#L67-L102
train
oceanprotocol/squid-py
squid_py/keeper/web3/contract.py
SquidContractFunction.transact
def transact(self, transaction=None): """ Customize calling smart contract transaction functions to use `personal_sendTransaction` instead of `eth_sendTransaction` and to estimate gas limit. This function is largely copied from web3 ContractFunction with important addition. Note...
python
def transact(self, transaction=None): """ Customize calling smart contract transaction functions to use `personal_sendTransaction` instead of `eth_sendTransaction` and to estimate gas limit. This function is largely copied from web3 ContractFunction with important addition. Note...
[ "def", "transact", "(", "self", ",", "transaction", "=", "None", ")", ":", "if", "transaction", "is", "None", ":", "transact_transaction", "=", "{", "}", "else", ":", "transact_transaction", "=", "dict", "(", "**", "transaction", ")", "if", "'data'", "in",...
Customize calling smart contract transaction functions to use `personal_sendTransaction` instead of `eth_sendTransaction` and to estimate gas limit. This function is largely copied from web3 ContractFunction with important addition. Note: will fallback to `eth_sendTransaction` if `passphrase` i...
[ "Customize", "calling", "smart", "contract", "transaction", "functions", "to", "use", "personal_sendTransaction", "instead", "of", "eth_sendTransaction", "and", "to", "estimate", "gas", "limit", ".", "This", "function", "is", "largely", "copied", "from", "web3", "Co...
43a5b7431627e4c9ab7382ed9eb8153e96ed4483
https://github.com/oceanprotocol/squid-py/blob/43a5b7431627e4c9ab7382ed9eb8153e96ed4483/squid_py/keeper/web3/contract.py#L10-L64
train
oceanprotocol/squid-py
squid_py/keeper/conditions/escrow_reward.py
EscrowRewardCondition.fulfill
def fulfill(self, agreement_id, amount, receiver_address, sender_address, lock_condition_id, release_condition_id, account): """ Fulfill the escrow reward condition. :param agreement_...
python
def fulfill(self, agreement_id, amount, receiver_address, sender_address, lock_condition_id, release_condition_id, account): """ Fulfill the escrow reward condition. :param agreement_...
[ "def", "fulfill", "(", "self", ",", "agreement_id", ",", "amount", ",", "receiver_address", ",", "sender_address", ",", "lock_condition_id", ",", "release_condition_id", ",", "account", ")", ":", "return", "self", ".", "_fulfill", "(", "agreement_id", ",", "amou...
Fulfill the escrow reward condition. :param agreement_id: id of the agreement, hex str :param amount: Amount of tokens, int :param receiver_address: ethereum address of the receiver, hex str :param sender_address: ethereum address of the sender, hex str :param lock_condition_id:...
[ "Fulfill", "the", "escrow", "reward", "condition", "." ]
43a5b7431627e4c9ab7382ed9eb8153e96ed4483
https://github.com/oceanprotocol/squid-py/blob/43a5b7431627e4c9ab7382ed9eb8153e96ed4483/squid_py/keeper/conditions/escrow_reward.py#L11-L40
train
oceanprotocol/squid-py
squid_py/keeper/conditions/escrow_reward.py
EscrowRewardCondition.hash_values
def hash_values(self, amount, receiver_address, sender_address, lock_condition_id, release_condition_id): """ Hash the values of the escrow reward condition. :param amount: Amount of tokens, int :param receiver_address: ethereum address of the receiver, hex str ...
python
def hash_values(self, amount, receiver_address, sender_address, lock_condition_id, release_condition_id): """ Hash the values of the escrow reward condition. :param amount: Amount of tokens, int :param receiver_address: ethereum address of the receiver, hex str ...
[ "def", "hash_values", "(", "self", ",", "amount", ",", "receiver_address", ",", "sender_address", ",", "lock_condition_id", ",", "release_condition_id", ")", ":", "return", "self", ".", "_hash_values", "(", "amount", ",", "receiver_address", ",", "sender_address", ...
Hash the values of the escrow reward condition. :param amount: Amount of tokens, int :param receiver_address: ethereum address of the receiver, hex str :param sender_address: ethereum address of the sender, hex str :param lock_condition_id: id of the condition, str :param releas...
[ "Hash", "the", "values", "of", "the", "escrow", "reward", "condition", "." ]
43a5b7431627e4c9ab7382ed9eb8153e96ed4483
https://github.com/oceanprotocol/squid-py/blob/43a5b7431627e4c9ab7382ed9eb8153e96ed4483/squid_py/keeper/conditions/escrow_reward.py#L42-L60
train
oceanprotocol/squid-py
squid_py/agreements/service_agreement_condition.py
Parameter.as_dictionary
def as_dictionary(self): """ Return the parameter as a dictionary. :return: dict """ return { "name": self.name, "type": self.type, "value": remove_0x_prefix(self.value) if self.type == 'bytes32' else self.value }
python
def as_dictionary(self): """ Return the parameter as a dictionary. :return: dict """ return { "name": self.name, "type": self.type, "value": remove_0x_prefix(self.value) if self.type == 'bytes32' else self.value }
[ "def", "as_dictionary", "(", "self", ")", ":", "return", "{", "\"name\"", ":", "self", ".", "name", ",", "\"type\"", ":", "self", ".", "type", ",", "\"value\"", ":", "remove_0x_prefix", "(", "self", ".", "value", ")", "if", "self", ".", "type", "==", ...
Return the parameter as a dictionary. :return: dict
[ "Return", "the", "parameter", "as", "a", "dictionary", "." ]
43a5b7431627e4c9ab7382ed9eb8153e96ed4483
https://github.com/oceanprotocol/squid-py/blob/43a5b7431627e4c9ab7382ed9eb8153e96ed4483/squid_py/agreements/service_agreement_condition.py#L21-L31
train
oceanprotocol/squid-py
squid_py/agreements/service_agreement_condition.py
ServiceAgreementCondition.init_from_condition_json
def init_from_condition_json(self, condition_json): """ Init the condition values from a condition json. :param condition_json: dict """ self.name = condition_json['name'] self.timelock = condition_json['timelock'] self.timeout = condition_json['timeout'] ...
python
def init_from_condition_json(self, condition_json): """ Init the condition values from a condition json. :param condition_json: dict """ self.name = condition_json['name'] self.timelock = condition_json['timelock'] self.timeout = condition_json['timeout'] ...
[ "def", "init_from_condition_json", "(", "self", ",", "condition_json", ")", ":", "self", ".", "name", "=", "condition_json", "[", "'name'", "]", "self", ".", "timelock", "=", "condition_json", "[", "'timelock'", "]", "self", ".", "timeout", "=", "condition_jso...
Init the condition values from a condition json. :param condition_json: dict
[ "Init", "the", "condition", "values", "from", "a", "condition", "json", "." ]
43a5b7431627e4c9ab7382ed9eb8153e96ed4483
https://github.com/oceanprotocol/squid-py/blob/43a5b7431627e4c9ab7382ed9eb8153e96ed4483/squid_py/agreements/service_agreement_condition.py#L93-L105
train
oceanprotocol/squid-py
squid_py/agreements/service_agreement_condition.py
ServiceAgreementCondition.as_dictionary
def as_dictionary(self): """ Return the condition as a dictionary. :return: dict """ condition_dict = { "name": self.name, "timelock": self.timelock, "timeout": self.timeout, "contractName": self.contract_name, "functio...
python
def as_dictionary(self): """ Return the condition as a dictionary. :return: dict """ condition_dict = { "name": self.name, "timelock": self.timelock, "timeout": self.timeout, "contractName": self.contract_name, "functio...
[ "def", "as_dictionary", "(", "self", ")", ":", "condition_dict", "=", "{", "\"name\"", ":", "self", ".", "name", ",", "\"timelock\"", ":", "self", ".", "timelock", ",", "\"timeout\"", ":", "self", ".", "timeout", ",", "\"contractName\"", ":", "self", ".", ...
Return the condition as a dictionary. :return: dict
[ "Return", "the", "condition", "as", "a", "dictionary", "." ]
43a5b7431627e4c9ab7382ed9eb8153e96ed4483
https://github.com/oceanprotocol/squid-py/blob/43a5b7431627e4c9ab7382ed9eb8153e96ed4483/squid_py/agreements/service_agreement_condition.py#L107-L123
train
oceanprotocol/squid-py
squid_py/ddo/service.py
Service.update_value
def update_value(self, name, value): """ Update value in the array of values. :param name: Key of the value, str :param value: New value, str :return: None """ if name not in {'id', self.SERVICE_ENDPOINT, self.CONSUME_ENDPOINT, 'type'}: self._values[n...
python
def update_value(self, name, value): """ Update value in the array of values. :param name: Key of the value, str :param value: New value, str :return: None """ if name not in {'id', self.SERVICE_ENDPOINT, self.CONSUME_ENDPOINT, 'type'}: self._values[n...
[ "def", "update_value", "(", "self", ",", "name", ",", "value", ")", ":", "if", "name", "not", "in", "{", "'id'", ",", "self", ".", "SERVICE_ENDPOINT", ",", "self", ".", "CONSUME_ENDPOINT", ",", "'type'", "}", ":", "self", ".", "_values", "[", "name", ...
Update value in the array of values. :param name: Key of the value, str :param value: New value, str :return: None
[ "Update", "value", "in", "the", "array", "of", "values", "." ]
43a5b7431627e4c9ab7382ed9eb8153e96ed4483
https://github.com/oceanprotocol/squid-py/blob/43a5b7431627e4c9ab7382ed9eb8153e96ed4483/squid_py/ddo/service.py#L92-L101
train
oceanprotocol/squid-py
squid_py/ddo/service.py
Service.as_text
def as_text(self, is_pretty=False): """Return the service as a JSON string.""" values = { 'type': self._type, self.SERVICE_ENDPOINT: self._service_endpoint, } if self._consume_endpoint is not None: values[self.CONSUME_ENDPOINT] = self._consume_endpoint...
python
def as_text(self, is_pretty=False): """Return the service as a JSON string.""" values = { 'type': self._type, self.SERVICE_ENDPOINT: self._service_endpoint, } if self._consume_endpoint is not None: values[self.CONSUME_ENDPOINT] = self._consume_endpoint...
[ "def", "as_text", "(", "self", ",", "is_pretty", "=", "False", ")", ":", "values", "=", "{", "'type'", ":", "self", ".", "_type", ",", "self", ".", "SERVICE_ENDPOINT", ":", "self", ".", "_service_endpoint", ",", "}", "if", "self", ".", "_consume_endpoint...
Return the service as a JSON string.
[ "Return", "the", "service", "as", "a", "JSON", "string", "." ]
43a5b7431627e4c9ab7382ed9eb8153e96ed4483
https://github.com/oceanprotocol/squid-py/blob/43a5b7431627e4c9ab7382ed9eb8153e96ed4483/squid_py/ddo/service.py#L116-L132
train
oceanprotocol/squid-py
squid_py/ddo/service.py
Service.as_dictionary
def as_dictionary(self): """Return the service as a python dictionary.""" values = { 'type': self._type, self.SERVICE_ENDPOINT: self._service_endpoint, } if self._consume_endpoint is not None: values[self.CONSUME_ENDPOINT] = self._consume_endpoint ...
python
def as_dictionary(self): """Return the service as a python dictionary.""" values = { 'type': self._type, self.SERVICE_ENDPOINT: self._service_endpoint, } if self._consume_endpoint is not None: values[self.CONSUME_ENDPOINT] = self._consume_endpoint ...
[ "def", "as_dictionary", "(", "self", ")", ":", "values", "=", "{", "'type'", ":", "self", ".", "_type", ",", "self", ".", "SERVICE_ENDPOINT", ":", "self", ".", "_service_endpoint", ",", "}", "if", "self", ".", "_consume_endpoint", "is", "not", "None", ":...
Return the service as a python dictionary.
[ "Return", "the", "service", "as", "a", "python", "dictionary", "." ]
43a5b7431627e4c9ab7382ed9eb8153e96ed4483
https://github.com/oceanprotocol/squid-py/blob/43a5b7431627e4c9ab7382ed9eb8153e96ed4483/squid_py/ddo/service.py#L134-L151
train
oceanprotocol/squid-py
squid_py/ddo/service.py
Service.from_json
def from_json(cls, service_dict): """Create a service object from a JSON string.""" sd = service_dict.copy() service_endpoint = sd.get(cls.SERVICE_ENDPOINT) if not service_endpoint: logger.error( 'Service definition in DDO document is missing the "serviceEndpo...
python
def from_json(cls, service_dict): """Create a service object from a JSON string.""" sd = service_dict.copy() service_endpoint = sd.get(cls.SERVICE_ENDPOINT) if not service_endpoint: logger.error( 'Service definition in DDO document is missing the "serviceEndpo...
[ "def", "from_json", "(", "cls", ",", "service_dict", ")", ":", "sd", "=", "service_dict", ".", "copy", "(", ")", "service_endpoint", "=", "sd", ".", "get", "(", "cls", ".", "SERVICE_ENDPOINT", ")", "if", "not", "service_endpoint", ":", "logger", ".", "er...
Create a service object from a JSON string.
[ "Create", "a", "service", "object", "from", "a", "JSON", "string", "." ]
43a5b7431627e4c9ab7382ed9eb8153e96ed4483
https://github.com/oceanprotocol/squid-py/blob/43a5b7431627e4c9ab7382ed9eb8153e96ed4483/squid_py/ddo/service.py#L154-L174
train
oceanprotocol/squid-py
squid_py/keeper/conditions/access.py
AccessSecretStoreCondition.fulfill
def fulfill(self, agreement_id, document_id, grantee_address, account): """ Fulfill the access secret store condition. :param agreement_id: id of the agreement, hex str :param document_id: refers to the DID in which secret store will issue the decryption keys, DID :param...
python
def fulfill(self, agreement_id, document_id, grantee_address, account): """ Fulfill the access secret store condition. :param agreement_id: id of the agreement, hex str :param document_id: refers to the DID in which secret store will issue the decryption keys, DID :param...
[ "def", "fulfill", "(", "self", ",", "agreement_id", ",", "document_id", ",", "grantee_address", ",", "account", ")", ":", "return", "self", ".", "_fulfill", "(", "agreement_id", ",", "document_id", ",", "grantee_address", ",", "transact", "=", "{", "'from'", ...
Fulfill the access secret store condition. :param agreement_id: id of the agreement, hex str :param document_id: refers to the DID in which secret store will issue the decryption keys, DID :param grantee_address: is the address of the granted user, str :param account: Account in...
[ "Fulfill", "the", "access", "secret", "store", "condition", "." ]
43a5b7431627e4c9ab7382ed9eb8153e96ed4483
https://github.com/oceanprotocol/squid-py/blob/43a5b7431627e4c9ab7382ed9eb8153e96ed4483/squid_py/keeper/conditions/access.py#L13-L30
train
oceanprotocol/squid-py
squid_py/keeper/conditions/access.py
AccessSecretStoreCondition.get_purchased_assets_by_address
def get_purchased_assets_by_address(self, address, from_block=0, to_block='latest'): """ Get the list of the assets dids consumed for an address. :param address: is the address of the granted user, hex-str :param from_block: block to start to listen :param to_block: block to sto...
python
def get_purchased_assets_by_address(self, address, from_block=0, to_block='latest'): """ Get the list of the assets dids consumed for an address. :param address: is the address of the granted user, hex-str :param from_block: block to start to listen :param to_block: block to sto...
[ "def", "get_purchased_assets_by_address", "(", "self", ",", "address", ",", "from_block", "=", "0", ",", "to_block", "=", "'latest'", ")", ":", "block_filter", "=", "EventFilter", "(", "ConditionBase", ".", "FULFILLED_EVENT", ",", "getattr", "(", "self", ".", ...
Get the list of the assets dids consumed for an address. :param address: is the address of the granted user, hex-str :param from_block: block to start to listen :param to_block: block to stop to listen :return: list of dids
[ "Get", "the", "list", "of", "the", "assets", "dids", "consumed", "for", "an", "address", "." ]
43a5b7431627e4c9ab7382ed9eb8153e96ed4483
https://github.com/oceanprotocol/squid-py/blob/43a5b7431627e4c9ab7382ed9eb8153e96ed4483/squid_py/keeper/conditions/access.py#L55-L76
train
oceanprotocol/squid-py
squid_py/keeper/web3_provider.py
Web3Provider.get_web3
def get_web3(): """Return the web3 instance to interact with the ethereum client.""" if Web3Provider._web3 is None: config = ConfigProvider.get_config() provider = ( config.web3_provider if config.web3_provider else CustomHTTPProvid...
python
def get_web3(): """Return the web3 instance to interact with the ethereum client.""" if Web3Provider._web3 is None: config = ConfigProvider.get_config() provider = ( config.web3_provider if config.web3_provider else CustomHTTPProvid...
[ "def", "get_web3", "(", ")", ":", "if", "Web3Provider", ".", "_web3", "is", "None", ":", "config", "=", "ConfigProvider", ".", "get_config", "(", ")", "provider", "=", "(", "config", ".", "web3_provider", "if", "config", ".", "web3_provider", "else", "Cust...
Return the web3 instance to interact with the ethereum client.
[ "Return", "the", "web3", "instance", "to", "interact", "with", "the", "ethereum", "client", "." ]
43a5b7431627e4c9ab7382ed9eb8153e96ed4483
https://github.com/oceanprotocol/squid-py/blob/43a5b7431627e4c9ab7382ed9eb8153e96ed4483/squid_py/keeper/web3_provider.py#L15-L38
train
BlueBrain/NeuroM
neurom/core/_soma.py
_get_type
def _get_type(points, soma_class): '''get the type of the soma Args: points: Soma points soma_class(str): one of 'contour' or 'cylinder' to specify the type ''' assert soma_class in (SOMA_CONTOUR, SOMA_CYLINDER) npoints = len(points) if soma_class == SOMA_CONTOUR: retur...
python
def _get_type(points, soma_class): '''get the type of the soma Args: points: Soma points soma_class(str): one of 'contour' or 'cylinder' to specify the type ''' assert soma_class in (SOMA_CONTOUR, SOMA_CYLINDER) npoints = len(points) if soma_class == SOMA_CONTOUR: retur...
[ "def", "_get_type", "(", "points", ",", "soma_class", ")", ":", "assert", "soma_class", "in", "(", "SOMA_CONTOUR", ",", "SOMA_CYLINDER", ")", "npoints", "=", "len", "(", "points", ")", "if", "soma_class", "==", "SOMA_CONTOUR", ":", "return", "{", "0", ":",...
get the type of the soma Args: points: Soma points soma_class(str): one of 'contour' or 'cylinder' to specify the type
[ "get", "the", "type", "of", "the", "soma" ]
254bb73535b20053d175bc4725bade662177d12b
https://github.com/BlueBrain/NeuroM/blob/254bb73535b20053d175bc4725bade662177d12b/neurom/core/_soma.py#L203-L232
train
BlueBrain/NeuroM
neurom/core/_soma.py
make_soma
def make_soma(points, soma_check=None, soma_class=SOMA_CONTOUR): '''Make a soma object from a set of points Infers the soma type (SomaSinglePoint, SomaSimpleContour) from the points and the 'soma_class' Parameters: points: collection of points forming a soma. soma_check: optional valid...
python
def make_soma(points, soma_check=None, soma_class=SOMA_CONTOUR): '''Make a soma object from a set of points Infers the soma type (SomaSinglePoint, SomaSimpleContour) from the points and the 'soma_class' Parameters: points: collection of points forming a soma. soma_check: optional valid...
[ "def", "make_soma", "(", "points", ",", "soma_check", "=", "None", ",", "soma_class", "=", "SOMA_CONTOUR", ")", ":", "if", "soma_check", ":", "soma_check", "(", "points", ")", "stype", "=", "_get_type", "(", "points", ",", "soma_class", ")", "if", "stype",...
Make a soma object from a set of points Infers the soma type (SomaSinglePoint, SomaSimpleContour) from the points and the 'soma_class' Parameters: points: collection of points forming a soma. soma_check: optional validation function applied to points. Should raise a SomaError if po...
[ "Make", "a", "soma", "object", "from", "a", "set", "of", "points" ]
254bb73535b20053d175bc4725bade662177d12b
https://github.com/BlueBrain/NeuroM/blob/254bb73535b20053d175bc4725bade662177d12b/neurom/core/_soma.py#L235-L260
train
BlueBrain/NeuroM
neurom/core/_soma.py
SomaSimpleContour.center
def center(self): '''Obtain the center from the average of all points''' points = np.array(self._points) return np.mean(points[:, COLS.XYZ], axis=0)
python
def center(self): '''Obtain the center from the average of all points''' points = np.array(self._points) return np.mean(points[:, COLS.XYZ], axis=0)
[ "def", "center", "(", "self", ")", ":", "points", "=", "np", ".", "array", "(", "self", ".", "_points", ")", "return", "np", ".", "mean", "(", "points", "[", ":", ",", "COLS", ".", "XYZ", "]", ",", "axis", "=", "0", ")" ]
Obtain the center from the average of all points
[ "Obtain", "the", "center", "from", "the", "average", "of", "all", "points" ]
254bb73535b20053d175bc4725bade662177d12b
https://github.com/BlueBrain/NeuroM/blob/254bb73535b20053d175bc4725bade662177d12b/neurom/core/_soma.py#L188-L191
train
BlueBrain/NeuroM
neurom/fst/sectionfunc.py
section_tortuosity
def section_tortuosity(section): '''Tortuosity of a section The tortuosity is defined as the ratio of the path length of a section and the euclidian distnce between its end points. The path length is the sum of distances between consecutive points. If the section contains less than 2 points, the ...
python
def section_tortuosity(section): '''Tortuosity of a section The tortuosity is defined as the ratio of the path length of a section and the euclidian distnce between its end points. The path length is the sum of distances between consecutive points. If the section contains less than 2 points, the ...
[ "def", "section_tortuosity", "(", "section", ")", ":", "pts", "=", "section", ".", "points", "return", "1", "if", "len", "(", "pts", ")", "<", "2", "else", "mm", ".", "section_length", "(", "pts", ")", "/", "mm", ".", "point_dist", "(", "pts", "[", ...
Tortuosity of a section The tortuosity is defined as the ratio of the path length of a section and the euclidian distnce between its end points. The path length is the sum of distances between consecutive points. If the section contains less than 2 points, the value 1 is returned.
[ "Tortuosity", "of", "a", "section" ]
254bb73535b20053d175bc4725bade662177d12b
https://github.com/BlueBrain/NeuroM/blob/254bb73535b20053d175bc4725bade662177d12b/neurom/fst/sectionfunc.py#L50-L61
train
BlueBrain/NeuroM
neurom/fst/sectionfunc.py
section_end_distance
def section_end_distance(section): '''End to end distance of a section The end to end distance of a section is defined as the euclidian distnce between its end points. If the section contains less than 2 points, the value 0 is returned. ''' pts = section.points return 0 if len(pts) < 2 els...
python
def section_end_distance(section): '''End to end distance of a section The end to end distance of a section is defined as the euclidian distnce between its end points. If the section contains less than 2 points, the value 0 is returned. ''' pts = section.points return 0 if len(pts) < 2 els...
[ "def", "section_end_distance", "(", "section", ")", ":", "pts", "=", "section", ".", "points", "return", "0", "if", "len", "(", "pts", ")", "<", "2", "else", "mm", ".", "point_dist", "(", "pts", "[", "-", "1", "]", ",", "pts", "[", "0", "]", ")" ...
End to end distance of a section The end to end distance of a section is defined as the euclidian distnce between its end points. If the section contains less than 2 points, the value 0 is returned.
[ "End", "to", "end", "distance", "of", "a", "section" ]
254bb73535b20053d175bc4725bade662177d12b
https://github.com/BlueBrain/NeuroM/blob/254bb73535b20053d175bc4725bade662177d12b/neurom/fst/sectionfunc.py#L64-L73
train
BlueBrain/NeuroM
neurom/fst/sectionfunc.py
strahler_order
def strahler_order(section): '''Branching order of a tree section The strahler order is the inverse of the branch order, since this is computed from the tips of the tree towards the root. This implementation is a translation of the three steps described in Wikipedia (https://en.wikipedia.org/w...
python
def strahler_order(section): '''Branching order of a tree section The strahler order is the inverse of the branch order, since this is computed from the tips of the tree towards the root. This implementation is a translation of the three steps described in Wikipedia (https://en.wikipedia.org/w...
[ "def", "strahler_order", "(", "section", ")", ":", "if", "section", ".", "children", ":", "child_orders", "=", "[", "strahler_order", "(", "child", ")", "for", "child", "in", "section", ".", "children", "]", "max_so_children", "=", "max", "(", "child_orders"...
Branching order of a tree section The strahler order is the inverse of the branch order, since this is computed from the tips of the tree towards the root. This implementation is a translation of the three steps described in Wikipedia (https://en.wikipedia.org/wiki/Strahler_number): - If t...
[ "Branching", "order", "of", "a", "tree", "section" ]
254bb73535b20053d175bc4725bade662177d12b
https://github.com/BlueBrain/NeuroM/blob/254bb73535b20053d175bc4725bade662177d12b/neurom/fst/sectionfunc.py#L108-L138
train
BlueBrain/NeuroM
neurom/view/common.py
figure_naming
def figure_naming(pretitle='', posttitle='', prefile='', postfile=''): """ Helper function to define the strings that handle pre-post conventions for viewing - plotting title and saving options. Args: pretitle(str): String to include before the general title of the figure. posttitle(str...
python
def figure_naming(pretitle='', posttitle='', prefile='', postfile=''): """ Helper function to define the strings that handle pre-post conventions for viewing - plotting title and saving options. Args: pretitle(str): String to include before the general title of the figure. posttitle(str...
[ "def", "figure_naming", "(", "pretitle", "=", "''", ",", "posttitle", "=", "''", ",", "prefile", "=", "''", ",", "postfile", "=", "''", ")", ":", "if", "pretitle", ":", "pretitle", "=", "\"%s -- \"", "%", "pretitle", "if", "posttitle", ":", "posttitle", ...
Helper function to define the strings that handle pre-post conventions for viewing - plotting title and saving options. Args: pretitle(str): String to include before the general title of the figure. posttitle(str): String to include after the general title of the figure. prefile(str): S...
[ "Helper", "function", "to", "define", "the", "strings", "that", "handle", "pre", "-", "post", "conventions", "for", "viewing", "-", "plotting", "title", "and", "saving", "options", "." ]
254bb73535b20053d175bc4725bade662177d12b
https://github.com/BlueBrain/NeuroM/blob/254bb73535b20053d175bc4725bade662177d12b/neurom/view/common.py#L56-L82
train
BlueBrain/NeuroM
neurom/view/common.py
get_figure
def get_figure(new_fig=True, subplot='111', params=None): """ Function to be used for viewing - plotting, to initialize the matplotlib figure - axes. Args: new_fig(bool): Defines if a new figure will be created, if false current figure is used subplot (tuple or matplolib subplot specifi...
python
def get_figure(new_fig=True, subplot='111', params=None): """ Function to be used for viewing - plotting, to initialize the matplotlib figure - axes. Args: new_fig(bool): Defines if a new figure will be created, if false current figure is used subplot (tuple or matplolib subplot specifi...
[ "def", "get_figure", "(", "new_fig", "=", "True", ",", "subplot", "=", "'111'", ",", "params", "=", "None", ")", ":", "_get_plt", "(", ")", "if", "new_fig", ":", "fig", "=", "plt", ".", "figure", "(", ")", "else", ":", "fig", "=", "plt", ".", "gc...
Function to be used for viewing - plotting, to initialize the matplotlib figure - axes. Args: new_fig(bool): Defines if a new figure will be created, if false current figure is used subplot (tuple or matplolib subplot specifier string): Create axes with these parameters params (dict): e...
[ "Function", "to", "be", "used", "for", "viewing", "-", "plotting", "to", "initialize", "the", "matplotlib", "figure", "-", "axes", "." ]
254bb73535b20053d175bc4725bade662177d12b
https://github.com/BlueBrain/NeuroM/blob/254bb73535b20053d175bc4725bade662177d12b/neurom/view/common.py#L85-L112
train
BlueBrain/NeuroM
neurom/view/common.py
save_plot
def save_plot(fig, prefile='', postfile='', output_path='./', output_name='Figure', output_format='png', dpi=300, transparent=False, **_): """Generates a figure file in the selected directory. Args: fig: matplotlib figure prefile(str): Include before the general filename of the fi...
python
def save_plot(fig, prefile='', postfile='', output_path='./', output_name='Figure', output_format='png', dpi=300, transparent=False, **_): """Generates a figure file in the selected directory. Args: fig: matplotlib figure prefile(str): Include before the general filename of the fi...
[ "def", "save_plot", "(", "fig", ",", "prefile", "=", "''", ",", "postfile", "=", "''", ",", "output_path", "=", "'./'", ",", "output_name", "=", "'Figure'", ",", "output_format", "=", "'png'", ",", "dpi", "=", "300", ",", "transparent", "=", "False", "...
Generates a figure file in the selected directory. Args: fig: matplotlib figure prefile(str): Include before the general filename of the figure postfile(str): Included after the general filename of the figure output_path(str): Define the path to the output directory output_n...
[ "Generates", "a", "figure", "file", "in", "the", "selected", "directory", "." ]
254bb73535b20053d175bc4725bade662177d12b
https://github.com/BlueBrain/NeuroM/blob/254bb73535b20053d175bc4725bade662177d12b/neurom/view/common.py#L115-L135
train
BlueBrain/NeuroM
neurom/view/common.py
plot_style
def plot_style(fig, ax, # pylint: disable=too-many-arguments, too-many-locals # plot_title pretitle='', title='Figure', posttitle='', title_fontsize=14, title_arg=None, # plot_labels label_fontsize=1...
python
def plot_style(fig, ax, # pylint: disable=too-many-arguments, too-many-locals # plot_title pretitle='', title='Figure', posttitle='', title_fontsize=14, title_arg=None, # plot_labels label_fontsize=1...
[ "def", "plot_style", "(", "fig", ",", "ax", ",", "pretitle", "=", "''", ",", "title", "=", "'Figure'", ",", "posttitle", "=", "''", ",", "title_fontsize", "=", "14", ",", "title_arg", "=", "None", ",", "label_fontsize", "=", "14", ",", "xlabel", "=", ...
Set the basic options of a matplotlib figure, to be used by viewing - plotting functions Args: fig(matplotlib figure): figure ax(matplotlib axes, belonging to `fig`): axes pretitle(str): String to include before the general title of the figure posttitle (str): String to include aft...
[ "Set", "the", "basic", "options", "of", "a", "matplotlib", "figure", "to", "be", "used", "by", "viewing", "-", "plotting", "functions" ]
254bb73535b20053d175bc4725bade662177d12b
https://github.com/BlueBrain/NeuroM/blob/254bb73535b20053d175bc4725bade662177d12b/neurom/view/common.py#L138-L225
train
BlueBrain/NeuroM
neurom/view/common.py
plot_title
def plot_title(ax, pretitle='', title='Figure', posttitle='', title_fontsize=14, title_arg=None): """Set title options of a matplotlib plot Args: ax: matplotlib axes pretitle(str): String to include before the general title of the figure posttitle (str): String to include after the gene...
python
def plot_title(ax, pretitle='', title='Figure', posttitle='', title_fontsize=14, title_arg=None): """Set title options of a matplotlib plot Args: ax: matplotlib axes pretitle(str): String to include before the general title of the figure posttitle (str): String to include after the gene...
[ "def", "plot_title", "(", "ax", ",", "pretitle", "=", "''", ",", "title", "=", "'Figure'", ",", "posttitle", "=", "''", ",", "title_fontsize", "=", "14", ",", "title_arg", "=", "None", ")", ":", "current_title", "=", "ax", ".", "get_title", "(", ")", ...
Set title options of a matplotlib plot Args: ax: matplotlib axes pretitle(str): String to include before the general title of the figure posttitle (str): String to include after the general title of the figure title (str): Set the title for the figure title_fontsize (int): D...
[ "Set", "title", "options", "of", "a", "matplotlib", "plot" ]
254bb73535b20053d175bc4725bade662177d12b
https://github.com/BlueBrain/NeuroM/blob/254bb73535b20053d175bc4725bade662177d12b/neurom/view/common.py#L228-L246
train
BlueBrain/NeuroM
neurom/view/common.py
plot_labels
def plot_labels(ax, label_fontsize=14, xlabel=None, xlabel_arg=None, ylabel=None, ylabel_arg=None, zlabel=None, zlabel_arg=None): """Sets the labels options of a matplotlib plot Args: ax: matplotlib axes label_fontsize(int): Size of the labels' fo...
python
def plot_labels(ax, label_fontsize=14, xlabel=None, xlabel_arg=None, ylabel=None, ylabel_arg=None, zlabel=None, zlabel_arg=None): """Sets the labels options of a matplotlib plot Args: ax: matplotlib axes label_fontsize(int): Size of the labels' fo...
[ "def", "plot_labels", "(", "ax", ",", "label_fontsize", "=", "14", ",", "xlabel", "=", "None", ",", "xlabel_arg", "=", "None", ",", "ylabel", "=", "None", ",", "ylabel_arg", "=", "None", ",", "zlabel", "=", "None", ",", "zlabel_arg", "=", "None", ")", ...
Sets the labels options of a matplotlib plot Args: ax: matplotlib axes label_fontsize(int): Size of the labels' font xlabel(str): The xlabel for the figure xlabel_arg(dict): Passsed into matplotlib as xlabel arguments ylabel(str): The ylabel for the figure ylabel_ar...
[ "Sets", "the", "labels", "options", "of", "a", "matplotlib", "plot" ]
254bb73535b20053d175bc4725bade662177d12b
https://github.com/BlueBrain/NeuroM/blob/254bb73535b20053d175bc4725bade662177d12b/neurom/view/common.py#L249-L277
train
BlueBrain/NeuroM
neurom/view/common.py
plot_ticks
def plot_ticks(ax, tick_fontsize=12, xticks=None, xticks_args=None, yticks=None, yticks_args=None, zticks=None, zticks_args=None): """Function that defines the labels options of a matplotlib plot. Args: ax: matplotlib axes tick_fontsize (int): Define...
python
def plot_ticks(ax, tick_fontsize=12, xticks=None, xticks_args=None, yticks=None, yticks_args=None, zticks=None, zticks_args=None): """Function that defines the labels options of a matplotlib plot. Args: ax: matplotlib axes tick_fontsize (int): Define...
[ "def", "plot_ticks", "(", "ax", ",", "tick_fontsize", "=", "12", ",", "xticks", "=", "None", ",", "xticks_args", "=", "None", ",", "yticks", "=", "None", ",", "yticks_args", "=", "None", ",", "zticks", "=", "None", ",", "zticks_args", "=", "None", ")",...
Function that defines the labels options of a matplotlib plot. Args: ax: matplotlib axes tick_fontsize (int): Defines the size of the ticks' font xticks([list of ticks]): Defines the values of x ticks in the figure xticks_arg(dict): Passsed into matplotlib as xticks arguments ...
[ "Function", "that", "defines", "the", "labels", "options", "of", "a", "matplotlib", "plot", "." ]
254bb73535b20053d175bc4725bade662177d12b
https://github.com/BlueBrain/NeuroM/blob/254bb73535b20053d175bc4725bade662177d12b/neurom/view/common.py#L280-L309
train
BlueBrain/NeuroM
neurom/view/common.py
update_plot_limits
def update_plot_limits(ax, white_space): """Sets the limit options of a matplotlib plot. Args: ax: matplotlib axes white_space(float): whitespace added to surround the tight limit of the data Note: This relies on ax.dataLim (in 2d) and ax.[xy, zz]_dataLim being set in 3d """ if ha...
python
def update_plot_limits(ax, white_space): """Sets the limit options of a matplotlib plot. Args: ax: matplotlib axes white_space(float): whitespace added to surround the tight limit of the data Note: This relies on ax.dataLim (in 2d) and ax.[xy, zz]_dataLim being set in 3d """ if ha...
[ "def", "update_plot_limits", "(", "ax", ",", "white_space", ")", ":", "if", "hasattr", "(", "ax", ",", "'zz_dataLim'", ")", ":", "bounds", "=", "ax", ".", "xy_dataLim", ".", "bounds", "ax", ".", "set_xlim", "(", "bounds", "[", "0", "]", "-", "white_spa...
Sets the limit options of a matplotlib plot. Args: ax: matplotlib axes white_space(float): whitespace added to surround the tight limit of the data Note: This relies on ax.dataLim (in 2d) and ax.[xy, zz]_dataLim being set in 3d
[ "Sets", "the", "limit", "options", "of", "a", "matplotlib", "plot", "." ]
254bb73535b20053d175bc4725bade662177d12b
https://github.com/BlueBrain/NeuroM/blob/254bb73535b20053d175bc4725bade662177d12b/neurom/view/common.py#L312-L333
train
BlueBrain/NeuroM
neurom/view/common.py
plot_legend
def plot_legend(ax, no_legend=True, legend_arg=None): """ Function that defines the legend options of a matplotlib plot. Args: ax: matplotlib axes no_legend (bool): Defines the presence of a legend in the figure legend_arg (dict): Addition arguments for matplotlib.legend() call ...
python
def plot_legend(ax, no_legend=True, legend_arg=None): """ Function that defines the legend options of a matplotlib plot. Args: ax: matplotlib axes no_legend (bool): Defines the presence of a legend in the figure legend_arg (dict): Addition arguments for matplotlib.legend() call ...
[ "def", "plot_legend", "(", "ax", ",", "no_legend", "=", "True", ",", "legend_arg", "=", "None", ")", ":", "legend_arg", "=", "dict_if_none", "(", "legend_arg", ")", "if", "not", "no_legend", ":", "ax", ".", "legend", "(", "**", "legend_arg", ")" ]
Function that defines the legend options of a matplotlib plot. Args: ax: matplotlib axes no_legend (bool): Defines the presence of a legend in the figure legend_arg (dict): Addition arguments for matplotlib.legend() call
[ "Function", "that", "defines", "the", "legend", "options", "of", "a", "matplotlib", "plot", "." ]
254bb73535b20053d175bc4725bade662177d12b
https://github.com/BlueBrain/NeuroM/blob/254bb73535b20053d175bc4725bade662177d12b/neurom/view/common.py#L336-L349
train
BlueBrain/NeuroM
neurom/view/common.py
generate_cylindrical_points
def generate_cylindrical_points(start, end, start_radius, end_radius, linspace_count=_LINSPACE_COUNT): '''Generate a 3d mesh of a cylinder with start and end points, and varying radius Based on: http://stackoverflow.com/a/32383775 ''' v = end - start length = norm(v)...
python
def generate_cylindrical_points(start, end, start_radius, end_radius, linspace_count=_LINSPACE_COUNT): '''Generate a 3d mesh of a cylinder with start and end points, and varying radius Based on: http://stackoverflow.com/a/32383775 ''' v = end - start length = norm(v)...
[ "def", "generate_cylindrical_points", "(", "start", ",", "end", ",", "start_radius", ",", "end_radius", ",", "linspace_count", "=", "_LINSPACE_COUNT", ")", ":", "v", "=", "end", "-", "start", "length", "=", "norm", "(", "v", ")", "v", "=", "v", "/", "len...
Generate a 3d mesh of a cylinder with start and end points, and varying radius Based on: http://stackoverflow.com/a/32383775
[ "Generate", "a", "3d", "mesh", "of", "a", "cylinder", "with", "start", "and", "end", "points", "and", "varying", "radius" ]
254bb73535b20053d175bc4725bade662177d12b
https://github.com/BlueBrain/NeuroM/blob/254bb73535b20053d175bc4725bade662177d12b/neurom/view/common.py#L369-L391
train
BlueBrain/NeuroM
neurom/view/common.py
plot_cylinder
def plot_cylinder(ax, start, end, start_radius, end_radius, color='black', alpha=1., linspace_count=_LINSPACE_COUNT): '''plot a 3d cylinder''' assert not np.all(start == end), 'Cylinder must have length' x, y, z = generate_cylindrical_points(start, end, start_radius, end_radius, ...
python
def plot_cylinder(ax, start, end, start_radius, end_radius, color='black', alpha=1., linspace_count=_LINSPACE_COUNT): '''plot a 3d cylinder''' assert not np.all(start == end), 'Cylinder must have length' x, y, z = generate_cylindrical_points(start, end, start_radius, end_radius, ...
[ "def", "plot_cylinder", "(", "ax", ",", "start", ",", "end", ",", "start_radius", ",", "end_radius", ",", "color", "=", "'black'", ",", "alpha", "=", "1.", ",", "linspace_count", "=", "_LINSPACE_COUNT", ")", ":", "assert", "not", "np", ".", "all", "(", ...
plot a 3d cylinder
[ "plot", "a", "3d", "cylinder" ]
254bb73535b20053d175bc4725bade662177d12b
https://github.com/BlueBrain/NeuroM/blob/254bb73535b20053d175bc4725bade662177d12b/neurom/view/common.py#L421-L427
train
BlueBrain/NeuroM
neurom/view/common.py
plot_sphere
def plot_sphere(ax, center, radius, color='black', alpha=1., linspace_count=_LINSPACE_COUNT): """ Plots a 3d sphere, given the center and the radius. """ u = np.linspace(0, 2 * np.pi, linspace_count) v = np.linspace(0, np.pi, linspace_count) sin_v = np.sin(v) x = center[0] + radius * np.outer(np.c...
python
def plot_sphere(ax, center, radius, color='black', alpha=1., linspace_count=_LINSPACE_COUNT): """ Plots a 3d sphere, given the center and the radius. """ u = np.linspace(0, 2 * np.pi, linspace_count) v = np.linspace(0, np.pi, linspace_count) sin_v = np.sin(v) x = center[0] + radius * np.outer(np.c...
[ "def", "plot_sphere", "(", "ax", ",", "center", ",", "radius", ",", "color", "=", "'black'", ",", "alpha", "=", "1.", ",", "linspace_count", "=", "_LINSPACE_COUNT", ")", ":", "u", "=", "np", ".", "linspace", "(", "0", ",", "2", "*", "np", ".", "pi"...
Plots a 3d sphere, given the center and the radius.
[ "Plots", "a", "3d", "sphere", "given", "the", "center", "and", "the", "radius", "." ]
254bb73535b20053d175bc4725bade662177d12b
https://github.com/BlueBrain/NeuroM/blob/254bb73535b20053d175bc4725bade662177d12b/neurom/view/common.py#L430-L440
train
BlueBrain/NeuroM
neurom/check/structural_checks.py
has_sequential_ids
def has_sequential_ids(data_wrapper): '''Check that IDs are increasing and consecutive returns tuple (bool, list of IDs that are not consecutive with their predecessor) ''' db = data_wrapper.data_block ids = db[:, COLS.ID] steps = ids[np.where(np.diff(ids) != 1)[0] + 1].astype(int) retu...
python
def has_sequential_ids(data_wrapper): '''Check that IDs are increasing and consecutive returns tuple (bool, list of IDs that are not consecutive with their predecessor) ''' db = data_wrapper.data_block ids = db[:, COLS.ID] steps = ids[np.where(np.diff(ids) != 1)[0] + 1].astype(int) retu...
[ "def", "has_sequential_ids", "(", "data_wrapper", ")", ":", "db", "=", "data_wrapper", ".", "data_block", "ids", "=", "db", "[", ":", ",", "COLS", ".", "ID", "]", "steps", "=", "ids", "[", "np", ".", "where", "(", "np", ".", "diff", "(", "ids", ")"...
Check that IDs are increasing and consecutive returns tuple (bool, list of IDs that are not consecutive with their predecessor)
[ "Check", "that", "IDs", "are", "increasing", "and", "consecutive" ]
254bb73535b20053d175bc4725bade662177d12b
https://github.com/BlueBrain/NeuroM/blob/254bb73535b20053d175bc4725bade662177d12b/neurom/check/structural_checks.py#L39-L48
train
BlueBrain/NeuroM
neurom/check/structural_checks.py
no_missing_parents
def no_missing_parents(data_wrapper): '''Check that all points have existing parents Point's parent ID must exist and parent must be declared before child. Returns: CheckResult with result and list of IDs that have no parent ''' db = data_wrapper.data_block ids = np.setdiff1d(db[:, ...
python
def no_missing_parents(data_wrapper): '''Check that all points have existing parents Point's parent ID must exist and parent must be declared before child. Returns: CheckResult with result and list of IDs that have no parent ''' db = data_wrapper.data_block ids = np.setdiff1d(db[:, ...
[ "def", "no_missing_parents", "(", "data_wrapper", ")", ":", "db", "=", "data_wrapper", ".", "data_block", "ids", "=", "np", ".", "setdiff1d", "(", "db", "[", ":", ",", "COLS", ".", "P", "]", ",", "db", "[", ":", ",", "COLS", ".", "ID", "]", ")", ...
Check that all points have existing parents Point's parent ID must exist and parent must be declared before child. Returns: CheckResult with result and list of IDs that have no parent
[ "Check", "that", "all", "points", "have", "existing", "parents", "Point", "s", "parent", "ID", "must", "exist", "and", "parent", "must", "be", "declared", "before", "child", "." ]
254bb73535b20053d175bc4725bade662177d12b
https://github.com/BlueBrain/NeuroM/blob/254bb73535b20053d175bc4725bade662177d12b/neurom/check/structural_checks.py#L51-L61
train
BlueBrain/NeuroM
neurom/check/structural_checks.py
is_single_tree
def is_single_tree(data_wrapper): '''Check that data forms a single tree Only the first point has ID of -1. Returns: CheckResult with result and list of IDs Note: This assumes no_missing_parents passed. ''' db = data_wrapper.data_block bad_ids = db[db[:, COLS.P] == -1][1:,...
python
def is_single_tree(data_wrapper): '''Check that data forms a single tree Only the first point has ID of -1. Returns: CheckResult with result and list of IDs Note: This assumes no_missing_parents passed. ''' db = data_wrapper.data_block bad_ids = db[db[:, COLS.P] == -1][1:,...
[ "def", "is_single_tree", "(", "data_wrapper", ")", ":", "db", "=", "data_wrapper", ".", "data_block", "bad_ids", "=", "db", "[", "db", "[", ":", ",", "COLS", ".", "P", "]", "==", "-", "1", "]", "[", "1", ":", ",", "COLS", ".", "ID", "]", "return"...
Check that data forms a single tree Only the first point has ID of -1. Returns: CheckResult with result and list of IDs Note: This assumes no_missing_parents passed.
[ "Check", "that", "data", "forms", "a", "single", "tree" ]
254bb73535b20053d175bc4725bade662177d12b
https://github.com/BlueBrain/NeuroM/blob/254bb73535b20053d175bc4725bade662177d12b/neurom/check/structural_checks.py#L64-L77
train
BlueBrain/NeuroM
neurom/check/structural_checks.py
has_soma_points
def has_soma_points(data_wrapper): '''Checks if the TYPE column of raw data block has an element of type soma Returns: CheckResult with result ''' db = data_wrapper.data_block return CheckResult(POINT_TYPE.SOMA in db[:, COLS.TYPE], None)
python
def has_soma_points(data_wrapper): '''Checks if the TYPE column of raw data block has an element of type soma Returns: CheckResult with result ''' db = data_wrapper.data_block return CheckResult(POINT_TYPE.SOMA in db[:, COLS.TYPE], None)
[ "def", "has_soma_points", "(", "data_wrapper", ")", ":", "db", "=", "data_wrapper", ".", "data_block", "return", "CheckResult", "(", "POINT_TYPE", ".", "SOMA", "in", "db", "[", ":", ",", "COLS", ".", "TYPE", "]", ",", "None", ")" ]
Checks if the TYPE column of raw data block has an element of type soma Returns: CheckResult with result
[ "Checks", "if", "the", "TYPE", "column", "of", "raw", "data", "block", "has", "an", "element", "of", "type", "soma" ]
254bb73535b20053d175bc4725bade662177d12b
https://github.com/BlueBrain/NeuroM/blob/254bb73535b20053d175bc4725bade662177d12b/neurom/check/structural_checks.py#L93-L100
train
BlueBrain/NeuroM
neurom/check/structural_checks.py
has_all_finite_radius_neurites
def has_all_finite_radius_neurites(data_wrapper, threshold=0.0): '''Check that all points with neurite type have a finite radius Returns: CheckResult with result and list of IDs of neurite points with zero radius ''' db = data_wrapper.data_block neurite_ids = np.in1d(db[:, COLS.TYPE], POINT...
python
def has_all_finite_radius_neurites(data_wrapper, threshold=0.0): '''Check that all points with neurite type have a finite radius Returns: CheckResult with result and list of IDs of neurite points with zero radius ''' db = data_wrapper.data_block neurite_ids = np.in1d(db[:, COLS.TYPE], POINT...
[ "def", "has_all_finite_radius_neurites", "(", "data_wrapper", ",", "threshold", "=", "0.0", ")", ":", "db", "=", "data_wrapper", ".", "data_block", "neurite_ids", "=", "np", ".", "in1d", "(", "db", "[", ":", ",", "COLS", ".", "TYPE", "]", ",", "POINT_TYPE"...
Check that all points with neurite type have a finite radius Returns: CheckResult with result and list of IDs of neurite points with zero radius
[ "Check", "that", "all", "points", "with", "neurite", "type", "have", "a", "finite", "radius" ]
254bb73535b20053d175bc4725bade662177d12b
https://github.com/BlueBrain/NeuroM/blob/254bb73535b20053d175bc4725bade662177d12b/neurom/check/structural_checks.py#L103-L114
train
BlueBrain/NeuroM
neurom/check/structural_checks.py
has_valid_soma
def has_valid_soma(data_wrapper): '''Check if a data block has a valid soma Returns: CheckResult with result ''' try: make_soma(data_wrapper.soma_points()) return CheckResult(True) except SomaError: return CheckResult(False)
python
def has_valid_soma(data_wrapper): '''Check if a data block has a valid soma Returns: CheckResult with result ''' try: make_soma(data_wrapper.soma_points()) return CheckResult(True) except SomaError: return CheckResult(False)
[ "def", "has_valid_soma", "(", "data_wrapper", ")", ":", "try", ":", "make_soma", "(", "data_wrapper", ".", "soma_points", "(", ")", ")", "return", "CheckResult", "(", "True", ")", "except", "SomaError", ":", "return", "CheckResult", "(", "False", ")" ]
Check if a data block has a valid soma Returns: CheckResult with result
[ "Check", "if", "a", "data", "block", "has", "a", "valid", "soma" ]
254bb73535b20053d175bc4725bade662177d12b
https://github.com/BlueBrain/NeuroM/blob/254bb73535b20053d175bc4725bade662177d12b/neurom/check/structural_checks.py#L117-L127
train
BlueBrain/NeuroM
doc/source/conf.py
_pelita_member_filter
def _pelita_member_filter(parent_name, item_names): """ Filter a list of autodoc items for which to generate documentation. Include only imports that come from the documented module or its submodules. """ filtered_names = [] if parent_name not in sys.modules: return item_names ...
python
def _pelita_member_filter(parent_name, item_names): """ Filter a list of autodoc items for which to generate documentation. Include only imports that come from the documented module or its submodules. """ filtered_names = [] if parent_name not in sys.modules: return item_names ...
[ "def", "_pelita_member_filter", "(", "parent_name", ",", "item_names", ")", ":", "filtered_names", "=", "[", "]", "if", "parent_name", "not", "in", "sys", ".", "modules", ":", "return", "item_names", "module", "=", "sys", ".", "modules", "[", "parent_name", ...
Filter a list of autodoc items for which to generate documentation. Include only imports that come from the documented module or its submodules.
[ "Filter", "a", "list", "of", "autodoc", "items", "for", "which", "to", "generate", "documentation", "." ]
254bb73535b20053d175bc4725bade662177d12b
https://github.com/BlueBrain/NeuroM/blob/254bb73535b20053d175bc4725bade662177d12b/doc/source/conf.py#L158-L179
train
BlueBrain/NeuroM
neurom/check/neuron_checks.py
has_axon
def has_axon(neuron, treefun=_read_neurite_type): '''Check if a neuron has an axon Arguments: neuron(Neuron): The neuron object to test treefun: Optional function to calculate the tree type of neuron's neurites Returns: CheckResult with result ''' return CheckResult...
python
def has_axon(neuron, treefun=_read_neurite_type): '''Check if a neuron has an axon Arguments: neuron(Neuron): The neuron object to test treefun: Optional function to calculate the tree type of neuron's neurites Returns: CheckResult with result ''' return CheckResult...
[ "def", "has_axon", "(", "neuron", ",", "treefun", "=", "_read_neurite_type", ")", ":", "return", "CheckResult", "(", "NeuriteType", ".", "axon", "in", "(", "treefun", "(", "n", ")", "for", "n", "in", "neuron", ".", "neurites", ")", ")" ]
Check if a neuron has an axon Arguments: neuron(Neuron): The neuron object to test treefun: Optional function to calculate the tree type of neuron's neurites Returns: CheckResult with result
[ "Check", "if", "a", "neuron", "has", "an", "axon" ]
254bb73535b20053d175bc4725bade662177d12b
https://github.com/BlueBrain/NeuroM/blob/254bb73535b20053d175bc4725bade662177d12b/neurom/check/neuron_checks.py#L54-L65
train
BlueBrain/NeuroM
neurom/check/neuron_checks.py
has_apical_dendrite
def has_apical_dendrite(neuron, min_number=1, treefun=_read_neurite_type): '''Check if a neuron has apical dendrites Arguments: neuron(Neuron): The neuron object to test min_number: minimum number of apical dendrites required treefun: Optional function to calculate the tree type of neur...
python
def has_apical_dendrite(neuron, min_number=1, treefun=_read_neurite_type): '''Check if a neuron has apical dendrites Arguments: neuron(Neuron): The neuron object to test min_number: minimum number of apical dendrites required treefun: Optional function to calculate the tree type of neur...
[ "def", "has_apical_dendrite", "(", "neuron", ",", "min_number", "=", "1", ",", "treefun", "=", "_read_neurite_type", ")", ":", "types", "=", "[", "treefun", "(", "n", ")", "for", "n", "in", "neuron", ".", "neurites", "]", "return", "CheckResult", "(", "t...
Check if a neuron has apical dendrites Arguments: neuron(Neuron): The neuron object to test min_number: minimum number of apical dendrites required treefun: Optional function to calculate the tree type of neuron's neurites Returns: CheckResult with result
[ "Check", "if", "a", "neuron", "has", "apical", "dendrites" ]
254bb73535b20053d175bc4725bade662177d12b
https://github.com/BlueBrain/NeuroM/blob/254bb73535b20053d175bc4725bade662177d12b/neurom/check/neuron_checks.py#L68-L81
train
BlueBrain/NeuroM
neurom/check/neuron_checks.py
has_basal_dendrite
def has_basal_dendrite(neuron, min_number=1, treefun=_read_neurite_type): '''Check if a neuron has basal dendrites Arguments: neuron(Neuron): The neuron object to test min_number: minimum number of basal dendrites required treefun: Optional function to calculate the tree type of neuron'...
python
def has_basal_dendrite(neuron, min_number=1, treefun=_read_neurite_type): '''Check if a neuron has basal dendrites Arguments: neuron(Neuron): The neuron object to test min_number: minimum number of basal dendrites required treefun: Optional function to calculate the tree type of neuron'...
[ "def", "has_basal_dendrite", "(", "neuron", ",", "min_number", "=", "1", ",", "treefun", "=", "_read_neurite_type", ")", ":", "types", "=", "[", "treefun", "(", "n", ")", "for", "n", "in", "neuron", ".", "neurites", "]", "return", "CheckResult", "(", "ty...
Check if a neuron has basal dendrites Arguments: neuron(Neuron): The neuron object to test min_number: minimum number of basal dendrites required treefun: Optional function to calculate the tree type of neuron's neurites Returns: CheckResult with result
[ "Check", "if", "a", "neuron", "has", "basal", "dendrites" ]
254bb73535b20053d175bc4725bade662177d12b
https://github.com/BlueBrain/NeuroM/blob/254bb73535b20053d175bc4725bade662177d12b/neurom/check/neuron_checks.py#L84-L97
train
BlueBrain/NeuroM
neurom/check/neuron_checks.py
has_no_flat_neurites
def has_no_flat_neurites(neuron, tol=0.1, method='ratio'): '''Check that a neuron has no flat neurites Arguments: neuron(Neuron): The neuron object to test tol(float): tolerance method(string): way of determining flatness, 'tolerance', 'ratio' \ as described in :meth:`neurom.che...
python
def has_no_flat_neurites(neuron, tol=0.1, method='ratio'): '''Check that a neuron has no flat neurites Arguments: neuron(Neuron): The neuron object to test tol(float): tolerance method(string): way of determining flatness, 'tolerance', 'ratio' \ as described in :meth:`neurom.che...
[ "def", "has_no_flat_neurites", "(", "neuron", ",", "tol", "=", "0.1", ",", "method", "=", "'ratio'", ")", ":", "return", "CheckResult", "(", "len", "(", "get_flat_neurites", "(", "neuron", ",", "tol", ",", "method", ")", ")", "==", "0", ")" ]
Check that a neuron has no flat neurites Arguments: neuron(Neuron): The neuron object to test tol(float): tolerance method(string): way of determining flatness, 'tolerance', 'ratio' \ as described in :meth:`neurom.check.morphtree.get_flat_neurites` Returns: CheckResult ...
[ "Check", "that", "a", "neuron", "has", "no", "flat", "neurites" ]
254bb73535b20053d175bc4725bade662177d12b
https://github.com/BlueBrain/NeuroM/blob/254bb73535b20053d175bc4725bade662177d12b/neurom/check/neuron_checks.py#L100-L112
train
BlueBrain/NeuroM
neurom/check/neuron_checks.py
has_all_nonzero_segment_lengths
def has_all_nonzero_segment_lengths(neuron, threshold=0.0): '''Check presence of neuron segments with length not above threshold Arguments: neuron(Neuron): The neuron object to test threshold(float): value above which a segment length is considered to be non-zero Returns: C...
python
def has_all_nonzero_segment_lengths(neuron, threshold=0.0): '''Check presence of neuron segments with length not above threshold Arguments: neuron(Neuron): The neuron object to test threshold(float): value above which a segment length is considered to be non-zero Returns: C...
[ "def", "has_all_nonzero_segment_lengths", "(", "neuron", ",", "threshold", "=", "0.0", ")", ":", "bad_ids", "=", "[", "]", "for", "sec", "in", "_nf", ".", "iter_sections", "(", "neuron", ")", ":", "p", "=", "sec", ".", "points", "for", "i", ",", "s", ...
Check presence of neuron segments with length not above threshold Arguments: neuron(Neuron): The neuron object to test threshold(float): value above which a segment length is considered to be non-zero Returns: CheckResult with result including list of (section_id, segment_id) ...
[ "Check", "presence", "of", "neuron", "segments", "with", "length", "not", "above", "threshold" ]
254bb73535b20053d175bc4725bade662177d12b
https://github.com/BlueBrain/NeuroM/blob/254bb73535b20053d175bc4725bade662177d12b/neurom/check/neuron_checks.py#L128-L147
train
BlueBrain/NeuroM
neurom/check/neuron_checks.py
has_all_nonzero_section_lengths
def has_all_nonzero_section_lengths(neuron, threshold=0.0): '''Check presence of neuron sections with length not above threshold Arguments: neuron(Neuron): The neuron object to test threshold(float): value above which a section length is considered to be non-zero Returns: C...
python
def has_all_nonzero_section_lengths(neuron, threshold=0.0): '''Check presence of neuron sections with length not above threshold Arguments: neuron(Neuron): The neuron object to test threshold(float): value above which a section length is considered to be non-zero Returns: C...
[ "def", "has_all_nonzero_section_lengths", "(", "neuron", ",", "threshold", "=", "0.0", ")", ":", "bad_ids", "=", "[", "s", ".", "id", "for", "s", "in", "_nf", ".", "iter_sections", "(", "neuron", ".", "neurites", ")", "if", "section_length", "(", "s", "....
Check presence of neuron sections with length not above threshold Arguments: neuron(Neuron): The neuron object to test threshold(float): value above which a section length is considered to be non-zero Returns: CheckResult with result including list of ids of bad sections
[ "Check", "presence", "of", "neuron", "sections", "with", "length", "not", "above", "threshold" ]
254bb73535b20053d175bc4725bade662177d12b
https://github.com/BlueBrain/NeuroM/blob/254bb73535b20053d175bc4725bade662177d12b/neurom/check/neuron_checks.py#L150-L164
train
BlueBrain/NeuroM
neurom/check/neuron_checks.py
has_all_nonzero_neurite_radii
def has_all_nonzero_neurite_radii(neuron, threshold=0.0): '''Check presence of neurite points with radius not above threshold Arguments: neuron(Neuron): The neuron object to test threshold: value above which a radius is considered to be non-zero Returns: CheckResult with result inc...
python
def has_all_nonzero_neurite_radii(neuron, threshold=0.0): '''Check presence of neurite points with radius not above threshold Arguments: neuron(Neuron): The neuron object to test threshold: value above which a radius is considered to be non-zero Returns: CheckResult with result inc...
[ "def", "has_all_nonzero_neurite_radii", "(", "neuron", ",", "threshold", "=", "0.0", ")", ":", "bad_ids", "=", "[", "]", "seen_ids", "=", "set", "(", ")", "for", "s", "in", "_nf", ".", "iter_sections", "(", "neuron", ")", ":", "for", "i", ",", "p", "...
Check presence of neurite points with radius not above threshold Arguments: neuron(Neuron): The neuron object to test threshold: value above which a radius is considered to be non-zero Returns: CheckResult with result including list of (section ID, point ID) pairs of zero-radiu...
[ "Check", "presence", "of", "neurite", "points", "with", "radius", "not", "above", "threshold" ]
254bb73535b20053d175bc4725bade662177d12b
https://github.com/BlueBrain/NeuroM/blob/254bb73535b20053d175bc4725bade662177d12b/neurom/check/neuron_checks.py#L167-L187
train
BlueBrain/NeuroM
neurom/check/neuron_checks.py
has_no_fat_ends
def has_no_fat_ends(neuron, multiple_of_mean=2.0, final_point_count=5): '''Check if leaf points are too large Arguments: neuron(Neuron): The neuron object to test multiple_of_mean(float): how many times larger the final radius has to be compared to the mean of the final points f...
python
def has_no_fat_ends(neuron, multiple_of_mean=2.0, final_point_count=5): '''Check if leaf points are too large Arguments: neuron(Neuron): The neuron object to test multiple_of_mean(float): how many times larger the final radius has to be compared to the mean of the final points f...
[ "def", "has_no_fat_ends", "(", "neuron", ",", "multiple_of_mean", "=", "2.0", ",", "final_point_count", "=", "5", ")", ":", "bad_ids", "=", "[", "]", "for", "leaf", "in", "_nf", ".", "iter_sections", "(", "neuron", ".", "neurites", ",", "iterator_type", "=...
Check if leaf points are too large Arguments: neuron(Neuron): The neuron object to test multiple_of_mean(float): how many times larger the final radius has to be compared to the mean of the final points final_point_count(int): how many points to include in the mean Returns: ...
[ "Check", "if", "leaf", "points", "are", "too", "large" ]
254bb73535b20053d175bc4725bade662177d12b
https://github.com/BlueBrain/NeuroM/blob/254bb73535b20053d175bc4725bade662177d12b/neurom/check/neuron_checks.py#L226-L250
train
BlueBrain/NeuroM
neurom/check/neuron_checks.py
has_no_narrow_start
def has_no_narrow_start(neuron, frac=0.9): '''Check if neurites have a narrow start Arguments: neuron(Neuron): The neuron object to test frac(float): Ratio that the second point must be smaller than the first Returns: CheckResult with a list of all first segments of neurites with a...
python
def has_no_narrow_start(neuron, frac=0.9): '''Check if neurites have a narrow start Arguments: neuron(Neuron): The neuron object to test frac(float): Ratio that the second point must be smaller than the first Returns: CheckResult with a list of all first segments of neurites with a...
[ "def", "has_no_narrow_start", "(", "neuron", ",", "frac", "=", "0.9", ")", ":", "bad_ids", "=", "[", "(", "neurite", ".", "root_node", ".", "id", ",", "[", "neurite", ".", "root_node", ".", "points", "[", "1", "]", "]", ")", "for", "neurite", "in", ...
Check if neurites have a narrow start Arguments: neuron(Neuron): The neuron object to test frac(float): Ratio that the second point must be smaller than the first Returns: CheckResult with a list of all first segments of neurites with a narrow start
[ "Check", "if", "neurites", "have", "a", "narrow", "start" ]
254bb73535b20053d175bc4725bade662177d12b
https://github.com/BlueBrain/NeuroM/blob/254bb73535b20053d175bc4725bade662177d12b/neurom/check/neuron_checks.py#L253-L266
train
BlueBrain/NeuroM
neurom/check/neuron_checks.py
has_no_dangling_branch
def has_no_dangling_branch(neuron): '''Check if the neuron has dangling neurites''' soma_center = neuron.soma.points[:, COLS.XYZ].mean(axis=0) recentered_soma = neuron.soma.points[:, COLS.XYZ] - soma_center radius = np.linalg.norm(recentered_soma, axis=1) soma_max_radius = radius.max() def is_d...
python
def has_no_dangling_branch(neuron): '''Check if the neuron has dangling neurites''' soma_center = neuron.soma.points[:, COLS.XYZ].mean(axis=0) recentered_soma = neuron.soma.points[:, COLS.XYZ] - soma_center radius = np.linalg.norm(recentered_soma, axis=1) soma_max_radius = radius.max() def is_d...
[ "def", "has_no_dangling_branch", "(", "neuron", ")", ":", "soma_center", "=", "neuron", ".", "soma", ".", "points", "[", ":", ",", "COLS", ".", "XYZ", "]", ".", "mean", "(", "axis", "=", "0", ")", "recentered_soma", "=", "neuron", ".", "soma", ".", "...
Check if the neuron has dangling neurites
[ "Check", "if", "the", "neuron", "has", "dangling", "neurites" ]
254bb73535b20053d175bc4725bade662177d12b
https://github.com/BlueBrain/NeuroM/blob/254bb73535b20053d175bc4725bade662177d12b/neurom/check/neuron_checks.py#L269-L295
train
BlueBrain/NeuroM
neurom/check/neuron_checks.py
has_no_narrow_neurite_section
def has_no_narrow_neurite_section(neuron, neurite_filter, radius_threshold=0.05, considered_section_min_length=50): '''Check if the neuron has dendrites with narrow sections Arguments: neuron(Neuron): ...
python
def has_no_narrow_neurite_section(neuron, neurite_filter, radius_threshold=0.05, considered_section_min_length=50): '''Check if the neuron has dendrites with narrow sections Arguments: neuron(Neuron): ...
[ "def", "has_no_narrow_neurite_section", "(", "neuron", ",", "neurite_filter", ",", "radius_threshold", "=", "0.05", ",", "considered_section_min_length", "=", "50", ")", ":", "considered_sections", "=", "(", "sec", "for", "sec", "in", "iter_sections", "(", "neuron",...
Check if the neuron has dendrites with narrow sections Arguments: neuron(Neuron): The neuron object to test neurite_filter(callable): filter the neurites by this callable radius_threshold(float): radii below this are considered narro considered_section_min_length(float): sections wi...
[ "Check", "if", "the", "neuron", "has", "dendrites", "with", "narrow", "sections" ]
254bb73535b20053d175bc4725bade662177d12b
https://github.com/BlueBrain/NeuroM/blob/254bb73535b20053d175bc4725bade662177d12b/neurom/check/neuron_checks.py#L298-L325
train
BlueBrain/NeuroM
examples/synthesis_json.py
transform_header
def transform_header(mtype_name): '''Add header to json output to wrap around distribution data. ''' head_dict = OrderedDict() head_dict["m-type"] = mtype_name head_dict["components"] = defaultdict(OrderedDict) return head_dict
python
def transform_header(mtype_name): '''Add header to json output to wrap around distribution data. ''' head_dict = OrderedDict() head_dict["m-type"] = mtype_name head_dict["components"] = defaultdict(OrderedDict) return head_dict
[ "def", "transform_header", "(", "mtype_name", ")", ":", "head_dict", "=", "OrderedDict", "(", ")", "head_dict", "[", "\"m-type\"", "]", "=", "mtype_name", "head_dict", "[", "\"components\"", "]", "=", "defaultdict", "(", "OrderedDict", ")", "return", "head_dict"...
Add header to json output to wrap around distribution data.
[ "Add", "header", "to", "json", "output", "to", "wrap", "around", "distribution", "data", "." ]
254bb73535b20053d175bc4725bade662177d12b
https://github.com/BlueBrain/NeuroM/blob/254bb73535b20053d175bc4725bade662177d12b/examples/synthesis_json.py#L92-L100
train
BlueBrain/NeuroM
neurom/view/plotly.py
draw
def draw(obj, plane='3d', inline=False, **kwargs): '''Draw the morphology using in the given plane plane (str): a string representing the 2D plane (example: 'xy') or '3d', '3D' for a 3D view inline (bool): must be set to True for interactive ipython notebook plotting ''' if plane....
python
def draw(obj, plane='3d', inline=False, **kwargs): '''Draw the morphology using in the given plane plane (str): a string representing the 2D plane (example: 'xy') or '3d', '3D' for a 3D view inline (bool): must be set to True for interactive ipython notebook plotting ''' if plane....
[ "def", "draw", "(", "obj", ",", "plane", "=", "'3d'", ",", "inline", "=", "False", ",", "**", "kwargs", ")", ":", "if", "plane", ".", "lower", "(", ")", "==", "'3d'", ":", "return", "_plot_neuron3d", "(", "obj", ",", "inline", ",", "**", "kwargs", ...
Draw the morphology using in the given plane plane (str): a string representing the 2D plane (example: 'xy') or '3d', '3D' for a 3D view inline (bool): must be set to True for interactive ipython notebook plotting
[ "Draw", "the", "morphology", "using", "in", "the", "given", "plane" ]
254bb73535b20053d175bc4725bade662177d12b
https://github.com/BlueBrain/NeuroM/blob/254bb73535b20053d175bc4725bade662177d12b/neurom/view/plotly.py#L21-L31
train
BlueBrain/NeuroM
neurom/view/plotly.py
_make_trace
def _make_trace(neuron, plane): '''Create the trace to be plotted''' for neurite in iter_neurites(neuron): segments = list(iter_segments(neurite)) segs = [(s[0][COLS.XYZ], s[1][COLS.XYZ]) for s in segments] coords = dict(x=list(chain.from_iterable((p1[0], p2[0], None) for p1, p2 in seg...
python
def _make_trace(neuron, plane): '''Create the trace to be plotted''' for neurite in iter_neurites(neuron): segments = list(iter_segments(neurite)) segs = [(s[0][COLS.XYZ], s[1][COLS.XYZ]) for s in segments] coords = dict(x=list(chain.from_iterable((p1[0], p2[0], None) for p1, p2 in seg...
[ "def", "_make_trace", "(", "neuron", ",", "plane", ")", ":", "for", "neurite", "in", "iter_neurites", "(", "neuron", ")", ":", "segments", "=", "list", "(", "iter_segments", "(", "neurite", ")", ")", "segs", "=", "[", "(", "s", "[", "0", "]", "[", ...
Create the trace to be plotted
[ "Create", "the", "trace", "to", "be", "plotted" ]
254bb73535b20053d175bc4725bade662177d12b
https://github.com/BlueBrain/NeuroM/blob/254bb73535b20053d175bc4725bade662177d12b/neurom/view/plotly.py#L46-L67
train
BlueBrain/NeuroM
neurom/view/plotly.py
get_figure
def get_figure(neuron, plane, title): '''Returns the plotly figure containing the neuron''' data = list(_make_trace(neuron, plane)) axis = dict( gridcolor='rgb(255, 255, 255)', zerolinecolor='rgb(255, 255, 255)', showbackground=True, backgroundcolor='rgb(230, 230,230)' ) ...
python
def get_figure(neuron, plane, title): '''Returns the plotly figure containing the neuron''' data = list(_make_trace(neuron, plane)) axis = dict( gridcolor='rgb(255, 255, 255)', zerolinecolor='rgb(255, 255, 255)', showbackground=True, backgroundcolor='rgb(230, 230,230)' ) ...
[ "def", "get_figure", "(", "neuron", ",", "plane", ",", "title", ")", ":", "data", "=", "list", "(", "_make_trace", "(", "neuron", ",", "plane", ")", ")", "axis", "=", "dict", "(", "gridcolor", "=", "'rgb(255, 255, 255)'", ",", "zerolinecolor", "=", "'rgb...
Returns the plotly figure containing the neuron
[ "Returns", "the", "plotly", "figure", "containing", "the", "neuron" ]
254bb73535b20053d175bc4725bade662177d12b
https://github.com/BlueBrain/NeuroM/blob/254bb73535b20053d175bc4725bade662177d12b/neurom/view/plotly.py#L70-L129
train
BlueBrain/NeuroM
neurom/geom/transform.py
rotate
def rotate(obj, axis, angle, origin=None): ''' Rotation around unit vector following the right hand rule Parameters: obj : obj to be rotated (e.g. neurite, neuron). Must implement a transform method. axis : unit vector for the axis of rotation angle : rotation angle in r...
python
def rotate(obj, axis, angle, origin=None): ''' Rotation around unit vector following the right hand rule Parameters: obj : obj to be rotated (e.g. neurite, neuron). Must implement a transform method. axis : unit vector for the axis of rotation angle : rotation angle in r...
[ "def", "rotate", "(", "obj", ",", "axis", ",", "angle", ",", "origin", "=", "None", ")", ":", "R", "=", "_rodrigues_to_dcm", "(", "axis", ",", "angle", ")", "try", ":", "return", "obj", ".", "transform", "(", "PivotRotation", "(", "R", ",", "origin",...
Rotation around unit vector following the right hand rule Parameters: obj : obj to be rotated (e.g. neurite, neuron). Must implement a transform method. axis : unit vector for the axis of rotation angle : rotation angle in rads Returns: A copy of the object with the...
[ "Rotation", "around", "unit", "vector", "following", "the", "right", "hand", "rule" ]
254bb73535b20053d175bc4725bade662177d12b
https://github.com/BlueBrain/NeuroM/blob/254bb73535b20053d175bc4725bade662177d12b/neurom/geom/transform.py#L128-L146
train
BlueBrain/NeuroM
neurom/geom/transform.py
_sin
def _sin(x): '''sine with case for pi multiples''' return 0. if np.isclose(np.mod(x, np.pi), 0.) else np.sin(x)
python
def _sin(x): '''sine with case for pi multiples''' return 0. if np.isclose(np.mod(x, np.pi), 0.) else np.sin(x)
[ "def", "_sin", "(", "x", ")", ":", "return", "0.", "if", "np", ".", "isclose", "(", "np", ".", "mod", "(", "x", ",", "np", ".", "pi", ")", ",", "0.", ")", "else", "np", ".", "sin", "(", "x", ")" ]
sine with case for pi multiples
[ "sine", "with", "case", "for", "pi", "multiples" ]
254bb73535b20053d175bc4725bade662177d12b
https://github.com/BlueBrain/NeuroM/blob/254bb73535b20053d175bc4725bade662177d12b/neurom/geom/transform.py#L149-L151
train
BlueBrain/NeuroM
neurom/geom/transform.py
_rodrigues_to_dcm
def _rodrigues_to_dcm(axis, angle): ''' Generates transformation matrix from unit vector and rotation angle. The rotation is applied in the direction of the axis which is a unit vector following the right hand rule. Inputs : axis : unit vector of the direction of the rotation angle...
python
def _rodrigues_to_dcm(axis, angle): ''' Generates transformation matrix from unit vector and rotation angle. The rotation is applied in the direction of the axis which is a unit vector following the right hand rule. Inputs : axis : unit vector of the direction of the rotation angle...
[ "def", "_rodrigues_to_dcm", "(", "axis", ",", "angle", ")", ":", "ux", ",", "uy", ",", "uz", "=", "axis", "/", "np", ".", "linalg", ".", "norm", "(", "axis", ")", "uxx", "=", "ux", "*", "ux", "uyy", "=", "uy", "*", "uy", "uzz", "=", "uz", "*"...
Generates transformation matrix from unit vector and rotation angle. The rotation is applied in the direction of the axis which is a unit vector following the right hand rule. Inputs : axis : unit vector of the direction of the rotation angle : angle of rotation in rads Returns : 3x3 ...
[ "Generates", "transformation", "matrix", "from", "unit", "vector", "and", "rotation", "angle", ".", "The", "rotation", "is", "applied", "in", "the", "direction", "of", "the", "axis", "which", "is", "a", "unit", "vector", "following", "the", "right", "hand", ...
254bb73535b20053d175bc4725bade662177d12b
https://github.com/BlueBrain/NeuroM/blob/254bb73535b20053d175bc4725bade662177d12b/neurom/geom/transform.py#L154-L194
train
BlueBrain/NeuroM
neurom/fst/_neuritefunc.py
total_length
def total_length(nrn_pop, neurite_type=NeuriteType.all): '''Get the total length of all sections in the group of neurons or neurites''' nrns = _neuronfunc.neuron_population(nrn_pop) return list(sum(section_lengths(n, neurite_type=neurite_type)) for n in nrns)
python
def total_length(nrn_pop, neurite_type=NeuriteType.all): '''Get the total length of all sections in the group of neurons or neurites''' nrns = _neuronfunc.neuron_population(nrn_pop) return list(sum(section_lengths(n, neurite_type=neurite_type)) for n in nrns)
[ "def", "total_length", "(", "nrn_pop", ",", "neurite_type", "=", "NeuriteType", ".", "all", ")", ":", "nrns", "=", "_neuronfunc", ".", "neuron_population", "(", "nrn_pop", ")", "return", "list", "(", "sum", "(", "section_lengths", "(", "n", ",", "neurite_typ...
Get the total length of all sections in the group of neurons or neurites
[ "Get", "the", "total", "length", "of", "all", "sections", "in", "the", "group", "of", "neurons", "or", "neurites" ]
254bb73535b20053d175bc4725bade662177d12b
https://github.com/BlueBrain/NeuroM/blob/254bb73535b20053d175bc4725bade662177d12b/neurom/fst/_neuritefunc.py#L45-L48
train
BlueBrain/NeuroM
neurom/fst/_neuritefunc.py
n_segments
def n_segments(neurites, neurite_type=NeuriteType.all): '''Number of segments in a collection of neurites''' return sum(len(s.points) - 1 for s in iter_sections(neurites, neurite_filter=is_type(neurite_type)))
python
def n_segments(neurites, neurite_type=NeuriteType.all): '''Number of segments in a collection of neurites''' return sum(len(s.points) - 1 for s in iter_sections(neurites, neurite_filter=is_type(neurite_type)))
[ "def", "n_segments", "(", "neurites", ",", "neurite_type", "=", "NeuriteType", ".", "all", ")", ":", "return", "sum", "(", "len", "(", "s", ".", "points", ")", "-", "1", "for", "s", "in", "iter_sections", "(", "neurites", ",", "neurite_filter", "=", "i...
Number of segments in a collection of neurites
[ "Number", "of", "segments", "in", "a", "collection", "of", "neurites" ]
254bb73535b20053d175bc4725bade662177d12b
https://github.com/BlueBrain/NeuroM/blob/254bb73535b20053d175bc4725bade662177d12b/neurom/fst/_neuritefunc.py#L51-L54
train
BlueBrain/NeuroM
neurom/fst/_neuritefunc.py
n_neurites
def n_neurites(neurites, neurite_type=NeuriteType.all): '''Number of neurites in a collection of neurites''' return sum(1 for _ in iter_neurites(neurites, filt=is_type(neurite_type)))
python
def n_neurites(neurites, neurite_type=NeuriteType.all): '''Number of neurites in a collection of neurites''' return sum(1 for _ in iter_neurites(neurites, filt=is_type(neurite_type)))
[ "def", "n_neurites", "(", "neurites", ",", "neurite_type", "=", "NeuriteType", ".", "all", ")", ":", "return", "sum", "(", "1", "for", "_", "in", "iter_neurites", "(", "neurites", ",", "filt", "=", "is_type", "(", "neurite_type", ")", ")", ")" ]
Number of neurites in a collection of neurites
[ "Number", "of", "neurites", "in", "a", "collection", "of", "neurites" ]
254bb73535b20053d175bc4725bade662177d12b
https://github.com/BlueBrain/NeuroM/blob/254bb73535b20053d175bc4725bade662177d12b/neurom/fst/_neuritefunc.py#L57-L59
train
BlueBrain/NeuroM
neurom/fst/_neuritefunc.py
n_sections
def n_sections(neurites, neurite_type=NeuriteType.all, iterator_type=Tree.ipreorder): '''Number of sections in a collection of neurites''' return sum(1 for _ in iter_sections(neurites, iterator_type=iterator_type, neurite_filter=is_...
python
def n_sections(neurites, neurite_type=NeuriteType.all, iterator_type=Tree.ipreorder): '''Number of sections in a collection of neurites''' return sum(1 for _ in iter_sections(neurites, iterator_type=iterator_type, neurite_filter=is_...
[ "def", "n_sections", "(", "neurites", ",", "neurite_type", "=", "NeuriteType", ".", "all", ",", "iterator_type", "=", "Tree", ".", "ipreorder", ")", ":", "return", "sum", "(", "1", "for", "_", "in", "iter_sections", "(", "neurites", ",", "iterator_type", "...
Number of sections in a collection of neurites
[ "Number", "of", "sections", "in", "a", "collection", "of", "neurites" ]
254bb73535b20053d175bc4725bade662177d12b
https://github.com/BlueBrain/NeuroM/blob/254bb73535b20053d175bc4725bade662177d12b/neurom/fst/_neuritefunc.py#L62-L66
train
BlueBrain/NeuroM
neurom/fst/_neuritefunc.py
n_bifurcation_points
def n_bifurcation_points(neurites, neurite_type=NeuriteType.all): '''number of bifurcation points in a collection of neurites''' return n_sections(neurites, neurite_type=neurite_type, iterator_type=Tree.ibifurcation_point)
python
def n_bifurcation_points(neurites, neurite_type=NeuriteType.all): '''number of bifurcation points in a collection of neurites''' return n_sections(neurites, neurite_type=neurite_type, iterator_type=Tree.ibifurcation_point)
[ "def", "n_bifurcation_points", "(", "neurites", ",", "neurite_type", "=", "NeuriteType", ".", "all", ")", ":", "return", "n_sections", "(", "neurites", ",", "neurite_type", "=", "neurite_type", ",", "iterator_type", "=", "Tree", ".", "ibifurcation_point", ")" ]
number of bifurcation points in a collection of neurites
[ "number", "of", "bifurcation", "points", "in", "a", "collection", "of", "neurites" ]
254bb73535b20053d175bc4725bade662177d12b
https://github.com/BlueBrain/NeuroM/blob/254bb73535b20053d175bc4725bade662177d12b/neurom/fst/_neuritefunc.py#L69-L71
train
BlueBrain/NeuroM
neurom/fst/_neuritefunc.py
n_forking_points
def n_forking_points(neurites, neurite_type=NeuriteType.all): '''number of forking points in a collection of neurites''' return n_sections(neurites, neurite_type=neurite_type, iterator_type=Tree.iforking_point)
python
def n_forking_points(neurites, neurite_type=NeuriteType.all): '''number of forking points in a collection of neurites''' return n_sections(neurites, neurite_type=neurite_type, iterator_type=Tree.iforking_point)
[ "def", "n_forking_points", "(", "neurites", ",", "neurite_type", "=", "NeuriteType", ".", "all", ")", ":", "return", "n_sections", "(", "neurites", ",", "neurite_type", "=", "neurite_type", ",", "iterator_type", "=", "Tree", ".", "iforking_point", ")" ]
number of forking points in a collection of neurites
[ "number", "of", "forking", "points", "in", "a", "collection", "of", "neurites" ]
254bb73535b20053d175bc4725bade662177d12b
https://github.com/BlueBrain/NeuroM/blob/254bb73535b20053d175bc4725bade662177d12b/neurom/fst/_neuritefunc.py#L74-L76
train
BlueBrain/NeuroM
neurom/fst/_neuritefunc.py
n_leaves
def n_leaves(neurites, neurite_type=NeuriteType.all): '''number of leaves points in a collection of neurites''' return n_sections(neurites, neurite_type=neurite_type, iterator_type=Tree.ileaf)
python
def n_leaves(neurites, neurite_type=NeuriteType.all): '''number of leaves points in a collection of neurites''' return n_sections(neurites, neurite_type=neurite_type, iterator_type=Tree.ileaf)
[ "def", "n_leaves", "(", "neurites", ",", "neurite_type", "=", "NeuriteType", ".", "all", ")", ":", "return", "n_sections", "(", "neurites", ",", "neurite_type", "=", "neurite_type", ",", "iterator_type", "=", "Tree", ".", "ileaf", ")" ]
number of leaves points in a collection of neurites
[ "number", "of", "leaves", "points", "in", "a", "collection", "of", "neurites" ]
254bb73535b20053d175bc4725bade662177d12b
https://github.com/BlueBrain/NeuroM/blob/254bb73535b20053d175bc4725bade662177d12b/neurom/fst/_neuritefunc.py#L79-L81
train
BlueBrain/NeuroM
neurom/fst/_neuritefunc.py
total_area_per_neurite
def total_area_per_neurite(neurites, neurite_type=NeuriteType.all): '''Surface area in a collection of neurites. The area is defined as the sum of the area of the sections. ''' return [neurite.area for neurite in iter_neurites(neurites, filt=is_type(neurite_type))]
python
def total_area_per_neurite(neurites, neurite_type=NeuriteType.all): '''Surface area in a collection of neurites. The area is defined as the sum of the area of the sections. ''' return [neurite.area for neurite in iter_neurites(neurites, filt=is_type(neurite_type))]
[ "def", "total_area_per_neurite", "(", "neurites", ",", "neurite_type", "=", "NeuriteType", ".", "all", ")", ":", "return", "[", "neurite", ".", "area", "for", "neurite", "in", "iter_neurites", "(", "neurites", ",", "filt", "=", "is_type", "(", "neurite_type", ...
Surface area in a collection of neurites. The area is defined as the sum of the area of the sections.
[ "Surface", "area", "in", "a", "collection", "of", "neurites", "." ]
254bb73535b20053d175bc4725bade662177d12b
https://github.com/BlueBrain/NeuroM/blob/254bb73535b20053d175bc4725bade662177d12b/neurom/fst/_neuritefunc.py#L84-L89
train
BlueBrain/NeuroM
neurom/fst/_neuritefunc.py
map_sections
def map_sections(fun, neurites, neurite_type=NeuriteType.all, iterator_type=Tree.ipreorder): '''Map `fun` to all the sections in a collection of neurites''' return map(fun, iter_sections(neurites, iterator_type=iterator_type, neurite_filter=is_...
python
def map_sections(fun, neurites, neurite_type=NeuriteType.all, iterator_type=Tree.ipreorder): '''Map `fun` to all the sections in a collection of neurites''' return map(fun, iter_sections(neurites, iterator_type=iterator_type, neurite_filter=is_...
[ "def", "map_sections", "(", "fun", ",", "neurites", ",", "neurite_type", "=", "NeuriteType", ".", "all", ",", "iterator_type", "=", "Tree", ".", "ipreorder", ")", ":", "return", "map", "(", "fun", ",", "iter_sections", "(", "neurites", ",", "iterator_type", ...
Map `fun` to all the sections in a collection of neurites
[ "Map", "fun", "to", "all", "the", "sections", "in", "a", "collection", "of", "neurites" ]
254bb73535b20053d175bc4725bade662177d12b
https://github.com/BlueBrain/NeuroM/blob/254bb73535b20053d175bc4725bade662177d12b/neurom/fst/_neuritefunc.py#L92-L96
train
BlueBrain/NeuroM
neurom/fst/_neuritefunc.py
section_lengths
def section_lengths(neurites, neurite_type=NeuriteType.all): '''section lengths in a collection of neurites''' return map_sections(_section_length, neurites, neurite_type=neurite_type)
python
def section_lengths(neurites, neurite_type=NeuriteType.all): '''section lengths in a collection of neurites''' return map_sections(_section_length, neurites, neurite_type=neurite_type)
[ "def", "section_lengths", "(", "neurites", ",", "neurite_type", "=", "NeuriteType", ".", "all", ")", ":", "return", "map_sections", "(", "_section_length", ",", "neurites", ",", "neurite_type", "=", "neurite_type", ")" ]
section lengths in a collection of neurites
[ "section", "lengths", "in", "a", "collection", "of", "neurites" ]
254bb73535b20053d175bc4725bade662177d12b
https://github.com/BlueBrain/NeuroM/blob/254bb73535b20053d175bc4725bade662177d12b/neurom/fst/_neuritefunc.py#L104-L106
train
BlueBrain/NeuroM
neurom/fst/_neuritefunc.py
section_term_lengths
def section_term_lengths(neurites, neurite_type=NeuriteType.all): '''Termination section lengths in a collection of neurites''' return map_sections(_section_length, neurites, neurite_type=neurite_type, iterator_type=Tree.ileaf)
python
def section_term_lengths(neurites, neurite_type=NeuriteType.all): '''Termination section lengths in a collection of neurites''' return map_sections(_section_length, neurites, neurite_type=neurite_type, iterator_type=Tree.ileaf)
[ "def", "section_term_lengths", "(", "neurites", ",", "neurite_type", "=", "NeuriteType", ".", "all", ")", ":", "return", "map_sections", "(", "_section_length", ",", "neurites", ",", "neurite_type", "=", "neurite_type", ",", "iterator_type", "=", "Tree", ".", "i...
Termination section lengths in a collection of neurites
[ "Termination", "section", "lengths", "in", "a", "collection", "of", "neurites" ]
254bb73535b20053d175bc4725bade662177d12b
https://github.com/BlueBrain/NeuroM/blob/254bb73535b20053d175bc4725bade662177d12b/neurom/fst/_neuritefunc.py#L109-L112
train
BlueBrain/NeuroM
neurom/fst/_neuritefunc.py
section_bif_lengths
def section_bif_lengths(neurites, neurite_type=NeuriteType.all): '''Bifurcation section lengths in a collection of neurites''' return map_sections(_section_length, neurites, neurite_type=neurite_type, iterator_type=Tree.ibifurcation_point)
python
def section_bif_lengths(neurites, neurite_type=NeuriteType.all): '''Bifurcation section lengths in a collection of neurites''' return map_sections(_section_length, neurites, neurite_type=neurite_type, iterator_type=Tree.ibifurcation_point)
[ "def", "section_bif_lengths", "(", "neurites", ",", "neurite_type", "=", "NeuriteType", ".", "all", ")", ":", "return", "map_sections", "(", "_section_length", ",", "neurites", ",", "neurite_type", "=", "neurite_type", ",", "iterator_type", "=", "Tree", ".", "ib...
Bifurcation section lengths in a collection of neurites
[ "Bifurcation", "section", "lengths", "in", "a", "collection", "of", "neurites" ]
254bb73535b20053d175bc4725bade662177d12b
https://github.com/BlueBrain/NeuroM/blob/254bb73535b20053d175bc4725bade662177d12b/neurom/fst/_neuritefunc.py#L115-L118
train
BlueBrain/NeuroM
neurom/fst/_neuritefunc.py
section_branch_orders
def section_branch_orders(neurites, neurite_type=NeuriteType.all): '''section branch orders in a collection of neurites''' return map_sections(sectionfunc.branch_order, neurites, neurite_type=neurite_type)
python
def section_branch_orders(neurites, neurite_type=NeuriteType.all): '''section branch orders in a collection of neurites''' return map_sections(sectionfunc.branch_order, neurites, neurite_type=neurite_type)
[ "def", "section_branch_orders", "(", "neurites", ",", "neurite_type", "=", "NeuriteType", ".", "all", ")", ":", "return", "map_sections", "(", "sectionfunc", ".", "branch_order", ",", "neurites", ",", "neurite_type", "=", "neurite_type", ")" ]
section branch orders in a collection of neurites
[ "section", "branch", "orders", "in", "a", "collection", "of", "neurites" ]
254bb73535b20053d175bc4725bade662177d12b
https://github.com/BlueBrain/NeuroM/blob/254bb73535b20053d175bc4725bade662177d12b/neurom/fst/_neuritefunc.py#L121-L123
train
BlueBrain/NeuroM
neurom/fst/_neuritefunc.py
section_bif_branch_orders
def section_bif_branch_orders(neurites, neurite_type=NeuriteType.all): '''Bifurcation section branch orders in a collection of neurites''' return map_sections(sectionfunc.branch_order, neurites, neurite_type=neurite_type, iterator_type=Tree.ibifurcation_point)
python
def section_bif_branch_orders(neurites, neurite_type=NeuriteType.all): '''Bifurcation section branch orders in a collection of neurites''' return map_sections(sectionfunc.branch_order, neurites, neurite_type=neurite_type, iterator_type=Tree.ibifurcation_point)
[ "def", "section_bif_branch_orders", "(", "neurites", ",", "neurite_type", "=", "NeuriteType", ".", "all", ")", ":", "return", "map_sections", "(", "sectionfunc", ".", "branch_order", ",", "neurites", ",", "neurite_type", "=", "neurite_type", ",", "iterator_type", ...
Bifurcation section branch orders in a collection of neurites
[ "Bifurcation", "section", "branch", "orders", "in", "a", "collection", "of", "neurites" ]
254bb73535b20053d175bc4725bade662177d12b
https://github.com/BlueBrain/NeuroM/blob/254bb73535b20053d175bc4725bade662177d12b/neurom/fst/_neuritefunc.py#L126-L129
train
BlueBrain/NeuroM
neurom/fst/_neuritefunc.py
section_term_branch_orders
def section_term_branch_orders(neurites, neurite_type=NeuriteType.all): '''Termination section branch orders in a collection of neurites''' return map_sections(sectionfunc.branch_order, neurites, neurite_type=neurite_type, iterator_type=Tree.ileaf)
python
def section_term_branch_orders(neurites, neurite_type=NeuriteType.all): '''Termination section branch orders in a collection of neurites''' return map_sections(sectionfunc.branch_order, neurites, neurite_type=neurite_type, iterator_type=Tree.ileaf)
[ "def", "section_term_branch_orders", "(", "neurites", ",", "neurite_type", "=", "NeuriteType", ".", "all", ")", ":", "return", "map_sections", "(", "sectionfunc", ".", "branch_order", ",", "neurites", ",", "neurite_type", "=", "neurite_type", ",", "iterator_type", ...
Termination section branch orders in a collection of neurites
[ "Termination", "section", "branch", "orders", "in", "a", "collection", "of", "neurites" ]
254bb73535b20053d175bc4725bade662177d12b
https://github.com/BlueBrain/NeuroM/blob/254bb73535b20053d175bc4725bade662177d12b/neurom/fst/_neuritefunc.py#L132-L135
train
BlueBrain/NeuroM
neurom/fst/_neuritefunc.py
section_path_lengths
def section_path_lengths(neurites, neurite_type=NeuriteType.all): '''Path lengths of a collection of neurites ''' # Calculates and stores the section lengths in one pass, # then queries the lengths in the path length iterations. # This avoids repeatedly calculating the lengths of the # same sections...
python
def section_path_lengths(neurites, neurite_type=NeuriteType.all): '''Path lengths of a collection of neurites ''' # Calculates and stores the section lengths in one pass, # then queries the lengths in the path length iterations. # This avoids repeatedly calculating the lengths of the # same sections...
[ "def", "section_path_lengths", "(", "neurites", ",", "neurite_type", "=", "NeuriteType", ".", "all", ")", ":", "dist", "=", "{", "}", "neurite_filter", "=", "is_type", "(", "neurite_type", ")", "for", "s", "in", "iter_sections", "(", "neurites", ",", "neurit...
Path lengths of a collection of neurites
[ "Path", "lengths", "of", "a", "collection", "of", "neurites" ]
254bb73535b20053d175bc4725bade662177d12b
https://github.com/BlueBrain/NeuroM/blob/254bb73535b20053d175bc4725bade662177d12b/neurom/fst/_neuritefunc.py#L138-L154
train
BlueBrain/NeuroM
neurom/fst/_neuritefunc.py
map_neurons
def map_neurons(fun, neurites, neurite_type): '''Map `fun` to all the neurites in a single or collection of neurons''' nrns = _neuronfunc.neuron_population(neurites) return [fun(n, neurite_type=neurite_type) for n in nrns]
python
def map_neurons(fun, neurites, neurite_type): '''Map `fun` to all the neurites in a single or collection of neurons''' nrns = _neuronfunc.neuron_population(neurites) return [fun(n, neurite_type=neurite_type) for n in nrns]
[ "def", "map_neurons", "(", "fun", ",", "neurites", ",", "neurite_type", ")", ":", "nrns", "=", "_neuronfunc", ".", "neuron_population", "(", "neurites", ")", "return", "[", "fun", "(", "n", ",", "neurite_type", "=", "neurite_type", ")", "for", "n", "in", ...
Map `fun` to all the neurites in a single or collection of neurons
[ "Map", "fun", "to", "all", "the", "neurites", "in", "a", "single", "or", "collection", "of", "neurons" ]
254bb73535b20053d175bc4725bade662177d12b
https://github.com/BlueBrain/NeuroM/blob/254bb73535b20053d175bc4725bade662177d12b/neurom/fst/_neuritefunc.py#L157-L160
train
BlueBrain/NeuroM
neurom/fst/_neuritefunc.py
map_segments
def map_segments(func, neurites, neurite_type): ''' Map `func` to all the segments in a collection of neurites `func` accepts a section and returns list of values corresponding to each segment. ''' neurite_filter = is_type(neurite_type) return [ s for ss in iter_sections(neurites, neuri...
python
def map_segments(func, neurites, neurite_type): ''' Map `func` to all the segments in a collection of neurites `func` accepts a section and returns list of values corresponding to each segment. ''' neurite_filter = is_type(neurite_type) return [ s for ss in iter_sections(neurites, neuri...
[ "def", "map_segments", "(", "func", ",", "neurites", ",", "neurite_type", ")", ":", "neurite_filter", "=", "is_type", "(", "neurite_type", ")", "return", "[", "s", "for", "ss", "in", "iter_sections", "(", "neurites", ",", "neurite_filter", "=", "neurite_filter...
Map `func` to all the segments in a collection of neurites `func` accepts a section and returns list of values corresponding to each segment.
[ "Map", "func", "to", "all", "the", "segments", "in", "a", "collection", "of", "neurites" ]
254bb73535b20053d175bc4725bade662177d12b
https://github.com/BlueBrain/NeuroM/blob/254bb73535b20053d175bc4725bade662177d12b/neurom/fst/_neuritefunc.py#L193-L201
train
BlueBrain/NeuroM
neurom/fst/_neuritefunc.py
segment_volumes
def segment_volumes(neurites, neurite_type=NeuriteType.all): '''Volumes of the segments in a collection of neurites''' def _func(sec): '''list of segment volumes of a section''' return [morphmath.segment_volume(seg) for seg in zip(sec.points[:-1], sec.points[1:])] return map_segments(_func,...
python
def segment_volumes(neurites, neurite_type=NeuriteType.all): '''Volumes of the segments in a collection of neurites''' def _func(sec): '''list of segment volumes of a section''' return [morphmath.segment_volume(seg) for seg in zip(sec.points[:-1], sec.points[1:])] return map_segments(_func,...
[ "def", "segment_volumes", "(", "neurites", ",", "neurite_type", "=", "NeuriteType", ".", "all", ")", ":", "def", "_func", "(", "sec", ")", ":", "return", "[", "morphmath", ".", "segment_volume", "(", "seg", ")", "for", "seg", "in", "zip", "(", "sec", "...
Volumes of the segments in a collection of neurites
[ "Volumes", "of", "the", "segments", "in", "a", "collection", "of", "neurites" ]
254bb73535b20053d175bc4725bade662177d12b
https://github.com/BlueBrain/NeuroM/blob/254bb73535b20053d175bc4725bade662177d12b/neurom/fst/_neuritefunc.py#L213-L219
train
BlueBrain/NeuroM
neurom/fst/_neuritefunc.py
segment_radii
def segment_radii(neurites, neurite_type=NeuriteType.all): '''arithmetic mean of the radii of the points in segments in a collection of neurites''' def _seg_radii(sec): '''vectorized mean radii''' pts = sec.points[:, COLS.R] return np.divide(np.add(pts[:-1], pts[1:]), 2.0) return ma...
python
def segment_radii(neurites, neurite_type=NeuriteType.all): '''arithmetic mean of the radii of the points in segments in a collection of neurites''' def _seg_radii(sec): '''vectorized mean radii''' pts = sec.points[:, COLS.R] return np.divide(np.add(pts[:-1], pts[1:]), 2.0) return ma...
[ "def", "segment_radii", "(", "neurites", ",", "neurite_type", "=", "NeuriteType", ".", "all", ")", ":", "def", "_seg_radii", "(", "sec", ")", ":", "pts", "=", "sec", ".", "points", "[", ":", ",", "COLS", ".", "R", "]", "return", "np", ".", "divide", ...
arithmetic mean of the radii of the points in segments in a collection of neurites
[ "arithmetic", "mean", "of", "the", "radii", "of", "the", "points", "in", "segments", "in", "a", "collection", "of", "neurites" ]
254bb73535b20053d175bc4725bade662177d12b
https://github.com/BlueBrain/NeuroM/blob/254bb73535b20053d175bc4725bade662177d12b/neurom/fst/_neuritefunc.py#L222-L229
train
BlueBrain/NeuroM
neurom/fst/_neuritefunc.py
segment_taper_rates
def segment_taper_rates(neurites, neurite_type=NeuriteType.all): '''taper rates of the segments in a collection of neurites The taper rate is defined as the absolute radii differences divided by length of the section ''' def _seg_taper_rates(sec): '''vectorized taper rates''' pts = sec....
python
def segment_taper_rates(neurites, neurite_type=NeuriteType.all): '''taper rates of the segments in a collection of neurites The taper rate is defined as the absolute radii differences divided by length of the section ''' def _seg_taper_rates(sec): '''vectorized taper rates''' pts = sec....
[ "def", "segment_taper_rates", "(", "neurites", ",", "neurite_type", "=", "NeuriteType", ".", "all", ")", ":", "def", "_seg_taper_rates", "(", "sec", ")", ":", "pts", "=", "sec", ".", "points", "[", ":", ",", "COLS", ".", "XYZR", "]", "diff", "=", "np",...
taper rates of the segments in a collection of neurites The taper rate is defined as the absolute radii differences divided by length of the section
[ "taper", "rates", "of", "the", "segments", "in", "a", "collection", "of", "neurites" ]
254bb73535b20053d175bc4725bade662177d12b
https://github.com/BlueBrain/NeuroM/blob/254bb73535b20053d175bc4725bade662177d12b/neurom/fst/_neuritefunc.py#L232-L244
train
BlueBrain/NeuroM
neurom/fst/_neuritefunc.py
segment_midpoints
def segment_midpoints(neurites, neurite_type=NeuriteType.all): '''Return a list of segment mid-points in a collection of neurites''' def _seg_midpoint(sec): '''Return the mid-points of segments in a section''' pts = sec.points[:, COLS.XYZ] return np.divide(np.add(pts[:-1], pts[1:]), 2.0)...
python
def segment_midpoints(neurites, neurite_type=NeuriteType.all): '''Return a list of segment mid-points in a collection of neurites''' def _seg_midpoint(sec): '''Return the mid-points of segments in a section''' pts = sec.points[:, COLS.XYZ] return np.divide(np.add(pts[:-1], pts[1:]), 2.0)...
[ "def", "segment_midpoints", "(", "neurites", ",", "neurite_type", "=", "NeuriteType", ".", "all", ")", ":", "def", "_seg_midpoint", "(", "sec", ")", ":", "pts", "=", "sec", ".", "points", "[", ":", ",", "COLS", ".", "XYZ", "]", "return", "np", ".", "...
Return a list of segment mid-points in a collection of neurites
[ "Return", "a", "list", "of", "segment", "mid", "-", "points", "in", "a", "collection", "of", "neurites" ]
254bb73535b20053d175bc4725bade662177d12b
https://github.com/BlueBrain/NeuroM/blob/254bb73535b20053d175bc4725bade662177d12b/neurom/fst/_neuritefunc.py#L253-L260
train
BlueBrain/NeuroM
neurom/fst/_neuritefunc.py
local_bifurcation_angles
def local_bifurcation_angles(neurites, neurite_type=NeuriteType.all): '''Get a list of local bifurcation angles in a collection of neurites''' return map_sections(_bifurcationfunc.local_bifurcation_angle, neurites, neurite_type=neurite_type, ...
python
def local_bifurcation_angles(neurites, neurite_type=NeuriteType.all): '''Get a list of local bifurcation angles in a collection of neurites''' return map_sections(_bifurcationfunc.local_bifurcation_angle, neurites, neurite_type=neurite_type, ...
[ "def", "local_bifurcation_angles", "(", "neurites", ",", "neurite_type", "=", "NeuriteType", ".", "all", ")", ":", "return", "map_sections", "(", "_bifurcationfunc", ".", "local_bifurcation_angle", ",", "neurites", ",", "neurite_type", "=", "neurite_type", ",", "ite...
Get a list of local bifurcation angles in a collection of neurites
[ "Get", "a", "list", "of", "local", "bifurcation", "angles", "in", "a", "collection", "of", "neurites" ]
254bb73535b20053d175bc4725bade662177d12b
https://github.com/BlueBrain/NeuroM/blob/254bb73535b20053d175bc4725bade662177d12b/neurom/fst/_neuritefunc.py#L280-L285
train
BlueBrain/NeuroM
neurom/fst/_neuritefunc.py
remote_bifurcation_angles
def remote_bifurcation_angles(neurites, neurite_type=NeuriteType.all): '''Get a list of remote bifurcation angles in a collection of neurites''' return map_sections(_bifurcationfunc.remote_bifurcation_angle, neurites, neurite_type=neurite_type, ...
python
def remote_bifurcation_angles(neurites, neurite_type=NeuriteType.all): '''Get a list of remote bifurcation angles in a collection of neurites''' return map_sections(_bifurcationfunc.remote_bifurcation_angle, neurites, neurite_type=neurite_type, ...
[ "def", "remote_bifurcation_angles", "(", "neurites", ",", "neurite_type", "=", "NeuriteType", ".", "all", ")", ":", "return", "map_sections", "(", "_bifurcationfunc", ".", "remote_bifurcation_angle", ",", "neurites", ",", "neurite_type", "=", "neurite_type", ",", "i...
Get a list of remote bifurcation angles in a collection of neurites
[ "Get", "a", "list", "of", "remote", "bifurcation", "angles", "in", "a", "collection", "of", "neurites" ]
254bb73535b20053d175bc4725bade662177d12b
https://github.com/BlueBrain/NeuroM/blob/254bb73535b20053d175bc4725bade662177d12b/neurom/fst/_neuritefunc.py#L288-L293
train