body_hash stringlengths 64 64 | body stringlengths 23 109k | docstring stringlengths 1 57k | path stringlengths 4 198 | name stringlengths 1 115 | repository_name stringlengths 7 111 | repository_stars float64 0 191k | lang stringclasses 1
value | body_without_docstring stringlengths 14 108k | unified stringlengths 45 133k |
|---|---|---|---|---|---|---|---|---|---|
419c0b95d78cc0b5f031abeecd1efb5744e43f4e74c225796ef431a2d64299a3 | def last_item(array):
'Returns the last item of an array in a list or an empty list.'
if (array.size == 0):
return []
indexer = ((slice((- 1), None),) * array.ndim)
return np.ravel(array[indexer]).tolist() | Returns the last item of an array in a list or an empty list. | openstreetmap-scraper/venv/lib/python3.7/site-packages/xarray/core/formatting.py | last_item | espoo-urban-planning/urbanplanningGAN | 51 | python | def last_item(array):
if (array.size == 0):
return []
indexer = ((slice((- 1), None),) * array.ndim)
return np.ravel(array[indexer]).tolist() | def last_item(array):
if (array.size == 0):
return []
indexer = ((slice((- 1), None),) * array.ndim)
return np.ravel(array[indexer]).tolist()<|docstring|>Returns the last item of an array in a list or an empty list.<|endoftext|> |
b8ca6b0ddae4a582bece03a35eef3c23525f5d9df41e8d0e612f1e3b9fc568ed | def format_timestamp(t):
'Cast given object to a Timestamp and return a nicely formatted string'
try:
datetime_str = str(pd.Timestamp(t))
except OutOfBoundsDatetime:
datetime_str = str(t)
try:
(date_str, time_str) = datetime_str.split()
except ValueError:
return datet... | Cast given object to a Timestamp and return a nicely formatted string | openstreetmap-scraper/venv/lib/python3.7/site-packages/xarray/core/formatting.py | format_timestamp | espoo-urban-planning/urbanplanningGAN | 51 | python | def format_timestamp(t):
try:
datetime_str = str(pd.Timestamp(t))
except OutOfBoundsDatetime:
datetime_str = str(t)
try:
(date_str, time_str) = datetime_str.split()
except ValueError:
return datetime_str
else:
if (time_str == '00:00:00'):
retu... | def format_timestamp(t):
try:
datetime_str = str(pd.Timestamp(t))
except OutOfBoundsDatetime:
datetime_str = str(t)
try:
(date_str, time_str) = datetime_str.split()
except ValueError:
return datetime_str
else:
if (time_str == '00:00:00'):
retu... |
dc7f2ec404ad8bb2ea97ea7f2286b999068a578da77d629d9c322f0df1050701 | def format_timedelta(t, timedelta_format=None):
'Cast given object to a Timestamp and return a nicely formatted string'
timedelta_str = str(pd.Timedelta(t))
try:
(days_str, time_str) = timedelta_str.split(' days ')
except ValueError:
return timedelta_str
else:
if (timedelta_f... | Cast given object to a Timestamp and return a nicely formatted string | openstreetmap-scraper/venv/lib/python3.7/site-packages/xarray/core/formatting.py | format_timedelta | espoo-urban-planning/urbanplanningGAN | 51 | python | def format_timedelta(t, timedelta_format=None):
timedelta_str = str(pd.Timedelta(t))
try:
(days_str, time_str) = timedelta_str.split(' days ')
except ValueError:
return timedelta_str
else:
if (timedelta_format == 'date'):
return (days_str + ' days')
elif ... | def format_timedelta(t, timedelta_format=None):
timedelta_str = str(pd.Timedelta(t))
try:
(days_str, time_str) = timedelta_str.split(' days ')
except ValueError:
return timedelta_str
else:
if (timedelta_format == 'date'):
return (days_str + ' days')
elif ... |
f77414ac68efa00c41d2b4b9e0444e49b906574e02e3f925284ded5130b36c9e | def format_item(x, timedelta_format=None, quote_strings=True):
'Returns a succinct summary of an object as a string'
if isinstance(x, (np.datetime64, datetime)):
return format_timestamp(x)
if isinstance(x, (np.timedelta64, timedelta)):
return format_timedelta(x, timedelta_format=timedelta_fo... | Returns a succinct summary of an object as a string | openstreetmap-scraper/venv/lib/python3.7/site-packages/xarray/core/formatting.py | format_item | espoo-urban-planning/urbanplanningGAN | 51 | python | def format_item(x, timedelta_format=None, quote_strings=True):
if isinstance(x, (np.datetime64, datetime)):
return format_timestamp(x)
if isinstance(x, (np.timedelta64, timedelta)):
return format_timedelta(x, timedelta_format=timedelta_format)
elif isinstance(x, (str, bytes)):
r... | def format_item(x, timedelta_format=None, quote_strings=True):
if isinstance(x, (np.datetime64, datetime)):
return format_timestamp(x)
if isinstance(x, (np.timedelta64, timedelta)):
return format_timedelta(x, timedelta_format=timedelta_format)
elif isinstance(x, (str, bytes)):
r... |
edadffaa195b23f8996b08e2100f56d7023a76e25495b6b63ab54f54694f5c90 | def format_items(x):
'Returns a succinct summaries of all items in a sequence as strings'
x = np.asarray(x)
timedelta_format = 'datetime'
if np.issubdtype(x.dtype, np.timedelta64):
x = np.asarray(x, dtype='timedelta64[ns]')
day_part = x[(~ pd.isnull(x))].astype('timedelta64[D]').astype('... | Returns a succinct summaries of all items in a sequence as strings | openstreetmap-scraper/venv/lib/python3.7/site-packages/xarray/core/formatting.py | format_items | espoo-urban-planning/urbanplanningGAN | 51 | python | def format_items(x):
x = np.asarray(x)
timedelta_format = 'datetime'
if np.issubdtype(x.dtype, np.timedelta64):
x = np.asarray(x, dtype='timedelta64[ns]')
day_part = x[(~ pd.isnull(x))].astype('timedelta64[D]').astype('timedelta64[ns]')
time_needed = (x[(~ pd.isnull(x))] != day_... | def format_items(x):
x = np.asarray(x)
timedelta_format = 'datetime'
if np.issubdtype(x.dtype, np.timedelta64):
x = np.asarray(x, dtype='timedelta64[ns]')
day_part = x[(~ pd.isnull(x))].astype('timedelta64[D]').astype('timedelta64[ns]')
time_needed = (x[(~ pd.isnull(x))] != day_... |
5a01dbb97a14fa72b8a901e88c228b5019eb222ce8dc3d8f8ca8f1b015fa1624 | def format_array_flat(array, max_width):
'Return a formatted string for as many items in the flattened version of\n array that will fit within max_width characters.\n '
max_possibly_relevant = min(max(array.size, 1), max(int(np.ceil((max_width / 2.0))), 2))
relevant_front_items = format_items(first_n_... | Return a formatted string for as many items in the flattened version of
array that will fit within max_width characters. | openstreetmap-scraper/venv/lib/python3.7/site-packages/xarray/core/formatting.py | format_array_flat | espoo-urban-planning/urbanplanningGAN | 51 | python | def format_array_flat(array, max_width):
'Return a formatted string for as many items in the flattened version of\n array that will fit within max_width characters.\n '
max_possibly_relevant = min(max(array.size, 1), max(int(np.ceil((max_width / 2.0))), 2))
relevant_front_items = format_items(first_n_... | def format_array_flat(array, max_width):
'Return a formatted string for as many items in the flattened version of\n array that will fit within max_width characters.\n '
max_possibly_relevant = min(max(array.size, 1), max(int(np.ceil((max_width / 2.0))), 2))
relevant_front_items = format_items(first_n_... |
a4e2eaf5a6ccd1b80efa1aa305cb47e594ef9d66941d58c14f268dbb096240ae | def summarize_attr(key, value, col_width=None):
'Summary for __repr__ - use ``X.attrs[key]`` for full value.'
k_str = (' %s:' % key)
if (col_width is not None):
k_str = pretty_print(k_str, col_width)
v_str = str(value).replace('\t', '\\t').replace('\n', '\\n')
return maybe_truncate(('%s %... | Summary for __repr__ - use ``X.attrs[key]`` for full value. | openstreetmap-scraper/venv/lib/python3.7/site-packages/xarray/core/formatting.py | summarize_attr | espoo-urban-planning/urbanplanningGAN | 51 | python | def summarize_attr(key, value, col_width=None):
k_str = (' %s:' % key)
if (col_width is not None):
k_str = pretty_print(k_str, col_width)
v_str = str(value).replace('\t', '\\t').replace('\n', '\\n')
return maybe_truncate(('%s %s' % (k_str, v_str)), OPTIONS['display_width']) | def summarize_attr(key, value, col_width=None):
k_str = (' %s:' % key)
if (col_width is not None):
k_str = pretty_print(k_str, col_width)
v_str = str(value).replace('\t', '\\t').replace('\n', '\\n')
return maybe_truncate(('%s %s' % (k_str, v_str)), OPTIONS['display_width'])<|docstring|>S... |
47c4fc86f2efb4e3e40283514b96b611fc749f0fedf145c0fd5151626b71efa3 | def _get_col_items(mapping):
'Get all column items to format, including both keys of `mapping`\n and MultiIndex levels if any.\n '
from .variable import IndexVariable
col_items = []
for (k, v) in mapping.items():
col_items.append(k)
var = getattr(v, 'variable', v)
if isinst... | Get all column items to format, including both keys of `mapping`
and MultiIndex levels if any. | openstreetmap-scraper/venv/lib/python3.7/site-packages/xarray/core/formatting.py | _get_col_items | espoo-urban-planning/urbanplanningGAN | 51 | python | def _get_col_items(mapping):
'Get all column items to format, including both keys of `mapping`\n and MultiIndex levels if any.\n '
from .variable import IndexVariable
col_items = []
for (k, v) in mapping.items():
col_items.append(k)
var = getattr(v, 'variable', v)
if isinst... | def _get_col_items(mapping):
'Get all column items to format, including both keys of `mapping`\n and MultiIndex levels if any.\n '
from .variable import IndexVariable
col_items = []
for (k, v) in mapping.items():
col_items.append(k)
var = getattr(v, 'variable', v)
if isinst... |
e3bb79a1ae9c7a610c274293d24e6fd101f70e25fd0183877c0d8273055b8b63 | def short_dask_repr(array, show_dtype=True):
"Similar to dask.array.DataArray.__repr__, but without\n redundant information that's already printed by the repr\n function of the xarray wrapper.\n "
chunksize = tuple((c[0] for c in array.chunks))
if show_dtype:
return ('dask.array<shape=%s, d... | Similar to dask.array.DataArray.__repr__, but without
redundant information that's already printed by the repr
function of the xarray wrapper. | openstreetmap-scraper/venv/lib/python3.7/site-packages/xarray/core/formatting.py | short_dask_repr | espoo-urban-planning/urbanplanningGAN | 51 | python | def short_dask_repr(array, show_dtype=True):
"Similar to dask.array.DataArray.__repr__, but without\n redundant information that's already printed by the repr\n function of the xarray wrapper.\n "
chunksize = tuple((c[0] for c in array.chunks))
if show_dtype:
return ('dask.array<shape=%s, d... | def short_dask_repr(array, show_dtype=True):
"Similar to dask.array.DataArray.__repr__, but without\n redundant information that's already printed by the repr\n function of the xarray wrapper.\n "
chunksize = tuple((c[0] for c in array.chunks))
if show_dtype:
return ('dask.array<shape=%s, d... |
949a0971c4149004e0c5367c4bcfc0b88bd0289c76df769bb80ada19b6f739af | def get_future_positions(start=datetime(2007, 1, 5), end=datetime.today()):
'\n\n :param start: 2007-01-05 上海期货交易所最早数据\n :param end:\n :return:\n '
trade_index = get_future_calender(start=start, end=end)
target = (RAW_DATA_DIR / 'receipt/shfe')
if (not target.exists()):
target.mkdir(... | :param start: 2007-01-05 上海期货交易所最早数据
:param end:
:return: | src/data/future/position.py | get_future_positions | newlyedward/datascinece | 2 | python | def get_future_positions(start=datetime(2007, 1, 5), end=datetime.today()):
'\n\n :param start: 2007-01-05 上海期货交易所最早数据\n :param end:\n :return:\n '
trade_index = get_future_calender(start=start, end=end)
target = (RAW_DATA_DIR / 'receipt/shfe')
if (not target.exists()):
target.mkdir(... | def get_future_positions(start=datetime(2007, 1, 5), end=datetime.today()):
'\n\n :param start: 2007-01-05 上海期货交易所最早数据\n :param end:\n :return:\n '
trade_index = get_future_calender(start=start, end=end)
target = (RAW_DATA_DIR / 'receipt/shfe')
if (not target.exists()):
target.mkdir(... |
cfa065ff5dbdeb43b9321758e8240f26855cd6d8f7c394c9c1dcb7f735e0a86b | def vecnorm_NDarray(v, axis=(- 1)):
'\n Vector normalisation performed along an arbitrary dimension, which by default is the last one.\n Comes with workaround by casting that to zero instead of keeping np.nan or np.inf.\n '
if (len(v.shape) > 1):
sh = list(v.shape)
sh[axis] = 1
... | Vector normalisation performed along an arbitrary dimension, which by default is the last one.
Comes with workaround by casting that to zero instead of keeping np.nan or np.inf. | calculate-S2.py | vecnorm_NDarray | zharmad/SpinRelax | 0 | python | def vecnorm_NDarray(v, axis=(- 1)):
'\n Vector normalisation performed along an arbitrary dimension, which by default is the last one.\n Comes with workaround by casting that to zero instead of keeping np.nan or np.inf.\n '
if (len(v.shape) > 1):
sh = list(v.shape)
sh[axis] = 1
... | def vecnorm_NDarray(v, axis=(- 1)):
'\n Vector normalisation performed along an arbitrary dimension, which by default is the last one.\n Comes with workaround by casting that to zero instead of keeping np.nan or np.inf.\n '
if (len(v.shape) > 1):
sh = list(v.shape)
sh[axis] = 1
... |
1078ab8618ba74f2ae98b060ce2b1ac7e6682287ad57c07da49597492110ab0b | def S2_by_outerProduct(v):
'\n Two\n '
outer = np.mean([np.outer(v[i], v[i]) for i in range(len(v))], axis=0)
return ((1.5 * np.sum((outer ** 2.0))) - 0.5) | Two | calculate-S2.py | S2_by_outerProduct | zharmad/SpinRelax | 0 | python | def S2_by_outerProduct(v):
'\n \n '
outer = np.mean([np.outer(v[i], v[i]) for i in range(len(v))], axis=0)
return ((1.5 * np.sum((outer ** 2.0))) - 0.5) | def S2_by_outerProduct(v):
'\n \n '
outer = np.mean([np.outer(v[i], v[i]) for i in range(len(v))], axis=0)
return ((1.5 * np.sum((outer ** 2.0))) - 0.5)<|docstring|>Two<|endoftext|> |
d57728ef648409b24231af9dadaff66c7da4974cc59d788483d59982b539a1c3 | def calculate_S2_by_outerProduct(vecs, delta_t=(- 1), tau_memory=(- 1)):
'\n Calculates the general order parameter S2 by using the quantity 3*Sum_i,j <e_i * e_j >^2 - 1 , which is akin to P2( CosTheta )\n Expects vecs to be of dimensions (time, 3) or ( time, nResidues, 3 )\n\n This directly collapses all ... | Calculates the general order parameter S2 by using the quantity 3*Sum_i,j <e_i * e_j >^2 - 1 , which is akin to P2( CosTheta )
Expects vecs to be of dimensions (time, 3) or ( time, nResidues, 3 )
This directly collapses all dimensions in two steps:
- 1. calculate the outer product <v_i v_j >
- 2. calculate Sum <v_i v_... | calculate-S2.py | calculate_S2_by_outerProduct | zharmad/SpinRelax | 0 | python | def calculate_S2_by_outerProduct(vecs, delta_t=(- 1), tau_memory=(- 1)):
'\n Calculates the general order parameter S2 by using the quantity 3*Sum_i,j <e_i * e_j >^2 - 1 , which is akin to P2( CosTheta )\n Expects vecs to be of dimensions (time, 3) or ( time, nResidues, 3 )\n\n This directly collapses all ... | def calculate_S2_by_outerProduct(vecs, delta_t=(- 1), tau_memory=(- 1)):
'\n Calculates the general order parameter S2 by using the quantity 3*Sum_i,j <e_i * e_j >^2 - 1 , which is akin to P2( CosTheta )\n Expects vecs to be of dimensions (time, 3) or ( time, nResidues, 3 )\n\n This directly collapses all ... |
5186239ed66e2658b51d8fec7c1828ad8a0a6c3155521d5326d9421f2f03f6ec | def reformat_vecs_by_tau(vecs, dt, tau):
"\n This proc assumes that vecs list is N 3D-arrays in the form <Nfile>,(frames, bonds, XYZ).\n We take advantage of Palmer's iteration where the trajectory is divided into N chunks each of tau in length,\n to reformulate everything into fast 4D np.arrays of form (n... | This proc assumes that vecs list is N 3D-arrays in the form <Nfile>,(frames, bonds, XYZ).
We take advantage of Palmer's iteration where the trajectory is divided into N chunks each of tau in length,
to reformulate everything into fast 4D np.arrays of form (nchunk, frames, bonds, XYZ) so as to
take full advantage of bro... | calculate-S2.py | reformat_vecs_by_tau | zharmad/SpinRelax | 0 | python | def reformat_vecs_by_tau(vecs, dt, tau):
"\n This proc assumes that vecs list is N 3D-arrays in the form <Nfile>,(frames, bonds, XYZ).\n We take advantage of Palmer's iteration where the trajectory is divided into N chunks each of tau in length,\n to reformulate everything into fast 4D np.arrays of form (n... | def reformat_vecs_by_tau(vecs, dt, tau):
"\n This proc assumes that vecs list is N 3D-arrays in the form <Nfile>,(frames, bonds, XYZ).\n We take advantage of Palmer's iteration where the trajectory is divided into N chunks each of tau in length,\n to reformulate everything into fast 4D np.arrays of form (n... |
a43b58c393881f430d2c4be6045230160aa2a0a3087185a2fa08c54a9cfcdd2e | def get_indices_mdtraj(seltxt, top, filename):
'\n NB: A workaround for MDTraj is needed becusae the standard reader\n does not return topologies.\n '
if (seltxt == 'custom occupancy'):
pdb = md.formats.pdb.pdbstructure.PdbStructure(open(filename))
mask = [atom.get_occupancy() for atom ... | NB: A workaround for MDTraj is needed becusae the standard reader
does not return topologies. | calculate-S2.py | get_indices_mdtraj | zharmad/SpinRelax | 0 | python | def get_indices_mdtraj(seltxt, top, filename):
'\n NB: A workaround for MDTraj is needed becusae the standard reader\n does not return topologies.\n '
if (seltxt == 'custom occupancy'):
pdb = md.formats.pdb.pdbstructure.PdbStructure(open(filename))
mask = [atom.get_occupancy() for atom ... | def get_indices_mdtraj(seltxt, top, filename):
'\n NB: A workaround for MDTraj is needed becusae the standard reader\n does not return topologies.\n '
if (seltxt == 'custom occupancy'):
pdb = md.formats.pdb.pdbstructure.PdbStructure(open(filename))
mask = [atom.get_occupancy() for atom ... |
490b00d7ff6e5d9da91c601e99d7a62cf0ee502b2e4d7439b5cdaef3a4941735 | def test_001_all(self):
'\n details for all workspaces\n '
ws = self.api.workspaces
ws_list = ws.list()
with ThreadPoolExecutor() as pool:
details = list(pool.map((lambda w: ws.details(workspace_id=w.workspace_id)), ws_list))
print(f'got details for {len(details)} workspaces') | details for all workspaces | tests/test_workspaces.py | test_001_all | jeokrohn/wxc_sdk | 0 | python | def test_001_all(self):
'\n \n '
ws = self.api.workspaces
ws_list = ws.list()
with ThreadPoolExecutor() as pool:
details = list(pool.map((lambda w: ws.details(workspace_id=w.workspace_id)), ws_list))
print(f'got details for {len(details)} workspaces') | def test_001_all(self):
'\n \n '
ws = self.api.workspaces
ws_list = ws.list()
with ThreadPoolExecutor() as pool:
details = list(pool.map((lambda w: ws.details(workspace_id=w.workspace_id)), ws_list))
print(f'got details for {len(details)} workspaces')<|docstring|>details for al... |
41a4b9ef62c03e71ab58ccbd5d778ab0b033721c99c3f6c82c435b603a35161e | def test_001_get_all(self):
'\n get outgoing permissions auto transfer numbers for all workspaces\n '
wsa = self.api.workspaces
tna = self.api.workspace_settings.permissions_out.transfer_numbers
targets = [ws for ws in wsa.list() if (ws.calling == CallingType.webex)]
if (not targets):
... | get outgoing permissions auto transfer numbers for all workspaces | tests/test_workspaces.py | test_001_get_all | jeokrohn/wxc_sdk | 0 | python | def test_001_get_all(self):
'\n \n '
wsa = self.api.workspaces
tna = self.api.workspace_settings.permissions_out.transfer_numbers
targets = [ws for ws in wsa.list() if (ws.calling == CallingType.webex)]
if (not targets):
self.skipTest('Need some WxC enabled workspaces to run th... | def test_001_get_all(self):
'\n \n '
wsa = self.api.workspaces
tna = self.api.workspace_settings.permissions_out.transfer_numbers
targets = [ws for ws in wsa.list() if (ws.calling == CallingType.webex)]
if (not targets):
self.skipTest('Need some WxC enabled workspaces to run th... |
cbfb2796377f13e6f873844ca4df03f8a145c7d84c9be48bc9b8e82965c9e623 | @contextmanager
def target_ws_context(self, use_custom_enabled: bool=True) -> Workspace:
'\n pick a random workspace and make sure that the outgoing permission settings are restored\n\n :return:\n '
po = self.api.workspace_settings.permissions_out
targets = [ws for ws in self.api.worksp... | pick a random workspace and make sure that the outgoing permission settings are restored
:return: | tests/test_workspaces.py | target_ws_context | jeokrohn/wxc_sdk | 0 | python | @contextmanager
def target_ws_context(self, use_custom_enabled: bool=True) -> Workspace:
'\n pick a random workspace and make sure that the outgoing permission settings are restored\n\n :return:\n '
po = self.api.workspace_settings.permissions_out
targets = [ws for ws in self.api.worksp... | @contextmanager
def target_ws_context(self, use_custom_enabled: bool=True) -> Workspace:
'\n pick a random workspace and make sure that the outgoing permission settings are restored\n\n :return:\n '
po = self.api.workspace_settings.permissions_out
targets = [ws for ws in self.api.worksp... |
a0cd84330aee36c41ad4ac3761cf21ebe394c22755e6f700a132fec7aef9df8b | def test_002_update_wo_custom_enabled(self):
'\n updating auto transfer numbers requires use_custom_enabled to be set\n :return:\n '
tna = self.api.workspace_settings.permissions_out.transfer_numbers
with self.target_ws_context(use_custom_enabled=False) as target_ws:
target_ws: ... | updating auto transfer numbers requires use_custom_enabled to be set
:return: | tests/test_workspaces.py | test_002_update_wo_custom_enabled | jeokrohn/wxc_sdk | 0 | python | def test_002_update_wo_custom_enabled(self):
'\n updating auto transfer numbers requires use_custom_enabled to be set\n :return:\n '
tna = self.api.workspace_settings.permissions_out.transfer_numbers
with self.target_ws_context(use_custom_enabled=False) as target_ws:
target_ws: ... | def test_002_update_wo_custom_enabled(self):
'\n updating auto transfer numbers requires use_custom_enabled to be set\n :return:\n '
tna = self.api.workspace_settings.permissions_out.transfer_numbers
with self.target_ws_context(use_custom_enabled=False) as target_ws:
target_ws: ... |
0da738c3a5a3c61e3782785787b6f48f7f85cb9e14f393cb1f4b4defc4936d90 | def test_003_update_one_number(self):
'\n try to update auto transfer numbers for a workspace\n '
tna = self.api.workspace_settings.permissions_out.transfer_numbers
with self.target_ws_context() as target_ws:
target_ws: Workspace
numbers = tna.read(person_id=target_ws.workspace... | try to update auto transfer numbers for a workspace | tests/test_workspaces.py | test_003_update_one_number | jeokrohn/wxc_sdk | 0 | python | def test_003_update_one_number(self):
'\n \n '
tna = self.api.workspace_settings.permissions_out.transfer_numbers
with self.target_ws_context() as target_ws:
target_ws: Workspace
numbers = tna.read(person_id=target_ws.workspace_id)
try:
update = numbers.copy... | def test_003_update_one_number(self):
'\n \n '
tna = self.api.workspace_settings.permissions_out.transfer_numbers
with self.target_ws_context() as target_ws:
target_ws: Workspace
numbers = tna.read(person_id=target_ws.workspace_id)
try:
update = numbers.copy... |
46d52075f4a1de4cbf8e421505fa6a4ec3253043e973328a9d8a18396d5267f7 | def test_002_update_one_number_no_effect_on_other_numbers(self):
"\n try to update auto transfer numbers for a workspace. Verify that updating a single number doesn't affect the\n other numbers\n "
tna = self.api.workspace_settings.permissions_out.transfer_numbers
with self.target_ws_co... | try to update auto transfer numbers for a workspace. Verify that updating a single number doesn't affect the
other numbers | tests/test_workspaces.py | test_002_update_one_number_no_effect_on_other_numbers | jeokrohn/wxc_sdk | 0 | python | def test_002_update_one_number_no_effect_on_other_numbers(self):
"\n try to update auto transfer numbers for a workspace. Verify that updating a single number doesn't affect the\n other numbers\n "
tna = self.api.workspace_settings.permissions_out.transfer_numbers
with self.target_ws_co... | def test_002_update_one_number_no_effect_on_other_numbers(self):
"\n try to update auto transfer numbers for a workspace. Verify that updating a single number doesn't affect the\n other numbers\n "
tna = self.api.workspace_settings.permissions_out.transfer_numbers
with self.target_ws_co... |
1db3959081391609056cf9d7fe4f4ccf4c8569b90a0653906751a0892591b6d6 | def test_001_trivial(self):
'\n create workspace with minimal settings\n '
ws = self.api.workspaces
name = next(self.new_names())
settings = Workspace.create(display_name=name)
workspace = ws.create(settings=settings)
print(f'new worksspace: {workspace.json()}')
self.assertEqua... | create workspace with minimal settings | tests/test_workspaces.py | test_001_trivial | jeokrohn/wxc_sdk | 0 | python | def test_001_trivial(self):
'\n \n '
ws = self.api.workspaces
name = next(self.new_names())
settings = Workspace.create(display_name=name)
workspace = ws.create(settings=settings)
print(f'new worksspace: {workspace.json()}')
self.assertEqual(name, workspace.display_name) | def test_001_trivial(self):
'\n \n '
ws = self.api.workspaces
name = next(self.new_names())
settings = Workspace.create(display_name=name)
workspace = ws.create(settings=settings)
print(f'new worksspace: {workspace.json()}')
self.assertEqual(name, workspace.display_name)<|docst... |
a07b693da37725b55a7eab62788948dbdf406e078da6046dae7a8f1806ffae82 | def test_002_edge_for_devices(self):
'\n create workspace with edge_for_devices\n '
ws = self.api.workspaces
name = next(self.new_names())
settings = Workspace(display_name=name, calling=CallingType.edge_for_devices)
workspace = ws.create(settings=settings)
print(f'new worksspace: ... | create workspace with edge_for_devices | tests/test_workspaces.py | test_002_edge_for_devices | jeokrohn/wxc_sdk | 0 | python | def test_002_edge_for_devices(self):
'\n \n '
ws = self.api.workspaces
name = next(self.new_names())
settings = Workspace(display_name=name, calling=CallingType.edge_for_devices)
workspace = ws.create(settings=settings)
print(f'new worksspace: {workspace.json()}')
self.assertEq... | def test_002_edge_for_devices(self):
'\n \n '
ws = self.api.workspaces
name = next(self.new_names())
settings = Workspace(display_name=name, calling=CallingType.edge_for_devices)
workspace = ws.create(settings=settings)
print(f'new worksspace: {workspace.json()}')
self.assertEq... |
2d35c10818891e32a9bbba40fc7e9b92376f3e6c1a7140bbc0efa12e9fa34960 | def test_003_change_name_full(self):
'\n change name of a workspace, full settings\n '
ws = self.api.workspaces
with self.target(no_edge=True) as target_ws:
target_ws: Workspace
settings: Workspace = target_ws.copy(deep=True)
new_name = next(self.new_names())
se... | change name of a workspace, full settings | tests/test_workspaces.py | test_003_change_name_full | jeokrohn/wxc_sdk | 0 | python | def test_003_change_name_full(self):
'\n \n '
ws = self.api.workspaces
with self.target(no_edge=True) as target_ws:
target_ws: Workspace
settings: Workspace = target_ws.copy(deep=True)
new_name = next(self.new_names())
settings.display_name = new_name
af... | def test_003_change_name_full(self):
'\n \n '
ws = self.api.workspaces
with self.target(no_edge=True) as target_ws:
target_ws: Workspace
settings: Workspace = target_ws.copy(deep=True)
new_name = next(self.new_names())
settings.display_name = new_name
af... |
298301aed3a7278e1fc1c6b61b9949bdfd08caa3d4a10de9e533f28413348355 | def test_004_change_name_name_only(self):
'\n change name of a workspace, only name update\n '
ws = self.api.workspaces
with self.target(no_edge=True) as target_ws:
target_ws: Workspace
new_name = next(self.new_names())
settings = Workspace(display_name=new_name)
... | change name of a workspace, only name update | tests/test_workspaces.py | test_004_change_name_name_only | jeokrohn/wxc_sdk | 0 | python | def test_004_change_name_name_only(self):
'\n \n '
ws = self.api.workspaces
with self.target(no_edge=True) as target_ws:
target_ws: Workspace
new_name = next(self.new_names())
settings = Workspace(display_name=new_name)
after = ws.update(workspace_id=target_ws.w... | def test_004_change_name_name_only(self):
'\n \n '
ws = self.api.workspaces
with self.target(no_edge=True) as target_ws:
target_ws: Workspace
new_name = next(self.new_names())
settings = Workspace(display_name=new_name)
after = ws.update(workspace_id=target_ws.w... |
d53dbeda749999521a50e8213f296218407701a08732755611598553abaf1766 | def test_001_delete_one(self):
'\n delete a random workspace\n '
ws = self.api.workspaces
ws_list = list(ws.list(display_name=TEST_WORKSPACES_PREFIX))
if (not ws_list):
self.skipTest('No test workspace to delete')
target = random.choice(ws_list)
ws.delete_workspace(workspac... | delete a random workspace | tests/test_workspaces.py | test_001_delete_one | jeokrohn/wxc_sdk | 0 | python | def test_001_delete_one(self):
'\n \n '
ws = self.api.workspaces
ws_list = list(ws.list(display_name=TEST_WORKSPACES_PREFIX))
if (not ws_list):
self.skipTest('No test workspace to delete')
target = random.choice(ws_list)
ws.delete_workspace(workspace_id=target.workspace_id)... | def test_001_delete_one(self):
'\n \n '
ws = self.api.workspaces
ws_list = list(ws.list(display_name=TEST_WORKSPACES_PREFIX))
if (not ws_list):
self.skipTest('No test workspace to delete')
target = random.choice(ws_list)
ws.delete_workspace(workspace_id=target.workspace_id)... |
91c50ce14732741668e5605aa9df20d450c96b6b377d06d3ce87bb52884f589c | def get_native_batch(self, stage: str, loader: Union[(str, int)]=0, data_index: int=0):
'Returns a batch from experiment loader\n\n Args:\n stage (str): stage name\n loader (Union[str, int]): loader name or its index,\n default is the first loader\n data_index ... | Returns a batch from experiment loader
Args:
stage (str): stage name
loader (Union[str, int]): loader name or its index,
default is the first loader
data_index (int): index in dataset from the loader | catalyst_rl/dl/core/experiment.py | get_native_batch | rhololkeolke/catalyst-rl | 46 | python | def get_native_batch(self, stage: str, loader: Union[(str, int)]=0, data_index: int=0):
'Returns a batch from experiment loader\n\n Args:\n stage (str): stage name\n loader (Union[str, int]): loader name or its index,\n default is the first loader\n data_index ... | def get_native_batch(self, stage: str, loader: Union[(str, int)]=0, data_index: int=0):
'Returns a batch from experiment loader\n\n Args:\n stage (str): stage name\n loader (Union[str, int]): loader name or its index,\n default is the first loader\n data_index ... |
0903f8c1acfcd0b8194829c037d9219acdcf0551a2e524deb2304e271db3e227 | def main():
'\n Extracts various features from a cv2 image and returns them in a list.\n :param None\n :return: A tuple containing two lists: containing the most similar and the least similar blobs wrt the query blob.\n '
parser = argparse.ArgumentParser()
parser.add_argument('--blob_set', requi... | Extracts various features from a cv2 image and returns them in a list.
:param None
:return: A tuple containing two lists: containing the most similar and the least similar blobs wrt the query blob. | q1_init.py | main | NJNischal/Blob-Detection-and-Classification | 0 | python | def main():
'\n Extracts various features from a cv2 image and returns them in a list.\n :param None\n :return: A tuple containing two lists: containing the most similar and the least similar blobs wrt the query blob.\n '
parser = argparse.ArgumentParser()
parser.add_argument('--blob_set', requi... | def main():
'\n Extracts various features from a cv2 image and returns them in a list.\n :param None\n :return: A tuple containing two lists: containing the most similar and the least similar blobs wrt the query blob.\n '
parser = argparse.ArgumentParser()
parser.add_argument('--blob_set', requi... |
f557b0da163b232ea0ba87f1f8cff8580d134c53a019fa749a45128a3e6b0d32 | def blob_feature_extractor(img):
'\n Extracts various features from a cv2 image and returns them in a list.\n :param img: A cv2 image of a blob.\n :return: A list where each element represents a unique feature in the image.\n '
imgray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
(ret, thresh) = cv2.t... | Extracts various features from a cv2 image and returns them in a list.
:param img: A cv2 image of a blob.
:return: A list where each element represents a unique feature in the image. | q1_init.py | blob_feature_extractor | NJNischal/Blob-Detection-and-Classification | 0 | python | def blob_feature_extractor(img):
'\n Extracts various features from a cv2 image and returns them in a list.\n :param img: A cv2 image of a blob.\n :return: A list where each element represents a unique feature in the image.\n '
imgray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
(ret, thresh) = cv2.t... | def blob_feature_extractor(img):
'\n Extracts various features from a cv2 image and returns them in a list.\n :param img: A cv2 image of a blob.\n :return: A list where each element represents a unique feature in the image.\n '
imgray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
(ret, thresh) = cv2.t... |
0065dbb3540b9a2e2a8dacc0d14b51b7c8fa1c933ff3caca8ed6848fca5e2e97 | @staticmethod
def get_environment(async_=False, ENVS={}):
'retrieve singleton jinja2 environment.'
from jinja2 import ChoiceLoader, DictLoader, Environment, FileSystemLoader
if (async_ in ENVS):
return ENVS[async_]
ENVS[async_] = ENVIRONMENT = Environment(enable_async=async_, loader=ChoiceLoader... | retrieve singleton jinja2 environment. | src/pidgy/weave.py | get_environment | bollwyvl/pidgy | 25 | python | @staticmethod
def get_environment(async_=False, ENVS={}):
from jinja2 import ChoiceLoader, DictLoader, Environment, FileSystemLoader
if (async_ in ENVS):
return ENVS[async_]
ENVS[async_] = ENVIRONMENT = Environment(enable_async=async_, loader=ChoiceLoader([DictLoader({}), FileSystemLoader('.')]... | @staticmethod
def get_environment(async_=False, ENVS={}):
from jinja2 import ChoiceLoader, DictLoader, Environment, FileSystemLoader
if (async_ in ENVS):
return ENVS[async_]
ENVS[async_] = ENVIRONMENT = Environment(enable_async=async_, loader=ChoiceLoader([DictLoader({}), FileSystemLoader('.')]... |
0ca20433729e18144f8441b353642c9770914332bb52dab7bbb93167d16995a1 | def normalize(self, type, object, metadata) -> str:
'normalize and object with (mime)type and return a string.'
from .utils import get_decoded, get_minified
if ((type == 'text/html') or ('svg' in type)):
object = get_minified(object)
if type.startswith('image'):
(width, height) = (metada... | normalize and object with (mime)type and return a string. | src/pidgy/weave.py | normalize | bollwyvl/pidgy | 25 | python | def normalize(self, type, object, metadata) -> str:
from .utils import get_decoded, get_minified
if ((type == 'text/html') or ('svg' in type)):
object = get_minified(object)
if type.startswith('image'):
(width, height) = (metadata.get(type, {}).get('width'), metadata.get(type, {}).get('... | def normalize(self, type, object, metadata) -> str:
from .utils import get_decoded, get_minified
if ((type == 'text/html') or ('svg' in type)):
object = get_minified(object)
if type.startswith('image'):
(width, height) = (metadata.get(type, {}).get('width'), metadata.get(type, {}).get('... |
50aea46e0ffbcb66670c488b2dbecadf2e78ca416e2edd787c86a06a13232db0 | def __call__(self, object):
'convert an object into a markdown/html representation'
from .utils import get_active_types
datum = get_ipython().display_formatter.format(object)
(data, metadata) = (datum if isinstance(datum, tuple) else (datum, {}))
try:
key = next(filter(data.__contains__, get... | convert an object into a markdown/html representation | src/pidgy/weave.py | __call__ | bollwyvl/pidgy | 25 | python | def __call__(self, object):
from .utils import get_active_types
datum = get_ipython().display_formatter.format(object)
(data, metadata) = (datum if isinstance(datum, tuple) else (datum, {}))
try:
key = next(filter(data.__contains__, get_active_types(get_ipython())))
except StopIteration... | def __call__(self, object):
from .utils import get_active_types
datum = get_ipython().display_formatter.format(object)
(data, metadata) = (datum if isinstance(datum, tuple) else (datum, {}))
try:
key = next(filter(data.__contains__, get_active_types(get_ipython())))
except StopIteration... |
11337ad32f55a1fefc4a1a5e833df2cc230dc45e184b361209dab530e6ad7f51 | def __init__(self, fname):
'\n Enlil time-series JSON dataset.\n\n This class will read in the given JSON file that contains\n the Enlil output for a specific satellite.\n '
self.name = os.path.basename(fname).split('.')[1]
with open(fname) as f:
self.json = json.loads(f.... | Enlil time-series JSON dataset.
This class will read in the given JSON file that contains
the Enlil output for a specific satellite. | pvw/server/evolution.py | __init__ | SWxTREC/enlil-3d-server | 0 | python | def __init__(self, fname):
'\n Enlil time-series JSON dataset.\n\n This class will read in the given JSON file that contains\n the Enlil output for a specific satellite.\n '
self.name = os.path.basename(fname).split('.')[1]
with open(fname) as f:
self.json = json.loads(f.... | def __init__(self, fname):
'\n Enlil time-series JSON dataset.\n\n This class will read in the given JSON file that contains\n the Enlil output for a specific satellite.\n '
self.name = os.path.basename(fname).split('.')[1]
with open(fname) as f:
self.json = json.loads(f.... |
791c195e16a19e82a5f8376bfd416173bcbd2ad58b3866c3bfef990a8a9d7fb9 | def get_position(self, time):
'\n Get the position at the given time.\n\n time : datetime-like\n Time of interest\n\n\n Returns\n -------\n The closest (X, Y, Z) position of the satellite to the requested time.\n '
loc = np.argmin(np.abs((np.datetime64(time) ... | Get the position at the given time.
time : datetime-like
Time of interest
Returns
-------
The closest (X, Y, Z) position of the satellite to the requested time. | pvw/server/evolution.py | get_position | SWxTREC/enlil-3d-server | 0 | python | def get_position(self, time):
'\n Get the position at the given time.\n\n time : datetime-like\n Time of interest\n\n\n Returns\n -------\n The closest (X, Y, Z) position of the satellite to the requested time.\n '
loc = np.argmin(np.abs((np.datetime64(time) ... | def get_position(self, time):
'\n Get the position at the given time.\n\n time : datetime-like\n Time of interest\n\n\n Returns\n -------\n The closest (X, Y, Z) position of the satellite to the requested time.\n '
loc = np.argmin(np.abs((np.datetime64(time) ... |
195ba857d58538780254d52eba6518620a6fe64825bb9b314595f37b8a9df807 | def get_data(self, variable):
'\n Get the data within the variable of this satellite\n\n variable : str\n Variable of interest\n\n Returns\n -------\n List of data for this satellite\n '
return self.json['data_vars'][variable]['data'] | Get the data within the variable of this satellite
variable : str
Variable of interest
Returns
-------
List of data for this satellite | pvw/server/evolution.py | get_data | SWxTREC/enlil-3d-server | 0 | python | def get_data(self, variable):
'\n Get the data within the variable of this satellite\n\n variable : str\n Variable of interest\n\n Returns\n -------\n List of data for this satellite\n '
return self.json['data_vars'][variable]['data'] | def get_data(self, variable):
'\n Get the data within the variable of this satellite\n\n variable : str\n Variable of interest\n\n Returns\n -------\n List of data for this satellite\n '
return self.json['data_vars'][variable]['data']<|docstring|>Get the data... |
8676d124a1da355cefe7f0dd45dad4a958ed661818c1f9b6d4bf901e4aa50b32 | def get_times(self):
'\n Get the time series within the variable of this satellite\n\n Returns\n -------\n List of times for this satellite\n '
return self.json['coords']['time']['data'] | Get the time series within the variable of this satellite
Returns
-------
List of times for this satellite | pvw/server/evolution.py | get_times | SWxTREC/enlil-3d-server | 0 | python | def get_times(self):
'\n Get the time series within the variable of this satellite\n\n Returns\n -------\n List of times for this satellite\n '
return self.json['coords']['time']['data'] | def get_times(self):
'\n Get the time series within the variable of this satellite\n\n Returns\n -------\n List of times for this satellite\n '
return self.json['coords']['time']['data']<|docstring|>Get the time series within the variable of this satellite
Returns
-------
Lis... |
89775c24d47b5feda2bae813fc085f5ed85c9f2dab7f5e53c0ac6cf39985fba1 | def as_latis(self):
'Create a Latis-style return for front-end use.'
ntimes = len(self.times)
timestep_data = []
for i in range(ntimes):
curr_row = [(int(self.get_times()[i]) * 1000)]
for var in ['Density', 'Vr', 'Pressure', 'T', 'Bx', 'By', 'Bz']:
curr_row.append(self.get_da... | Create a Latis-style return for front-end use. | pvw/server/evolution.py | as_latis | SWxTREC/enlil-3d-server | 0 | python | def as_latis(self):
ntimes = len(self.times)
timestep_data = []
for i in range(ntimes):
curr_row = [(int(self.get_times()[i]) * 1000)]
for var in ['Density', 'Vr', 'Pressure', 'T', 'Bx', 'By', 'Bz']:
curr_row.append(self.get_data(var)[i][0])
timestep_data.append(curr... | def as_latis(self):
ntimes = len(self.times)
timestep_data = []
for i in range(ntimes):
curr_row = [(int(self.get_times()[i]) * 1000)]
for var in ['Density', 'Vr', 'Pressure', 'T', 'Bx', 'By', 'Bz']:
curr_row.append(self.get_data(var)[i][0])
timestep_data.append(curr... |
64af5cdc35e967a0afd3a4cbc1ba6ab44fa7e5b2aa637f5e9464912f0a6a6bc4 | def tl_vbm_and_oae(stim, L):
'\n DEFINE ALL THE PARAMTERS HERE\n '
sheraPdat = 'StartingPoles.dat'
poles = []
for line in open(sheraPdat, 'r'):
poles.append(float(line.rstrip()))
sheraPo = np.array(poles)
irregularities = 1
opts = {}
opts['sheraPo'] = sheraPo
opts['stor... | DEFINE ALL THE PARAMTERS HERE | tlmodel/get_tl_vbm_and_oae.py | tl_vbm_and_oae | deepakbaby/CoNNear_cochlea | 10 | python | def tl_vbm_and_oae(stim, L):
'\n \n '
sheraPdat = 'StartingPoles.dat'
poles = []
for line in open(sheraPdat, 'r'):
poles.append(float(line.rstrip()))
sheraPo = np.array(poles)
irregularities = 1
opts = {}
opts['sheraPo'] = sheraPo
opts['storeflag'] = 've'
opts['prob... | def tl_vbm_and_oae(stim, L):
'\n \n '
sheraPdat = 'StartingPoles.dat'
poles = []
for line in open(sheraPdat, 'r'):
poles.append(float(line.rstrip()))
sheraPo = np.array(poles)
irregularities = 1
opts = {}
opts['sheraPo'] = sheraPo
opts['storeflag'] = 've'
opts['prob... |
85d6a9b73336267f841b6752eb9a540474e28e6ecabd62ffc40aef31b4fdc3ff | @is_staff('Helper')
@commands.group(aliases=['autoprobation'], invoke_without_command=True, case_insensitive=True)
async def autoprobate(self, ctx):
'\n Manages auto-probation.\n on | true | 1 | enable: turns on auto-probation.\n off | false | 0 | disable: turns off auto-probation.\n To ... | Manages auto-probation.
on | true | 1 | enable: turns on auto-probation.
off | false | 0 | disable: turns off auto-probation.
To display the status of auto-probation, invoke with no subcommand. | cogs/newcomers.py | autoprobate | xnoe/Kurisu | 51 | python | @is_staff('Helper')
@commands.group(aliases=['autoprobation'], invoke_without_command=True, case_insensitive=True)
async def autoprobate(self, ctx):
'\n Manages auto-probation.\n on | true | 1 | enable: turns on auto-probation.\n off | false | 0 | disable: turns off auto-probation.\n To ... | @is_staff('Helper')
@commands.group(aliases=['autoprobation'], invoke_without_command=True, case_insensitive=True)
async def autoprobate(self, ctx):
'\n Manages auto-probation.\n on | true | 1 | enable: turns on auto-probation.\n off | false | 0 | disable: turns off auto-probation.\n To ... |
20bd0e9d615a48c3028517f34961b8ae231834563bfcf4315f3909201fa0ca84 | @check_if_user_can_ready()
@commands.guild_only()
@commands.command(aliases=['ready'], cooldown=commands.CooldownMapping.from_cooldown(rate=1, per=300.0, type=commands.BucketType.member))
async def ncready(self, ctx, *, reason=''):
'Alerts online staff to a ready request in newcomers.'
newcomers = self.bot.chan... | Alerts online staff to a ready request in newcomers. | cogs/newcomers.py | ncready | xnoe/Kurisu | 51 | python | @check_if_user_can_ready()
@commands.guild_only()
@commands.command(aliases=['ready'], cooldown=commands.CooldownMapping.from_cooldown(rate=1, per=300.0, type=commands.BucketType.member))
async def ncready(self, ctx, *, reason=):
newcomers = self.bot.channels['newcomers']
reason = reason[:300]
reason =... | @check_if_user_can_ready()
@commands.guild_only()
@commands.command(aliases=['ready'], cooldown=commands.CooldownMapping.from_cooldown(rate=1, per=300.0, type=commands.BucketType.member))
async def ncready(self, ctx, *, reason=):
newcomers = self.bot.channels['newcomers']
reason = reason[:300]
reason =... |
4a943787e4c72affb8d9bd5ad7164e84087619ff42299bf4b773fd906a0d3476 | @numba.njit()
def _get_interpolation_values(xi, yi, sigma_range, mu_range, d_sigma, d_mu):
'\n Return values needed for interpolation: bilinear (2D) interpolation\n within ranges, linear (1D) if "one edge" is crossed, corner value if\n "two edges" are crossed. Defined as jitted function due to compatibilit... | Return values needed for interpolation: bilinear (2D) interpolation
within ranges, linear (1D) if "one edge" is crossed, corner value if
"two edges" are crossed. Defined as jitted function due to compatibility
with numba backend.
:param xi: interpolation value on x-axis, i.e. I_sigma
:type xi: float
:param yi: interpo... | neurolib/models/multimodel/builder/aln.py | _get_interpolation_values | lionelkusch/neurolib | 258 | python | @numba.njit()
def _get_interpolation_values(xi, yi, sigma_range, mu_range, d_sigma, d_mu):
'\n Return values needed for interpolation: bilinear (2D) interpolation\n within ranges, linear (1D) if "one edge" is crossed, corner value if\n "two edges" are crossed. Defined as jitted function due to compatibilit... | @numba.njit()
def _get_interpolation_values(xi, yi, sigma_range, mu_range, d_sigma, d_mu):
'\n Return values needed for interpolation: bilinear (2D) interpolation\n within ranges, linear (1D) if "one edge" is crossed, corner value if\n "two edges" are crossed. Defined as jitted function due to compatibilit... |
9f69a46e0ae6a5df06babd358e1c455f9d78c6c4313509f0943b91b23f391ea4 | @numba.njit()
def _table_lookup(current_mu, current_sigma, sigma_range, mu_range, d_sigma, d_mu, transfer_function_table):
'\n Translate mean and std. deviation of the current to selected quantity using\n linear-nonlinear lookup table for ALN. Defined as jitted function due to\n compatibility with numba ba... | Translate mean and std. deviation of the current to selected quantity using
linear-nonlinear lookup table for ALN. Defined as jitted function due to
compatibility with numba backend. | neurolib/models/multimodel/builder/aln.py | _table_lookup | lionelkusch/neurolib | 258 | python | @numba.njit()
def _table_lookup(current_mu, current_sigma, sigma_range, mu_range, d_sigma, d_mu, transfer_function_table):
'\n Translate mean and std. deviation of the current to selected quantity using\n linear-nonlinear lookup table for ALN. Defined as jitted function due to\n compatibility with numba ba... | @numba.njit()
def _table_lookup(current_mu, current_sigma, sigma_range, mu_range, d_sigma, d_mu, transfer_function_table):
'\n Translate mean and std. deviation of the current to selected quantity using\n linear-nonlinear lookup table for ALN. Defined as jitted function due to\n compatibility with numba ba... |
675a13be8471c04f71c3ffe1d8087d665b0cb1726592115275478635dae1599b | def __init__(self, params, lin_nonlin_transfer_function_filename=None, seed=None):
'\n :param lin_nonlin_transfer_function_filename: filename for precomputed\n transfer functions of the ALN model, if None, will look for it in this\n directory\n :type lin_nonlin_transfer_function_... | :param lin_nonlin_transfer_function_filename: filename for precomputed
transfer functions of the ALN model, if None, will look for it in this
directory
:type lin_nonlin_transfer_function_filename: str|None
:param seed: seed for random number generator
:type seed: int|None | neurolib/models/multimodel/builder/aln.py | __init__ | lionelkusch/neurolib | 258 | python | def __init__(self, params, lin_nonlin_transfer_function_filename=None, seed=None):
'\n :param lin_nonlin_transfer_function_filename: filename for precomputed\n transfer functions of the ALN model, if None, will look for it in this\n directory\n :type lin_nonlin_transfer_function_... | def __init__(self, params, lin_nonlin_transfer_function_filename=None, seed=None):
'\n :param lin_nonlin_transfer_function_filename: filename for precomputed\n transfer functions of the ALN model, if None, will look for it in this\n directory\n :type lin_nonlin_transfer_function_... |
e79f0f98aed41f0da5329bb1a9b3dfdb90e015441bf8e8232a3a9b44db99e60d | def _load_lin_nonlin_transfer_function(self, filename):
'\n Load precomputed transfer functions from h5 file.\n '
logging.info(f'Loading precomputed transfer functions from {filename}')
loaded_h5 = File(filename, 'r')
self.mu_range = np.array(loaded_h5['mu_vals'])
self.d_mu = (self.mu_... | Load precomputed transfer functions from h5 file. | neurolib/models/multimodel/builder/aln.py | _load_lin_nonlin_transfer_function | lionelkusch/neurolib | 258 | python | def _load_lin_nonlin_transfer_function(self, filename):
'\n \n '
logging.info(f'Loading precomputed transfer functions from {filename}')
loaded_h5 = File(filename, 'r')
self.mu_range = np.array(loaded_h5['mu_vals'])
self.d_mu = (self.mu_range[1] - self.mu_range[0])
self.sigma_range... | def _load_lin_nonlin_transfer_function(self, filename):
'\n \n '
logging.info(f'Loading precomputed transfer functions from {filename}')
loaded_h5 = File(filename, 'r')
self.mu_range = np.array(loaded_h5['mu_vals'])
self.d_mu = (self.mu_range[1] - self.mu_range[0])
self.sigma_range... |
8bedffe6917f0946d2a4c42660db306a668e684f9f5dd9a2966f952ae1f6785b | def _callbacks(self):
'\n Construct list of python callbacks for ALN model.\n '
callbacks_list = [(self.callback_functions['firing_rate_lookup'], self.firing_rate_lookup, 2), (self.callback_functions['voltage_lookup'], self.voltage_lookup, 2), (self.callback_functions['tau_lookup'], self.tau_looku... | Construct list of python callbacks for ALN model. | neurolib/models/multimodel/builder/aln.py | _callbacks | lionelkusch/neurolib | 258 | python | def _callbacks(self):
'\n \n '
callbacks_list = [(self.callback_functions['firing_rate_lookup'], self.firing_rate_lookup, 2), (self.callback_functions['voltage_lookup'], self.voltage_lookup, 2), (self.callback_functions['tau_lookup'], self.tau_lookup, 2)]
self._validate_callbacks(callbacks_lis... | def _callbacks(self):
'\n \n '
callbacks_list = [(self.callback_functions['firing_rate_lookup'], self.firing_rate_lookup, 2), (self.callback_functions['voltage_lookup'], self.voltage_lookup, 2), (self.callback_functions['tau_lookup'], self.tau_lookup, 2)]
self._validate_callbacks(callbacks_lis... |
3304baac284683c29f4729bb67937537fae7a41265939fbc177ec4547f240230 | def _numba_callbacks(self):
'\n Define numba callbacks - has to be different than jitcdde callbacks\n because of the internals.\n '
def _table_numba_gen(sigma_range, mu_range, d_sigma, d_mu, transfer_function):
'\n Function generator for numba callbacks. This works simil... | Define numba callbacks - has to be different than jitcdde callbacks
because of the internals. | neurolib/models/multimodel/builder/aln.py | _numba_callbacks | lionelkusch/neurolib | 258 | python | def _numba_callbacks(self):
'\n Define numba callbacks - has to be different than jitcdde callbacks\n because of the internals.\n '
def _table_numba_gen(sigma_range, mu_range, d_sigma, d_mu, transfer_function):
'\n Function generator for numba callbacks. This works simil... | def _numba_callbacks(self):
'\n Define numba callbacks - has to be different than jitcdde callbacks\n because of the internals.\n '
def _table_numba_gen(sigma_range, mu_range, d_sigma, d_mu, transfer_function):
'\n Function generator for numba callbacks. This works simil... |
82a135d8d5266f94736591343e8ff2d59377735d03fdbf43d3f937889e8d3543 | def firing_rate_lookup(self, y, current_mu, current_sigma):
'\n Translate mean and std. deviation of the current to firing rate using\n linear-nonlinear lookup table for ALN.\n '
return _table_lookup(current_mu, current_sigma, self.sigma_range, self.mu_range, self.d_sigma, self.d_mu, self.f... | Translate mean and std. deviation of the current to firing rate using
linear-nonlinear lookup table for ALN. | neurolib/models/multimodel/builder/aln.py | firing_rate_lookup | lionelkusch/neurolib | 258 | python | def firing_rate_lookup(self, y, current_mu, current_sigma):
'\n Translate mean and std. deviation of the current to firing rate using\n linear-nonlinear lookup table for ALN.\n '
return _table_lookup(current_mu, current_sigma, self.sigma_range, self.mu_range, self.d_sigma, self.d_mu, self.f... | def firing_rate_lookup(self, y, current_mu, current_sigma):
'\n Translate mean and std. deviation of the current to firing rate using\n linear-nonlinear lookup table for ALN.\n '
return _table_lookup(current_mu, current_sigma, self.sigma_range, self.mu_range, self.d_sigma, self.d_mu, self.f... |
7d202b260c86db36457023d124a05afa1792b5bf038e16bba6149e3d13cdb435 | def voltage_lookup(self, y, current_mu, current_sigma):
'\n Translate mean and std. deviation of the current to voltage using\n precomputed transfer functions of the aln model.\n '
return _table_lookup(current_mu, current_sigma, self.sigma_range, self.mu_range, self.d_sigma, self.d_mu, self... | Translate mean and std. deviation of the current to voltage using
precomputed transfer functions of the aln model. | neurolib/models/multimodel/builder/aln.py | voltage_lookup | lionelkusch/neurolib | 258 | python | def voltage_lookup(self, y, current_mu, current_sigma):
'\n Translate mean and std. deviation of the current to voltage using\n precomputed transfer functions of the aln model.\n '
return _table_lookup(current_mu, current_sigma, self.sigma_range, self.mu_range, self.d_sigma, self.d_mu, self... | def voltage_lookup(self, y, current_mu, current_sigma):
'\n Translate mean and std. deviation of the current to voltage using\n precomputed transfer functions of the aln model.\n '
return _table_lookup(current_mu, current_sigma, self.sigma_range, self.mu_range, self.d_sigma, self.d_mu, self... |
c10a5a9116417ca428c0bd3a3658c0fbbdd5f76476093993077c4ed6ff107889 | def tau_lookup(self, y, current_mu, current_sigma):
'\n Translate mean and std. deviation of the current to tau - membrane time\n constant using precomputed transfer functions of the aln model.\n '
return _table_lookup(current_mu, current_sigma, self.sigma_range, self.mu_range, self.d_sigma... | Translate mean and std. deviation of the current to tau - membrane time
constant using precomputed transfer functions of the aln model. | neurolib/models/multimodel/builder/aln.py | tau_lookup | lionelkusch/neurolib | 258 | python | def tau_lookup(self, y, current_mu, current_sigma):
'\n Translate mean and std. deviation of the current to tau - membrane time\n constant using precomputed transfer functions of the aln model.\n '
return _table_lookup(current_mu, current_sigma, self.sigma_range, self.mu_range, self.d_sigma... | def tau_lookup(self, y, current_mu, current_sigma):
'\n Translate mean and std. deviation of the current to tau - membrane time\n constant using precomputed transfer functions of the aln model.\n '
return _table_lookup(current_mu, current_sigma, self.sigma_range, self.mu_range, self.d_sigma... |
fd82c4ae4f28b63d49ece26aa694b8d05c2310dd17eeb9d1adf374fc1e214fda | def _get_current_sigma(self, I_syn_sigma_exc, I_syn_sigma_inh, exc_inp, inh_inp, J_exc_max, J_inh_max, ext_sigma):
'\n Compute membrane current standard deviation sigma.\n '
return se.sqrt((((((((2 * (J_exc_max ** 2)) * I_syn_sigma_exc) * self.params['tau_se']) * (self.params['C'] / self.params['g... | Compute membrane current standard deviation sigma. | neurolib/models/multimodel/builder/aln.py | _get_current_sigma | lionelkusch/neurolib | 258 | python | def _get_current_sigma(self, I_syn_sigma_exc, I_syn_sigma_inh, exc_inp, inh_inp, J_exc_max, J_inh_max, ext_sigma):
'\n \n '
return se.sqrt((((((((2 * (J_exc_max ** 2)) * I_syn_sigma_exc) * self.params['tau_se']) * (self.params['C'] / self.params['gL'])) / (((1.0 + exc_inp) * (self.params['C'] / se... | def _get_current_sigma(self, I_syn_sigma_exc, I_syn_sigma_inh, exc_inp, inh_inp, J_exc_max, J_inh_max, ext_sigma):
'\n \n '
return se.sqrt((((((((2 * (J_exc_max ** 2)) * I_syn_sigma_exc) * self.params['tau_se']) * (self.params['C'] / self.params['gL'])) / (((1.0 + exc_inp) * (self.params['C'] / se... |
f46e8f4ac8e39e5bb8b34159e64ec58d732983efacf2d39370f96298629af3e7 | def _get_synaptic_current_mu(self, I_syn_mu, inp, tau):
'\n Compute synaptic current mean mu. Used for both excitatory and inhibitory cuurent.\n '
return ((((1.0 - I_syn_mu) * inp) - I_syn_mu) / tau) | Compute synaptic current mean mu. Used for both excitatory and inhibitory cuurent. | neurolib/models/multimodel/builder/aln.py | _get_synaptic_current_mu | lionelkusch/neurolib | 258 | python | def _get_synaptic_current_mu(self, I_syn_mu, inp, tau):
'\n \n '
return ((((1.0 - I_syn_mu) * inp) - I_syn_mu) / tau) | def _get_synaptic_current_mu(self, I_syn_mu, inp, tau):
'\n \n '
return ((((1.0 - I_syn_mu) * inp) - I_syn_mu) / tau)<|docstring|>Compute synaptic current mean mu. Used for both excitatory and inhibitory cuurent.<|endoftext|> |
929579bb1d70938bc0edcaf04d066fd653fd3fd90709e8f5db9b1eaa0e1083ff | def _initialize_state_vector(self):
'\n Initialize state vector.\n '
np.random.seed(self.seed)
self.initial_state = (np.random.uniform(0, 1, self.num_state_variables) * np.array([3.0, 200.0, 0.5, 0.5, 0.001, 0.001, 0.01])).tolist() | Initialize state vector. | neurolib/models/multimodel/builder/aln.py | _initialize_state_vector | lionelkusch/neurolib | 258 | python | def _initialize_state_vector(self):
'\n \n '
np.random.seed(self.seed)
self.initial_state = (np.random.uniform(0, 1, self.num_state_variables) * np.array([3.0, 200.0, 0.5, 0.5, 0.001, 0.001, 0.01])).tolist() | def _initialize_state_vector(self):
'\n \n '
np.random.seed(self.seed)
self.initial_state = (np.random.uniform(0, 1, self.num_state_variables) * np.array([3.0, 200.0, 0.5, 0.5, 0.001, 0.001, 0.01])).tolist()<|docstring|>Initialize state vector.<|endoftext|> |
49d3841155a1463d15acadcceb8f7f3a2afdc2888013a3ef120942a81c488b97 | def _get_adaptation_current(self, I_adaptation, firing_rate, voltage):
'\n Compute adaptation current as a sum of subthreshold adaptation and spike-triggered adaptation.\n '
return ((((self.params['a'] * (voltage - self.params['EA'])) - I_adaptation) + ((self.params['tauA'] * self.params['b']) * f... | Compute adaptation current as a sum of subthreshold adaptation and spike-triggered adaptation. | neurolib/models/multimodel/builder/aln.py | _get_adaptation_current | lionelkusch/neurolib | 258 | python | def _get_adaptation_current(self, I_adaptation, firing_rate, voltage):
'\n \n '
return ((((self.params['a'] * (voltage - self.params['EA'])) - I_adaptation) + ((self.params['tauA'] * self.params['b']) * firing_rate)) / self.params['tauA']) | def _get_adaptation_current(self, I_adaptation, firing_rate, voltage):
'\n \n '
return ((((self.params['a'] * (voltage - self.params['EA'])) - I_adaptation) + ((self.params['tauA'] * self.params['b']) * firing_rate)) / self.params['tauA'])<|docstring|>Compute adaptation current as a sum of subthre... |
66cb7036102df047b77b07685018088671455c0868ceecea6b3f1f6948c83306 | def _compute_couplings(self, coupling_variables):
'\n Helper that computes coupling from other nodes and network.\n '
exc_coupling = (((self.params['Ke'] * coupling_variables['node_exc_exc']) + ((((self.params['c_gl'] * self.params['tau_se']) / self.params['Jee_max']) * self.params['Ke_gl']) * cou... | Helper that computes coupling from other nodes and network. | neurolib/models/multimodel/builder/aln.py | _compute_couplings | lionelkusch/neurolib | 258 | python | def _compute_couplings(self, coupling_variables):
'\n \n '
exc_coupling = (((self.params['Ke'] * coupling_variables['node_exc_exc']) + ((((self.params['c_gl'] * self.params['tau_se']) / self.params['Jee_max']) * self.params['Ke_gl']) * coupling_variables['network_exc_exc'])) + ((((self.params['c_g... | def _compute_couplings(self, coupling_variables):
'\n \n '
exc_coupling = (((self.params['Ke'] * coupling_variables['node_exc_exc']) + ((((self.params['c_gl'] * self.params['tau_se']) / self.params['Jee_max']) * self.params['Ke_gl']) * coupling_variables['network_exc_exc'])) + ((((self.params['c_g... |
e369705b435f3ef823a5d9b98a24e05c942636009b50918b3cdc7cad63754ea2 | def _initialize_state_vector(self):
'\n Initialize state vector.\n '
np.random.seed(self.seed)
self.initial_state = (np.random.uniform(0, 1, self.num_state_variables) * np.array([3.0, 0.5, 0.5, 0.01, 0.01, 0.01])).tolist() | Initialize state vector. | neurolib/models/multimodel/builder/aln.py | _initialize_state_vector | lionelkusch/neurolib | 258 | python | def _initialize_state_vector(self):
'\n \n '
np.random.seed(self.seed)
self.initial_state = (np.random.uniform(0, 1, self.num_state_variables) * np.array([3.0, 0.5, 0.5, 0.01, 0.01, 0.01])).tolist() | def _initialize_state_vector(self):
'\n \n '
np.random.seed(self.seed)
self.initial_state = (np.random.uniform(0, 1, self.num_state_variables) * np.array([3.0, 0.5, 0.5, 0.01, 0.01, 0.01])).tolist()<|docstring|>Initialize state vector.<|endoftext|> |
82e24022e8b820fe39051b5c7898622a6fcbb93077781c1d13d8087e635b87a5 | def _compute_couplings(self, coupling_variables):
'\n Helper that computes coupling from other nodes and network.\n '
exc_coupling = ((self.params['Ke'] * coupling_variables['node_inh_exc']) + ((((self.params['c_gl'] * self.params['tau_se']) / self.params['Jie_max']) * self.params['Ke_gl']) * self... | Helper that computes coupling from other nodes and network. | neurolib/models/multimodel/builder/aln.py | _compute_couplings | lionelkusch/neurolib | 258 | python | def _compute_couplings(self, coupling_variables):
'\n \n '
exc_coupling = ((self.params['Ke'] * coupling_variables['node_inh_exc']) + ((((self.params['c_gl'] * self.params['tau_se']) / self.params['Jie_max']) * self.params['Ke_gl']) * self.params['ext_inh_rate']))
inh_coupling = (self.params['... | def _compute_couplings(self, coupling_variables):
'\n \n '
exc_coupling = ((self.params['Ke'] * coupling_variables['node_inh_exc']) + ((((self.params['c_gl'] * self.params['tau_se']) / self.params['Jie_max']) * self.params['Ke_gl']) * self.params['ext_inh_rate']))
inh_coupling = (self.params['... |
cc0d8f107227f2afa410f96732a96e6fa14e33f435315cc688c668e86e387e84 | def _rescale_connectivity(self):
'\n Rescale connection strengths for ALN. Should work also for ALN nodes\n with arbitrary number of masses of any type.\n '
tau_mat = np.zeros_like(self.connectivity)
J_mat = np.zeros_like(self.connectivity)
for (col, mass_from) in enumerate(self.mas... | Rescale connection strengths for ALN. Should work also for ALN nodes
with arbitrary number of masses of any type. | neurolib/models/multimodel/builder/aln.py | _rescale_connectivity | lionelkusch/neurolib | 258 | python | def _rescale_connectivity(self):
'\n Rescale connection strengths for ALN. Should work also for ALN nodes\n with arbitrary number of masses of any type.\n '
tau_mat = np.zeros_like(self.connectivity)
J_mat = np.zeros_like(self.connectivity)
for (col, mass_from) in enumerate(self.mas... | def _rescale_connectivity(self):
'\n Rescale connection strengths for ALN. Should work also for ALN nodes\n with arbitrary number of masses of any type.\n '
tau_mat = np.zeros_like(self.connectivity)
J_mat = np.zeros_like(self.connectivity)
for (col, mass_from) in enumerate(self.mas... |
291a14b9dc7eca658e098463453264af8dc45e3e1c673d49ea3dac2e2137fc46 | def __init__(self, exc_params=None, inh_params=None, exc_lin_nonlin_transfer_function_filename=None, inh_lin_nonlin_transfer_function_filename=None, connectivity=ALN_NODE_DEFAULT_CONNECTIVITY, delays=ALN_NODE_DEFAULT_DELAYS, exc_seed=None, inh_seed=None):
'\n :param exc_params: parameters for the excitatory ... | :param exc_params: parameters for the excitatory mass
:type exc_params: dict|None
:param inh_params: parameters for the inhibitory mass
:type inh_params: dict|None
:param exc_lin_nonlin_transfer_function_filename: filename for precomputed
linear-nonlinear transfer functions for excitatory ALN mass, if None, will
... | neurolib/models/multimodel/builder/aln.py | __init__ | lionelkusch/neurolib | 258 | python | def __init__(self, exc_params=None, inh_params=None, exc_lin_nonlin_transfer_function_filename=None, inh_lin_nonlin_transfer_function_filename=None, connectivity=ALN_NODE_DEFAULT_CONNECTIVITY, delays=ALN_NODE_DEFAULT_DELAYS, exc_seed=None, inh_seed=None):
'\n :param exc_params: parameters for the excitatory ... | def __init__(self, exc_params=None, inh_params=None, exc_lin_nonlin_transfer_function_filename=None, inh_lin_nonlin_transfer_function_filename=None, connectivity=ALN_NODE_DEFAULT_CONNECTIVITY, delays=ALN_NODE_DEFAULT_DELAYS, exc_seed=None, inh_seed=None):
'\n :param exc_params: parameters for the excitatory ... |
f34f433371f5252b9754d70364f83a3c297510118cdcc9d0fed6605fd12c6977 | def update_params(self, params_dict, rescale=True):
'\n Rescale connectivity after params update if connectivity was updated.\n '
old_connectivity = self.connectivity.copy()
super().update_params(params_dict)
rescale_flag = (not (self.connectivity == old_connectivity).all())
if (rescal... | Rescale connectivity after params update if connectivity was updated. | neurolib/models/multimodel/builder/aln.py | update_params | lionelkusch/neurolib | 258 | python | def update_params(self, params_dict, rescale=True):
'\n \n '
old_connectivity = self.connectivity.copy()
super().update_params(params_dict)
rescale_flag = (not (self.connectivity == old_connectivity).all())
if (rescale_flag and rescale):
self._rescale_connectivity() | def update_params(self, params_dict, rescale=True):
'\n \n '
old_connectivity = self.connectivity.copy()
super().update_params(params_dict)
rescale_flag = (not (self.connectivity == old_connectivity).all())
if (rescale_flag and rescale):
self._rescale_connectivity()<|docstring|... |
5ba9ce6e7cde578a5211b198ff13adad2b424e3994a4f01b43db8c8d7914a9e2 | def _sync(self):
'\n Apart from basic EXC<->INH connectivity, construct also squared\n variants.\n '
connectivity_sq = ((self.connectivity ** 2) * self.inputs)
sq_connectivity = [(self.sync_symbols[f'node_exc_exc_sq_{self.index}'], sum([connectivity_sq[(row, col)] for row in self.excita... | Apart from basic EXC<->INH connectivity, construct also squared
variants. | neurolib/models/multimodel/builder/aln.py | _sync | lionelkusch/neurolib | 258 | python | def _sync(self):
'\n Apart from basic EXC<->INH connectivity, construct also squared\n variants.\n '
connectivity_sq = ((self.connectivity ** 2) * self.inputs)
sq_connectivity = [(self.sync_symbols[f'node_exc_exc_sq_{self.index}'], sum([connectivity_sq[(row, col)] for row in self.excita... | def _sync(self):
'\n Apart from basic EXC<->INH connectivity, construct also squared\n variants.\n '
connectivity_sq = ((self.connectivity ** 2) * self.inputs)
sq_connectivity = [(self.sync_symbols[f'node_exc_exc_sq_{self.index}'], sum([connectivity_sq[(row, col)] for row in self.excita... |
4d865def66ec1b6c72e9cd31e285165a3febed0ab96415cd1f80791b97581b9b | def __init__(self, connectivity_matrix, delay_matrix, exc_mass_params=None, inh_mass_params=None, exc_lin_nonlin_transfer_function_filename=None, inh_lin_nonlin_transfer_function_filename=None, local_connectivity=ALN_NODE_DEFAULT_CONNECTIVITY, local_delays=ALN_NODE_DEFAULT_DELAYS, exc_seed=None, inh_seed=None):
'\n... | :param connectivity_matrix: connectivity matrix for coupling between
nodes, defined as [from, to]
:type connectivity_matrix: np.ndarray
:param delay_matrix: delay matrix between nodes, if None, delays are
all zeros, in ms, defined as [from, to]
:type delay_matrix: np.ndarray|None
:param exc_mass_params: parameters... | neurolib/models/multimodel/builder/aln.py | __init__ | lionelkusch/neurolib | 258 | python | def __init__(self, connectivity_matrix, delay_matrix, exc_mass_params=None, inh_mass_params=None, exc_lin_nonlin_transfer_function_filename=None, inh_lin_nonlin_transfer_function_filename=None, local_connectivity=ALN_NODE_DEFAULT_CONNECTIVITY, local_delays=ALN_NODE_DEFAULT_DELAYS, exc_seed=None, inh_seed=None):
'\n... | def __init__(self, connectivity_matrix, delay_matrix, exc_mass_params=None, inh_mass_params=None, exc_lin_nonlin_transfer_function_filename=None, inh_lin_nonlin_transfer_function_filename=None, local_connectivity=ALN_NODE_DEFAULT_CONNECTIVITY, local_delays=ALN_NODE_DEFAULT_DELAYS, exc_seed=None, inh_seed=None):
'\n... |
103a9fc65a61803b5f9ccfb8c99ef420475806fc2d0542581b157cc9b85cf9a3 | def _sync(self):
'\n Overload sync method since the ALN model requires\n squared coupling weights and non-trivial coupling indices.\n '
coupling_var_idx = set(sum([list(node[0].coupling_variables.keys()) for node in self], []))
assert (len(coupling_var_idx) == 1)
coupling_var_idx = ... | Overload sync method since the ALN model requires
squared coupling weights and non-trivial coupling indices. | neurolib/models/multimodel/builder/aln.py | _sync | lionelkusch/neurolib | 258 | python | def _sync(self):
'\n Overload sync method since the ALN model requires\n squared coupling weights and non-trivial coupling indices.\n '
coupling_var_idx = set(sum([list(node[0].coupling_variables.keys()) for node in self], []))
assert (len(coupling_var_idx) == 1)
coupling_var_idx = ... | def _sync(self):
'\n Overload sync method since the ALN model requires\n squared coupling weights and non-trivial coupling indices.\n '
coupling_var_idx = set(sum([list(node[0].coupling_variables.keys()) for node in self], []))
assert (len(coupling_var_idx) == 1)
coupling_var_idx = ... |
0a67dfce3d8805a55a84687b0bb4c847bb41022e06f84571adbea47ca5adefcd | def _table_numba_gen(sigma_range, mu_range, d_sigma, d_mu, transfer_function):
'\n Function generator for numba callbacks. This works similarly as\n `functools.partial` (i.e. sets some of the arguments of the inner\n function), but afterwards can be jitted with `numba.njit()`, while... | Function generator for numba callbacks. This works similarly as
`functools.partial` (i.e. sets some of the arguments of the inner
function), but afterwards can be jitted with `numba.njit()`, while
partial functions cannot. | neurolib/models/multimodel/builder/aln.py | _table_numba_gen | lionelkusch/neurolib | 258 | python | def _table_numba_gen(sigma_range, mu_range, d_sigma, d_mu, transfer_function):
'\n Function generator for numba callbacks. This works similarly as\n `functools.partial` (i.e. sets some of the arguments of the inner\n function), but afterwards can be jitted with `numba.njit()`, while... | def _table_numba_gen(sigma_range, mu_range, d_sigma, d_mu, transfer_function):
'\n Function generator for numba callbacks. This works similarly as\n `functools.partial` (i.e. sets some of the arguments of the inner\n function), but afterwards can be jitted with `numba.njit()`, while... |
9416f09d202f64f8fb2ea7c8fb2b7c6ed741023e34942ae0773b7306a2e9a7d3 | def benchmark_cuds_create(benchmark):
'Wrapper function for the CudsCreate benchmark.'
return CudsCreate.iterate_pytest_benchmark(benchmark, size=DEFAULT_SIZE) | Wrapper function for the CudsCreate benchmark. | tests/benchmark_cuds_api.py | benchmark_cuds_create | simphony/osp-core | 17 | python | def benchmark_cuds_create(benchmark):
return CudsCreate.iterate_pytest_benchmark(benchmark, size=DEFAULT_SIZE) | def benchmark_cuds_create(benchmark):
return CudsCreate.iterate_pytest_benchmark(benchmark, size=DEFAULT_SIZE)<|docstring|>Wrapper function for the CudsCreate benchmark.<|endoftext|> |
d4077983a58539e12402b1a328a66335797042711333fca2b8c07aac000e1da6 | def benchmark_add_default(benchmark):
'Wrapper function for the Cuds_add_Default benchmark.'
return Cuds_add_Default.iterate_pytest_benchmark(benchmark, size=DEFAULT_SIZE) | Wrapper function for the Cuds_add_Default benchmark. | tests/benchmark_cuds_api.py | benchmark_add_default | simphony/osp-core | 17 | python | def benchmark_add_default(benchmark):
return Cuds_add_Default.iterate_pytest_benchmark(benchmark, size=DEFAULT_SIZE) | def benchmark_add_default(benchmark):
return Cuds_add_Default.iterate_pytest_benchmark(benchmark, size=DEFAULT_SIZE)<|docstring|>Wrapper function for the Cuds_add_Default benchmark.<|endoftext|> |
2490b932d7327234b05dccf98ba0bca0e57e39fa1044af63ae3d5e41137c193f | def benchmark_cuds_add_rel(benchmark):
'Wrapper function for the Cuds_add_Rel benchmark.'
return Cuds_add_Rel.iterate_pytest_benchmark(benchmark, size=DEFAULT_SIZE) | Wrapper function for the Cuds_add_Rel benchmark. | tests/benchmark_cuds_api.py | benchmark_cuds_add_rel | simphony/osp-core | 17 | python | def benchmark_cuds_add_rel(benchmark):
return Cuds_add_Rel.iterate_pytest_benchmark(benchmark, size=DEFAULT_SIZE) | def benchmark_cuds_add_rel(benchmark):
return Cuds_add_Rel.iterate_pytest_benchmark(benchmark, size=DEFAULT_SIZE)<|docstring|>Wrapper function for the Cuds_add_Rel benchmark.<|endoftext|> |
5565a5834dad0f25b13df3291948cab03d82e54e54a919a326b36cceb2de6caa | def benchmark_cuds_get_byuiduuid(benchmark):
'Wrapper function for the Cuds_get_ByuidUUID benchmark.'
return Cuds_get_ByuidUUID.iterate_pytest_benchmark(benchmark, size=DEFAULT_SIZE) | Wrapper function for the Cuds_get_ByuidUUID benchmark. | tests/benchmark_cuds_api.py | benchmark_cuds_get_byuiduuid | simphony/osp-core | 17 | python | def benchmark_cuds_get_byuiduuid(benchmark):
return Cuds_get_ByuidUUID.iterate_pytest_benchmark(benchmark, size=DEFAULT_SIZE) | def benchmark_cuds_get_byuiduuid(benchmark):
return Cuds_get_ByuidUUID.iterate_pytest_benchmark(benchmark, size=DEFAULT_SIZE)<|docstring|>Wrapper function for the Cuds_get_ByuidUUID benchmark.<|endoftext|> |
15b28bcb75cd9b5e148cc03e83d4ed93b6bab5a55643de8665cfc8b203f327a5 | def benchmark_get_byuiduriref(benchmark):
'Wrapper function for the Cuds_get_ByuidURIRef benchmark.'
return Cuds_get_ByuidURIRef.iterate_pytest_benchmark(benchmark, size=DEFAULT_SIZE) | Wrapper function for the Cuds_get_ByuidURIRef benchmark. | tests/benchmark_cuds_api.py | benchmark_get_byuiduriref | simphony/osp-core | 17 | python | def benchmark_get_byuiduriref(benchmark):
return Cuds_get_ByuidURIRef.iterate_pytest_benchmark(benchmark, size=DEFAULT_SIZE) | def benchmark_get_byuiduriref(benchmark):
return Cuds_get_ByuidURIRef.iterate_pytest_benchmark(benchmark, size=DEFAULT_SIZE)<|docstring|>Wrapper function for the Cuds_get_ByuidURIRef benchmark.<|endoftext|> |
270d70eaf940fcc36f6c4707133ed74d58a4d7fba1e98d1c4cfcad262740274b | def benchmark_get_byrel(benchmark):
'Wrapper function for the Cuds_get_ByRel benchmark.'
return Cuds_get_ByRel.iterate_pytest_benchmark(benchmark, size=DEFAULT_SIZE) | Wrapper function for the Cuds_get_ByRel benchmark. | tests/benchmark_cuds_api.py | benchmark_get_byrel | simphony/osp-core | 17 | python | def benchmark_get_byrel(benchmark):
return Cuds_get_ByRel.iterate_pytest_benchmark(benchmark, size=DEFAULT_SIZE) | def benchmark_get_byrel(benchmark):
return Cuds_get_ByRel.iterate_pytest_benchmark(benchmark, size=DEFAULT_SIZE)<|docstring|>Wrapper function for the Cuds_get_ByRel benchmark.<|endoftext|> |
7e8b394ed75748454e342ebdbef4c6d4bf9160c439c2606e84293a8c9562f424 | def benchmark_get_byoclass(benchmark):
'Wrapper function for the Cuds_get_Byoclass benchmark.'
return Cuds_get_Byoclass.iterate_pytest_benchmark(benchmark, DEFAULT_SIZE) | Wrapper function for the Cuds_get_Byoclass benchmark. | tests/benchmark_cuds_api.py | benchmark_get_byoclass | simphony/osp-core | 17 | python | def benchmark_get_byoclass(benchmark):
return Cuds_get_Byoclass.iterate_pytest_benchmark(benchmark, DEFAULT_SIZE) | def benchmark_get_byoclass(benchmark):
return Cuds_get_Byoclass.iterate_pytest_benchmark(benchmark, DEFAULT_SIZE)<|docstring|>Wrapper function for the Cuds_get_Byoclass benchmark.<|endoftext|> |
f0769042ea6c63a3f7f28f4d97aa379a27cfa5a6329efcea52d9ecdc029904d4 | def benchmark_cuds_iter_byuiduuid(benchmark):
'Wrapper function for the Cuds_iter_ByuidUUID benchmark.'
return Cuds_iter_ByuidUUID.iterate_pytest_benchmark(benchmark, size=DEFAULT_SIZE) | Wrapper function for the Cuds_iter_ByuidUUID benchmark. | tests/benchmark_cuds_api.py | benchmark_cuds_iter_byuiduuid | simphony/osp-core | 17 | python | def benchmark_cuds_iter_byuiduuid(benchmark):
return Cuds_iter_ByuidUUID.iterate_pytest_benchmark(benchmark, size=DEFAULT_SIZE) | def benchmark_cuds_iter_byuiduuid(benchmark):
return Cuds_iter_ByuidUUID.iterate_pytest_benchmark(benchmark, size=DEFAULT_SIZE)<|docstring|>Wrapper function for the Cuds_iter_ByuidUUID benchmark.<|endoftext|> |
860f4e30de8471ccf2c546958d5dbdcb13c6a9ce2541af0f85ce2b41bee187f9 | def benchmark_cuds_iter_byuiduriref(benchmark):
'Wrapper function for the Cuds_iter_ByuidURIRef benchmark.'
return Cuds_iter_ByuidURIRef.iterate_pytest_benchmark(benchmark, size=DEFAULT_SIZE) | Wrapper function for the Cuds_iter_ByuidURIRef benchmark. | tests/benchmark_cuds_api.py | benchmark_cuds_iter_byuiduriref | simphony/osp-core | 17 | python | def benchmark_cuds_iter_byuiduriref(benchmark):
return Cuds_iter_ByuidURIRef.iterate_pytest_benchmark(benchmark, size=DEFAULT_SIZE) | def benchmark_cuds_iter_byuiduriref(benchmark):
return Cuds_iter_ByuidURIRef.iterate_pytest_benchmark(benchmark, size=DEFAULT_SIZE)<|docstring|>Wrapper function for the Cuds_iter_ByuidURIRef benchmark.<|endoftext|> |
f2429465682feb63d6798a8590e4a5d6cbc5c5e0fc0ae1f1be7a55f453dbd69a | def benchmark_cuds_iter_byrel(benchmark):
'Wrapper function for the Cuds_iter_ByRel benchmark.'
return Cuds_iter_ByRel.iterate_pytest_benchmark(benchmark, size=DEFAULT_SIZE) | Wrapper function for the Cuds_iter_ByRel benchmark. | tests/benchmark_cuds_api.py | benchmark_cuds_iter_byrel | simphony/osp-core | 17 | python | def benchmark_cuds_iter_byrel(benchmark):
return Cuds_iter_ByRel.iterate_pytest_benchmark(benchmark, size=DEFAULT_SIZE) | def benchmark_cuds_iter_byrel(benchmark):
return Cuds_iter_ByRel.iterate_pytest_benchmark(benchmark, size=DEFAULT_SIZE)<|docstring|>Wrapper function for the Cuds_iter_ByRel benchmark.<|endoftext|> |
849a4d1313733464e1c3616c2872ebbf0e1f5c3772e34ccc17ec6579d7919090 | def benchmark_iter_byoclass(benchmark):
'Wrapper function for the Cuds_iter_Byoclass benchmark.'
return Cuds_iter_Byoclass.iterate_pytest_benchmark(benchmark, size=DEFAULT_SIZE) | Wrapper function for the Cuds_iter_Byoclass benchmark. | tests/benchmark_cuds_api.py | benchmark_iter_byoclass | simphony/osp-core | 17 | python | def benchmark_iter_byoclass(benchmark):
return Cuds_iter_Byoclass.iterate_pytest_benchmark(benchmark, size=DEFAULT_SIZE) | def benchmark_iter_byoclass(benchmark):
return Cuds_iter_Byoclass.iterate_pytest_benchmark(benchmark, size=DEFAULT_SIZE)<|docstring|>Wrapper function for the Cuds_iter_Byoclass benchmark.<|endoftext|> |
1813039272f48983fbef6dda0bf7e830c389d0f29d866c39452d1a6bc42be3f3 | def benchmark_cuds_is_a(benchmark):
'Wrapper function for the Cuds_is_a benchmark.'
return Cuds_is_a.iterate_pytest_benchmark(benchmark, size=DEFAULT_SIZE) | Wrapper function for the Cuds_is_a benchmark. | tests/benchmark_cuds_api.py | benchmark_cuds_is_a | simphony/osp-core | 17 | python | def benchmark_cuds_is_a(benchmark):
return Cuds_is_a.iterate_pytest_benchmark(benchmark, size=DEFAULT_SIZE) | def benchmark_cuds_is_a(benchmark):
return Cuds_is_a.iterate_pytest_benchmark(benchmark, size=DEFAULT_SIZE)<|docstring|>Wrapper function for the Cuds_is_a benchmark.<|endoftext|> |
1a2dc8dbaaa55954f5ca3eb325e30a4a4cc57c62efa3aecbdf6b920a121cc1ab | def benchmark_cuds_oclass(benchmark):
'Wrapper function for the Cuds_oclass benchmark.'
return Cuds_oclass.iterate_pytest_benchmark(benchmark, size=DEFAULT_SIZE) | Wrapper function for the Cuds_oclass benchmark. | tests/benchmark_cuds_api.py | benchmark_cuds_oclass | simphony/osp-core | 17 | python | def benchmark_cuds_oclass(benchmark):
return Cuds_oclass.iterate_pytest_benchmark(benchmark, size=DEFAULT_SIZE) | def benchmark_cuds_oclass(benchmark):
return Cuds_oclass.iterate_pytest_benchmark(benchmark, size=DEFAULT_SIZE)<|docstring|>Wrapper function for the Cuds_oclass benchmark.<|endoftext|> |
ae1fa9feb7cff4baee0f22b5e18e71a36b066b0ce8f5f60f3fd3cccf585bacaa | def benchmark_cuds_uid(benchmark):
'Wrapper function for the Cuds_uid benchmark.'
return Cuds_uid.iterate_pytest_benchmark(benchmark, size=DEFAULT_SIZE) | Wrapper function for the Cuds_uid benchmark. | tests/benchmark_cuds_api.py | benchmark_cuds_uid | simphony/osp-core | 17 | python | def benchmark_cuds_uid(benchmark):
return Cuds_uid.iterate_pytest_benchmark(benchmark, size=DEFAULT_SIZE) | def benchmark_cuds_uid(benchmark):
return Cuds_uid.iterate_pytest_benchmark(benchmark, size=DEFAULT_SIZE)<|docstring|>Wrapper function for the Cuds_uid benchmark.<|endoftext|> |
19a33c621f7e0167fd7e3fb5361c271fe683a7fef8843f8c5e6fa6bc65a0cc6b | def benchmark_cuds_iri(benchmark):
'Wrapper function for the Cuds_iri benchmark.'
return Cuds_iri.iterate_pytest_benchmark(benchmark, size=DEFAULT_SIZE) | Wrapper function for the Cuds_iri benchmark. | tests/benchmark_cuds_api.py | benchmark_cuds_iri | simphony/osp-core | 17 | python | def benchmark_cuds_iri(benchmark):
return Cuds_iri.iterate_pytest_benchmark(benchmark, size=DEFAULT_SIZE) | def benchmark_cuds_iri(benchmark):
return Cuds_iri.iterate_pytest_benchmark(benchmark, size=DEFAULT_SIZE)<|docstring|>Wrapper function for the Cuds_iri benchmark.<|endoftext|> |
cc3bfcb3f8653acb89a1141e1ffa50098acab2558b1609acdd93d5896e996ebb | def benchmark_cuds_attributes(benchmark):
'Wrapper function for the Cuds_attributes benchmark.'
return Cuds_attributes.iterate_pytest_benchmark(benchmark, size=DEFAULT_SIZE) | Wrapper function for the Cuds_attributes benchmark. | tests/benchmark_cuds_api.py | benchmark_cuds_attributes | simphony/osp-core | 17 | python | def benchmark_cuds_attributes(benchmark):
return Cuds_attributes.iterate_pytest_benchmark(benchmark, size=DEFAULT_SIZE) | def benchmark_cuds_attributes(benchmark):
return Cuds_attributes.iterate_pytest_benchmark(benchmark, size=DEFAULT_SIZE)<|docstring|>Wrapper function for the Cuds_attributes benchmark.<|endoftext|> |
f5c427cccc83a30b11683a09a50d623acde72e1ba6de0862d2a07d7e95a479c1 | def plot_images(images, cls_true, cls_pred=None):
'\n Adapted from https://github.com/Hvass-Labs/TensorFlow-Tutorials/\n '
(fig, axes) = plt.subplots(3, 3)
for (i, ax) in enumerate(axes.flat):
ax.imshow(images[(i, :, :, :)], interpolation='spline16')
cls_true_name = label_names[cls_tru... | Adapted from https://github.com/Hvass-Labs/TensorFlow-Tutorials/ | utils.py | plot_images | archeltaneka/cgp-cnn-PyTorch | 58 | python | def plot_images(images, cls_true, cls_pred=None):
'\n \n '
(fig, axes) = plt.subplots(3, 3)
for (i, ax) in enumerate(axes.flat):
ax.imshow(images[(i, :, :, :)], interpolation='spline16')
cls_true_name = label_names[cls_true[i]]
if (cls_pred is None):
xlabel = '{0} (... | def plot_images(images, cls_true, cls_pred=None):
'\n \n '
(fig, axes) = plt.subplots(3, 3)
for (i, ax) in enumerate(axes.flat):
ax.imshow(images[(i, :, :, :)], interpolation='spline16')
cls_true_name = label_names[cls_true[i]]
if (cls_pred is None):
xlabel = '{0} (... |
6de4325d259b0294240f8a09bee16ef507a868c62e11b2afa890510b63799df7 | def main(*args):
'\n usage attr1, attr2, attr3, ..., t0, t1\n '
try:
assert (len(args) > 2)
(t0, t1) = (args[(- 2)], args[(- 1)])
models = args[:(- 2)]
ArchivingWidget.run(models, t0, t1)
except:
print(__usage__) | usage attr1, attr2, attr3, ..., t0, t1 | PyTangoArchiving/widget/tpgarchivingwidget.py | main | sergirubio/PyTangoArchiving | 6 | python | def main(*args):
'\n \n '
try:
assert (len(args) > 2)
(t0, t1) = (args[(- 2)], args[(- 1)])
models = args[:(- 2)]
ArchivingWidget.run(models, t0, t1)
except:
print(__usage__) | def main(*args):
'\n \n '
try:
assert (len(args) > 2)
(t0, t1) = (args[(- 2)], args[(- 1)])
models = args[:(- 2)]
ArchivingWidget.run(models, t0, t1)
except:
print(__usage__)<|docstring|>usage attr1, attr2, attr3, ..., t0, t1<|endoftext|> |
9ff94085baa893588fff6489d30d7debd3ca531127692eb25497e3ed635d5174 | def addXYModels(self, attrs, t0=None, t1=None):
"\n Convert model, dates to \n 'tgarch://alba03.cells.es:10000/sr/id/scw01/pressure?db=*;t0=2019-11-11T11:41:59;t1=2020-01-03T09:03:03;ts',\n "
c = self.cursor()
self.setCursor(Qt.Qt.WaitCursor)
attrs = fn.toList(attrs)
if ((not t0... | Convert model, dates to
'tgarch://alba03.cells.es:10000/sr/id/scw01/pressure?db=*;t0=2019-11-11T11:41:59;t1=2020-01-03T09:03:03;ts', | PyTangoArchiving/widget/tpgarchivingwidget.py | addXYModels | sergirubio/PyTangoArchiving | 6 | python | def addXYModels(self, attrs, t0=None, t1=None):
"\n Convert model, dates to \n 'tgarch://alba03.cells.es:10000/sr/id/scw01/pressure?db=*;t0=2019-11-11T11:41:59;t1=2020-01-03T09:03:03;ts',\n "
c = self.cursor()
self.setCursor(Qt.Qt.WaitCursor)
attrs = fn.toList(attrs)
if ((not t0... | def addXYModels(self, attrs, t0=None, t1=None):
"\n Convert model, dates to \n 'tgarch://alba03.cells.es:10000/sr/id/scw01/pressure?db=*;t0=2019-11-11T11:41:59;t1=2020-01-03T09:03:03;ts',\n "
c = self.cursor()
self.setCursor(Qt.Qt.WaitCursor)
attrs = fn.toList(attrs)
if ((not t0... |
7ff59a2a0901ee4a0666ea6b7b33fc92b4d2e0321311d090776b513534702871 | def onAddXYModel(self, models=None):
"\n models being a list like:\n \n [('tgarch://alba03.cells.es:10000/sr/id/scw01/pressure?db=*;t0=2019-11-11T11:41:59;t1=2020-01-03T09:03:03;ts', \n 'tgarch://alba03.cells.es:10000/sr/id/scw01/pressure?db=*;t0=2019-11-11T11:41:59;t1=2020-01-03T09:03:0... | models being a list like:
[('tgarch://alba03.cells.es:10000/sr/id/scw01/pressure?db=*;t0=2019-11-11T11:41:59;t1=2020-01-03T09:03:03;ts',
'tgarch://alba03.cells.es:10000/sr/id/scw01/pressure?db=*;t0=2019-11-11T11:41:59;t1=2020-01-03T09:03:03')] | PyTangoArchiving/widget/tpgarchivingwidget.py | onAddXYModel | sergirubio/PyTangoArchiving | 6 | python | def onAddXYModel(self, models=None):
"\n models being a list like:\n \n [('tgarch://alba03.cells.es:10000/sr/id/scw01/pressure?db=*;t0=2019-11-11T11:41:59;t1=2020-01-03T09:03:03;ts', \n 'tgarch://alba03.cells.es:10000/sr/id/scw01/pressure?db=*;t0=2019-11-11T11:41:59;t1=2020-01-03T09:03:0... | def onAddXYModel(self, models=None):
"\n models being a list like:\n \n [('tgarch://alba03.cells.es:10000/sr/id/scw01/pressure?db=*;t0=2019-11-11T11:41:59;t1=2020-01-03T09:03:03;ts', \n 'tgarch://alba03.cells.es:10000/sr/id/scw01/pressure?db=*;t0=2019-11-11T11:41:59;t1=2020-01-03T09:03:0... |
8225f7ed7d33eb713a2718bd19513f955ce98d0d4608316f6a9d925f5f555ce7 | def __init__(self, width=0, height=0):
'Inilization of the width and height of the Rectangle'
self.width = width
self.height = height
Rectangle.number_of_instances += 1 | Inilization of the width and height of the Rectangle | 0x08-python-more_classes/7-rectangle.py | __init__ | JRodriguez9510/holbertonschool-higher_level_programming-2 | 1 | python | def __init__(self, width=0, height=0):
self.width = width
self.height = height
Rectangle.number_of_instances += 1 | def __init__(self, width=0, height=0):
self.width = width
self.height = height
Rectangle.number_of_instances += 1<|docstring|>Inilization of the width and height of the Rectangle<|endoftext|> |
0bdcb37eb526223b64b4e9550d1f0572234645089da2a40eecc8f604a2fa0ff8 | @property
def width(self):
' returns width variable of Square class instance '
return self.__width | returns width variable of Square class instance | 0x08-python-more_classes/7-rectangle.py | width | JRodriguez9510/holbertonschool-higher_level_programming-2 | 1 | python | @property
def width(self):
' '
return self.__width | @property
def width(self):
' '
return self.__width<|docstring|>returns width variable of Square class instance<|endoftext|> |
71898f5ee0241deb03f0384ece1837c7490f748e0da9d14439dd1c091faaa5ac | @width.setter
def width(self, value):
'Sets width value for Rectangle'
if (type(value) != int):
raise TypeError('width must be an integer')
if (value < 0):
raise ValueError('width must be >= 0')
self.__width = value | Sets width value for Rectangle | 0x08-python-more_classes/7-rectangle.py | width | JRodriguez9510/holbertonschool-higher_level_programming-2 | 1 | python | @width.setter
def width(self, value):
if (type(value) != int):
raise TypeError('width must be an integer')
if (value < 0):
raise ValueError('width must be >= 0')
self.__width = value | @width.setter
def width(self, value):
if (type(value) != int):
raise TypeError('width must be an integer')
if (value < 0):
raise ValueError('width must be >= 0')
self.__width = value<|docstring|>Sets width value for Rectangle<|endoftext|> |
38119b655de76e0533d469bc736deb3df443f1d7ae80a9cd3e3ef5cf59a46c69 | @property
def height(self):
' returns height variable of Square class instance '
return self.__height | returns height variable of Square class instance | 0x08-python-more_classes/7-rectangle.py | height | JRodriguez9510/holbertonschool-higher_level_programming-2 | 1 | python | @property
def height(self):
' '
return self.__height | @property
def height(self):
' '
return self.__height<|docstring|>returns height variable of Square class instance<|endoftext|> |
5caee779a4f76b57610bd6d2433e39e1054f7258836735a2d77a03c1a8872c1d | @height.setter
def height(self, value):
'Sets heigth value for Rectangle'
if (type(value) != int):
raise TypeError('height must be an integer')
if (value < 0):
raise ValueError('height must be >= 0')
self.__height = value | Sets heigth value for Rectangle | 0x08-python-more_classes/7-rectangle.py | height | JRodriguez9510/holbertonschool-higher_level_programming-2 | 1 | python | @height.setter
def height(self, value):
if (type(value) != int):
raise TypeError('height must be an integer')
if (value < 0):
raise ValueError('height must be >= 0')
self.__height = value | @height.setter
def height(self, value):
if (type(value) != int):
raise TypeError('height must be an integer')
if (value < 0):
raise ValueError('height must be >= 0')
self.__height = value<|docstring|>Sets heigth value for Rectangle<|endoftext|> |
4569577e3ca64ab83a3f6882ad4311674d972ea0bcf0a0bb3e55b1f2227ec6dd | def area(self):
'Returns the area of the Rectangle'
return (self.__width * self.__height) | Returns the area of the Rectangle | 0x08-python-more_classes/7-rectangle.py | area | JRodriguez9510/holbertonschool-higher_level_programming-2 | 1 | python | def area(self):
return (self.__width * self.__height) | def area(self):
return (self.__width * self.__height)<|docstring|>Returns the area of the Rectangle<|endoftext|> |
77222fe833fee18394511cae699c32a6a6366dfa81efb119064550b222d11b15 | def perimeter(self):
'Returns the perimeter of the Rectangle'
if ((self.__width == 0) or (self.__height == 0)):
p = 0
else:
p = ((self.__width * 2) + (self.__height * 2))
return p | Returns the perimeter of the Rectangle | 0x08-python-more_classes/7-rectangle.py | perimeter | JRodriguez9510/holbertonschool-higher_level_programming-2 | 1 | python | def perimeter(self):
if ((self.__width == 0) or (self.__height == 0)):
p = 0
else:
p = ((self.__width * 2) + (self.__height * 2))
return p | def perimeter(self):
if ((self.__width == 0) or (self.__height == 0)):
p = 0
else:
p = ((self.__width * 2) + (self.__height * 2))
return p<|docstring|>Returns the perimeter of the Rectangle<|endoftext|> |
05a1f4ad00f1827a46b59e2569905e32c165773f0b520821389e972b50470c12 | def __str__(self):
'Prints the rectangle made with # signs'
st = ''
if ((self.__width == 0) or (self.__height == 0)):
return st
else:
for h in range(self.__height):
st += str(((str(self.print_symbol) * self.__width) + '\n'))
h += 1
return st[:(- 1)] | Prints the rectangle made with # signs | 0x08-python-more_classes/7-rectangle.py | __str__ | JRodriguez9510/holbertonschool-higher_level_programming-2 | 1 | python | def __str__(self):
st =
if ((self.__width == 0) or (self.__height == 0)):
return st
else:
for h in range(self.__height):
st += str(((str(self.print_symbol) * self.__width) + '\n'))
h += 1
return st[:(- 1)] | def __str__(self):
st =
if ((self.__width == 0) or (self.__height == 0)):
return st
else:
for h in range(self.__height):
st += str(((str(self.print_symbol) * self.__width) + '\n'))
h += 1
return st[:(- 1)]<|docstring|>Prints the rectangle made with # signs<|... |
6bd153a65c19446272952256b31f1e06f0331616dfe7699c4a1f6194eb73d6df | def __repr__(self):
'returns representation of a rectangle'
return 'Rectangle({:d}, {:d})'.format(self.__width, self.__height) | returns representation of a rectangle | 0x08-python-more_classes/7-rectangle.py | __repr__ | JRodriguez9510/holbertonschool-higher_level_programming-2 | 1 | python | def __repr__(self):
return 'Rectangle({:d}, {:d})'.format(self.__width, self.__height) | def __repr__(self):
return 'Rectangle({:d}, {:d})'.format(self.__width, self.__height)<|docstring|>returns representation of a rectangle<|endoftext|> |
d0175c07cd7e8063c94ca43d9d5550a170913aa607f02aafa02aa1bcc32bf1a4 | def __del__(self):
'deletes a rectangle'
Rectangle.number_of_instances -= 1
return print('Bye rectangle...') | deletes a rectangle | 0x08-python-more_classes/7-rectangle.py | __del__ | JRodriguez9510/holbertonschool-higher_level_programming-2 | 1 | python | def __del__(self):
Rectangle.number_of_instances -= 1
return print('Bye rectangle...') | def __del__(self):
Rectangle.number_of_instances -= 1
return print('Bye rectangle...')<|docstring|>deletes a rectangle<|endoftext|> |
272396952efcab4dffb6241282b410bc0a3da9b64e21f6c826471882c6a4dd33 | def generate_pdf():
'his methods generates pdf report of cinemas statistics\n There are informations like: total sum of selled tickets or total income'
pdf_filename = 'cinemas_report.pdf'
c = canvas.Canvas(pdf_filename, pagesize=portrait(A4))
w = defaultPageSize[0]
h = defaultPageSize[1]
c.se... | his methods generates pdf report of cinemas statistics
There are informations like: total sum of selled tickets or total income | app_dir/reports.py | generate_pdf | mkwiatek770/Cinema_Assistant | 1 | python | def generate_pdf():
'his methods generates pdf report of cinemas statistics\n There are informations like: total sum of selled tickets or total income'
pdf_filename = 'cinemas_report.pdf'
c = canvas.Canvas(pdf_filename, pagesize=portrait(A4))
w = defaultPageSize[0]
h = defaultPageSize[1]
c.se... | def generate_pdf():
'his methods generates pdf report of cinemas statistics\n There are informations like: total sum of selled tickets or total income'
pdf_filename = 'cinemas_report.pdf'
c = canvas.Canvas(pdf_filename, pagesize=portrait(A4))
w = defaultPageSize[0]
h = defaultPageSize[1]
c.se... |
c1f6e07570927183ba19df5e6c9460102d4363ae57c194d6ec83eabb380043ee | def generate_xls():
'This methods generates xls document of cinemas statistics\n There are informations like: total sum of selled tickets or total income'
xls_filename = 'raport.xls'
(cnx, cursor) = create_connection()
workbook = xlsxwriter.Workbook(xls_filename)
worksheet = workbook.add_workshee... | This methods generates xls document of cinemas statistics
There are informations like: total sum of selled tickets or total income | app_dir/reports.py | generate_xls | mkwiatek770/Cinema_Assistant | 1 | python | def generate_xls():
'This methods generates xls document of cinemas statistics\n There are informations like: total sum of selled tickets or total income'
xls_filename = 'raport.xls'
(cnx, cursor) = create_connection()
workbook = xlsxwriter.Workbook(xls_filename)
worksheet = workbook.add_workshee... | def generate_xls():
'This methods generates xls document of cinemas statistics\n There are informations like: total sum of selled tickets or total income'
xls_filename = 'raport.xls'
(cnx, cursor) = create_connection()
workbook = xlsxwriter.Workbook(xls_filename)
worksheet = workbook.add_workshee... |
4f0ae01e08baf81844fc4cdc4110d381045f361d486836e7a5576b702093b0c3 | def crystallographic_resolution(wavelength, pixel_center_distance, detector_distance):
'\n Returns crystallographic resolution :math:`R_f` (full-period resolution) in unit meter\n\n .. math::\n\n R_f = \\frac{ \\lambda }{ 2 \\sin\\left( \\arctan\\left( \\frac{X}{D} \\right) / 2 \\right) }\n\n Args:\n ... | Returns crystallographic resolution :math:`R_f` (full-period resolution) in unit meter
.. math::
R_f = \frac{ \lambda }{ 2 \sin\left( \arctan\left( \frac{X}{D} \right) / 2 \right) }
Args:
:wavelength (float): Photon wavelength :math:`\lambda` in unit meter
:pixel_center_distance (float): Distance :math:`X` be... | condor/utils/diffraction.py | crystallographic_resolution | irischang020/condor | 20 | python | def crystallographic_resolution(wavelength, pixel_center_distance, detector_distance):
'\n Returns crystallographic resolution :math:`R_f` (full-period resolution) in unit meter\n\n .. math::\n\n R_f = \\frac{ \\lambda }{ 2 \\sin\\left( \\arctan\\left( \\frac{X}{D} \\right) / 2 \\right) }\n\n Args:\n ... | def crystallographic_resolution(wavelength, pixel_center_distance, detector_distance):
'\n Returns crystallographic resolution :math:`R_f` (full-period resolution) in unit meter\n\n .. math::\n\n R_f = \\frac{ \\lambda }{ 2 \\sin\\left( \\arctan\\left( \\frac{X}{D} \\right) / 2 \\right) }\n\n Args:\n ... |
7d8b0d7318e62a88b8cf7a0293237de0dd50b02fe4a07a6bb4b700b662930816 | def resolution_element(wavelength, pixel_center_distance, detector_distance):
'\n Returns length :math:`R_h` of one resolution element (half-period resolution) in unit meter\n\n .. math::\n\n R_h = \\frac{ \\lambda }{ 4 \\, \\sin\\left( \\arctan \\left( \\frac{X}{D} \\right) / 2 \\right) }\n\n Args:\n... | Returns length :math:`R_h` of one resolution element (half-period resolution) in unit meter
.. math::
R_h = \frac{ \lambda }{ 4 \, \sin\left( \arctan \left( \frac{X}{D} \right) / 2 \right) }
Args:
:wavelength (float): Photon wavelength :math:`\lambda` in unit meter
:pixel_center_distance (float): Distance :ma... | condor/utils/diffraction.py | resolution_element | irischang020/condor | 20 | python | def resolution_element(wavelength, pixel_center_distance, detector_distance):
'\n Returns length :math:`R_h` of one resolution element (half-period resolution) in unit meter\n\n .. math::\n\n R_h = \\frac{ \\lambda }{ 4 \\, \\sin\\left( \\arctan \\left( \\frac{X}{D} \\right) / 2 \\right) }\n\n Args:\n... | def resolution_element(wavelength, pixel_center_distance, detector_distance):
'\n Returns length :math:`R_h` of one resolution element (half-period resolution) in unit meter\n\n .. math::\n\n R_h = \\frac{ \\lambda }{ 4 \\, \\sin\\left( \\arctan \\left( \\frac{X}{D} \\right) / 2 \\right) }\n\n Args:\n... |
e572bda57e7879ec7b58b67e7c463802e9464338650165714f85c859ac197aff | def nyquist_pixel_size(wavelength, detector_distance, particle_size):
'\n Returns size :math:`p_N` of one Nyquist pixel on the detector in unit meter\n\n .. math::\n \n p_N = \\frac{ D \\lambda }{ d }\n\n Args:\n :wavelength (float): Photon wavelength :math:`\\lambda` in unit meter\n \n ... | Returns size :math:`p_N` of one Nyquist pixel on the detector in unit meter
.. math::
p_N = \frac{ D \lambda }{ d }
Args:
:wavelength (float): Photon wavelength :math:`\lambda` in unit meter
:detector_distance (float): Distance :math:`D` between interaction point and detector plane in unit meter
:particle_... | condor/utils/diffraction.py | nyquist_pixel_size | irischang020/condor | 20 | python | def nyquist_pixel_size(wavelength, detector_distance, particle_size):
'\n Returns size :math:`p_N` of one Nyquist pixel on the detector in unit meter\n\n .. math::\n \n p_N = \\frac{ D \\lambda }{ d }\n\n Args:\n :wavelength (float): Photon wavelength :math:`\\lambda` in unit meter\n \n ... | def nyquist_pixel_size(wavelength, detector_distance, particle_size):
'\n Returns size :math:`p_N` of one Nyquist pixel on the detector in unit meter\n\n .. math::\n \n p_N = \\frac{ D \\lambda }{ d }\n\n Args:\n :wavelength (float): Photon wavelength :math:`\\lambda` in unit meter\n \n ... |
babbc18b295925db62206e1a25d27a36aad5e96518690f85fa475d5ff03ebfc9 | def polarization_factor(x, y, detector_distance, polarization='ignore'):
'\n Returns polarization factor for a given geometry and polarization\n \n Horizontally polarized:\n\n .. math::\n\n P = \\cos^2\\left(\x07rcsin\\left(\x0crac{x}{\\sqrt{x^2+y^2+D^2}}\right)\right)\n\n Vertically polarized:\... | Returns polarization factor for a given geometry and polarization
Horizontally polarized:
.. math::
P = \cos^2\left(rcsin\left(rac{x}{\sqrt{x^2+y^2+D^2}}
ight)
ight)
Vertically polarized:
.. math::
P = \cos^2\left(rcsin\left(rac{y}{\sqrt{x^2+y^2+D^2}}
ight)
ight)
Unpolarized:
P = 0.5\left(1 + \cos^2\l... | condor/utils/diffraction.py | polarization_factor | irischang020/condor | 20 | python | def polarization_factor(x, y, detector_distance, polarization='ignore'):
'\n Returns polarization factor for a given geometry and polarization\n \n Horizontally polarized:\n\n .. math::\n\n P = \\cos^2\\left(\x07rcsin\\left(\x0crac{x}{\\sqrt{x^2+y^2+D^2}}\right)\right)\n\n Vertically polarized:\... | def polarization_factor(x, y, detector_distance, polarization='ignore'):
'\n Returns polarization factor for a given geometry and polarization\n \n Horizontally polarized:\n\n .. math::\n\n P = \\cos^2\\left(\x07rcsin\\left(\x0crac{x}{\\sqrt{x^2+y^2+D^2}}\right)\right)\n\n Vertically polarized:\... |
a031a63d347a3a1f432a371e230aeb6ac619ac38229951f8455ce839bbc15d2f | def file_mock(func):
'Create pseudo file object.'
@functools.wraps(func)
def wrapper(*args, **kwargs):
content = '\n'.join((f'{i},{i}' for i in range(6)))
with mock.patch('lib.image_data.open', mock.mock_open(read_data=content)) as f_mock:
func(*args, **kwargs)
return wrappe... | Create pseudo file object. | dito/tests/test_image_data.py | file_mock | luise-strietzel/slurk-bots | 0 | python | def file_mock(func):
@functools.wraps(func)
def wrapper(*args, **kwargs):
content = '\n'.join((f'{i},{i}' for i in range(6)))
with mock.patch('lib.image_data.open', mock.mock_open(read_data=content)) as f_mock:
func(*args, **kwargs)
return wrapper | def file_mock(func):
@functools.wraps(func)
def wrapper(*args, **kwargs):
content = '\n'.join((f'{i},{i}' for i in range(6)))
with mock.patch('lib.image_data.open', mock.mock_open(read_data=content)) as f_mock:
func(*args, **kwargs)
return wrapper<|docstring|>Create pseudo ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.