body stringlengths 26 98.2k | body_hash int64 -9,222,864,604,528,158,000 9,221,803,474B | docstring stringlengths 1 16.8k | path stringlengths 5 230 | name stringlengths 1 96 | repository_name stringlengths 7 89 | lang stringclasses 1
value | body_without_docstring stringlengths 20 98.2k |
|---|---|---|---|---|---|---|---|
@profiler
def create_routes_for_payment(self, *, amount_msat: int, final_total_msat: int, invoice_pubkey, min_cltv_expiry, r_tags, invoice_features: int, payment_hash, payment_secret, trampoline_fee_level: int, use_two_trampolines: bool, fwd_trampoline_onion=None, full_path: LNPaymentPath=None) -> Sequence[Tuple[(LNPay... | -5,895,710,188,087,822,000 | Creates multiple routes for splitting a payment over the available
private channels.
We first try to conduct the payment over a single channel. If that fails
and mpp is supported by the receiver, we will split the payment. | electrum/lnworker.py | create_routes_for_payment | jeroz1/electrum-ravencoin-utd | python | @profiler
def create_routes_for_payment(self, *, amount_msat: int, final_total_msat: int, invoice_pubkey, min_cltv_expiry, r_tags, invoice_features: int, payment_hash, payment_secret, trampoline_fee_level: int, use_two_trampolines: bool, fwd_trampoline_onion=None, full_path: LNPaymentPath=None) -> Sequence[Tuple[(LNPay... |
def get_payment_info(self, payment_hash: bytes) -> Optional[PaymentInfo]:
'returns None if payment_hash is a payment we are forwarding'
key = payment_hash.hex()
with self.lock:
if (key in self.payments):
(amount_msat, direction, status) = self.payments[key]
return PaymentInfo... | 8,287,857,047,201,814,000 | returns None if payment_hash is a payment we are forwarding | electrum/lnworker.py | get_payment_info | jeroz1/electrum-ravencoin-utd | python | def get_payment_info(self, payment_hash: bytes) -> Optional[PaymentInfo]:
key = payment_hash.hex()
with self.lock:
if (key in self.payments):
(amount_msat, direction, status) = self.payments[key]
return PaymentInfo(payment_hash, amount_msat, direction, status) |
def check_received_mpp_htlc(self, payment_secret, short_channel_id, htlc: UpdateAddHtlc, expected_msat: int) -> Optional[bool]:
' return MPP status: True (accepted), False (expired) or None '
payment_hash = htlc.payment_hash
(is_expired, is_accepted, htlc_set) = self.received_mpp_htlcs.get(payment_secret, (... | -3,202,478,210,011,258,400 | return MPP status: True (accepted), False (expired) or None | electrum/lnworker.py | check_received_mpp_htlc | jeroz1/electrum-ravencoin-utd | python | def check_received_mpp_htlc(self, payment_secret, short_channel_id, htlc: UpdateAddHtlc, expected_msat: int) -> Optional[bool]:
' '
payment_hash = htlc.payment_hash
(is_expired, is_accepted, htlc_set) = self.received_mpp_htlcs.get(payment_secret, (False, False, set()))
if (self.get_payment_status(payme... |
async def _calc_routing_hints_for_invoice(self, amount_msat: Optional[int]):
"calculate routing hints (BOLT-11 'r' field)"
routing_hints = []
channels = list(self.channels.values())
channels = [chan for chan in channels if (chan.is_open() and (not chan.is_frozen_for_receiving()))]
channels = sorted(... | -7,572,827,854,677,782,000 | calculate routing hints (BOLT-11 'r' field) | electrum/lnworker.py | _calc_routing_hints_for_invoice | jeroz1/electrum-ravencoin-utd | python | async def _calc_routing_hints_for_invoice(self, amount_msat: Optional[int]):
routing_hints = []
channels = list(self.channels.values())
channels = [chan for chan in channels if (chan.is_open() and (not chan.is_frozen_for_receiving()))]
channels = sorted(channels, key=(lambda chan: ((not chan.is_act... |
def has_conflicting_backup_with(self, remote_node_id: bytes):
' Returns whether we have an active channel with this node on another device, using same local node id. '
channel_backup_peers = [cb.node_id for cb in self.channel_backups.values() if ((not cb.is_closed()) and (cb.get_local_pubkey() == self.node_keyp... | 7,341,898,079,577,866,000 | Returns whether we have an active channel with this node on another device, using same local node id. | electrum/lnworker.py | has_conflicting_backup_with | jeroz1/electrum-ravencoin-utd | python | def has_conflicting_backup_with(self, remote_node_id: bytes):
' '
channel_backup_peers = [cb.node_id for cb in self.channel_backups.values() if ((not cb.is_closed()) and (cb.get_local_pubkey() == self.node_keypair.pubkey))]
return any((remote_node_id.startswith(cb_peer_nodeid) for cb_peer_nodeid in channel... |
def get_backend():
'The backend is this module itself.'
return Connection() | 9,118,483,233,459,801,000 | The backend is this module itself. | fm-rest-api/fm/fm/db/sqlalchemy/api.py | get_backend | MarioCarrilloA/fault | python | def get_backend():
return Connection() |
def model_query(model, *args, **kwargs):
'Query helper for simpler session usage.\n\n :param session: if present, the session to use\n '
with _session_for_read() as session:
query = session.query(model, *args)
return query | 6,410,123,238,035,086,000 | Query helper for simpler session usage.
:param session: if present, the session to use | fm-rest-api/fm/fm/db/sqlalchemy/api.py | model_query | MarioCarrilloA/fault | python | def model_query(model, *args, **kwargs):
'Query helper for simpler session usage.\n\n :param session: if present, the session to use\n '
with _session_for_read() as session:
query = session.query(model, *args)
return query |
def add_event_log_filter_by_event_suppression(query, include_suppress):
'Adds an event_suppression filter to a query.\n\n Filters results by suppression status\n\n :param query: Initial query to add filter to.\n :param include_suppress: Value for filtering results by.\n :return: Modified query.\n '
... | -807,128,944,204,826,800 | Adds an event_suppression filter to a query.
Filters results by suppression status
:param query: Initial query to add filter to.
:param include_suppress: Value for filtering results by.
:return: Modified query. | fm-rest-api/fm/fm/db/sqlalchemy/api.py | add_event_log_filter_by_event_suppression | MarioCarrilloA/fault | python | def add_event_log_filter_by_event_suppression(query, include_suppress):
'Adds an event_suppression filter to a query.\n\n Filters results by suppression status\n\n :param query: Initial query to add filter to.\n :param include_suppress: Value for filtering results by.\n :return: Modified query.\n '
... |
def add_alarm_filter_by_event_suppression(query, include_suppress):
'Adds an event_suppression filter to a query.\n\n Filters results by suppression status\n\n :param query: Initial query to add filter to.\n :param include_suppress: Value for filtering results by.\n :return: Modified query.\n '
q... | -449,629,066,408,219,000 | Adds an event_suppression filter to a query.
Filters results by suppression status
:param query: Initial query to add filter to.
:param include_suppress: Value for filtering results by.
:return: Modified query. | fm-rest-api/fm/fm/db/sqlalchemy/api.py | add_alarm_filter_by_event_suppression | MarioCarrilloA/fault | python | def add_alarm_filter_by_event_suppression(query, include_suppress):
'Adds an event_suppression filter to a query.\n\n Filters results by suppression status\n\n :param query: Initial query to add filter to.\n :param include_suppress: Value for filtering results by.\n :return: Modified query.\n '
q... |
def add_alarm_mgmt_affecting_by_event_suppression(query):
'Adds a mgmt_affecting attribute from event_suppression to query.\n\n :param query: Initial query.\n :return: Modified query.\n '
query = query.add_columns(models.EventSuppression.mgmt_affecting)
return query | 5,047,030,622,101,545,000 | Adds a mgmt_affecting attribute from event_suppression to query.
:param query: Initial query.
:return: Modified query. | fm-rest-api/fm/fm/db/sqlalchemy/api.py | add_alarm_mgmt_affecting_by_event_suppression | MarioCarrilloA/fault | python | def add_alarm_mgmt_affecting_by_event_suppression(query):
'Adds a mgmt_affecting attribute from event_suppression to query.\n\n :param query: Initial query.\n :return: Modified query.\n '
query = query.add_columns(models.EventSuppression.mgmt_affecting)
return query |
def add_alarm_degrade_affecting_by_event_suppression(query):
'Adds a degrade_affecting attribute from event_suppression to query.\n\n :param query: Initial query.\n :return: Modified query.\n '
query = query.add_columns(models.EventSuppression.degrade_affecting)
return query | -8,166,228,253,472,973,000 | Adds a degrade_affecting attribute from event_suppression to query.
:param query: Initial query.
:return: Modified query. | fm-rest-api/fm/fm/db/sqlalchemy/api.py | add_alarm_degrade_affecting_by_event_suppression | MarioCarrilloA/fault | python | def add_alarm_degrade_affecting_by_event_suppression(query):
'Adds a degrade_affecting attribute from event_suppression to query.\n\n :param query: Initial query.\n :return: Modified query.\n '
query = query.add_columns(models.EventSuppression.degrade_affecting)
return query |
def test_modify_left_param(self):
' inner function'
inp = self._pipeline.parallelize([[1, 2, 3], [6, 5, 4]])
def _sum(x, y):
x[0] += y[0]
x[1] += y[1]
x[2] += y[2]
return x
result = transforms.union(inp.reduce(_sum), inp.reduce(_sum)).get()
self.assertEqual([[7, 7, 7... | 6,170,765,211,557,646,000 | inner function | bigflow_python/python/bigflow/transform_impls/test/reduce_test.py | test_modify_left_param | aiplat/bigflow | python | def test_modify_left_param(self):
' '
inp = self._pipeline.parallelize([[1, 2, 3], [6, 5, 4]])
def _sum(x, y):
x[0] += y[0]
x[1] += y[1]
x[2] += y[2]
return x
result = transforms.union(inp.reduce(_sum), inp.reduce(_sum)).get()
self.assertEqual([[7, 7, 7], [7, 7, 7]],... |
def train(opt):
' dataset preparation '
if (not opt.data_filtering_off):
print('Filtering the images containing characters which are not in opt.character')
print('Filtering the images whose label is longer than opt.batch_max_length')
opt.select_data = opt.select_data.split('-')
opt.batch... | -7,748,018,635,452,727,000 | dataset preparation | train.py | train | unanan/deep-text-recognition-benchmark-mnn-ncnn | python | def train(opt):
' '
if (not opt.data_filtering_off):
print('Filtering the images containing characters which are not in opt.character')
print('Filtering the images whose label is longer than opt.batch_max_length')
opt.select_data = opt.select_data.split('-')
opt.batch_ratio = opt.batch_... |
def tomography_basis(basis, prep_fun=None, meas_fun=None):
'\n Generate a TomographyBasis object.\n\n See TomographyBasis for further details.abs\n\n Args:\n prep_fun (callable) optional: the function which adds preparation\n gates to a circuit.\n meas_fun (callable) optional: the ... | 226,170,564,236,531,970 | Generate a TomographyBasis object.
See TomographyBasis for further details.abs
Args:
prep_fun (callable) optional: the function which adds preparation
gates to a circuit.
meas_fun (callable) optional: the function which adds measurement
gates to a circuit.
Returns:
TomographyBasis: A tomo... | qiskit/tools/qcvv/tomography.py | tomography_basis | filemaster/qiskit-terra | python | def tomography_basis(basis, prep_fun=None, meas_fun=None):
'\n Generate a TomographyBasis object.\n\n See TomographyBasis for further details.abs\n\n Args:\n prep_fun (callable) optional: the function which adds preparation\n gates to a circuit.\n meas_fun (callable) optional: the ... |
def __pauli_prep_gates(circuit, qreg, op):
'\n Add state preparation gates to a circuit.\n '
(bas, proj) = op
if (bas not in ['X', 'Y', 'Z']):
raise QiskitError("There's no X, Y or Z basis for this Pauli preparation")
if (bas == 'X'):
if (proj == 1):
circuit.u2(np.pi, n... | -5,024,664,810,581,299,000 | Add state preparation gates to a circuit. | qiskit/tools/qcvv/tomography.py | __pauli_prep_gates | filemaster/qiskit-terra | python | def __pauli_prep_gates(circuit, qreg, op):
'\n \n '
(bas, proj) = op
if (bas not in ['X', 'Y', 'Z']):
raise QiskitError("There's no X, Y or Z basis for this Pauli preparation")
if (bas == 'X'):
if (proj == 1):
circuit.u2(np.pi, np.pi, qreg)
else:
cir... |
def __pauli_meas_gates(circuit, qreg, op):
'\n Add state measurement gates to a circuit.\n '
if (op not in ['X', 'Y', 'Z']):
raise QiskitError("There's no X, Y or Z basis for this Pauli measurement")
if (op == 'X'):
circuit.u2(0.0, np.pi, qreg)
elif (op == 'Y'):
circuit.u2(... | -7,524,631,782,530,808,000 | Add state measurement gates to a circuit. | qiskit/tools/qcvv/tomography.py | __pauli_meas_gates | filemaster/qiskit-terra | python | def __pauli_meas_gates(circuit, qreg, op):
'\n \n '
if (op not in ['X', 'Y', 'Z']):
raise QiskitError("There's no X, Y or Z basis for this Pauli measurement")
if (op == 'X'):
circuit.u2(0.0, np.pi, qreg)
elif (op == 'Y'):
circuit.u2(0.0, (0.5 * np.pi), qreg) |
def __sic_prep_gates(circuit, qreg, op):
'\n Add state preparation gates to a circuit.\n '
(bas, proj) = op
if (bas != 'S'):
raise QiskitError('Not in SIC basis!')
theta = ((- 2) * np.arctan(np.sqrt(2)))
if (proj == 1):
circuit.u3(theta, np.pi, 0.0, qreg)
elif (proj == 2):
... | 8,698,999,360,930,628,000 | Add state preparation gates to a circuit. | qiskit/tools/qcvv/tomography.py | __sic_prep_gates | filemaster/qiskit-terra | python | def __sic_prep_gates(circuit, qreg, op):
'\n \n '
(bas, proj) = op
if (bas != 'S'):
raise QiskitError('Not in SIC basis!')
theta = ((- 2) * np.arctan(np.sqrt(2)))
if (proj == 1):
circuit.u3(theta, np.pi, 0.0, qreg)
elif (proj == 2):
circuit.u3(theta, (np.pi / 3), 0.... |
def tomography_set(meas_qubits, meas_basis='Pauli', prep_qubits=None, prep_basis=None):
'\n Generate a dictionary of tomography experiment configurations.\n\n This returns a data structure that is used by other tomography functions\n to generate state and process tomography circuits, and extract tomography... | -3,920,841,991,119,536,600 | Generate a dictionary of tomography experiment configurations.
This returns a data structure that is used by other tomography functions
to generate state and process tomography circuits, and extract tomography
data from results after execution on a backend.
Quantum State Tomography:
Be default it will return a se... | qiskit/tools/qcvv/tomography.py | tomography_set | filemaster/qiskit-terra | python | def tomography_set(meas_qubits, meas_basis='Pauli', prep_qubits=None, prep_basis=None):
'\n Generate a dictionary of tomography experiment configurations.\n\n This returns a data structure that is used by other tomography functions\n to generate state and process tomography circuits, and extract tomography... |
def state_tomography_set(qubits, meas_basis='Pauli'):
'\n Generate a dictionary of state tomography experiment configurations.\n\n This returns a data structure that is used by other tomography functions\n to generate state and process tomography circuits, and extract tomography\n data from results afte... | -6,288,560,604,954,466,000 | Generate a dictionary of state tomography experiment configurations.
This returns a data structure that is used by other tomography functions
to generate state and process tomography circuits, and extract tomography
data from results after execution on a backend.
Quantum State Tomography:
Be default it will retur... | qiskit/tools/qcvv/tomography.py | state_tomography_set | filemaster/qiskit-terra | python | def state_tomography_set(qubits, meas_basis='Pauli'):
'\n Generate a dictionary of state tomography experiment configurations.\n\n This returns a data structure that is used by other tomography functions\n to generate state and process tomography circuits, and extract tomography\n data from results afte... |
def process_tomography_set(meas_qubits, meas_basis='Pauli', prep_qubits=None, prep_basis='SIC'):
'\n Generate a dictionary of process tomography experiment configurations.\n\n This returns a data structure that is used by other tomography functions\n to generate state and process tomography circuits, and e... | 2,854,921,193,160,348,000 | Generate a dictionary of process tomography experiment configurations.
This returns a data structure that is used by other tomography functions
to generate state and process tomography circuits, and extract tomography
data from results after execution on a backend.
A quantum process tomography set is created by sp... | qiskit/tools/qcvv/tomography.py | process_tomography_set | filemaster/qiskit-terra | python | def process_tomography_set(meas_qubits, meas_basis='Pauli', prep_qubits=None, prep_basis='SIC'):
'\n Generate a dictionary of process tomography experiment configurations.\n\n This returns a data structure that is used by other tomography functions\n to generate state and process tomography circuits, and e... |
def tomography_circuit_names(tomo_set, name=''):
'\n Return a list of tomography circuit names.\n\n The returned list is the same as the one returned by\n `create_tomography_circuits` and can be used by a QuantumProgram\n to execute tomography circuits and extract measurement results.\n\n Args:\n ... | 3,232,676,696,004,374,000 | Return a list of tomography circuit names.
The returned list is the same as the one returned by
`create_tomography_circuits` and can be used by a QuantumProgram
to execute tomography circuits and extract measurement results.
Args:
tomo_set (tomography_set): a tomography set generated by
`tomography_set`.
... | qiskit/tools/qcvv/tomography.py | tomography_circuit_names | filemaster/qiskit-terra | python | def tomography_circuit_names(tomo_set, name=):
'\n Return a list of tomography circuit names.\n\n The returned list is the same as the one returned by\n `create_tomography_circuits` and can be used by a QuantumProgram\n to execute tomography circuits and extract measurement results.\n\n Args:\n ... |
def create_tomography_circuits(circuit, qreg, creg, tomoset):
"\n Add tomography measurement circuits to a QuantumProgram.\n\n The quantum program must contain a circuit 'name', which is treated as a\n state preparation circuit for state tomography, or as teh circuit being\n measured for process tomogra... | 5,433,345,039,005,012,000 | Add tomography measurement circuits to a QuantumProgram.
The quantum program must contain a circuit 'name', which is treated as a
state preparation circuit for state tomography, or as teh circuit being
measured for process tomography. This function then appends the circuit
with a set of measurements specified by the i... | qiskit/tools/qcvv/tomography.py | create_tomography_circuits | filemaster/qiskit-terra | python | def create_tomography_circuits(circuit, qreg, creg, tomoset):
"\n Add tomography measurement circuits to a QuantumProgram.\n\n The quantum program must contain a circuit 'name', which is treated as a\n state preparation circuit for state tomography, or as teh circuit being\n measured for process tomogra... |
def tomography_data(results, name, tomoset):
'\n Return a results dict for a state or process tomography experiment.\n\n Args:\n results (Result): Results from execution of a process tomography\n circuits on a backend.\n name (string): The name of the circuit being reconstructed.\n ... | 4,341,700,413,205,243,400 | Return a results dict for a state or process tomography experiment.
Args:
results (Result): Results from execution of a process tomography
circuits on a backend.
name (string): The name of the circuit being reconstructed.
tomoset (tomography_set): the dict of tomography configurations.
Returns:
... | qiskit/tools/qcvv/tomography.py | tomography_data | filemaster/qiskit-terra | python | def tomography_data(results, name, tomoset):
'\n Return a results dict for a state or process tomography experiment.\n\n Args:\n results (Result): Results from execution of a process tomography\n circuits on a backend.\n name (string): The name of the circuit being reconstructed.\n ... |
def marginal_counts(counts, meas_qubits):
"\n Compute the marginal counts for a subset of measured qubits.\n\n Args:\n counts (dict): the counts returned from a backend ({str: int}).\n meas_qubits (list[int]): the qubits to return the marginal\n counts distributio... | -5,976,532,595,156,514,000 | Compute the marginal counts for a subset of measured qubits.
Args:
counts (dict): the counts returned from a backend ({str: int}).
meas_qubits (list[int]): the qubits to return the marginal
counts distribution for.
Returns:
dict: A counts dict for the meas_qubits.abs
Examp... | qiskit/tools/qcvv/tomography.py | marginal_counts | filemaster/qiskit-terra | python | def marginal_counts(counts, meas_qubits):
"\n Compute the marginal counts for a subset of measured qubits.\n\n Args:\n counts (dict): the counts returned from a backend ({str: int}).\n meas_qubits (list[int]): the qubits to return the marginal\n counts distributio... |
def count_keys(n):
"Generate outcome bitstrings for n-qubits.\n\n Args:\n n (int): the number of qubits.\n\n Returns:\n list: A list of bitstrings ordered as follows:\n Example: n=2 returns ['00', '01', '10', '11'].\n "
return [bin(j)[2:].zfill(n) for j in range((2 ** n))] | 4,993,537,896,861,154,000 | Generate outcome bitstrings for n-qubits.
Args:
n (int): the number of qubits.
Returns:
list: A list of bitstrings ordered as follows:
Example: n=2 returns ['00', '01', '10', '11']. | qiskit/tools/qcvv/tomography.py | count_keys | filemaster/qiskit-terra | python | def count_keys(n):
"Generate outcome bitstrings for n-qubits.\n\n Args:\n n (int): the number of qubits.\n\n Returns:\n list: A list of bitstrings ordered as follows:\n Example: n=2 returns ['00', '01', '10', '11'].\n "
return [bin(j)[2:].zfill(n) for j in range((2 ** n))] |
def fit_tomography_data(tomo_data, method='wizard', options=None):
"\n Reconstruct a density matrix or process-matrix from tomography data.\n\n If the input data is state_tomography_data the returned operator will\n be a density matrix. If the input data is process_tomography_data the\n returned operato... | 1,225,486,021,359,920,400 | Reconstruct a density matrix or process-matrix from tomography data.
If the input data is state_tomography_data the returned operator will
be a density matrix. If the input data is process_tomography_data the
returned operator will be a Choi-matrix in the column-vectorization
convention.
Args:
tomo_data (dict): p... | qiskit/tools/qcvv/tomography.py | fit_tomography_data | filemaster/qiskit-terra | python | def fit_tomography_data(tomo_data, method='wizard', options=None):
"\n Reconstruct a density matrix or process-matrix from tomography data.\n\n If the input data is state_tomography_data the returned operator will\n be a density matrix. If the input data is process_tomography_data the\n returned operato... |
def __get_option(opt, options):
'\n Return an optional value or None if not found.\n '
if (options is not None):
if (opt in options):
return options[opt]
return None | -5,979,756,822,097,294,000 | Return an optional value or None if not found. | qiskit/tools/qcvv/tomography.py | __get_option | filemaster/qiskit-terra | python | def __get_option(opt, options):
'\n \n '
if (options is not None):
if (opt in options):
return options[opt]
return None |
def __leastsq_fit(tomo_data, weights=None, trace=None, beta=None):
'\n Reconstruct a state from unconstrained least-squares fitting.\n\n Args:\n tomo_data (list[dict]): state or process tomography data.\n weights (list or array or None): weights to use for least squares\n fitting. The... | 5,078,531,888,912,305,000 | Reconstruct a state from unconstrained least-squares fitting.
Args:
tomo_data (list[dict]): state or process tomography data.
weights (list or array or None): weights to use for least squares
fitting. The default is standard deviation from a binomial
distribution.
trace (float or None): tra... | qiskit/tools/qcvv/tomography.py | __leastsq_fit | filemaster/qiskit-terra | python | def __leastsq_fit(tomo_data, weights=None, trace=None, beta=None):
'\n Reconstruct a state from unconstrained least-squares fitting.\n\n Args:\n tomo_data (list[dict]): state or process tomography data.\n weights (list or array or None): weights to use for least squares\n fitting. The... |
def __projector(op_list, basis):
'Returns a projectors.\n '
ret = 1
for op in op_list:
(label, eigenstate) = op
ret = np.kron(basis[label][eigenstate], ret)
return ret | 6,264,293,341,667,256,000 | Returns a projectors. | qiskit/tools/qcvv/tomography.py | __projector | filemaster/qiskit-terra | python | def __projector(op_list, basis):
'\n '
ret = 1
for op in op_list:
(label, eigenstate) = op
ret = np.kron(basis[label][eigenstate], ret)
return ret |
def __tomo_linear_inv(freqs, ops, weights=None, trace=None):
'\n Reconstruct a matrix through linear inversion.\n\n Args:\n freqs (list[float]): list of observed frequences.\n ops (list[np.array]): list of corresponding projectors.\n weights (list[float] or array_like):\n weigh... | 2,932,244,388,342,729,700 | Reconstruct a matrix through linear inversion.
Args:
freqs (list[float]): list of observed frequences.
ops (list[np.array]): list of corresponding projectors.
weights (list[float] or array_like):
weights to be used for weighted fitting.
trace (float or None): trace of returned operator.
Return... | qiskit/tools/qcvv/tomography.py | __tomo_linear_inv | filemaster/qiskit-terra | python | def __tomo_linear_inv(freqs, ops, weights=None, trace=None):
'\n Reconstruct a matrix through linear inversion.\n\n Args:\n freqs (list[float]): list of observed frequences.\n ops (list[np.array]): list of corresponding projectors.\n weights (list[float] or array_like):\n weigh... |
def __wizard(rho, epsilon=None):
'\n Returns the nearest positive semidefinite operator to an operator.\n\n This method is based on reference [1]. It constrains positivity\n by setting negative eigenvalues to zero and rescaling the positive\n eigenvalues.\n\n Args:\n rho (array_like): the inpu... | -4,302,117,271,755,895,300 | Returns the nearest positive semidefinite operator to an operator.
This method is based on reference [1]. It constrains positivity
by setting negative eigenvalues to zero and rescaling the positive
eigenvalues.
Args:
rho (array_like): the input operator.
epsilon(float or None): threshold (>=0) for truncating ... | qiskit/tools/qcvv/tomography.py | __wizard | filemaster/qiskit-terra | python | def __wizard(rho, epsilon=None):
'\n Returns the nearest positive semidefinite operator to an operator.\n\n This method is based on reference [1]. It constrains positivity\n by setting negative eigenvalues to zero and rescaling the positive\n eigenvalues.\n\n Args:\n rho (array_like): the inpu... |
def build_wigner_circuits(circuit, phis, thetas, qubits, qreg, creg):
'Create the circuits to rotate to points in phase space\n Args:\n circuit (QuantumCircuit): The circuit to be appended with tomography\n state preparation and/or measurements.\n phis (np.matrix[[c... | 8,931,927,208,068,485,000 | Create the circuits to rotate to points in phase space
Args:
circuit (QuantumCircuit): The circuit to be appended with tomography
state preparation and/or measurements.
phis (np.matrix[[complex]]): phis
thetas (np.matrix[[complex]]): thetas
qubits (list[int]): a list of the... | qiskit/tools/qcvv/tomography.py | build_wigner_circuits | filemaster/qiskit-terra | python | def build_wigner_circuits(circuit, phis, thetas, qubits, qreg, creg):
'Create the circuits to rotate to points in phase space\n Args:\n circuit (QuantumCircuit): The circuit to be appended with tomography\n state preparation and/or measurements.\n phis (np.matrix[[c... |
def wigner_data(q_result, meas_qubits, labels, shots=None):
'Get the value of the Wigner function from measurement results.\n\n Args:\n q_result (Result): Results from execution of a state tomography\n circuits on a backend.\n meas_qubits (list[int]): a list of the qubit ... | -6,619,506,774,687,886,000 | Get the value of the Wigner function from measurement results.
Args:
q_result (Result): Results from execution of a state tomography
circuits on a backend.
meas_qubits (list[int]): a list of the qubit indexes measured.
labels (list[str]): a list of names of the circuits
shots (i... | qiskit/tools/qcvv/tomography.py | wigner_data | filemaster/qiskit-terra | python | def wigner_data(q_result, meas_qubits, labels, shots=None):
'Get the value of the Wigner function from measurement results.\n\n Args:\n q_result (Result): Results from execution of a state tomography\n circuits on a backend.\n meas_qubits (list[int]): a list of the qubit ... |
def prep_gate(self, circuit, qreg, op):
'\n Add state preparation gates to a circuit.\n\n Args:\n circuit (QuantumCircuit): circuit to add a preparation to.\n qreg (tuple(QuantumRegister,int)): quantum register to apply\n preparation to.\n op (tuple(str, int... | -3,505,176,667,774,246,000 | Add state preparation gates to a circuit.
Args:
circuit (QuantumCircuit): circuit to add a preparation to.
qreg (tuple(QuantumRegister,int)): quantum register to apply
preparation to.
op (tuple(str, int)): the basis label and index for the
preparation op. | qiskit/tools/qcvv/tomography.py | prep_gate | filemaster/qiskit-terra | python | def prep_gate(self, circuit, qreg, op):
'\n Add state preparation gates to a circuit.\n\n Args:\n circuit (QuantumCircuit): circuit to add a preparation to.\n qreg (tuple(QuantumRegister,int)): quantum register to apply\n preparation to.\n op (tuple(str, int... |
def meas_gate(self, circuit, qreg, op):
'\n Add measurement gates to a circuit.\n\n Args:\n circuit (QuantumCircuit): circuit to add measurement to.\n qreg (tuple(QuantumRegister,int)): quantum register being measured.\n op (str): the basis label for the measurement.\n... | -2,191,418,647,831,939,800 | Add measurement gates to a circuit.
Args:
circuit (QuantumCircuit): circuit to add measurement to.
qreg (tuple(QuantumRegister,int)): quantum register being measured.
op (str): the basis label for the measurement. | qiskit/tools/qcvv/tomography.py | meas_gate | filemaster/qiskit-terra | python | def meas_gate(self, circuit, qreg, op):
'\n Add measurement gates to a circuit.\n\n Args:\n circuit (QuantumCircuit): circuit to add measurement to.\n qreg (tuple(QuantumRegister,int)): quantum register being measured.\n op (str): the basis label for the measurement.\n... |
def __init__(self, cmndpipe, rspdpipe):
'\n Create a PyQt viewer which reads commands from the Pipe\n cmndpipe and writes responses back to rspdpipe.\n '
super(PipedImagerPQ, self).__init__()
self.__cmndpipe = cmndpipe
self.__rspdpipe = rspdpipe
signal.signal(signal.SIGINT, sign... | -8,444,863,606,549,846,000 | Create a PyQt viewer which reads commands from the Pipe
cmndpipe and writes responses back to rspdpipe. | pviewmod/pipedimagerpq.py | __init__ | Jhongesell/PyFerret | python | def __init__(self, cmndpipe, rspdpipe):
'\n Create a PyQt viewer which reads commands from the Pipe\n cmndpipe and writes responses back to rspdpipe.\n '
super(PipedImagerPQ, self).__init__()
self.__cmndpipe = cmndpipe
self.__rspdpipe = rspdpipe
signal.signal(signal.SIGINT, sign... |
def createMenus(self):
'\n Create the menu items for the viewer\n using the previously created actions.\n '
menuBar = self.menuBar()
sceneMenu = menuBar.addMenu(menuBar.tr('&Image'))
sceneMenu.addAction(self.__scaleact)
sceneMenu.addAction(self.__saveact)
sceneMenu.addAction... | -6,105,742,166,732,878,000 | Create the menu items for the viewer
using the previously created actions. | pviewmod/pipedimagerpq.py | createMenus | Jhongesell/PyFerret | python | def createMenus(self):
'\n Create the menu items for the viewer\n using the previously created actions.\n '
menuBar = self.menuBar()
sceneMenu = menuBar.addMenu(menuBar.tr('&Image'))
sceneMenu.addAction(self.__scaleact)
sceneMenu.addAction(self.__saveact)
sceneMenu.addAction... |
def resizeEvent(self, event):
'\n Monitor resizing in case auto-scaling of the image is selected.\n '
if self.__autoscale:
if self.autoScaleScene():
event.accept()
else:
event.ignore()
else:
event.accept() | -7,212,234,922,400,166,000 | Monitor resizing in case auto-scaling of the image is selected. | pviewmod/pipedimagerpq.py | resizeEvent | Jhongesell/PyFerret | python | def resizeEvent(self, event):
'\n \n '
if self.__autoscale:
if self.autoScaleScene():
event.accept()
else:
event.ignore()
else:
event.accept() |
def closeEvent(self, event):
'\n Clean up and send the WINDOW_CLOSED_MESSAGE on the response pipe \n before closing the window.\n '
self.__timer.stop()
self.__cmndpipe.close()
try:
try:
self.__rspdpipe.send(WINDOW_CLOSED_MESSAGE)
finally:
self... | 4,528,090,795,886,455,300 | Clean up and send the WINDOW_CLOSED_MESSAGE on the response pipe
before closing the window. | pviewmod/pipedimagerpq.py | closeEvent | Jhongesell/PyFerret | python | def closeEvent(self, event):
'\n Clean up and send the WINDOW_CLOSED_MESSAGE on the response pipe \n before closing the window.\n '
self.__timer.stop()
self.__cmndpipe.close()
try:
try:
self.__rspdpipe.send(WINDOW_CLOSED_MESSAGE)
finally:
self... |
def exitViewer(self):
'\n Close and exit the viewer.\n '
self.close() | 9,079,184,898,135,921,000 | Close and exit the viewer. | pviewmod/pipedimagerpq.py | exitViewer | Jhongesell/PyFerret | python | def exitViewer(self):
'\n \n '
self.close() |
def ignoreAlpha(self):
'\n Return whether the alpha channel in colors should always be ignored.\n '
return self.__noalpha | -836,406,128,240,010,500 | Return whether the alpha channel in colors should always be ignored. | pviewmod/pipedimagerpq.py | ignoreAlpha | Jhongesell/PyFerret | python | def ignoreAlpha(self):
'\n \n '
return self.__noalpha |
def updateScene(self):
'\n Clear the displayed scene using self.__lastclearcolor,\n then draw the scaled current image.\n '
labelwidth = int(((self.__scalefactor * self.__scenewidth) + 0.5))
labelheight = int(((self.__scalefactor * self.__sceneheight) + 0.5))
newpixmap = QPixmap(lab... | -1,039,652,449,111,709,000 | Clear the displayed scene using self.__lastclearcolor,
then draw the scaled current image. | pviewmod/pipedimagerpq.py | updateScene | Jhongesell/PyFerret | python | def updateScene(self):
'\n Clear the displayed scene using self.__lastclearcolor,\n then draw the scaled current image.\n '
labelwidth = int(((self.__scalefactor * self.__scenewidth) + 0.5))
labelheight = int(((self.__scalefactor * self.__sceneheight) + 0.5))
newpixmap = QPixmap(lab... |
def clearScene(self, bkgcolor=None):
'\n Deletes the scene image and fills the label with bkgcolor.\n If bkgcolor is None or an invalid color, the color used is \n the one used from the last clearScene or redrawScene call \n with a valid color (or opaque white if a color has never \n ... | -7,456,187,501,108,598,000 | Deletes the scene image and fills the label with bkgcolor.
If bkgcolor is None or an invalid color, the color used is
the one used from the last clearScene or redrawScene call
with a valid color (or opaque white if a color has never
been specified). | pviewmod/pipedimagerpq.py | clearScene | Jhongesell/PyFerret | python | def clearScene(self, bkgcolor=None):
'\n Deletes the scene image and fills the label with bkgcolor.\n If bkgcolor is None or an invalid color, the color used is \n the one used from the last clearScene or redrawScene call \n with a valid color (or opaque white if a color has never \n ... |
def redrawScene(self, bkgcolor=None):
'\n Clear and redraw the displayed scene.\n '
if bkgcolor:
if bkgcolor.isValid():
self.__lastclearcolor = bkgcolor
QApplication.setOverrideCursor(Qt.WaitCursor)
self.statusBar().showMessage(self.tr('Redrawing image'))
try:
... | -6,725,467,494,940,689,000 | Clear and redraw the displayed scene. | pviewmod/pipedimagerpq.py | redrawScene | Jhongesell/PyFerret | python | def redrawScene(self, bkgcolor=None):
'\n \n '
if bkgcolor:
if bkgcolor.isValid():
self.__lastclearcolor = bkgcolor
QApplication.setOverrideCursor(Qt.WaitCursor)
self.statusBar().showMessage(self.tr('Redrawing image'))
try:
self.updateScene()
finally:
... |
def resizeScene(self, width, height):
'\n Resize the scene to the given width and height in units of pixels.\n If the size changes, this deletes the current image and clear the\n displayed scene.\n '
newwidth = int((width + 0.5))
if (newwidth < self.__minsize):
newwidth =... | -7,876,032,258,201,786,000 | Resize the scene to the given width and height in units of pixels.
If the size changes, this deletes the current image and clear the
displayed scene. | pviewmod/pipedimagerpq.py | resizeScene | Jhongesell/PyFerret | python | def resizeScene(self, width, height):
'\n Resize the scene to the given width and height in units of pixels.\n If the size changes, this deletes the current image and clear the\n displayed scene.\n '
newwidth = int((width + 0.5))
if (newwidth < self.__minsize):
newwidth =... |
def loadNewSceneImage(self, imageinfo):
'\n Create a new scene image from the information given in this\n and subsequent dictionaries imageinfo. The image is created\n from multiple calls to this function since there is a limit\n on the size of a single object passed through a pipe.\n ... | 7,243,623,650,107,950,000 | Create a new scene image from the information given in this
and subsequent dictionaries imageinfo. The image is created
from multiple calls to this function since there is a limit
on the size of a single object passed through a pipe.
The first imageinfo dictionary given when creating an image
must define the followin... | pviewmod/pipedimagerpq.py | loadNewSceneImage | Jhongesell/PyFerret | python | def loadNewSceneImage(self, imageinfo):
'\n Create a new scene image from the information given in this\n and subsequent dictionaries imageinfo. The image is created\n from multiple calls to this function since there is a limit\n on the size of a single object passed through a pipe.\n ... |
def inquireSceneScale(self):
'\n Prompt the user for the desired scaling factor for the scene.\n '
labelwidth = int(((self.__scenewidth * self.__scalefactor) + 0.5))
labelheight = int(((self.__sceneheight * self.__scalefactor) + 0.5))
scaledlg = ScaleDialogPQ(self.__scalefactor, labelwidth... | -6,377,533,769,439,809,000 | Prompt the user for the desired scaling factor for the scene. | pviewmod/pipedimagerpq.py | inquireSceneScale | Jhongesell/PyFerret | python | def inquireSceneScale(self):
'\n \n '
labelwidth = int(((self.__scenewidth * self.__scalefactor) + 0.5))
labelheight = int(((self.__sceneheight * self.__scalefactor) + 0.5))
scaledlg = ScaleDialogPQ(self.__scalefactor, labelwidth, labelheight, self.__minsize, self.__minsize, self.__autosca... |
def autoScaleScene(self):
'\n Selects a scaling factor that maximizes the scene within the window \n frame without requiring scroll bars. Intended to be called when\n the window size is changed by the user and auto-scaling is turn on.\n\n Returns:\n True if scaling of this sc... | -2,819,780,426,648,615,400 | Selects a scaling factor that maximizes the scene within the window
frame without requiring scroll bars. Intended to be called when
the window size is changed by the user and auto-scaling is turn on.
Returns:
True if scaling of this scene is done (no window resize)
False if the a window resize command was is... | pviewmod/pipedimagerpq.py | autoScaleScene | Jhongesell/PyFerret | python | def autoScaleScene(self):
'\n Selects a scaling factor that maximizes the scene within the window \n frame without requiring scroll bars. Intended to be called when\n the window size is changed by the user and auto-scaling is turn on.\n\n Returns:\n True if scaling of this sc... |
def scaleScene(self, factor, resizewin):
'\n Scales both the horizontal and vertical directions by factor.\n Scaling factors are not accumulative. So if the scene was\n already scaled, that scaling is "removed" before this scaling\n factor is applied. If resizewin is True, the main win... | 5,059,421,301,477,726,000 | Scales both the horizontal and vertical directions by factor.
Scaling factors are not accumulative. So if the scene was
already scaled, that scaling is "removed" before this scaling
factor is applied. If resizewin is True, the main window is
resized to accommodate this new scaled scene size.
If factor is zero, just... | pviewmod/pipedimagerpq.py | scaleScene | Jhongesell/PyFerret | python | def scaleScene(self, factor, resizewin):
'\n Scales both the horizontal and vertical directions by factor.\n Scaling factors are not accumulative. So if the scene was\n already scaled, that scaling is "removed" before this scaling\n factor is applied. If resizewin is True, the main win... |
def inquireSaveFilename(self):
'\n Prompt the user for the name of the file into which to save the scene.\n The file format will be determined from the filename extension.\n '
formattypes = [('png', 'PNG - Portable Networks Graphics (*.png)'), ('jpeg', 'JPEG - Joint Photographic Experts Gro... | 1,811,016,900,019,698,700 | Prompt the user for the name of the file into which to save the scene.
The file format will be determined from the filename extension. | pviewmod/pipedimagerpq.py | inquireSaveFilename | Jhongesell/PyFerret | python | def inquireSaveFilename(self):
'\n Prompt the user for the name of the file into which to save the scene.\n The file format will be determined from the filename extension.\n '
formattypes = [('png', 'PNG - Portable Networks Graphics (*.png)'), ('jpeg', 'JPEG - Joint Photographic Experts Gro... |
def saveSceneToFile(self, filename, imageformat, transparent, rastsize):
'\n Save the current scene to the named file.\n \n If imageformat is empty or None, the format is guessed from\n the filename extension.\n\n If transparent is False, the entire scene is initialized\n t... | 5,735,915,115,842,178,000 | Save the current scene to the named file.
If imageformat is empty or None, the format is guessed from
the filename extension.
If transparent is False, the entire scene is initialized
to the last clearing color.
If given, rastsize is the pixels size of the saved image.
If rastsize is not given, the saved image will b... | pviewmod/pipedimagerpq.py | saveSceneToFile | Jhongesell/PyFerret | python | def saveSceneToFile(self, filename, imageformat, transparent, rastsize):
'\n Save the current scene to the named file.\n \n If imageformat is empty or None, the format is guessed from\n the filename extension.\n\n If transparent is False, the entire scene is initialized\n t... |
def checkCommandPipe(self):
'\n Get and perform commands waiting in the pipe.\n Stop when no more commands or if more than 50\n milliseconds have passed.\n '
try:
starttime = time.clock()
while self.__cmndpipe.poll(0.002):
cmnd = self.__cmndpipe.recv()
... | -1,018,358,762,143,865,300 | Get and perform commands waiting in the pipe.
Stop when no more commands or if more than 50
milliseconds have passed. | pviewmod/pipedimagerpq.py | checkCommandPipe | Jhongesell/PyFerret | python | def checkCommandPipe(self):
'\n Get and perform commands waiting in the pipe.\n Stop when no more commands or if more than 50\n milliseconds have passed.\n '
try:
starttime = time.clock()
while self.__cmndpipe.poll(0.002):
cmnd = self.__cmndpipe.recv()
... |
def processCommand(self, cmnd):
'\n Examine the action of cmnd and call the appropriate\n method to deal with this command. Raises a KeyError\n if the "action" key is missing.\n '
try:
cmndact = cmnd['action']
except KeyError:
raise ValueError(("Unknown command '... | -6,530,815,419,400,795,000 | Examine the action of cmnd and call the appropriate
method to deal with this command. Raises a KeyError
if the "action" key is missing. | pviewmod/pipedimagerpq.py | processCommand | Jhongesell/PyFerret | python | def processCommand(self, cmnd):
'\n Examine the action of cmnd and call the appropriate\n method to deal with this command. Raises a KeyError\n if the "action" key is missing.\n '
try:
cmndact = cmnd['action']
except KeyError:
raise ValueError(("Unknown command '... |
def __init__(self, cmndpipe, rspdpipe):
'\n Create a Process that will produce a PipedImagerPQ\n attached to the given Pipes when run.\n '
super(PipedImagerPQProcess, self).__init__(group=None, target=None, name='PipedImagerPQ')
self.__cmndpipe = cmndpipe
self.__rspdpipe = rspdpipe
... | 2,727,524,586,828,027,000 | Create a Process that will produce a PipedImagerPQ
attached to the given Pipes when run. | pviewmod/pipedimagerpq.py | __init__ | Jhongesell/PyFerret | python | def __init__(self, cmndpipe, rspdpipe):
'\n Create a Process that will produce a PipedImagerPQ\n attached to the given Pipes when run.\n '
super(PipedImagerPQProcess, self).__init__(group=None, target=None, name='PipedImagerPQ')
self.__cmndpipe = cmndpipe
self.__rspdpipe = rspdpipe
... |
def run(self):
'\n Create a PipedImagerPQ that is attached\n to the Pipe of this instance.\n '
self.__app = QApplication(['PipedImagerPQ'])
self.__viewer = PipedImagerPQ(self.__cmndpipe, self.__rspdpipe)
myresult = self.__app.exec_()
sys.exit(myresult) | -3,157,003,115,251,203,000 | Create a PipedImagerPQ that is attached
to the Pipe of this instance. | pviewmod/pipedimagerpq.py | run | Jhongesell/PyFerret | python | def run(self):
'\n Create a PipedImagerPQ that is attached\n to the Pipe of this instance.\n '
self.__app = QApplication(['PipedImagerPQ'])
self.__viewer = PipedImagerPQ(self.__cmndpipe, self.__rspdpipe)
myresult = self.__app.exec_()
sys.exit(myresult) |
def __init__(self, parent, cmndpipe, rspdpipe, cmndlist):
'\n Create a QDialog with a single QPushButton for controlling\n the submission of commands from cmndlist to cmndpipe.\n '
super(_CommandSubmitterPQ, self).__init__(parent)
self.__cmndlist = cmndlist
self.__cmndpipe = cmndpip... | 5,109,366,959,997,596,000 | Create a QDialog with a single QPushButton for controlling
the submission of commands from cmndlist to cmndpipe. | pviewmod/pipedimagerpq.py | __init__ | Jhongesell/PyFerret | python | def __init__(self, parent, cmndpipe, rspdpipe, cmndlist):
'\n Create a QDialog with a single QPushButton for controlling\n the submission of commands from cmndlist to cmndpipe.\n '
super(_CommandSubmitterPQ, self).__init__(parent)
self.__cmndlist = cmndlist
self.__cmndpipe = cmndpip... |
def submitNextCommand(self):
'\n Submit the next command from the command list to the command pipe,\n or shutdown if there are no more commands to submit.\n '
try:
cmndstr = str(self.__cmndlist[self.__nextcmnd])
if (len(cmndstr) > 188):
cmndstr = (cmndstr[:188] +... | -4,546,979,611,108,747,000 | Submit the next command from the command list to the command pipe,
or shutdown if there are no more commands to submit. | pviewmod/pipedimagerpq.py | submitNextCommand | Jhongesell/PyFerret | python | def submitNextCommand(self):
'\n Submit the next command from the command list to the command pipe,\n or shutdown if there are no more commands to submit.\n '
try:
cmndstr = str(self.__cmndlist[self.__nextcmnd])
if (len(cmndstr) > 188):
cmndstr = (cmndstr[:188] +... |
def split_match(self, match):
'Override this method to prefix the error message with the lint binary name.'
(match, line, col, error, warning, message, near) = super().split_match(match)
if match:
message = ('[vcom] ' + message)
return (match, line, col, error, warning, message, near) | 6,648,812,486,559,834,000 | Override this method to prefix the error message with the lint binary name. | linter.py | split_match | dave2pi/SublimeLinter-contrib-vcom | python | def split_match(self, match):
(match, line, col, error, warning, message, near) = super().split_match(match)
if match:
message = ('[vcom] ' + message)
return (match, line, col, error, warning, message, near) |
def setUp(self):
'See unittest.TestCase.setUp for full specification.\n\n Overriding implementations must call this implementation.\n '
self._control = test_control.PauseFailControl()
self._digest_pool = logging_pool.pool(test_constants.POOL_SIZE)
self._digest = _digest.digest(_stock_service.STOCK... | 5,657,211,816,029,526,000 | See unittest.TestCase.setUp for full specification.
Overriding implementations must call this implementation. | src/python/grpcio/tests/unit/framework/interfaces/face/_future_invocation_asynchronous_event_service.py | setUp | DiracResearch/grpc | python | def setUp(self):
'See unittest.TestCase.setUp for full specification.\n\n Overriding implementations must call this implementation.\n '
self._control = test_control.PauseFailControl()
self._digest_pool = logging_pool.pool(test_constants.POOL_SIZE)
self._digest = _digest.digest(_stock_service.STOCK... |
def tearDown(self):
'See unittest.TestCase.tearDown for full specification.\n\n Overriding implementations must call this implementation.\n '
self._invoker = None
self.implementation.destantiate(self._memo)
self._digest_pool.shutdown(wait=True) | -5,514,593,741,479,847,000 | See unittest.TestCase.tearDown for full specification.
Overriding implementations must call this implementation. | src/python/grpcio/tests/unit/framework/interfaces/face/_future_invocation_asynchronous_event_service.py | tearDown | DiracResearch/grpc | python | def tearDown(self):
'See unittest.TestCase.tearDown for full specification.\n\n Overriding implementations must call this implementation.\n '
self._invoker = None
self.implementation.destantiate(self._memo)
self._digest_pool.shutdown(wait=True) |
def killall(self, everywhere=False):
'Kills all nailgun servers started by pants.\n\n :param bool everywhere: If ``True``, kills all pants-started nailguns on this machine;\n otherwise restricts the nailguns killed to those started for the\n curre... | 7,276,317,597,980,383,000 | Kills all nailgun servers started by pants.
:param bool everywhere: If ``True``, kills all pants-started nailguns on this machine;
otherwise restricts the nailguns killed to those started for the
current build root. | src/python/pants/java/nailgun_executor.py | killall | revl/pants | python | def killall(self, everywhere=False):
'Kills all nailgun servers started by pants.\n\n :param bool everywhere: If ``True``, kills all pants-started nailguns on this machine;\n otherwise restricts the nailguns killed to those started for the\n curre... |
@staticmethod
def _fingerprint(jvm_options, classpath, java_version):
'Compute a fingerprint for this invocation of a Java task.\n\n :param list jvm_options: JVM options passed to the java invocation\n :param list classpath: The -cp arguments passed to the java invocation\n :param Revision java... | -855,648,847,069,729,900 | Compute a fingerprint for this invocation of a Java task.
:param list jvm_options: JVM options passed to the java invocation
:param list classpath: The -cp arguments passed to the java invocation
:param Revision java_version: return value from Distribution.version()
:return: a hexstring representing a fingerprint of t... | src/python/pants/java/nailgun_executor.py | _fingerprint | revl/pants | python | @staticmethod
def _fingerprint(jvm_options, classpath, java_version):
'Compute a fingerprint for this invocation of a Java task.\n\n :param list jvm_options: JVM options passed to the java invocation\n :param list classpath: The -cp arguments passed to the java invocation\n :param Revision java... |
def _runner(self, classpath, main, jvm_options, args):
'Runner factory.\n\n Called via Executor.execute().\n '
command = self._create_command(classpath, main, jvm_options, args)
class Runner(self.Runner):
@property
def executor(this):
return self
@propert... | 964,269,671,404,280,400 | Runner factory.
Called via Executor.execute(). | src/python/pants/java/nailgun_executor.py | _runner | revl/pants | python | def _runner(self, classpath, main, jvm_options, args):
'Runner factory.\n\n Called via Executor.execute().\n '
command = self._create_command(classpath, main, jvm_options, args)
class Runner(self.Runner):
@property
def executor(this):
return self
@propert... |
def _get_nailgun_client(self, jvm_options, classpath, stdout, stderr, stdin):
'This (somewhat unfortunately) is the main entrypoint to this class via the Runner.\n\n It handles creation of the running nailgun server as well as creation of the client.\n '
classpath = (self._nailgun_classpath + clas... | 5,750,670,072,620,023,000 | This (somewhat unfortunately) is the main entrypoint to this class via the Runner.
It handles creation of the running nailgun server as well as creation of the client. | src/python/pants/java/nailgun_executor.py | _get_nailgun_client | revl/pants | python | def _get_nailgun_client(self, jvm_options, classpath, stdout, stderr, stdin):
'This (somewhat unfortunately) is the main entrypoint to this class via the Runner.\n\n It handles creation of the running nailgun server as well as creation of the client.\n '
classpath = (self._nailgun_classpath + clas... |
def _await_socket(self, timeout):
'Blocks for the nailgun subprocess to bind and emit a listening port in the nailgun\n stdout.'
start_time = time.time()
accumulated_stdout = ''
def calculate_remaining_time():
return (time.time() - (start_time + timeout))
def possibly_raise_timeout(... | -7,452,305,804,962,434,000 | Blocks for the nailgun subprocess to bind and emit a listening port in the nailgun
stdout. | src/python/pants/java/nailgun_executor.py | _await_socket | revl/pants | python | def _await_socket(self, timeout):
'Blocks for the nailgun subprocess to bind and emit a listening port in the nailgun\n stdout.'
start_time = time.time()
accumulated_stdout =
def calculate_remaining_time():
return (time.time() - (start_time + timeout))
def possibly_raise_timeout(re... |
def ensure_connectable(self, nailgun):
'Ensures that a nailgun client is connectable or raises NailgunError.'
attempt_count = 1
while 1:
try:
with closing(nailgun.try_connect()) as sock:
logger.debug('Verified new ng server is connectable at {}'.format(sock.getpeername())... | -8,188,085,437,961,309,000 | Ensures that a nailgun client is connectable or raises NailgunError. | src/python/pants/java/nailgun_executor.py | ensure_connectable | revl/pants | python | def ensure_connectable(self, nailgun):
attempt_count = 1
while 1:
try:
with closing(nailgun.try_connect()) as sock:
logger.debug('Verified new ng server is connectable at {}'.format(sock.getpeername()))
return
except nailgun.NailgunConnectionError... |
def _spawn_nailgun_server(self, fingerprint, jvm_options, classpath, stdout, stderr, stdin):
'Synchronously spawn a new nailgun server.'
safe_file_dump(self._ng_stdout, b'', mode='wb')
safe_file_dump(self._ng_stderr, b'', mode='wb')
jvm_options = (jvm_options + [self._PANTS_NG_BUILDROOT_ARG, self._creat... | -9,036,215,056,650,780,000 | Synchronously spawn a new nailgun server. | src/python/pants/java/nailgun_executor.py | _spawn_nailgun_server | revl/pants | python | def _spawn_nailgun_server(self, fingerprint, jvm_options, classpath, stdout, stderr, stdin):
safe_file_dump(self._ng_stdout, b, mode='wb')
safe_file_dump(self._ng_stderr, b, mode='wb')
jvm_options = (jvm_options + [self._PANTS_NG_BUILDROOT_ARG, self._create_owner_arg(self._workdir), self._create_finger... |
def _check_process_buildroot(self, process):
'Matches only processes started from the current buildroot.'
return (self._PANTS_NG_BUILDROOT_ARG in process.cmdline()) | 4,314,080,186,965,596,700 | Matches only processes started from the current buildroot. | src/python/pants/java/nailgun_executor.py | _check_process_buildroot | revl/pants | python | def _check_process_buildroot(self, process):
return (self._PANTS_NG_BUILDROOT_ARG in process.cmdline()) |
def is_alive(self):
'A ProcessManager.is_alive() override that ensures buildroot flags are present in the\n process command line arguments.'
return super().is_alive(self._check_process_buildroot) | -4,234,401,703,301,696,500 | A ProcessManager.is_alive() override that ensures buildroot flags are present in the
process command line arguments. | src/python/pants/java/nailgun_executor.py | is_alive | revl/pants | python | def is_alive(self):
'A ProcessManager.is_alive() override that ensures buildroot flags are present in the\n process command line arguments.'
return super().is_alive(self._check_process_buildroot) |
def post_fork_child(self, fingerprint, jvm_options, classpath, stdout, stderr):
'Post-fork() child callback for ProcessManager.daemon_spawn().'
java = SubprocessExecutor(self._distribution)
subproc = java.spawn(classpath=classpath, main='com.martiansoftware.nailgun.NGServer', jvm_options=jvm_options, args=[... | -1,710,778,269,961,609,500 | Post-fork() child callback for ProcessManager.daemon_spawn(). | src/python/pants/java/nailgun_executor.py | post_fork_child | revl/pants | python | def post_fork_child(self, fingerprint, jvm_options, classpath, stdout, stderr):
java = SubprocessExecutor(self._distribution)
subproc = java.spawn(classpath=classpath, main='com.martiansoftware.nailgun.NGServer', jvm_options=jvm_options, args=[':0'], stdin=safe_open('/dev/null', 'r'), stdout=safe_open(self... |
def __init__(self, io: StratumStyle, config: configparser.ConfigParser):
'\n Object constructor.\n\n :param PyStratumStyle io: The output decorator.\n '
self._code: str = ''
'\n The generated Python code buffer.\n '
self._lob_as_string_flag: bool = False
'\n ... | -2,458,651,980,066,538,000 | Object constructor.
:param PyStratumStyle io: The output decorator. | pystratum_common/backend/CommonRoutineWrapperGeneratorWorker.py | __init__ | DatabaseStratum/py-stratum-common | python | def __init__(self, io: StratumStyle, config: configparser.ConfigParser):
'\n Object constructor.\n\n :param PyStratumStyle io: The output decorator.\n '
self._code: str =
'\n The generated Python code buffer.\n '
self._lob_as_string_flag: bool = False
'\n I... |
def execute(self) -> int:
'\n The "main" of the wrapper generator. Returns 0 on success, 1 if one or more errors occurred.\n\n :rtype: int\n '
self._read_configuration_file()
if self._wrapper_class_name:
self._io.title('Wrapper')
self.__generate_wrapper_class()
s... | -8,795,018,086,121,583,000 | The "main" of the wrapper generator. Returns 0 on success, 1 if one or more errors occurred.
:rtype: int | pystratum_common/backend/CommonRoutineWrapperGeneratorWorker.py | execute | DatabaseStratum/py-stratum-common | python | def execute(self) -> int:
'\n The "main" of the wrapper generator. Returns 0 on success, 1 if one or more errors occurred.\n\n :rtype: int\n '
self._read_configuration_file()
if self._wrapper_class_name:
self._io.title('Wrapper')
self.__generate_wrapper_class()
s... |
def __generate_wrapper_class(self) -> None:
'\n Generates the wrapper class.\n '
routines = self._read_routine_metadata()
self._write_class_header()
if routines:
for routine_name in sorted(routines):
if (routines[routine_name]['designation'] != 'hidden'):
... | 4,423,072,790,207,266,300 | Generates the wrapper class. | pystratum_common/backend/CommonRoutineWrapperGeneratorWorker.py | __generate_wrapper_class | DatabaseStratum/py-stratum-common | python | def __generate_wrapper_class(self) -> None:
'\n \n '
routines = self._read_routine_metadata()
self._write_class_header()
if routines:
for routine_name in sorted(routines):
if (routines[routine_name]['designation'] != 'hidden'):
self._write_routine_functi... |
def _read_configuration_file(self) -> None:
'\n Reads parameters from the configuration file.\n '
self._parent_class_name = self._config.get('wrapper', 'parent_class')
self._parent_class_namespace = self._config.get('wrapper', 'parent_class_namespace')
self._wrapper_class_name = self._conf... | 8,673,982,918,055,212,000 | Reads parameters from the configuration file. | pystratum_common/backend/CommonRoutineWrapperGeneratorWorker.py | _read_configuration_file | DatabaseStratum/py-stratum-common | python | def _read_configuration_file(self) -> None:
'\n \n '
self._parent_class_name = self._config.get('wrapper', 'parent_class')
self._parent_class_namespace = self._config.get('wrapper', 'parent_class_namespace')
self._wrapper_class_name = self._config.get('wrapper', 'wrapper_class')
self._... |
def _read_routine_metadata(self) -> Dict:
'\n Returns the metadata of stored routines.\n\n :rtype: dict\n '
metadata = {}
if os.path.isfile(self._metadata_filename):
with open(self._metadata_filename, 'r') as file:
metadata = json.load(file)
return metadata | 8,979,833,419,646,104,000 | Returns the metadata of stored routines.
:rtype: dict | pystratum_common/backend/CommonRoutineWrapperGeneratorWorker.py | _read_routine_metadata | DatabaseStratum/py-stratum-common | python | def _read_routine_metadata(self) -> Dict:
'\n Returns the metadata of stored routines.\n\n :rtype: dict\n '
metadata = {}
if os.path.isfile(self._metadata_filename):
with open(self._metadata_filename, 'r') as file:
metadata = json.load(file)
return metadata |
def _write_class_header(self) -> None:
'\n Generate a class header for stored routine wrapper.\n '
self._write_line('from typing import Any, Dict, List, Optional, Union')
self._write_line()
self._write_line('from {0!s} import {1!s}'.format(self._parent_class_namespace, self._parent_class_n... | 1,402,745,181,515,204,400 | Generate a class header for stored routine wrapper. | pystratum_common/backend/CommonRoutineWrapperGeneratorWorker.py | _write_class_header | DatabaseStratum/py-stratum-common | python | def _write_class_header(self) -> None:
'\n \n '
self._write_line('from typing import Any, Dict, List, Optional, Union')
self._write_line()
self._write_line('from {0!s} import {1!s}'.format(self._parent_class_namespace, self._parent_class_name))
self._write_line()
self._write_line()... |
def _write_line(self, text: str='') -> None:
'\n Writes a line with Python code to the generate code buffer.\n\n :param str text: The line with Python code.\n '
if text:
self._code += (str(text) + '\n')
else:
self._code += '\n' | 5,762,203,659,539,912,000 | Writes a line with Python code to the generate code buffer.
:param str text: The line with Python code. | pystratum_common/backend/CommonRoutineWrapperGeneratorWorker.py | _write_line | DatabaseStratum/py-stratum-common | python | def _write_line(self, text: str=) -> None:
'\n Writes a line with Python code to the generate code buffer.\n\n :param str text: The line with Python code.\n '
if text:
self._code += (str(text) + '\n')
else:
self._code += '\n' |
def _write_class_trailer(self) -> None:
'\n Generate a class trailer for stored routine wrapper.\n '
self._write_line()
self._write_line()
self._write_line(('# ' + ('-' * 118))) | 1,877,206,851,702,984,400 | Generate a class trailer for stored routine wrapper. | pystratum_common/backend/CommonRoutineWrapperGeneratorWorker.py | _write_class_trailer | DatabaseStratum/py-stratum-common | python | def _write_class_trailer(self) -> None:
'\n \n '
self._write_line()
self._write_line()
self._write_line(('# ' + ('-' * 118))) |
@abc.abstractmethod
def _write_routine_function(self, routine: Dict[(str, Any)]) -> None:
'\n Generates a complete wrapper method for a stored routine.\n\n :param dict routine: The metadata of the stored routine.\n '
raise NotImplementedError() | -2,223,047,177,619,755,500 | Generates a complete wrapper method for a stored routine.
:param dict routine: The metadata of the stored routine. | pystratum_common/backend/CommonRoutineWrapperGeneratorWorker.py | _write_routine_function | DatabaseStratum/py-stratum-common | python | @abc.abstractmethod
def _write_routine_function(self, routine: Dict[(str, Any)]) -> None:
'\n Generates a complete wrapper method for a stored routine.\n\n :param dict routine: The metadata of the stored routine.\n '
raise NotImplementedError() |
def get_parser():
'Parser to specify arguments and their defaults.'
parser = argparse.ArgumentParser(prog='neuropredict', formatter_class=argparse.RawTextHelpFormatter, description='Easy, standardized and comprehensive predictive analysis.')
help_text_fs_dir = textwrap.dedent('\n Absolute path to ``SUBJE... | -1,475,722,670,201,997,800 | Parser to specify arguments and their defaults. | neuropredict/run_workflow.py | get_parser | dinga92/neuropredict | python | def get_parser():
parser = argparse.ArgumentParser(prog='neuropredict', formatter_class=argparse.RawTextHelpFormatter, description='Easy, standardized and comprehensive predictive analysis.')
help_text_fs_dir = textwrap.dedent('\n Absolute path to ``SUBJECTS_DIR`` containing the finished runs of Freesur... |
def organize_inputs(user_args):
'\n Validates the input features specified and returns organized list of paths and readers.\n\n Parameters\n ----------\n user_args : ArgParse object\n Various options specified by the user.\n\n Returns\n -------\n user_feature_paths : list\n List o... | -745,357,083,414,423,400 | Validates the input features specified and returns organized list of paths and readers.
Parameters
----------
user_args : ArgParse object
Various options specified by the user.
Returns
-------
user_feature_paths : list
List of paths to specified input features
user_feature_type : str
String identifying th... | neuropredict/run_workflow.py | organize_inputs | dinga92/neuropredict | python | def organize_inputs(user_args):
'\n Validates the input features specified and returns organized list of paths and readers.\n\n Parameters\n ----------\n user_args : ArgParse object\n Various options specified by the user.\n\n Returns\n -------\n user_feature_paths : list\n List o... |
def parse_args():
'Parser/validator for the cmd line args.'
parser = get_parser()
if (len(sys.argv) < 2):
print('Too few arguments!')
parser.print_help()
parser.exit(1)
try:
user_args = parser.parse_args()
except:
parser.exit(1)
if ((len(sys.argv) == 3) an... | 1,028,055,262,831,333,100 | Parser/validator for the cmd line args. | neuropredict/run_workflow.py | parse_args | dinga92/neuropredict | python | def parse_args():
parser = get_parser()
if (len(sys.argv) < 2):
print('Too few arguments!')
parser.print_help()
parser.exit(1)
try:
user_args = parser.parse_args()
except:
parser.exit(1)
if ((len(sys.argv) == 3) and not_unspecified(user_args.make_vis)):
... |
def make_visualizations(results_file_path, out_dir, options_path=None):
'\n Produces the performance visualizations/comparisons from the cross-validation results.\n\n Parameters\n ----------\n results_file_path : str\n Path to file containing results produced by `rhst`\n\n out_dir : str\n ... | -877,074,157,645,304,800 | Produces the performance visualizations/comparisons from the cross-validation results.
Parameters
----------
results_file_path : str
Path to file containing results produced by `rhst`
out_dir : str
Path to a folder to store results. | neuropredict/run_workflow.py | make_visualizations | dinga92/neuropredict | python | def make_visualizations(results_file_path, out_dir, options_path=None):
'\n Produces the performance visualizations/comparisons from the cross-validation results.\n\n Parameters\n ----------\n results_file_path : str\n Path to file containing results produced by `rhst`\n\n out_dir : str\n ... |
def validate_class_set(classes, subgroups, positive_class=None):
'Ensures class names are valid and sub-groups exist.'
class_set = list(set(classes.values()))
sub_group_list = list()
if (subgroups != 'all'):
if isinstance(subgroups, str):
subgroups = [subgroups]
for comb in s... | -4,337,507,200,275,579,400 | Ensures class names are valid and sub-groups exist. | neuropredict/run_workflow.py | validate_class_set | dinga92/neuropredict | python | def validate_class_set(classes, subgroups, positive_class=None):
class_set = list(set(classes.values()))
sub_group_list = list()
if (subgroups != 'all'):
if isinstance(subgroups, str):
subgroups = [subgroups]
for comb in subgroups:
cls_list = comb.split(',')
... |
def import_datasets(method_list, out_dir, subjects, classes, feature_path, feature_type='dir_of_dirs'):
"\n Imports all the specified feature sets and organizes them into datasets.\n\n Parameters\n ----------\n method_list : list of callables\n Set of predefined methods returning a vector of feat... | 5,965,091,228,184,356,000 | Imports all the specified feature sets and organizes them into datasets.
Parameters
----------
method_list : list of callables
Set of predefined methods returning a vector of features for a given sample id and location
out_dir : str
Path to the output folder
subjects : list of str
List of sample ids
class... | neuropredict/run_workflow.py | import_datasets | dinga92/neuropredict | python | def import_datasets(method_list, out_dir, subjects, classes, feature_path, feature_type='dir_of_dirs'):
"\n Imports all the specified feature sets and organizes them into datasets.\n\n Parameters\n ----------\n method_list : list of callables\n Set of predefined methods returning a vector of feat... |
def make_method_list(fs_subject_dir, user_feature_paths, user_feature_type='dir_of_dirs'):
'\n Returns an organized list of feature paths and methods to read in features.\n\n Parameters\n ----------\n fs_subject_dir : str\n user_feature_paths : list of str\n user_feature_type : str\n\n Returns\... | -3,986,442,342,340,710,400 | Returns an organized list of feature paths and methods to read in features.
Parameters
----------
fs_subject_dir : str
user_feature_paths : list of str
user_feature_type : str
Returns
-------
feature_dir : list
method_list : list | neuropredict/run_workflow.py | make_method_list | dinga92/neuropredict | python | def make_method_list(fs_subject_dir, user_feature_paths, user_feature_type='dir_of_dirs'):
'\n Returns an organized list of feature paths and methods to read in features.\n\n Parameters\n ----------\n fs_subject_dir : str\n user_feature_paths : list of str\n user_feature_type : str\n\n Returns\... |
def prepare_and_run(subjects, classes, out_dir, options_path, user_feature_paths, user_feature_type, fs_subject_dir, train_perc, num_rep_cv, positive_class, sub_group_list, feature_selection_size, num_procs, grid_search_level, classifier, feat_select_method):
'Organizes the inputs and prepares them for CV'
(fea... | -2,289,500,217,651,069,400 | Organizes the inputs and prepares them for CV | neuropredict/run_workflow.py | prepare_and_run | dinga92/neuropredict | python | def prepare_and_run(subjects, classes, out_dir, options_path, user_feature_paths, user_feature_type, fs_subject_dir, train_perc, num_rep_cv, positive_class, sub_group_list, feature_selection_size, num_procs, grid_search_level, classifier, feat_select_method):
(feature_dir, method_list) = make_method_list(fs_su... |
def cli():
'\n Main entry point.\n\n '
(subjects, classes, out_dir, options_path, user_feature_paths, user_feature_type, fs_subject_dir, train_perc, num_rep_cv, positive_class, sub_group_list, feature_selection_size, num_procs, grid_search_level, classifier, feat_select_method) = parse_args()
print('R... | 2,863,102,169,206,160,000 | Main entry point. | neuropredict/run_workflow.py | cli | dinga92/neuropredict | python | def cli():
'\n \n\n '
(subjects, classes, out_dir, options_path, user_feature_paths, user_feature_type, fs_subject_dir, train_perc, num_rep_cv, positive_class, sub_group_list, feature_selection_size, num_procs, grid_search_level, classifier, feat_select_method) = parse_args()
print('Running neuropredi... |
def run(feature_sets, feature_type=cfg.default_feature_type, meta_data=None, output_dir=None, pipeline=None, train_perc=0.5, num_repetitions=200, positive_class=None, feat_sel_size=cfg.default_num_features_to_select, sub_groups='all', grid_search_level=cfg.GRIDSEARCH_LEVEL_DEFAULT, num_procs=2):
'\n Generate com... | 7,251,242,653,249,876,000 | Generate comprehensive report on the predictive performance for different feature sets and statistically compare them.
Main entry point for API access.
Parameters
----------
feature_sets : list
The input can be specified in either of the following ways:
- list of paths to pyradigm datasets saved on disk
... | neuropredict/run_workflow.py | run | dinga92/neuropredict | python | def run(feature_sets, feature_type=cfg.default_feature_type, meta_data=None, output_dir=None, pipeline=None, train_perc=0.5, num_repetitions=200, positive_class=None, feat_sel_size=cfg.default_num_features_to_select, sub_groups='all', grid_search_level=cfg.GRIDSEARCH_LEVEL_DEFAULT, num_procs=2):
'\n Generate com... |
def portfolio_computeKnm_np(X, Xbar, l, sigma):
'\n X: n x d\n l: d\n '
n = np.shape(X)[0]
m = np.shape(Xbar)[0]
xdim = np.shape(X)[1]
l = l.reshape(1, xdim)
X = (X / l)
Xbar = (Xbar / l)
Q = np.tile(np.sum((X * X), axis=1, keepdims=True), reps=(1, m))
Qbar = np.tile(np.sum(... | 9,051,418,591,690,908,000 | X: n x d
l: d | functions.py | portfolio_computeKnm_np | qphong/BayesOpt-LV | python | def portfolio_computeKnm_np(X, Xbar, l, sigma):
'\n X: n x d\n l: d\n '
n = np.shape(X)[0]
m = np.shape(Xbar)[0]
xdim = np.shape(X)[1]
l = l.reshape(1, xdim)
X = (X / l)
Xbar = (Xbar / l)
Q = np.tile(np.sum((X * X), axis=1, keepdims=True), reps=(1, m))
Qbar = np.tile(np.sum(... |
def portfolio_computeKnm(X, Xbar, l, sigma, dtype=tf.float32):
'\n X: n x d\n l: d\n '
n = tf.shape(X)[0]
m = tf.shape(Xbar)[0]
X = (X / l)
Xbar = (Xbar / l)
Q = tf.tile(tf.reduce_sum(tf.square(X), axis=1, keepdims=True), multiples=(1, m))
Qbar = tf.tile(tf.transpose(tf.reduce_sum(t... | 195,986,522,214,792,770 | X: n x d
l: d | functions.py | portfolio_computeKnm | qphong/BayesOpt-LV | python | def portfolio_computeKnm(X, Xbar, l, sigma, dtype=tf.float32):
'\n X: n x d\n l: d\n '
n = tf.shape(X)[0]
m = tf.shape(Xbar)[0]
X = (X / l)
Xbar = (Xbar / l)
Q = tf.tile(tf.reduce_sum(tf.square(X), axis=1, keepdims=True), multiples=(1, m))
Qbar = tf.tile(tf.transpose(tf.reduce_sum(t... |
def __init__(self, intermediate_directory='intermediates'):
'\n :param intermediate_directory: Directory, where the\n intermediate pandas dataframe should be persisted\n to.\n '
super(NumpyNullPreprocessor, self).__init__()
self._intermediate_directory = intermediate_dire... | -2,495,241,162,938,111,500 | :param intermediate_directory: Directory, where the
intermediate pandas dataframe should be persisted
to. | brewPipe/preprocess/numpy_null.py | __init__ | meyerd/brewPipe | python | def __init__(self, intermediate_directory='intermediates'):
'\n :param intermediate_directory: Directory, where the\n intermediate pandas dataframe should be persisted\n to.\n '
super(NumpyNullPreprocessor, self).__init__()
self._intermediate_directory = intermediate_dire... |
def spatial_variable(self, symbol):
'\n Convert a :class:`pybamm.SpatialVariable` node to a linear algebra object that\n can be evaluated (here, a :class:`pybamm.Vector` on either the nodes or the\n edges).\n\n Parameters\n -----------\n symbol : :class:`pybamm.SpatialVaria... | 2,688,663,816,349,106,000 | Convert a :class:`pybamm.SpatialVariable` node to a linear algebra object that
can be evaluated (here, a :class:`pybamm.Vector` on either the nodes or the
edges).
Parameters
-----------
symbol : :class:`pybamm.SpatialVariable`
The spatial variable to be discretised.
Returns
-------
:class:`pybamm.Vector`
Cont... | pybamm/spatial_methods/spatial_method.py | spatial_variable | jedgedrudd/PyBaMM | python | def spatial_variable(self, symbol):
'\n Convert a :class:`pybamm.SpatialVariable` node to a linear algebra object that\n can be evaluated (here, a :class:`pybamm.Vector` on either the nodes or the\n edges).\n\n Parameters\n -----------\n symbol : :class:`pybamm.SpatialVaria... |
def broadcast(self, symbol, domain, auxiliary_domains, broadcast_type):
"\n Broadcast symbol to a specified domain.\n\n Parameters\n ----------\n symbol : :class:`pybamm.Symbol`\n The symbol to be broadcasted\n domain : iterable of strings\n The domain to bro... | 2,225,620,983,754,394,400 | Broadcast symbol to a specified domain.
Parameters
----------
symbol : :class:`pybamm.Symbol`
The symbol to be broadcasted
domain : iterable of strings
The domain to broadcast to
broadcast_type : str
The type of broadcast, either: 'primary' or 'full'
Returns
-------
broadcasted_symbol: class: `pybamm.Symb... | pybamm/spatial_methods/spatial_method.py | broadcast | jedgedrudd/PyBaMM | python | def broadcast(self, symbol, domain, auxiliary_domains, broadcast_type):
"\n Broadcast symbol to a specified domain.\n\n Parameters\n ----------\n symbol : :class:`pybamm.Symbol`\n The symbol to be broadcasted\n domain : iterable of strings\n The domain to bro... |
def gradient(self, symbol, discretised_symbol, boundary_conditions):
'\n Implements the gradient for a spatial method.\n\n Parameters\n ----------\n symbol: :class:`pybamm.Symbol`\n The symbol that we will take the gradient of.\n discretised_symbol: :class:`pybamm.Symbo... | -1,960,366,641,476,553,500 | Implements the gradient for a spatial method.
Parameters
----------
symbol: :class:`pybamm.Symbol`
The symbol that we will take the gradient of.
discretised_symbol: :class:`pybamm.Symbol`
The discretised symbol of the correct size
boundary_conditions : dict
The boundary conditions of the model
({symbo... | pybamm/spatial_methods/spatial_method.py | gradient | jedgedrudd/PyBaMM | python | def gradient(self, symbol, discretised_symbol, boundary_conditions):
'\n Implements the gradient for a spatial method.\n\n Parameters\n ----------\n symbol: :class:`pybamm.Symbol`\n The symbol that we will take the gradient of.\n discretised_symbol: :class:`pybamm.Symbo... |
def divergence(self, symbol, discretised_symbol, boundary_conditions):
'\n Implements the divergence for a spatial method.\n\n Parameters\n ----------\n symbol: :class:`pybamm.Symbol`\n The symbol that we will take the gradient of.\n discretised_symbol: :class:`pybamm.S... | -467,223,934,223,671,550 | Implements the divergence for a spatial method.
Parameters
----------
symbol: :class:`pybamm.Symbol`
The symbol that we will take the gradient of.
discretised_symbol: :class:`pybamm.Symbol`
The discretised symbol of the correct size
boundary_conditions : dict
The boundary conditions of the model
({symb... | pybamm/spatial_methods/spatial_method.py | divergence | jedgedrudd/PyBaMM | python | def divergence(self, symbol, discretised_symbol, boundary_conditions):
'\n Implements the divergence for a spatial method.\n\n Parameters\n ----------\n symbol: :class:`pybamm.Symbol`\n The symbol that we will take the gradient of.\n discretised_symbol: :class:`pybamm.S... |
def laplacian(self, symbol, discretised_symbol, boundary_conditions):
'\n Implements the laplacian for a spatial method.\n\n Parameters\n ----------\n symbol: :class:`pybamm.Symbol`\n The symbol that we will take the gradient of.\n discretised_symbol: :class:`pybamm.Sym... | -2,857,456,298,622,612,000 | Implements the laplacian for a spatial method.
Parameters
----------
symbol: :class:`pybamm.Symbol`
The symbol that we will take the gradient of.
discretised_symbol: :class:`pybamm.Symbol`
The discretised symbol of the correct size
boundary_conditions : dict
The boundary conditions of the model
({symbo... | pybamm/spatial_methods/spatial_method.py | laplacian | jedgedrudd/PyBaMM | python | def laplacian(self, symbol, discretised_symbol, boundary_conditions):
'\n Implements the laplacian for a spatial method.\n\n Parameters\n ----------\n symbol: :class:`pybamm.Symbol`\n The symbol that we will take the gradient of.\n discretised_symbol: :class:`pybamm.Sym... |
def gradient_squared(self, symbol, discretised_symbol, boundary_conditions):
'\n Implements the inner product of the gradient with itself for a spatial method.\n\n Parameters\n ----------\n symbol: :class:`pybamm.Symbol`\n The symbol that we will take the gradient of.\n ... | 5,460,788,753,370,440,000 | Implements the inner product of the gradient with itself for a spatial method.
Parameters
----------
symbol: :class:`pybamm.Symbol`
The symbol that we will take the gradient of.
discretised_symbol: :class:`pybamm.Symbol`
The discretised symbol of the correct size
boundary_conditions : dict
The boundary co... | pybamm/spatial_methods/spatial_method.py | gradient_squared | jedgedrudd/PyBaMM | python | def gradient_squared(self, symbol, discretised_symbol, boundary_conditions):
'\n Implements the inner product of the gradient with itself for a spatial method.\n\n Parameters\n ----------\n symbol: :class:`pybamm.Symbol`\n The symbol that we will take the gradient of.\n ... |
def integral(self, child, discretised_child):
'\n Implements the integral for a spatial method.\n\n Parameters\n ----------\n child: :class:`pybamm.Symbol`\n The symbol to which is being integrated\n discretised_child: :class:`pybamm.Symbol`\n The discretised... | 326,992,160,910,767,740 | Implements the integral for a spatial method.
Parameters
----------
child: :class:`pybamm.Symbol`
The symbol to which is being integrated
discretised_child: :class:`pybamm.Symbol`
The discretised symbol of the correct size
Returns
-------
:class: `pybamm.Array`
Contains the result of acting the discretise... | pybamm/spatial_methods/spatial_method.py | integral | jedgedrudd/PyBaMM | python | def integral(self, child, discretised_child):
'\n Implements the integral for a spatial method.\n\n Parameters\n ----------\n child: :class:`pybamm.Symbol`\n The symbol to which is being integrated\n discretised_child: :class:`pybamm.Symbol`\n The discretised... |
def indefinite_integral(self, child, discretised_child):
'\n Implements the indefinite integral for a spatial method.\n\n Parameters\n ----------\n child: :class:`pybamm.Symbol`\n The symbol to which is being integrated\n discretised_child: :class:`pybamm.Symbol`\n ... | -4,873,417,814,637,923,000 | Implements the indefinite integral for a spatial method.
Parameters
----------
child: :class:`pybamm.Symbol`
The symbol to which is being integrated
discretised_child: :class:`pybamm.Symbol`
The discretised symbol of the correct size
Returns
-------
:class: `pybamm.Array`
Contains the result of acting the... | pybamm/spatial_methods/spatial_method.py | indefinite_integral | jedgedrudd/PyBaMM | python | def indefinite_integral(self, child, discretised_child):
'\n Implements the indefinite integral for a spatial method.\n\n Parameters\n ----------\n child: :class:`pybamm.Symbol`\n The symbol to which is being integrated\n discretised_child: :class:`pybamm.Symbol`\n ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.