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 |
|---|---|---|---|---|---|---|---|---|---|
85e9e73f54941530163c9c24d5d0ff590c6950b9d5f3f30339ae5b4062003401 | def lifetimes(self, dates, include_start_date):
'\n Compute a DataFrame representing asset lifetimes for the specified date\n range.\n\n Parameters\n ----------\n dates : pd.DatetimeIndex\n The dates for which to compute lifetimes.\n include_start_date : bool\n ... | Compute a DataFrame representing asset lifetimes for the specified date
range.
Parameters
----------
dates : pd.DatetimeIndex
The dates for which to compute lifetimes.
include_start_date : bool
Whether or not to count the asset as alive on its start_date.
This is useful in a backtesting context where `lif... | catalyst/exchange/exchange_asset_finder.py | lifetimes | korigod/catalyst | 6 | python | def lifetimes(self, dates, include_start_date):
'\n Compute a DataFrame representing asset lifetimes for the specified date\n range.\n\n Parameters\n ----------\n dates : pd.DatetimeIndex\n The dates for which to compute lifetimes.\n include_start_date : bool\n ... | def lifetimes(self, dates, include_start_date):
'\n Compute a DataFrame representing asset lifetimes for the specified date\n range.\n\n Parameters\n ----------\n dates : pd.DatetimeIndex\n The dates for which to compute lifetimes.\n include_start_date : bool\n ... |
2624f84f5e31d3577ffd7ec704aab4aeaa53998fd41c99ea80ccec4fef5abb8f | @click.group(cls=cli.make_multi_command('treadmill.cli'))
@click.option('--dns-domain', required=False, envvar='TREADMILL_DNS_DOMAIN', callback=cli.handle_context_opt, is_eager=True, expose_value=False)
@click.option('--dns-server', required=False, envvar='TREADMILL_DNS_SERVER', callback=cli.handle_context_opt, is_eage... | Treadmill CLI. | treadmill/console.py | run | gaocegege/treadmill | 2 | python | @click.group(cls=cli.make_multi_command('treadmill.cli'))
@click.option('--dns-domain', required=False, envvar='TREADMILL_DNS_DOMAIN', callback=cli.handle_context_opt, is_eager=True, expose_value=False)
@click.option('--dns-server', required=False, envvar='TREADMILL_DNS_SERVER', callback=cli.handle_context_opt, is_eage... | @click.group(cls=cli.make_multi_command('treadmill.cli'))
@click.option('--dns-domain', required=False, envvar='TREADMILL_DNS_DOMAIN', callback=cli.handle_context_opt, is_eager=True, expose_value=False)
@click.option('--dns-server', required=False, envvar='TREADMILL_DNS_SERVER', callback=cli.handle_context_opt, is_eage... |
c426f9245b4086f36928ce3d446496dab858b934082ea950cb4ecdb2555cc76b | def populate_obj(self, *objs):
"\n Populates the attributes of the passed `obj`s with data from the\n form's fields. This is especially useful to populate the topic and\n post objects at the same time.\n "
for obj in objs:
super(EditTopicForm, self).populate_obj(obj)
imag... | Populates the attributes of the passed `obj`s with data from the
form's fields. This is especially useful to populate the topic and
post objects at the same time. | flaskbb/forum/forms.py | populate_obj | 1panpan1/tj_dnalab | 0 | python | def populate_obj(self, *objs):
"\n Populates the attributes of the passed `obj`s with data from the\n form's fields. This is especially useful to populate the topic and\n post objects at the same time.\n "
for obj in objs:
super(EditTopicForm, self).populate_obj(obj)
imag... | def populate_obj(self, *objs):
"\n Populates the attributes of the passed `obj`s with data from the\n form's fields. This is especially useful to populate the topic and\n post objects at the same time.\n "
for obj in objs:
super(EditTopicForm, self).populate_obj(obj)
imag... |
fff013c0121c94d9205d6dba35ef70dfeb95088e1bdd6bd56b3f77a34daaf5d6 | def test_precipitable_water():
'Test precipitable water with observed sounding.'
with UseSampleData():
data = get_upper_air_data(datetime(2016, 5, 22, 0), 'DDC', source='wyoming')
pw = precipitable_water(data.variables['dewpoint'][:], data.variables['pressure'][:], top=(400 * units.hPa))
truth =... | Test precipitable water with observed sounding. | metpy/calc/tests/test_indices.py | test_precipitable_water | shofer16450/MetPy | 0 | python | def test_precipitable_water():
with UseSampleData():
data = get_upper_air_data(datetime(2016, 5, 22, 0), 'DDC', source='wyoming')
pw = precipitable_water(data.variables['dewpoint'][:], data.variables['pressure'][:], top=(400 * units.hPa))
truth = (0.8899441949243486 * units('inches')).to('milli... | def test_precipitable_water():
with UseSampleData():
data = get_upper_air_data(datetime(2016, 5, 22, 0), 'DDC', source='wyoming')
pw = precipitable_water(data.variables['dewpoint'][:], data.variables['pressure'][:], top=(400 * units.hPa))
truth = (0.8899441949243486 * units('inches')).to('milli... |
60988bc934626062f889e9fbab7b02630e9a8e4a99e9e129d71a75758d083cf3 | def test_precipitable_water_no_bounds():
'Test precipitable water with observed sounding and no bounds given.'
with UseSampleData():
data = get_upper_air_data(datetime(2016, 5, 22, 0), 'DDC', source='wyoming')
dewpoint = data.variables['dewpoint'][:]
pressure = data.variables['pressure'][:]
... | Test precipitable water with observed sounding and no bounds given. | metpy/calc/tests/test_indices.py | test_precipitable_water_no_bounds | shofer16450/MetPy | 0 | python | def test_precipitable_water_no_bounds():
with UseSampleData():
data = get_upper_air_data(datetime(2016, 5, 22, 0), 'DDC', source='wyoming')
dewpoint = data.variables['dewpoint'][:]
pressure = data.variables['pressure'][:]
inds = (pressure >= (400 * units.hPa))
pw = precipitable_water(de... | def test_precipitable_water_no_bounds():
with UseSampleData():
data = get_upper_air_data(datetime(2016, 5, 22, 0), 'DDC', source='wyoming')
dewpoint = data.variables['dewpoint'][:]
pressure = data.variables['pressure'][:]
inds = (pressure >= (400 * units.hPa))
pw = precipitable_water(de... |
1af281b70688ffed20c45e8f4cf6d3f0409ffc12eefbffbff1137307a2d52a3c | def test_precipitable_water_bound_error():
'Test with no top bound given and data that produced floating point issue #596.'
pressure = (np.array([993.0, 978.0, 960.5, 927.6, 925.0, 895.8, 892.0, 876.0, 45.9, 39.9, 36.0, 36.0, 34.3]) * units.hPa)
dewpoint = (np.array([25.5, 24.1, 23.1, 21.2, 21.1, 19.4, 19.2... | Test with no top bound given and data that produced floating point issue #596. | metpy/calc/tests/test_indices.py | test_precipitable_water_bound_error | shofer16450/MetPy | 0 | python | def test_precipitable_water_bound_error():
pressure = (np.array([993.0, 978.0, 960.5, 927.6, 925.0, 895.8, 892.0, 876.0, 45.9, 39.9, 36.0, 36.0, 34.3]) * units.hPa)
dewpoint = (np.array([25.5, 24.1, 23.1, 21.2, 21.1, 19.4, 19.2, 19.2, (- 87.1), (- 86.5), (- 86.5), (- 86.5), (- 88.1)]) * units.degC)
pw ... | def test_precipitable_water_bound_error():
pressure = (np.array([993.0, 978.0, 960.5, 927.6, 925.0, 895.8, 892.0, 876.0, 45.9, 39.9, 36.0, 36.0, 34.3]) * units.hPa)
dewpoint = (np.array([25.5, 24.1, 23.1, 21.2, 21.1, 19.4, 19.2, 19.2, (- 87.1), (- 86.5), (- 86.5), (- 86.5), (- 88.1)]) * units.degC)
pw ... |
46ba3f62b0717cdd66e5a07b8b3fabaab3c652f124cd81f9e0743837138a6cc8 | def test_mean_pressure_weighted():
'Test pressure-weighted mean wind function with vertical interpolation.'
with UseSampleData():
data = get_upper_air_data(datetime(2016, 5, 22, 0), 'DDC', source='wyoming')
(u, v) = mean_pressure_weighted(data.variables['pressure'][:], data.variables['u_wind'][:], d... | Test pressure-weighted mean wind function with vertical interpolation. | metpy/calc/tests/test_indices.py | test_mean_pressure_weighted | shofer16450/MetPy | 0 | python | def test_mean_pressure_weighted():
with UseSampleData():
data = get_upper_air_data(datetime(2016, 5, 22, 0), 'DDC', source='wyoming')
(u, v) = mean_pressure_weighted(data.variables['pressure'][:], data.variables['u_wind'][:], data.variables['v_wind'][:], heights=data.variables['height'][:], depth=(... | def test_mean_pressure_weighted():
with UseSampleData():
data = get_upper_air_data(datetime(2016, 5, 22, 0), 'DDC', source='wyoming')
(u, v) = mean_pressure_weighted(data.variables['pressure'][:], data.variables['u_wind'][:], data.variables['v_wind'][:], heights=data.variables['height'][:], depth=(... |
7ce41880d534651a397ac34fda166c838d855742ef29c256dd3fcaa32f8e996e | def test_mean_pressure_weighted_elevated():
'Test pressure-weighted mean wind function with a base above the surface.'
with UseSampleData():
data = get_upper_air_data(datetime(2016, 5, 22, 0), 'DDC', source='wyoming')
(u, v) = mean_pressure_weighted(data.variables['pressure'][:], data.variables['u_w... | Test pressure-weighted mean wind function with a base above the surface. | metpy/calc/tests/test_indices.py | test_mean_pressure_weighted_elevated | shofer16450/MetPy | 0 | python | def test_mean_pressure_weighted_elevated():
with UseSampleData():
data = get_upper_air_data(datetime(2016, 5, 22, 0), 'DDC', source='wyoming')
(u, v) = mean_pressure_weighted(data.variables['pressure'][:], data.variables['u_wind'][:], data.variables['v_wind'][:], heights=data.variables['height'][:]... | def test_mean_pressure_weighted_elevated():
with UseSampleData():
data = get_upper_air_data(datetime(2016, 5, 22, 0), 'DDC', source='wyoming')
(u, v) = mean_pressure_weighted(data.variables['pressure'][:], data.variables['u_wind'][:], data.variables['v_wind'][:], heights=data.variables['height'][:]... |
bcaf5c7cca0b2c8bc87e1a02025faecfe9652914bcd86b1106c216a7e00992b3 | def test_bunkers_motion():
'Test Bunkers storm motion with observed sounding.'
with UseSampleData():
data = get_upper_air_data(datetime(2016, 5, 22, 0), 'DDC', source='wyoming')
motion = concatenate(bunkers_storm_motion(data.variables['pressure'][:], data.variables['u_wind'][:], data.variables['v_wi... | Test Bunkers storm motion with observed sounding. | metpy/calc/tests/test_indices.py | test_bunkers_motion | shofer16450/MetPy | 0 | python | def test_bunkers_motion():
with UseSampleData():
data = get_upper_air_data(datetime(2016, 5, 22, 0), 'DDC', source='wyoming')
motion = concatenate(bunkers_storm_motion(data.variables['pressure'][:], data.variables['u_wind'][:], data.variables['v_wind'][:], data.variables['height'][:]))
truth = ... | def test_bunkers_motion():
with UseSampleData():
data = get_upper_air_data(datetime(2016, 5, 22, 0), 'DDC', source='wyoming')
motion = concatenate(bunkers_storm_motion(data.variables['pressure'][:], data.variables['u_wind'][:], data.variables['v_wind'][:], data.variables['height'][:]))
truth = ... |
b7af2487c6f7ec9bf652c2feb47f500376cd876463ef54baa2a8ebb1d38f8d7f | def test_bulk_shear():
'Test bulk shear with observed sounding.'
with UseSampleData():
data = get_upper_air_data(datetime(2016, 5, 22, 0), 'DDC', source='wyoming')
(u, v) = bulk_shear(data.variables['pressure'][:], data.variables['u_wind'][:], data.variables['v_wind'][:], heights=data.variables['hei... | Test bulk shear with observed sounding. | metpy/calc/tests/test_indices.py | test_bulk_shear | shofer16450/MetPy | 0 | python | def test_bulk_shear():
with UseSampleData():
data = get_upper_air_data(datetime(2016, 5, 22, 0), 'DDC', source='wyoming')
(u, v) = bulk_shear(data.variables['pressure'][:], data.variables['u_wind'][:], data.variables['v_wind'][:], heights=data.variables['height'][:], depth=(6000 * units('meter')))
... | def test_bulk_shear():
with UseSampleData():
data = get_upper_air_data(datetime(2016, 5, 22, 0), 'DDC', source='wyoming')
(u, v) = bulk_shear(data.variables['pressure'][:], data.variables['u_wind'][:], data.variables['v_wind'][:], heights=data.variables['height'][:], depth=(6000 * units('meter')))
... |
6369b81a5ce524d4b9d94544e42e814ba68941a849c1f99eb62fef482025819a | def test_bulk_shear_no_depth():
'Test bulk shear with observed sounding and no depth given. Issue #568.'
with UseSampleData():
data = get_upper_air_data(datetime(2016, 5, 22, 0), 'DDC', source='wyoming')
(u, v) = bulk_shear(data.variables['pressure'][:], data.variables['u_wind'][:], data.variables['... | Test bulk shear with observed sounding and no depth given. Issue #568. | metpy/calc/tests/test_indices.py | test_bulk_shear_no_depth | shofer16450/MetPy | 0 | python | def test_bulk_shear_no_depth():
with UseSampleData():
data = get_upper_air_data(datetime(2016, 5, 22, 0), 'DDC', source='wyoming')
(u, v) = bulk_shear(data.variables['pressure'][:], data.variables['u_wind'][:], data.variables['v_wind'][:], heights=data.variables['height'][:])
truth = ([20.22501... | def test_bulk_shear_no_depth():
with UseSampleData():
data = get_upper_air_data(datetime(2016, 5, 22, 0), 'DDC', source='wyoming')
(u, v) = bulk_shear(data.variables['pressure'][:], data.variables['u_wind'][:], data.variables['v_wind'][:], heights=data.variables['height'][:])
truth = ([20.22501... |
cde2545c27bb8daa7a1ac3cb4bb57cb9f6e8215fbd3d914d2d25aafdd6e2a5fa | def test_bulk_shear_elevated():
'Test bulk shear with observed sounding and a base above the surface.'
with UseSampleData():
data = get_upper_air_data(datetime(2016, 5, 22, 0), 'DDC', source='wyoming')
(u, v) = bulk_shear(data.variables['pressure'][:], data.variables['u_wind'][:], data.variables['v_... | Test bulk shear with observed sounding and a base above the surface. | metpy/calc/tests/test_indices.py | test_bulk_shear_elevated | shofer16450/MetPy | 0 | python | def test_bulk_shear_elevated():
with UseSampleData():
data = get_upper_air_data(datetime(2016, 5, 22, 0), 'DDC', source='wyoming')
(u, v) = bulk_shear(data.variables['pressure'][:], data.variables['u_wind'][:], data.variables['v_wind'][:], heights=data.variables['height'][:], bottom=(data.variables... | def test_bulk_shear_elevated():
with UseSampleData():
data = get_upper_air_data(datetime(2016, 5, 22, 0), 'DDC', source='wyoming')
(u, v) = bulk_shear(data.variables['pressure'][:], data.variables['u_wind'][:], data.variables['v_wind'][:], heights=data.variables['height'][:], bottom=(data.variables... |
319e1a20133c8258d0e6bfe8b8019140bab2605676188e612b5fdc89d84076b5 | def test_supercell_composite():
'Test supercell composite function.'
mucape = ([2000.0, 1000.0, 500.0, 2000.0] * units('J/kg'))
esrh = ([400.0, 150.0, 45.0, 45.0] * units('m^2/s^2'))
ebwd = ([30.0, 15.0, 5.0, 5.0] * units('m/s'))
truth = [16.0, 2.25, 0.0, 0.0]
supercell_comp = supercell_composit... | Test supercell composite function. | metpy/calc/tests/test_indices.py | test_supercell_composite | shofer16450/MetPy | 0 | python | def test_supercell_composite():
mucape = ([2000.0, 1000.0, 500.0, 2000.0] * units('J/kg'))
esrh = ([400.0, 150.0, 45.0, 45.0] * units('m^2/s^2'))
ebwd = ([30.0, 15.0, 5.0, 5.0] * units('m/s'))
truth = [16.0, 2.25, 0.0, 0.0]
supercell_comp = supercell_composite(mucape, esrh, ebwd)
assert_arr... | def test_supercell_composite():
mucape = ([2000.0, 1000.0, 500.0, 2000.0] * units('J/kg'))
esrh = ([400.0, 150.0, 45.0, 45.0] * units('m^2/s^2'))
ebwd = ([30.0, 15.0, 5.0, 5.0] * units('m/s'))
truth = [16.0, 2.25, 0.0, 0.0]
supercell_comp = supercell_composite(mucape, esrh, ebwd)
assert_arr... |
6f2a2c82820dd5870376333a3bec703eee4d937f3135d452cfc978bf6f9b9cc6 | def test_supercell_composite_scalar():
'Test supercell composite function with a single value.'
mucape = (2000.0 * units('J/kg'))
esrh = (400.0 * units('m^2/s^2'))
ebwd = (30.0 * units('m/s'))
truth = 16.0
supercell_comp = supercell_composite(mucape, esrh, ebwd)
assert_almost_equal(supercell... | Test supercell composite function with a single value. | metpy/calc/tests/test_indices.py | test_supercell_composite_scalar | shofer16450/MetPy | 0 | python | def test_supercell_composite_scalar():
mucape = (2000.0 * units('J/kg'))
esrh = (400.0 * units('m^2/s^2'))
ebwd = (30.0 * units('m/s'))
truth = 16.0
supercell_comp = supercell_composite(mucape, esrh, ebwd)
assert_almost_equal(supercell_comp, truth, 6) | def test_supercell_composite_scalar():
mucape = (2000.0 * units('J/kg'))
esrh = (400.0 * units('m^2/s^2'))
ebwd = (30.0 * units('m/s'))
truth = 16.0
supercell_comp = supercell_composite(mucape, esrh, ebwd)
assert_almost_equal(supercell_comp, truth, 6)<|docstring|>Test supercell composite fu... |
54ec801d27c55f59e3e32d77ae2042e69a0c9755ce424b057bcaca5f5546d764 | def test_sigtor():
'Test significant tornado parameter function.'
sbcape = ([2000.0, 2000.0, 2000.0, 2000.0, 3000, 4000] * units('J/kg'))
sblcl = ([3000.0, 1500.0, 500.0, 1500.0, 1500, 800] * units('meter'))
srh1 = ([200.0, 200.0, 200.0, 200.0, 300, 400] * units('m^2/s^2'))
shr6 = ([20.0, 5.0, 20.0,... | Test significant tornado parameter function. | metpy/calc/tests/test_indices.py | test_sigtor | shofer16450/MetPy | 0 | python | def test_sigtor():
sbcape = ([2000.0, 2000.0, 2000.0, 2000.0, 3000, 4000] * units('J/kg'))
sblcl = ([3000.0, 1500.0, 500.0, 1500.0, 1500, 800] * units('meter'))
srh1 = ([200.0, 200.0, 200.0, 200.0, 300, 400] * units('m^2/s^2'))
shr6 = ([20.0, 5.0, 20.0, 35.0, 20.0, 35] * units('m/s'))
truth = [... | def test_sigtor():
sbcape = ([2000.0, 2000.0, 2000.0, 2000.0, 3000, 4000] * units('J/kg'))
sblcl = ([3000.0, 1500.0, 500.0, 1500.0, 1500, 800] * units('meter'))
srh1 = ([200.0, 200.0, 200.0, 200.0, 300, 400] * units('m^2/s^2'))
shr6 = ([20.0, 5.0, 20.0, 35.0, 20.0, 35] * units('m/s'))
truth = [... |
470e90ef448f04a57f5f21380e05eb29a43de679d8289004fcd107f7e11cb599 | def test_sigtor_scalar():
'Test significant tornado parameter function with a single value.'
sbcape = (4000 * units('J/kg'))
sblcl = (800 * units('meter'))
srh1 = (400 * units('m^2/s^2'))
shr6 = (35 * units('m/s'))
truth = 10.666667
sigtor = significant_tornado(sbcape, sblcl, srh1, shr6)
... | Test significant tornado parameter function with a single value. | metpy/calc/tests/test_indices.py | test_sigtor_scalar | shofer16450/MetPy | 0 | python | def test_sigtor_scalar():
sbcape = (4000 * units('J/kg'))
sblcl = (800 * units('meter'))
srh1 = (400 * units('m^2/s^2'))
shr6 = (35 * units('m/s'))
truth = 10.666667
sigtor = significant_tornado(sbcape, sblcl, srh1, shr6)
assert_almost_equal(sigtor, truth, 6) | def test_sigtor_scalar():
sbcape = (4000 * units('J/kg'))
sblcl = (800 * units('meter'))
srh1 = (400 * units('m^2/s^2'))
shr6 = (35 * units('m/s'))
truth = 10.666667
sigtor = significant_tornado(sbcape, sblcl, srh1, shr6)
assert_almost_equal(sigtor, truth, 6)<|docstring|>Test significan... |
dace591c97dd8306bd2b9c7154efaffdb3e1d796b4ac3b6bfa7d48bf76e1eb3d | def downloader(url: str, name: str) -> str:
'Download method with urllib library.\n\n Args:\n url (str): Link to file\n name (str): Saving path with name of the downloaded file\n Returns:\n file (str): Path to file\n '
print(f'Downloading file {name} from {url}...')
print('This... | Download method with urllib library.
Args:
url (str): Link to file
name (str): Saving path with name of the downloaded file
Returns:
file (str): Path to file | googlesat/utils.py | downloader | alekfal/googlesat | 1 | python | def downloader(url: str, name: str) -> str:
'Download method with urllib library.\n\n Args:\n url (str): Link to file\n name (str): Saving path with name of the downloaded file\n Returns:\n file (str): Path to file\n '
print(f'Downloading file {name} from {url}...')
print('This... | def downloader(url: str, name: str) -> str:
'Download method with urllib library.\n\n Args:\n url (str): Link to file\n name (str): Saving path with name of the downloaded file\n Returns:\n file (str): Path to file\n '
print(f'Downloading file {name} from {url}...')
print('This... |
4d35d1538ffbd5387d33261e4703d293f48b584c45e00b8e6ca680ccce0423f3 | def get_cache_dir(subdir: str=None) -> str:
'Function for getting cache directory to store reused files like kernels, or scratch space for autotuning, etc.\n\n Args:\n subdir (str, optional): Directory to save data. Defaults to None\n\n Returns:\n str: Path to package cache directory\n '
... | Function for getting cache directory to store reused files like kernels, or scratch space for autotuning, etc.
Args:
subdir (str, optional): Directory to save data. Defaults to None
Returns:
str: Path to package cache directory | googlesat/utils.py | get_cache_dir | alekfal/googlesat | 1 | python | def get_cache_dir(subdir: str=None) -> str:
'Function for getting cache directory to store reused files like kernels, or scratch space for autotuning, etc.\n\n Args:\n subdir (str, optional): Directory to save data. Defaults to None\n\n Returns:\n str: Path to package cache directory\n '
... | def get_cache_dir(subdir: str=None) -> str:
'Function for getting cache directory to store reused files like kernels, or scratch space for autotuning, etc.\n\n Args:\n subdir (str, optional): Directory to save data. Defaults to None\n\n Returns:\n str: Path to package cache directory\n '
... |
f3040ba8d8bc499f56e343e2f50b1d40b9654b40f676e406d97ba81bcd6fb887 | def extract(file: str, chunksize: int=(10 ** 4)) -> pd.DataFrame:
'Extracts a compressed CSV file and stores it into a pandas DataFrame as chunks.\n\n Args:\n file (str): Path and name of the CSV file\n chunksize (int, optional): Chunk size. Defaults to 10**4\n\n Returns:\n pd.DataFrame: ... | Extracts a compressed CSV file and stores it into a pandas DataFrame as chunks.
Args:
file (str): Path and name of the CSV file
chunksize (int, optional): Chunk size. Defaults to 10**4
Returns:
pd.DataFrame: Pandas DataFrame into chunks | googlesat/utils.py | extract | alekfal/googlesat | 1 | python | def extract(file: str, chunksize: int=(10 ** 4)) -> pd.DataFrame:
'Extracts a compressed CSV file and stores it into a pandas DataFrame as chunks.\n\n Args:\n file (str): Path and name of the CSV file\n chunksize (int, optional): Chunk size. Defaults to 10**4\n\n Returns:\n pd.DataFrame: ... | def extract(file: str, chunksize: int=(10 ** 4)) -> pd.DataFrame:
'Extracts a compressed CSV file and stores it into a pandas DataFrame as chunks.\n\n Args:\n file (str): Path and name of the CSV file\n chunksize (int, optional): Chunk size. Defaults to 10**4\n\n Returns:\n pd.DataFrame: ... |
e92a357aeaab8ad6b77548305406d731f103dd4278c9837ac615288f3cfecb8f | def create_connection(db_file: str):
'Create a database connection to a SQLite database.\n\n Args:\n db_file (str): Path to SQLite database\n '
print(f'Connecting to {db_file}...')
conn = None
try:
conn = sqlite3.connect(db_file)
except ValueError as error:
print(error)
... | Create a database connection to a SQLite database.
Args:
db_file (str): Path to SQLite database | googlesat/utils.py | create_connection | alekfal/googlesat | 1 | python | def create_connection(db_file: str):
'Create a database connection to a SQLite database.\n\n Args:\n db_file (str): Path to SQLite database\n '
print(f'Connecting to {db_file}...')
conn = None
try:
conn = sqlite3.connect(db_file)
except ValueError as error:
print(error)
... | def create_connection(db_file: str):
'Create a database connection to a SQLite database.\n\n Args:\n db_file (str): Path to SQLite database\n '
print(f'Connecting to {db_file}...')
conn = None
try:
conn = sqlite3.connect(db_file)
except ValueError as error:
print(error)
... |
52734969dbca1e9700b9e5ca54389c1f3d9a9897253bdac8f9389a2092ae9e9a | def fill_database(connection: sqlite3, data: pd.DataFrame, name: str='Fill'):
'Fill an SQL database from pandas dataframe chunks.\n\n Args:\n connection (sqlite3): SQLite3 database path\n data (pd.DataFrame): Data in chunks\n name (str, optional): Name of the created table. Defaults to "Fill... | Fill an SQL database from pandas dataframe chunks.
Args:
connection (sqlite3): SQLite3 database path
data (pd.DataFrame): Data in chunks
name (str, optional): Name of the created table. Defaults to "Fill". | googlesat/utils.py | fill_database | alekfal/googlesat | 1 | python | def fill_database(connection: sqlite3, data: pd.DataFrame, name: str='Fill'):
'Fill an SQL database from pandas dataframe chunks.\n\n Args:\n connection (sqlite3): SQLite3 database path\n data (pd.DataFrame): Data in chunks\n name (str, optional): Name of the created table. Defaults to "Fill... | def fill_database(connection: sqlite3, data: pd.DataFrame, name: str='Fill'):
'Fill an SQL database from pandas dataframe chunks.\n\n Args:\n connection (sqlite3): SQLite3 database path\n data (pd.DataFrame): Data in chunks\n name (str, optional): Name of the created table. Defaults to "Fill... |
174b7aa3b4b1cb977d2b36f5a43f56348478307d360da055e7f9f571b1ebaa29 | def get_links(data: pd.DataFrame) -> pd.DataFrame:
'Converts google cloud storage links to simple http links\n\n Args:\n data (pd.DataFrame): DataFrame with the result from querying the database\n\n Returns:\n pd.DataFrame: New DataFrame with http links\n '
data['URL'] = data['BASE_URL']
... | Converts google cloud storage links to simple http links
Args:
data (pd.DataFrame): DataFrame with the result from querying the database
Returns:
pd.DataFrame: New DataFrame with http links | googlesat/utils.py | get_links | alekfal/googlesat | 1 | python | def get_links(data: pd.DataFrame) -> pd.DataFrame:
'Converts google cloud storage links to simple http links\n\n Args:\n data (pd.DataFrame): DataFrame with the result from querying the database\n\n Returns:\n pd.DataFrame: New DataFrame with http links\n '
data['URL'] = data['BASE_URL']
... | def get_links(data: pd.DataFrame) -> pd.DataFrame:
'Converts google cloud storage links to simple http links\n\n Args:\n data (pd.DataFrame): DataFrame with the result from querying the database\n\n Returns:\n pd.DataFrame: New DataFrame with http links\n '
data['URL'] = data['BASE_URL']
... |
4207bfcc9b907150a960ccddd72756032bc309335cbc7b6531f08aaa4c9a9b42 | @receiver(post_delete, sender=Feedback)
def feedback_screenshot_delete(sender, instance, **kwargs):
"\n Delete feedback's screenshot.\n "
if instance.screenshot:
instance.screenshot.delete(save=False) | Delete feedback's screenshot. | tellme/models.py | feedback_screenshot_delete | danihodovic/django-tellme | 0 | python | @receiver(post_delete, sender=Feedback)
def feedback_screenshot_delete(sender, instance, **kwargs):
"\n \n "
if instance.screenshot:
instance.screenshot.delete(save=False) | @receiver(post_delete, sender=Feedback)
def feedback_screenshot_delete(sender, instance, **kwargs):
"\n \n "
if instance.screenshot:
instance.screenshot.delete(save=False)<|docstring|>Delete feedback's screenshot.<|endoftext|> |
a7f23639b8f94d868401efd565836570f189a5615ac916ff2f249263945f9197 | def get_ramp(x0, x1, vmax, a, dt, output='ramp only'):
"\n Generate a ramp trajectory from x0 to x1 with constant\n acceleration, a, to maximum velocity v_max. \n\n Note, the main purlpose of this routine is to generate a\n trajectory from x0 to x1. For this reason v_max and a are adjusted\n slightly... | Generate a ramp trajectory from x0 to x1 with constant
acceleration, a, to maximum velocity v_max.
Note, the main purlpose of this routine is to generate a
trajectory from x0 to x1. For this reason v_max and a are adjusted
slightly to work with the given time step.
Arguments:
x0 = starting position
x1 = ending pos... | software/python/autostep/autostep/utility.py | get_ramp | hanhanhan-kim/autostep | 2 | python | def get_ramp(x0, x1, vmax, a, dt, output='ramp only'):
"\n Generate a ramp trajectory from x0 to x1 with constant\n acceleration, a, to maximum velocity v_max. \n\n Note, the main purlpose of this routine is to generate a\n trajectory from x0 to x1. For this reason v_max and a are adjusted\n slightly... | def get_ramp(x0, x1, vmax, a, dt, output='ramp only'):
"\n Generate a ramp trajectory from x0 to x1 with constant\n acceleration, a, to maximum velocity v_max. \n\n Note, the main purlpose of this routine is to generate a\n trajectory from x0 to x1. For this reason v_max and a are adjusted\n slightly... |
6b1624c15a3bb627b4daaf614507fdb28119b91d133b83ceed935fa7b90e818b | @fn.register_derived_var(varname='pCFC11', dependent_vars=['CFC11', 'TEMP', 'SALT'])
def derive_var_pCFC11(ds):
'compute pCFC11'
from calc import calc_cfc11sol
ds['pCFC11'] = ((ds['CFC11'] * 1e-09) / calc_cfc11sol(ds.SALT, ds.TEMP))
ds.pCFC11.attrs['long_name'] = 'pCFC-11'
ds.pCFC11.attrs['units'] =... | compute pCFC11 | notebooks/figures/variable_defs.py | derive_var_pCFC11 | mgrover1/cesm2-marbl-book | 0 | python | @fn.register_derived_var(varname='pCFC11', dependent_vars=['CFC11', 'TEMP', 'SALT'])
def derive_var_pCFC11(ds):
from calc import calc_cfc11sol
ds['pCFC11'] = ((ds['CFC11'] * 1e-09) / calc_cfc11sol(ds.SALT, ds.TEMP))
ds.pCFC11.attrs['long_name'] = 'pCFC-11'
ds.pCFC11.attrs['units'] = 'patm'
if (... | @fn.register_derived_var(varname='pCFC11', dependent_vars=['CFC11', 'TEMP', 'SALT'])
def derive_var_pCFC11(ds):
from calc import calc_cfc11sol
ds['pCFC11'] = ((ds['CFC11'] * 1e-09) / calc_cfc11sol(ds.SALT, ds.TEMP))
ds.pCFC11.attrs['long_name'] = 'pCFC-11'
ds.pCFC11.attrs['units'] = 'patm'
if (... |
3c616334e7bfc9c02c7357cc898185d0f70abf2051a5e479e1fb181885824084 | @fn.register_derived_var(varname='pCFC12', dependent_vars=['CFC12', 'TEMP', 'SALT'])
def derive_var_pCFC12(ds):
'compute pCFC12'
from calc import calc_cfc12sol
ds['pCFC12'] = ((ds['CFC12'] * 1e-09) / calc_cfc12sol(ds['SALT'], ds['TEMP']))
ds.pCFC12.attrs['long_name'] = 'pCFC-12'
ds.pCFC12.attrs['uni... | compute pCFC12 | notebooks/figures/variable_defs.py | derive_var_pCFC12 | mgrover1/cesm2-marbl-book | 0 | python | @fn.register_derived_var(varname='pCFC12', dependent_vars=['CFC12', 'TEMP', 'SALT'])
def derive_var_pCFC12(ds):
from calc import calc_cfc12sol
ds['pCFC12'] = ((ds['CFC12'] * 1e-09) / calc_cfc12sol(ds['SALT'], ds['TEMP']))
ds.pCFC12.attrs['long_name'] = 'pCFC-12'
ds.pCFC12.attrs['units'] = 'patm'
... | @fn.register_derived_var(varname='pCFC12', dependent_vars=['CFC12', 'TEMP', 'SALT'])
def derive_var_pCFC12(ds):
from calc import calc_cfc12sol
ds['pCFC12'] = ((ds['CFC12'] * 1e-09) / calc_cfc12sol(ds['SALT'], ds['TEMP']))
ds.pCFC12.attrs['long_name'] = 'pCFC-12'
ds.pCFC12.attrs['units'] = 'patm'
... |
3042091a1887529f0a0d94d04935488cc6948bc26a943950a046673ce58b85a6 | @fn.register_derived_var(varname='Cant', dependent_vars=['DIC', 'DIC_ALT_CO2'])
def derive_var_Cant(ds):
'compute Cant'
ds['Cant'] = (ds['DIC'] - ds['DIC_ALT_CO2'])
ds.Cant.attrs = ds.DIC.attrs
ds.Cant.attrs['long_name'] = 'Anthropogenic CO$_2$'
if ('coordinates' in ds.DIC.attrs):
ds.Cant.at... | compute Cant | notebooks/figures/variable_defs.py | derive_var_Cant | mgrover1/cesm2-marbl-book | 0 | python | @fn.register_derived_var(varname='Cant', dependent_vars=['DIC', 'DIC_ALT_CO2'])
def derive_var_Cant(ds):
ds['Cant'] = (ds['DIC'] - ds['DIC_ALT_CO2'])
ds.Cant.attrs = ds.DIC.attrs
ds.Cant.attrs['long_name'] = 'Anthropogenic CO$_2$'
if ('coordinates' in ds.DIC.attrs):
ds.Cant.attrs['coordinat... | @fn.register_derived_var(varname='Cant', dependent_vars=['DIC', 'DIC_ALT_CO2'])
def derive_var_Cant(ds):
ds['Cant'] = (ds['DIC'] - ds['DIC_ALT_CO2'])
ds.Cant.attrs = ds.DIC.attrs
ds.Cant.attrs['long_name'] = 'Anthropogenic CO$_2$'
if ('coordinates' in ds.DIC.attrs):
ds.Cant.attrs['coordinat... |
b8fcc892dd7d300c17f61d0fd34398e9e700704264fc68ae41984c0bbec288d2 | @fn.register_derived_var(varname='Del14C', dependent_vars=['ABIO_DIC14', 'ABIO_DIC'])
def derive_var_Del14C(ds):
'compute Del14C'
ds['Del14C'] = (1000.0 * ((ds['ABIO_DIC14'] / ds['ABIO_DIC']) - 1.0))
ds.Del14C.attrs = ds.ABIO_DIC14.attrs
ds.Del14C.attrs['long_name'] = '$\\Delta^{14}$C'
ds.Del14C.att... | compute Del14C | notebooks/figures/variable_defs.py | derive_var_Del14C | mgrover1/cesm2-marbl-book | 0 | python | @fn.register_derived_var(varname='Del14C', dependent_vars=['ABIO_DIC14', 'ABIO_DIC'])
def derive_var_Del14C(ds):
ds['Del14C'] = (1000.0 * ((ds['ABIO_DIC14'] / ds['ABIO_DIC']) - 1.0))
ds.Del14C.attrs = ds.ABIO_DIC14.attrs
ds.Del14C.attrs['long_name'] = '$\\Delta^{14}$C'
ds.Del14C.attrs['units'] = 'p... | @fn.register_derived_var(varname='Del14C', dependent_vars=['ABIO_DIC14', 'ABIO_DIC'])
def derive_var_Del14C(ds):
ds['Del14C'] = (1000.0 * ((ds['ABIO_DIC14'] / ds['ABIO_DIC']) - 1.0))
ds.Del14C.attrs = ds.ABIO_DIC14.attrs
ds.Del14C.attrs['long_name'] = '$\\Delta^{14}$C'
ds.Del14C.attrs['units'] = 'p... |
5aabf71711fa0abe0f6273d9dc4c519bebd90cd40c7f947d03d148d1a1c24903 | @fn.register_derived_var(varname='SST', dependent_vars=['TEMP'])
def derive_var_SST(ds):
'compute SST'
ds['SST'] = ds['TEMP'].isel(z_t=0, drop=True)
ds.SST.attrs = ds.TEMP.attrs
ds.SST.attrs['long_name'] = 'SST'
ds.SST.encoding = ds.TEMP.encoding
if ('coordinates' in ds.TEMP.attrs):
ds.S... | compute SST | notebooks/figures/variable_defs.py | derive_var_SST | mgrover1/cesm2-marbl-book | 0 | python | @fn.register_derived_var(varname='SST', dependent_vars=['TEMP'])
def derive_var_SST(ds):
ds['SST'] = ds['TEMP'].isel(z_t=0, drop=True)
ds.SST.attrs = ds.TEMP.attrs
ds.SST.attrs['long_name'] = 'SST'
ds.SST.encoding = ds.TEMP.encoding
if ('coordinates' in ds.TEMP.attrs):
ds.SST.attrs['coo... | @fn.register_derived_var(varname='SST', dependent_vars=['TEMP'])
def derive_var_SST(ds):
ds['SST'] = ds['TEMP'].isel(z_t=0, drop=True)
ds.SST.attrs = ds.TEMP.attrs
ds.SST.attrs['long_name'] = 'SST'
ds.SST.encoding = ds.TEMP.encoding
if ('coordinates' in ds.TEMP.attrs):
ds.SST.attrs['coo... |
33f0f74c677dc8ef0244cb690b45a73169099efaf4c82b82aeb5f74e39ce1499 | @fn.register_derived_var(varname='DOC_FLUX_IN_100m', dependent_vars=['DIA_IMPVF_DOC', 'HDIFB_DOC', 'WT_DOC'])
def derive_var_DOC_FLUX_IN_100m(ds):
'compute DOC flux across 100m (positive down)'
k_100m_top = np.where((ds.z_w_top == 10000.0))[0][0]
k_100m_bot = np.where((ds.z_w_bot == 10000.0))[0][0]
DIA_... | compute DOC flux across 100m (positive down) | notebooks/figures/variable_defs.py | derive_var_DOC_FLUX_IN_100m | mgrover1/cesm2-marbl-book | 0 | python | @fn.register_derived_var(varname='DOC_FLUX_IN_100m', dependent_vars=['DIA_IMPVF_DOC', 'HDIFB_DOC', 'WT_DOC'])
def derive_var_DOC_FLUX_IN_100m(ds):
k_100m_top = np.where((ds.z_w_top == 10000.0))[0][0]
k_100m_bot = np.where((ds.z_w_bot == 10000.0))[0][0]
DIA_IMPVF = ds.DIA_IMPVF_DOC.isel(z_w_bot=k_100m_b... | @fn.register_derived_var(varname='DOC_FLUX_IN_100m', dependent_vars=['DIA_IMPVF_DOC', 'HDIFB_DOC', 'WT_DOC'])
def derive_var_DOC_FLUX_IN_100m(ds):
k_100m_top = np.where((ds.z_w_top == 10000.0))[0][0]
k_100m_bot = np.where((ds.z_w_bot == 10000.0))[0][0]
DIA_IMPVF = ds.DIA_IMPVF_DOC.isel(z_w_bot=k_100m_b... |
32851626d502c9be5bcd9dad76fb428d156a65bf01fa7662cb14fb6b96e875aa | @fn.register_derived_var(varname='DOCr_FLUX_IN_100m', dependent_vars=['DIA_IMPVF_DOCr', 'HDIFB_DOCr', 'WT_DOCr'])
def derive_var_DOCr_FLUX_IN_100m(ds):
'compute DOCr flux across 100m (positive down)'
k_100m_top = np.where((ds.z_w_top == 10000.0))[0][0]
k_100m_bot = np.where((ds.z_w_bot == 10000.0))[0][0]
... | compute DOCr flux across 100m (positive down) | notebooks/figures/variable_defs.py | derive_var_DOCr_FLUX_IN_100m | mgrover1/cesm2-marbl-book | 0 | python | @fn.register_derived_var(varname='DOCr_FLUX_IN_100m', dependent_vars=['DIA_IMPVF_DOCr', 'HDIFB_DOCr', 'WT_DOCr'])
def derive_var_DOCr_FLUX_IN_100m(ds):
k_100m_top = np.where((ds.z_w_top == 10000.0))[0][0]
k_100m_bot = np.where((ds.z_w_bot == 10000.0))[0][0]
DIA_IMPVF = ds.DIA_IMPVF_DOCr.isel(z_w_bot=k_... | @fn.register_derived_var(varname='DOCr_FLUX_IN_100m', dependent_vars=['DIA_IMPVF_DOCr', 'HDIFB_DOCr', 'WT_DOCr'])
def derive_var_DOCr_FLUX_IN_100m(ds):
k_100m_top = np.where((ds.z_w_top == 10000.0))[0][0]
k_100m_bot = np.where((ds.z_w_bot == 10000.0))[0][0]
DIA_IMPVF = ds.DIA_IMPVF_DOCr.isel(z_w_bot=k_... |
21055da29865b97099fded0bc5743f2d97b08fe53cb0c2388b6427d2572f3c69 | @fn.register_derived_var(varname='DOCt_FLUX_IN_100m', dependent_vars=['DIA_IMPVF_DOC', 'HDIFB_DOC', 'WT_DOC', 'DIA_IMPVF_DOCr', 'HDIFB_DOCr', 'WT_DOCr'])
def derive_var_DOCt_FLUX_IN_100m(ds):
'compute DOCt (DOC + DOCr) flux across 100m (positive down)'
k_100m_top = np.where((ds.z_w_top == 10000.0))[0][0]
k_... | compute DOCt (DOC + DOCr) flux across 100m (positive down) | notebooks/figures/variable_defs.py | derive_var_DOCt_FLUX_IN_100m | mgrover1/cesm2-marbl-book | 0 | python | @fn.register_derived_var(varname='DOCt_FLUX_IN_100m', dependent_vars=['DIA_IMPVF_DOC', 'HDIFB_DOC', 'WT_DOC', 'DIA_IMPVF_DOCr', 'HDIFB_DOCr', 'WT_DOCr'])
def derive_var_DOCt_FLUX_IN_100m(ds):
k_100m_top = np.where((ds.z_w_top == 10000.0))[0][0]
k_100m_bot = np.where((ds.z_w_bot == 10000.0))[0][0]
DIA_I... | @fn.register_derived_var(varname='DOCt_FLUX_IN_100m', dependent_vars=['DIA_IMPVF_DOC', 'HDIFB_DOC', 'WT_DOC', 'DIA_IMPVF_DOCr', 'HDIFB_DOCr', 'WT_DOCr'])
def derive_var_DOCt_FLUX_IN_100m(ds):
k_100m_top = np.where((ds.z_w_top == 10000.0))[0][0]
k_100m_bot = np.where((ds.z_w_bot == 10000.0))[0][0]
DIA_I... |
5cfe508a1fadeed3f924f9599d1fa42fbcfa64a0ce949772e1de8696731db983 | @fn.register_derived_var(varname='DOCt', dependent_vars=['DOC', 'DOCr'])
def derive_var_DOCt(ds):
'compute DOCt'
ds['DOCt'] = (ds['DOC'] + ds['DOCr'])
ds.DOCt.attrs = ds.DOC.attrs
ds.DOCt.attrs['long_name'] = 'Dissolved Organic Carbon (total)'
ds.DOCt.encoding = ds.DOC.encoding
return ds.drop(['... | compute DOCt | notebooks/figures/variable_defs.py | derive_var_DOCt | mgrover1/cesm2-marbl-book | 0 | python | @fn.register_derived_var(varname='DOCt', dependent_vars=['DOC', 'DOCr'])
def derive_var_DOCt(ds):
ds['DOCt'] = (ds['DOC'] + ds['DOCr'])
ds.DOCt.attrs = ds.DOC.attrs
ds.DOCt.attrs['long_name'] = 'Dissolved Organic Carbon (total)'
ds.DOCt.encoding = ds.DOC.encoding
return ds.drop(['DOC', 'DOCr']) | @fn.register_derived_var(varname='DOCt', dependent_vars=['DOC', 'DOCr'])
def derive_var_DOCt(ds):
ds['DOCt'] = (ds['DOC'] + ds['DOCr'])
ds.DOCt.attrs = ds.DOC.attrs
ds.DOCt.attrs['long_name'] = 'Dissolved Organic Carbon (total)'
ds.DOCt.encoding = ds.DOC.encoding
return ds.drop(['DOC', 'DOCr'])... |
7541c9d2b6cdf7cbaa84f82538dbf40e3038cd9cbcc522d4305d1de55db2ddab | @fn.register_derived_var(varname='DONt', dependent_vars=['DON', 'DONr'])
def derive_var_DONt(ds):
'compute DONt'
ds['DONt'] = (ds['DON'] + ds['DONr'])
ds.DONt.attrs = ds.DON.attrs
ds.DONt.attrs['long_name'] = 'Dissolved Organic Nitrogen (total)'
ds.DONt.encoding = ds.DON.encoding
return ds.drop(... | compute DONt | notebooks/figures/variable_defs.py | derive_var_DONt | mgrover1/cesm2-marbl-book | 0 | python | @fn.register_derived_var(varname='DONt', dependent_vars=['DON', 'DONr'])
def derive_var_DONt(ds):
ds['DONt'] = (ds['DON'] + ds['DONr'])
ds.DONt.attrs = ds.DON.attrs
ds.DONt.attrs['long_name'] = 'Dissolved Organic Nitrogen (total)'
ds.DONt.encoding = ds.DON.encoding
return ds.drop(['DON', 'DONr'... | @fn.register_derived_var(varname='DONt', dependent_vars=['DON', 'DONr'])
def derive_var_DONt(ds):
ds['DONt'] = (ds['DON'] + ds['DONr'])
ds.DONt.attrs = ds.DON.attrs
ds.DONt.attrs['long_name'] = 'Dissolved Organic Nitrogen (total)'
ds.DONt.encoding = ds.DON.encoding
return ds.drop(['DON', 'DONr'... |
1ed9389b195275bc0133cad38406aa4e67118f1a10eed9ac77902fc35c163184 | @fn.register_derived_var(varname='DOPt', dependent_vars=['DOP', 'DOPr'])
def derive_var_DOPt(ds):
'compute DOPt'
ds['DOPt'] = (ds['DOP'] + ds['DOPr'])
ds.DOPt.attrs = ds.DOP.attrs
ds.DOPt.attrs['long_name'] = 'Dissolved Organic Phosphorus (total)'
ds.DOPt.encoding = ds.DOP.encoding
return ds.dro... | compute DOPt | notebooks/figures/variable_defs.py | derive_var_DOPt | mgrover1/cesm2-marbl-book | 0 | python | @fn.register_derived_var(varname='DOPt', dependent_vars=['DOP', 'DOPr'])
def derive_var_DOPt(ds):
ds['DOPt'] = (ds['DOP'] + ds['DOPr'])
ds.DOPt.attrs = ds.DOP.attrs
ds.DOPt.attrs['long_name'] = 'Dissolved Organic Phosphorus (total)'
ds.DOPt.encoding = ds.DOP.encoding
return ds.drop(['DOP', 'DOP... | @fn.register_derived_var(varname='DOPt', dependent_vars=['DOP', 'DOPr'])
def derive_var_DOPt(ds):
ds['DOPt'] = (ds['DOP'] + ds['DOPr'])
ds.DOPt.attrs = ds.DOP.attrs
ds.DOPt.attrs['long_name'] = 'Dissolved Organic Phosphorus (total)'
ds.DOPt.encoding = ds.DOP.encoding
return ds.drop(['DOP', 'DOP... |
095dcdabe5bcc29e738c6b646d7728885575d0339d4362c58ea3a8166ea246b7 | def initialize_data_buffer(self) -> NoReturn:
'\n TODO: Annotation\n '
_buffer_args = {}
if self.use_rnn:
_type = 'EpisodeExperienceReplay'
_buffer_args.update(batch_size=self.episode_batch_size, capacity=self.episode_buffer_size, burn_in_time_step=self.burn_in_time_step, train... | TODO: Annotation | rls/algos/base/off_policy.py | initialize_data_buffer | qiushuiai/RLs | 1 | python | def initialize_data_buffer(self) -> NoReturn:
'\n \n '
_buffer_args = {}
if self.use_rnn:
_type = 'EpisodeExperienceReplay'
_buffer_args.update(batch_size=self.episode_batch_size, capacity=self.episode_buffer_size, burn_in_time_step=self.burn_in_time_step, train_time_step=self.... | def initialize_data_buffer(self) -> NoReturn:
'\n \n '
_buffer_args = {}
if self.use_rnn:
_type = 'EpisodeExperienceReplay'
_buffer_args.update(batch_size=self.episode_batch_size, capacity=self.episode_buffer_size, burn_in_time_step=self.burn_in_time_step, train_time_step=self.... |
20dfa48ce49a0e6bb61552439be9be3e9156db6e2e489a2ec1be4a4948b23eef | def store_data(self, exps: BatchExperiences) -> NoReturn:
'\n for off-policy training, use this function to store <s, a, r, s_, done> into ReplayBuffer.\n '
self.data.add(exps) | for off-policy training, use this function to store <s, a, r, s_, done> into ReplayBuffer. | rls/algos/base/off_policy.py | store_data | qiushuiai/RLs | 1 | python | def store_data(self, exps: BatchExperiences) -> NoReturn:
'\n \n '
self.data.add(exps) | def store_data(self, exps: BatchExperiences) -> NoReturn:
'\n \n '
self.data.add(exps)<|docstring|>for off-policy training, use this function to store <s, a, r, s_, done> into ReplayBuffer.<|endoftext|> |
2a02800777cc583a2a9d09408d1e51514fa840f9ca6328c881727f07fb3bd8cc | def get_transitions(self) -> BatchExperiences:
'\n TODO: Annotation\n '
exps = self.data.sample()
return self._data_process2dict(exps) | TODO: Annotation | rls/algos/base/off_policy.py | get_transitions | qiushuiai/RLs | 1 | python | def get_transitions(self) -> BatchExperiences:
'\n \n '
exps = self.data.sample()
return self._data_process2dict(exps) | def get_transitions(self) -> BatchExperiences:
'\n \n '
exps = self.data.sample()
return self._data_process2dict(exps)<|docstring|>TODO: Annotation<|endoftext|> |
b76552c6de7df80baaa971d90157fc7a6603b9714443ec2fa623abba2c733292 | def _train(self, *args):
'\n NOTE: usually need to override this function\n TODO: Annotation\n '
return (None, {}) | NOTE: usually need to override this function
TODO: Annotation | rls/algos/base/off_policy.py | _train | qiushuiai/RLs | 1 | python | def _train(self, *args):
'\n NOTE: usually need to override this function\n TODO: Annotation\n '
return (None, {}) | def _train(self, *args):
'\n NOTE: usually need to override this function\n TODO: Annotation\n '
return (None, {})<|docstring|>NOTE: usually need to override this function
TODO: Annotation<|endoftext|> |
ff68173855482dcb4bc52e0467a21a392e42238464274b92d7f9578b118b9632 | def _target_params_update(self, *args):
'\n NOTE: usually need to override this function\n TODO: Annotation\n '
return None | NOTE: usually need to override this function
TODO: Annotation | rls/algos/base/off_policy.py | _target_params_update | qiushuiai/RLs | 1 | python | def _target_params_update(self, *args):
'\n NOTE: usually need to override this function\n TODO: Annotation\n '
return None | def _target_params_update(self, *args):
'\n NOTE: usually need to override this function\n TODO: Annotation\n '
return None<|docstring|>NOTE: usually need to override this function
TODO: Annotation<|endoftext|> |
4071d4d06ec0fca25e936e3597fd657d7fd9eedef36fcfb62f297b4a7dd1eba6 | def _learn(self, function_dict: Dict={}) -> NoReturn:
'\n TODO: Annotation\n '
_summary = function_dict.get('summary_dict', {})
_use_stack = function_dict.get('use_stack', False)
if self.data.is_lg_batch_size:
self.intermediate_variable_reset()
data = self.get_transitions()... | TODO: Annotation | rls/algos/base/off_policy.py | _learn | qiushuiai/RLs | 1 | python | def _learn(self, function_dict: Dict={}) -> NoReturn:
'\n \n '
_summary = function_dict.get('summary_dict', {})
_use_stack = function_dict.get('use_stack', False)
if self.data.is_lg_batch_size:
self.intermediate_variable_reset()
data = self.get_transitions()
cell_st... | def _learn(self, function_dict: Dict={}) -> NoReturn:
'\n \n '
_summary = function_dict.get('summary_dict', {})
_use_stack = function_dict.get('use_stack', False)
if self.data.is_lg_batch_size:
self.intermediate_variable_reset()
data = self.get_transitions()
cell_st... |
0e5cc75ebbb0f2b24607f80b7bb4b47567671157035a36a23ebcb5a584cb1638 | def _apex_learn(self, function_dict: Dict, data: BatchExperiences, priorities) -> np.ndarray:
'\n TODO: Annotation\n '
_summary = function_dict.get('summary_dict', {})
_use_stack = function_dict.get('use_stack', False)
self.intermediate_variable_reset()
data = self._data_process2dict(d... | TODO: Annotation | rls/algos/base/off_policy.py | _apex_learn | qiushuiai/RLs | 1 | python | def _apex_learn(self, function_dict: Dict, data: BatchExperiences, priorities) -> np.ndarray:
'\n \n '
_summary = function_dict.get('summary_dict', {})
_use_stack = function_dict.get('use_stack', False)
self.intermediate_variable_reset()
data = self._data_process2dict(data=data)
if... | def _apex_learn(self, function_dict: Dict, data: BatchExperiences, priorities) -> np.ndarray:
'\n \n '
_summary = function_dict.get('summary_dict', {})
_use_stack = function_dict.get('use_stack', False)
self.intermediate_variable_reset()
data = self._data_process2dict(data=data)
if... |
0a4a0e9be40b563a601955c4c03099fe5aca2c14ed40514ce8c32129fa1eea94 | def _apex_cal_td(self, data: BatchExperiences, function_dict: Dict={}) -> np.ndarray:
'\n TODO: Annotation\n '
_use_stack = function_dict.get('use_stack', False)
data = self._data_process2dict(data=data)
if _use_stack:
obs = [tf.concat([o, o_], axis=0) for (o, o_) in zip(data.obs, ... | TODO: Annotation | rls/algos/base/off_policy.py | _apex_cal_td | qiushuiai/RLs | 1 | python | def _apex_cal_td(self, data: BatchExperiences, function_dict: Dict={}) -> np.ndarray:
'\n \n '
_use_stack = function_dict.get('use_stack', False)
data = self._data_process2dict(data=data)
if _use_stack:
obs = [tf.concat([o, o_], axis=0) for (o, o_) in zip(data.obs, data.obs_)]
... | def _apex_cal_td(self, data: BatchExperiences, function_dict: Dict={}) -> np.ndarray:
'\n \n '
_use_stack = function_dict.get('use_stack', False)
data = self._data_process2dict(data=data)
if _use_stack:
obs = [tf.concat([o, o_], axis=0) for (o, o_) in zip(data.obs, data.obs_)]
... |
8fdf87f94818e78f979238b38853babd4d0fdaa37d9d701c407884067c0f9df9 | def get_bin(self, atom_indx):
'Return the bin given an atom index.'
x = self.pos[(atom_indx, :)]
n = self.inv_bin_shape.dot(x)
return n.astype(np.int32) | Return the bin given an atom index. | cemc/mcmc/grid_labeling.py | get_bin | davidkleiven/WangLandau | 2 | python | def get_bin(self, atom_indx):
x = self.pos[(atom_indx, :)]
n = self.inv_bin_shape.dot(x)
return n.astype(np.int32) | def get_bin(self, atom_indx):
x = self.pos[(atom_indx, :)]
n = self.inv_bin_shape.dot(x)
return n.astype(np.int32)<|docstring|>Return the bin given an atom index.<|endoftext|> |
a07283910df959d9b3500e305cc66eded1c997943da3814b9440b8fd0b59dba2 | def populate_grid(self):
'Loop over atoms object and populate the grid.\n \n The algrotihm will count how many of each element\n there is in each bin\n '
from cemc_cpp_code import hoshen_kopelman
self.bins[(:, :, :)] = 0
for atom in self.atoms:
if (atom.symbo... | Loop over atoms object and populate the grid.
The algrotihm will count how many of each element
there is in each bin | cemc/mcmc/grid_labeling.py | populate_grid | davidkleiven/WangLandau | 2 | python | def populate_grid(self):
'Loop over atoms object and populate the grid.\n \n The algrotihm will count how many of each element\n there is in each bin\n '
from cemc_cpp_code import hoshen_kopelman
self.bins[(:, :, :)] = 0
for atom in self.atoms:
if (atom.symbo... | def populate_grid(self):
'Loop over atoms object and populate the grid.\n \n The algrotihm will count how many of each element\n there is in each bin\n '
from cemc_cpp_code import hoshen_kopelman
self.bins[(:, :, :)] = 0
for atom in self.atoms:
if (atom.symbo... |
3128b08eaf884987fa0b6916eb8955fd858a7670d9a7e4dfd6611002c60a1c6a | def get_bin_changes(self, system_changes):
'Return the changes to the bins produced by this move.'
bin_changes = {}
for change in system_changes:
new_bin = tuple(self.get_bin(change[0]))
if ((change[1] not in self.track_elements) and (change[2] in self.track_elements)):
bin_chang... | Return the changes to the bins produced by this move. | cemc/mcmc/grid_labeling.py | get_bin_changes | davidkleiven/WangLandau | 2 | python | def get_bin_changes(self, system_changes):
bin_changes = {}
for change in system_changes:
new_bin = tuple(self.get_bin(change[0]))
if ((change[1] not in self.track_elements) and (change[2] in self.track_elements)):
bin_changes[new_bin] = (bin_changes.get(new_bin, 0) + 1)
... | def get_bin_changes(self, system_changes):
bin_changes = {}
for change in system_changes:
new_bin = tuple(self.get_bin(change[0]))
if ((change[1] not in self.track_elements) and (change[2] in self.track_elements)):
bin_changes[new_bin] = (bin_changes.get(new_bin, 0) + 1)
... |
c94a73250faba98f895251bf635fb1cc7df654aff385f0e525561d24da846824 | def move_require_cluster_update(self, system_changes):
'Return True if the move require updating the clusters.'
bin_changes = self.get_bin_changes(system_changes)
for (k, v) in bin_changes.items():
if ((self.bins[k] == 0) and (v > 0)):
return True
elif ((v < 0) and (abs(v) >= sel... | Return True if the move require updating the clusters. | cemc/mcmc/grid_labeling.py | move_require_cluster_update | davidkleiven/WangLandau | 2 | python | def move_require_cluster_update(self, system_changes):
bin_changes = self.get_bin_changes(system_changes)
for (k, v) in bin_changes.items():
if ((self.bins[k] == 0) and (v > 0)):
return True
elif ((v < 0) and (abs(v) >= self.bins[k])):
return True
return False | def move_require_cluster_update(self, system_changes):
bin_changes = self.get_bin_changes(system_changes)
for (k, v) in bin_changes.items():
if ((self.bins[k] == 0) and (v > 0)):
return True
elif ((v < 0) and (abs(v) >= self.bins[k])):
return True
return False<|d... |
68a0efb4b9c9af041fc61a5ac5e38fea95f47e036f2c4020a8442cda57318ca7 | def merge(self, nums1: List[int], m: int, nums2: List[int], n: int) -> None:
'\n Do not return anything, modify nums1 in-place instead.\n Sort from right to left\n '
(i, j, s) = ((m - 1), (n - 1), ((m + n) - 1))
while ((i >= 0) or (j >= 0)):
if ((i >= 0) and (j >= 0)):
... | Do not return anything, modify nums1 in-place instead.
Sort from right to left | Q088-v3.py | merge | Linchin/python_leetcode_git | 0 | python | def merge(self, nums1: List[int], m: int, nums2: List[int], n: int) -> None:
'\n Do not return anything, modify nums1 in-place instead.\n Sort from right to left\n '
(i, j, s) = ((m - 1), (n - 1), ((m + n) - 1))
while ((i >= 0) or (j >= 0)):
if ((i >= 0) and (j >= 0)):
... | def merge(self, nums1: List[int], m: int, nums2: List[int], n: int) -> None:
'\n Do not return anything, modify nums1 in-place instead.\n Sort from right to left\n '
(i, j, s) = ((m - 1), (n - 1), ((m + n) - 1))
while ((i >= 0) or (j >= 0)):
if ((i >= 0) and (j >= 0)):
... |
746a183dc231478225762b415d218dc8a3271a6d97289e40e6651ab1402ee334 | def choose_civ(self):
'\n By calling this method, you set up chosen_civ field in parent class\n (in our case ConnectWindow or MapGeneratorWindow)\n '
civilization = self.combo_box.currentText()
nickname = self.nickname_line.text()
self.parent.set_player_info(civilization, nickname... | By calling this method, you set up chosen_civ field in parent class
(in our case ConnectWindow or MapGeneratorWindow) | start_screens/nick_civ_window.py | choose_civ | chceswieta/age-of-divisiveness | 5 | python | def choose_civ(self):
'\n By calling this method, you set up chosen_civ field in parent class\n (in our case ConnectWindow or MapGeneratorWindow)\n '
civilization = self.combo_box.currentText()
nickname = self.nickname_line.text()
self.parent.set_player_info(civilization, nickname... | def choose_civ(self):
'\n By calling this method, you set up chosen_civ field in parent class\n (in our case ConnectWindow or MapGeneratorWindow)\n '
civilization = self.combo_box.currentText()
nickname = self.nickname_line.text()
self.parent.set_player_info(civilization, nickname... |
eee3c599aee6dfb86db57db6b9bd282ba3c88034130e6745851f461efd0123b9 | def compute_numerical_gradient(cost_func_J, theta, eps=0.0001):
'\n Computes the gradient using "finite differences" and gives us a numerical estimate of the gradient.\n\n Parameters\n ----------\n cost_func_J : func\n The cost function which will be used to estimate its numerical gradient.\n\n ... | Computes the gradient using "finite differences" and gives us a numerical estimate of the gradient.
Parameters
----------
cost_func_J : func
The cost function which will be used to estimate its numerical gradient.
theta : array_like
The one dimensional unrolled network parameters. The numerical gradient is co... | python/ex8_anomaly_recommender/ano_rec_funcs/compute_numerical_gradient.py | compute_numerical_gradient | ashu-vyas-github/AndrewNg_MachineLearning_Coursera | 0 | python | def compute_numerical_gradient(cost_func_J, theta, eps=0.0001):
'\n Computes the gradient using "finite differences" and gives us a numerical estimate of the gradient.\n\n Parameters\n ----------\n cost_func_J : func\n The cost function which will be used to estimate its numerical gradient.\n\n ... | def compute_numerical_gradient(cost_func_J, theta, eps=0.0001):
'\n Computes the gradient using "finite differences" and gives us a numerical estimate of the gradient.\n\n Parameters\n ----------\n cost_func_J : func\n The cost function which will be used to estimate its numerical gradient.\n\n ... |
3e6e15e13e2d14b7f7939dc60550d002b677ccc2026d8a27316fa1859f786283 | def add_suffix_if_exists(candidate, existing_names, suffix_patt='_v{}'):
' Append a auto-incrementing suffix to a candidate name as long as the\n candidate name is in the existing names.\n\n Parameters\n ----------\n candidate : str\n Candidate name to add a suffix to if present in the existing n... | Append a auto-incrementing suffix to a candidate name as long as the
candidate name is in the existing names.
Parameters
----------
candidate : str
Candidate name to add a suffix to if present in the existing names.
existing_names : list(str)
List of names that the output path cannot be.
suffix_patt : str
... | app_common/std_lib/str_utils.py | add_suffix_if_exists | KBIbiopharma/app_common | 2 | python | def add_suffix_if_exists(candidate, existing_names, suffix_patt='_v{}'):
' Append a auto-incrementing suffix to a candidate name as long as the\n candidate name is in the existing names.\n\n Parameters\n ----------\n candidate : str\n Candidate name to add a suffix to if present in the existing n... | def add_suffix_if_exists(candidate, existing_names, suffix_patt='_v{}'):
' Append a auto-incrementing suffix to a candidate name as long as the\n candidate name is in the existing names.\n\n Parameters\n ----------\n candidate : str\n Candidate name to add a suffix to if present in the existing n... |
b1f4b1d90566b7ed54bc7341a1aa360662076ff61e22081150c89bc0e8bad569 | def sanitize_string(string, special_chars=None, replace_with='_'):
" Replace special characters in a string by a character ('_' by default).\n\n This can be used to generate a valid filename, or a valid variable name\n from a general string.\n\n Parameters\n ----------\n string : str\n String ... | Replace special characters in a string by a character ('_' by default).
This can be used to generate a valid filename, or a valid variable name
from a general string.
Parameters
----------
string : str
String to sanitize.
special_chars : iterable of string, optional
Special characters to remove from the stri... | app_common/std_lib/str_utils.py | sanitize_string | KBIbiopharma/app_common | 2 | python | def sanitize_string(string, special_chars=None, replace_with='_'):
" Replace special characters in a string by a character ('_' by default).\n\n This can be used to generate a valid filename, or a valid variable name\n from a general string.\n\n Parameters\n ----------\n string : str\n String ... | def sanitize_string(string, special_chars=None, replace_with='_'):
" Replace special characters in a string by a character ('_' by default).\n\n This can be used to generate a valid filename, or a valid variable name\n from a general string.\n\n Parameters\n ----------\n string : str\n String ... |
35aa76c6550d9d19827f712ae20ab4f5dfd3f02d00ee933302d9cdad8ec954fc | def fuzzy_string_search_in(element, collection, transform='std', ignore=' _'):
' Search if a string is loosely in a collection of strings.\n\n Parameters\n ----------\n element : str\n Element to search for.\n\n collection : iterable of strings\n Collection of element to search through for... | Search if a string is loosely in a collection of strings.
Parameters
----------
element : str
Element to search for.
collection : iterable of strings
Collection of element to search through for a fuzzy match.
transform : callable or "std" or None
Customized transformation applied to (both) elements befor... | app_common/std_lib/str_utils.py | fuzzy_string_search_in | KBIbiopharma/app_common | 2 | python | def fuzzy_string_search_in(element, collection, transform='std', ignore=' _'):
' Search if a string is loosely in a collection of strings.\n\n Parameters\n ----------\n element : str\n Element to search for.\n\n collection : iterable of strings\n Collection of element to search through for... | def fuzzy_string_search_in(element, collection, transform='std', ignore=' _'):
' Search if a string is loosely in a collection of strings.\n\n Parameters\n ----------\n element : str\n Element to search for.\n\n collection : iterable of strings\n Collection of element to search through for... |
52835eca10b5311c1b8f1c547b7c149b7797bebc88da5bacba33e46425c64587 | def format_array(arr, precision=4):
' Create a string representation of a numpy array with less precision\n than the default.\n\n Parameters\n ----------\n arr : array\n Array to be converted to a string\n\n precision : int\n Number of significant digit to display each value.\n\n Ret... | Create a string representation of a numpy array with less precision
than the default.
Parameters
----------
arr : array
Array to be converted to a string
precision : int
Number of significant digit to display each value.
Returns
-------
str
Nice string representation of the array. | app_common/std_lib/str_utils.py | format_array | KBIbiopharma/app_common | 2 | python | def format_array(arr, precision=4):
' Create a string representation of a numpy array with less precision\n than the default.\n\n Parameters\n ----------\n arr : array\n Array to be converted to a string\n\n precision : int\n Number of significant digit to display each value.\n\n Ret... | def format_array(arr, precision=4):
' Create a string representation of a numpy array with less precision\n than the default.\n\n Parameters\n ----------\n arr : array\n Array to be converted to a string\n\n precision : int\n Number of significant digit to display each value.\n\n Ret... |
81ad5bd5501921e3ae82f2f0facfeb7db5859c6e615765befda91f2a1fddd0fe | def get_runs_helper(ids, data, dataset, iteration_limit, metric):
'\n Workaround to use runs that log TRAIN_LOSS and AVERAGE_LOSS.\n\n TODO: Why do we need this and what is this doing\n '
output = {}
for run_id in ids:
data_point = data[(data[h.K_ID] == run_id)]
if (not pd.isnull(da... | Workaround to use runs that log TRAIN_LOSS and AVERAGE_LOSS.
TODO: Why do we need this and what is this doing | plots/for_paper/plotting_common.py | get_runs_helper | jacqueschen1/adam_sgd_heavy_tails | 1 | python | def get_runs_helper(ids, data, dataset, iteration_limit, metric):
'\n Workaround to use runs that log TRAIN_LOSS and AVERAGE_LOSS.\n\n TODO: Why do we need this and what is this doing\n '
output = {}
for run_id in ids:
data_point = data[(data[h.K_ID] == run_id)]
if (not pd.isnull(da... | def get_runs_helper(ids, data, dataset, iteration_limit, metric):
'\n Workaround to use runs that log TRAIN_LOSS and AVERAGE_LOSS.\n\n TODO: Why do we need this and what is this doing\n '
output = {}
for run_id in ids:
data_point = data[(data[h.K_ID] == run_id)]
if (not pd.isnull(da... |
abbffa9e2b53135de4dbd2dc39aa7186716b73d58d5e1fb952db095fa1dff615 | def get_value_at_end_of_run_for_ids(ids, metric, iteration_limit=0):
'Returns a list of the loss at the iteration_limit of each run in ids\n (if set, end otherwise)'
vals = []
for run_id in ids:
run = h.get_run(run_id, data_type=metric)
if (len(run) == 0):
vals.append(math.inf... | Returns a list of the loss at the iteration_limit of each run in ids
(if set, end otherwise) | plots/for_paper/plotting_common.py | get_value_at_end_of_run_for_ids | jacqueschen1/adam_sgd_heavy_tails | 1 | python | def get_value_at_end_of_run_for_ids(ids, metric, iteration_limit=0):
'Returns a list of the loss at the iteration_limit of each run in ids\n (if set, end otherwise)'
vals = []
for run_id in ids:
run = h.get_run(run_id, data_type=metric)
if (len(run) == 0):
vals.append(math.inf... | def get_value_at_end_of_run_for_ids(ids, metric, iteration_limit=0):
'Returns a list of the loss at the iteration_limit of each run in ids\n (if set, end otherwise)'
vals = []
for run_id in ids:
run = h.get_run(run_id, data_type=metric)
if (len(run) == 0):
vals.append(math.inf... |
c14151264ecf457cb2d1601801beb733421f30704a233994d97bb202ff907a8a | def tag_yaxis(ax, increment=1):
'\n Tags in logscale with increments. For .5, will give\n 10**0, 10**.5, 10**1, ...\n for increment = 1.0,\n 10**0, 10**1, 10**2, ...\n '
if (type(ax.yaxis._scale) != mpl.scale.LogScale):
return
(ymin, ymax) = ax.get_ylim()
if ((ymax < 10) a... | Tags in logscale with increments. For .5, will give
10**0, 10**.5, 10**1, ...
for increment = 1.0,
10**0, 10**1, 10**2, ... | plots/for_paper/plotting_common.py | tag_yaxis | jacqueschen1/adam_sgd_heavy_tails | 1 | python | def tag_yaxis(ax, increment=1):
'\n Tags in logscale with increments. For .5, will give\n 10**0, 10**.5, 10**1, ...\n for increment = 1.0,\n 10**0, 10**1, 10**2, ...\n '
if (type(ax.yaxis._scale) != mpl.scale.LogScale):
return
(ymin, ymax) = ax.get_ylim()
if ((ymax < 10) a... | def tag_yaxis(ax, increment=1):
'\n Tags in logscale with increments. For .5, will give\n 10**0, 10**.5, 10**1, ...\n for increment = 1.0,\n 10**0, 10**1, 10**2, ...\n '
if (type(ax.yaxis._scale) != mpl.scale.LogScale):
return
(ymin, ymax) = ax.get_ylim()
if ((ymax < 10) a... |
6e0713cfd67b117396998bec450c116ab9e8bf06c1c7b3bccb329ca60f918479 | @staticmethod
def adjust_node_str_to_dict(node):
'\n If the node properties are in string format, this method returns\n a node where properties are in a dictionary format\n\n :param node: Node of InfoGraph\n :return: Node of InfoGraph\n '
node = [node[0], InfoGraphUtilities.st... | If the node properties are in string format, this method returns
a node where properties are in a dictionary format
:param node: Node of InfoGraph
:return: Node of InfoGraph | analytics_engine/heuristics/beans/infograph.py | adjust_node_str_to_dict | sandlbn/analytics_engine | 0 | python | @staticmethod
def adjust_node_str_to_dict(node):
'\n If the node properties are in string format, this method returns\n a node where properties are in a dictionary format\n\n :param node: Node of InfoGraph\n :return: Node of InfoGraph\n '
node = [node[0], InfoGraphUtilities.st... | @staticmethod
def adjust_node_str_to_dict(node):
'\n If the node properties are in string format, this method returns\n a node where properties are in a dictionary format\n\n :param node: Node of InfoGraph\n :return: Node of InfoGraph\n '
node = [node[0], InfoGraphUtilities.st... |
df0886664af0825ce261f5e02bf2f2f5e641353d63929d47f1097730b99c1e9f | @staticmethod
def set_queries(node, queries):
'\n Store the telemetry queries into the node properties.\n\n :param node:\n :param queries: (list of str) Queries to get all metrics related to\n the node.\n :return: None\n '
if (not (len(node) == 2)):
... | Store the telemetry queries into the node properties.
:param node:
:param queries: (list of str) Queries to get all metrics related to
the node.
:return: None | analytics_engine/heuristics/beans/infograph.py | set_queries | sandlbn/analytics_engine | 0 | python | @staticmethod
def set_queries(node, queries):
'\n Store the telemetry queries into the node properties.\n\n :param node:\n :param queries: (list of str) Queries to get all metrics related to\n the node.\n :return: None\n '
if (not (len(node) == 2)):
... | @staticmethod
def set_queries(node, queries):
'\n Store the telemetry queries into the node properties.\n\n :param node:\n :param queries: (list of str) Queries to get all metrics related to\n the node.\n :return: None\n '
if (not (len(node) == 2)):
... |
87dd6231a2a95dd51a9f959a114cf8997b53bbefa83861d871384a82ddba1c65 | @staticmethod
def get_stack_name(graph, node):
'\n If the node is a virtual machine, returns the stack name correspondent\n\n :param graph: InfoGraph\n :param node: node of InfoGraph representing a vm\n :return: (str)\n '
res = ['', '']
ungraph = graph.to_undirected()
... | If the node is a virtual machine, returns the stack name correspondent
:param graph: InfoGraph
:param node: node of InfoGraph representing a vm
:return: (str) | analytics_engine/heuristics/beans/infograph.py | get_stack_name | sandlbn/analytics_engine | 0 | python | @staticmethod
def get_stack_name(graph, node):
'\n If the node is a virtual machine, returns the stack name correspondent\n\n :param graph: InfoGraph\n :param node: node of InfoGraph representing a vm\n :return: (str)\n '
res = [, ]
ungraph = graph.to_undirected()
node... | @staticmethod
def get_stack_name(graph, node):
'\n If the node is a virtual machine, returns the stack name correspondent\n\n :param graph: InfoGraph\n :param node: node of InfoGraph representing a vm\n :return: (str)\n '
res = [, ]
ungraph = graph.to_undirected()
node... |
7776849816eea9560300be7a1355429697ce0ca6713fb3162c1615822500b134 | @staticmethod
def get_physical_nodes(graph):
'\n Returns physical nodes grouped by hostname.\n :param graph: (InfoGraph) graph\n :return:\n '
res = dict()
for node in graph.nodes(data=True):
node_layer = InfoGraphNode.get_layer(node)
if (not (node_layer == InfoGra... | Returns physical nodes grouped by hostname.
:param graph: (InfoGraph) graph
:return: | analytics_engine/heuristics/beans/infograph.py | get_physical_nodes | sandlbn/analytics_engine | 0 | python | @staticmethod
def get_physical_nodes(graph):
'\n Returns physical nodes grouped by hostname.\n :param graph: (InfoGraph) graph\n :return:\n '
res = dict()
for node in graph.nodes(data=True):
node_layer = InfoGraphNode.get_layer(node)
if (not (node_layer == InfoGra... | @staticmethod
def get_physical_nodes(graph):
'\n Returns physical nodes grouped by hostname.\n :param graph: (InfoGraph) graph\n :return:\n '
res = dict()
for node in graph.nodes(data=True):
node_layer = InfoGraphNode.get_layer(node)
if (not (node_layer == InfoGra... |
51363ba71bc522f9da74cf7a1ec8e57104f9665aa6b0e10d96a0420d96f07f61 | @staticmethod
def filter_by_layer(graph, layer):
'\n Returns virtual nodes\n :param graph:\n :param layer: (str) the result will include only nodes beloging to\n this layer\n :return: (list of InfoGraphNodes)\n '
res = list()
for node in graph.no... | Returns virtual nodes
:param graph:
:param layer: (str) the result will include only nodes beloging to
this layer
:return: (list of InfoGraphNodes) | analytics_engine/heuristics/beans/infograph.py | filter_by_layer | sandlbn/analytics_engine | 0 | python | @staticmethod
def filter_by_layer(graph, layer):
'\n Returns virtual nodes\n :param graph:\n :param layer: (str) the result will include only nodes beloging to\n this layer\n :return: (list of InfoGraphNodes)\n '
res = list()
for node in graph.no... | @staticmethod
def filter_by_layer(graph, layer):
'\n Returns virtual nodes\n :param graph:\n :param layer: (str) the result will include only nodes beloging to\n this layer\n :return: (list of InfoGraphNodes)\n '
res = list()
for node in graph.no... |
98b141dfff47bc0c1ee2e67f438b964ba23b7bd425d31c77a64cd1613c8abbd9 | @staticmethod
def get_vnic_on_phnic(graph, node):
'\n If node is a physical SRIOV NIC, it returns the virtual NIC\n with it.\n\n :param graph: (InfoGraph)\n :param node: (Infograph Node) physical NIC\n :return: InfoGraph node or None\n '
node_name = InfoGraphNode.get_na... | If node is a physical SRIOV NIC, it returns the virtual NIC
with it.
:param graph: (InfoGraph)
:param node: (Infograph Node) physical NIC
:return: InfoGraph node or None | analytics_engine/heuristics/beans/infograph.py | get_vnic_on_phnic | sandlbn/analytics_engine | 0 | python | @staticmethod
def get_vnic_on_phnic(graph, node):
'\n If node is a physical SRIOV NIC, it returns the virtual NIC\n with it.\n\n :param graph: (InfoGraph)\n :param node: (Infograph Node) physical NIC\n :return: InfoGraph node or None\n '
node_name = InfoGraphNode.get_na... | @staticmethod
def get_vnic_on_phnic(graph, node):
'\n If node is a physical SRIOV NIC, it returns the virtual NIC\n with it.\n\n :param graph: (InfoGraph)\n :param node: (Infograph Node) physical NIC\n :return: InfoGraph node or None\n '
node_name = InfoGraphNode.get_na... |
dfcac44fee605b00ac65d95a61236dd2f3c18f322b942e0b737ea60ad98d22a4 | @staticmethod
def str_to_dict(string):
'\n Returns a dictionary from the string\n\n :param string: (str) String to be converted\n :return: (dict)\n '
res = None
if isinstance(string, str):
res = ast.literal_eval(str(string))
elif isinstance(string, unicode):
r... | Returns a dictionary from the string
:param string: (str) String to be converted
:return: (dict) | analytics_engine/heuristics/beans/infograph.py | str_to_dict | sandlbn/analytics_engine | 0 | python | @staticmethod
def str_to_dict(string):
'\n Returns a dictionary from the string\n\n :param string: (str) String to be converted\n :return: (dict)\n '
res = None
if isinstance(string, str):
res = ast.literal_eval(str(string))
elif isinstance(string, unicode):
r... | @staticmethod
def str_to_dict(string):
'\n Returns a dictionary from the string\n\n :param string: (str) String to be converted\n :return: (dict)\n '
res = None
if isinstance(string, str):
res = ast.literal_eval(str(string))
elif isinstance(string, unicode):
r... |
2680ac56ef153ac2a3cc40196a930bcf924d307c40ab5a76db7f3ed854b8e1f7 | @staticmethod
def get_neighbors(graph, node_name, layer=None, type=None):
'\n Return the neighbors of a node in the graph.\n THe neighbors could be filtered by the layer or the type.\n\n :param graph: (InfoGraph) Graph to search into\n :param node_name: (str) Name of the node to look the... | Return the neighbors of a node in the graph.
THe neighbors could be filtered by the layer or the type.
:param graph: (InfoGraph) Graph to search into
:param node_name: (str) Name of the node to look the neighbors for
:param layer: (str) Layer of the neighbors (optional)
:param type: (str) Type of the neighbors
:return... | analytics_engine/heuristics/beans/infograph.py | get_neighbors | sandlbn/analytics_engine | 0 | python | @staticmethod
def get_neighbors(graph, node_name, layer=None, type=None):
'\n Return the neighbors of a node in the graph.\n THe neighbors could be filtered by the layer or the type.\n\n :param graph: (InfoGraph) Graph to search into\n :param node_name: (str) Name of the node to look the... | @staticmethod
def get_neighbors(graph, node_name, layer=None, type=None):
'\n Return the neighbors of a node in the graph.\n THe neighbors could be filtered by the layer or the type.\n\n :param graph: (InfoGraph) Graph to search into\n :param node_name: (str) Name of the node to look the... |
7164086c3c8c137dd97f01e96f27e040c2ca96ddc501773c3391c4cdd44b4642 | @staticmethod
def get_vitual_resources(graph, hostnames):
'\n Returns virtual nodes grouped by compute nodes\n\n :param graph: (InfoGraph)\n :param hostnames: (list(str))\n :return: (dict)\n '
res = dict()
undirected_graph = graph.to_undirected()
for hostname in hostna... | Returns virtual nodes grouped by compute nodes
:param graph: (InfoGraph)
:param hostnames: (list(str))
:return: (dict) | analytics_engine/heuristics/beans/infograph.py | get_vitual_resources | sandlbn/analytics_engine | 0 | python | @staticmethod
def get_vitual_resources(graph, hostnames):
'\n Returns virtual nodes grouped by compute nodes\n\n :param graph: (InfoGraph)\n :param hostnames: (list(str))\n :return: (dict)\n '
res = dict()
undirected_graph = graph.to_undirected()
for hostname in hostna... | @staticmethod
def get_vitual_resources(graph, hostnames):
'\n Returns virtual nodes grouped by compute nodes\n\n :param graph: (InfoGraph)\n :param hostnames: (list(str))\n :return: (dict)\n '
res = dict()
undirected_graph = graph.to_undirected()
for hostname in hostna... |
d002897d1ddaef0996c6fab6afc7cac984d6d3aecff6c24ebcbcc1738441644c | @dispatch()
def get_slots(self):
'\n Returns an empty set.\n '
return self._slots | Returns an empty set. | templates/string_template.py | get_slots | KAIST-AILab/PyOpenDial | 9 | python | @dispatch()
def get_slots(self):
'\n \n '
return self._slots | @dispatch()
def get_slots(self):
'\n \n '
return self._slots<|docstring|>Returns an empty set.<|endoftext|> |
c95633b2a4ca4f265b37a76e796d369a591d60edd0916c26125d7cb7a694f812 | @dispatch()
def is_under_specified(self):
'\n Returns false\n '
return False | Returns false | templates/string_template.py | is_under_specified | KAIST-AILab/PyOpenDial | 9 | python | @dispatch()
def is_under_specified(self):
'\n \n '
return False | @dispatch()
def is_under_specified(self):
'\n \n '
return False<|docstring|>Returns false<|endoftext|> |
c0c45e35925fae0c9e2575d34d0c08db1711f8c482fa5f18affd6f50183f9a36 | @dispatch(str)
def match(self, str_val):
'\n Returns a match result if the provided value is identical to the string\n template. Else, returns an unmatched result.\n '
str_val = str_val.strip()
if (str_val.lower() == self._str_val.lower()):
return MatchResult(0, len(str_val))
... | Returns a match result if the provided value is identical to the string
template. Else, returns an unmatched result. | templates/string_template.py | match | KAIST-AILab/PyOpenDial | 9 | python | @dispatch(str)
def match(self, str_val):
'\n Returns a match result if the provided value is identical to the string\n template. Else, returns an unmatched result.\n '
str_val = str_val.strip()
if (str_val.lower() == self._str_val.lower()):
return MatchResult(0, len(str_val))
... | @dispatch(str)
def match(self, str_val):
'\n Returns a match result if the provided value is identical to the string\n template. Else, returns an unmatched result.\n '
str_val = str_val.strip()
if (str_val.lower() == self._str_val.lower()):
return MatchResult(0, len(str_val))
... |
34b9757f611f5d4b359c56332169f7d25b80c94edd3ae9f5d12bfa7974d1dd6a | @dispatch(str, int)
def find(self, str_val, max_results):
'\n Searches for all possible occurrences of the template in the provided string.\n Stops if the maximum number of results is reached.\n '
str_val = str_val.strip()
results = []
start = 0
while True:
try:
... | Searches for all possible occurrences of the template in the provided string.
Stops if the maximum number of results is reached. | templates/string_template.py | find | KAIST-AILab/PyOpenDial | 9 | python | @dispatch(str, int)
def find(self, str_val, max_results):
'\n Searches for all possible occurrences of the template in the provided string.\n Stops if the maximum number of results is reached.\n '
str_val = str_val.strip()
results = []
start = 0
while True:
try:
... | @dispatch(str, int)
def find(self, str_val, max_results):
'\n Searches for all possible occurrences of the template in the provided string.\n Stops if the maximum number of results is reached.\n '
str_val = str_val.strip()
results = []
start = 0
while True:
try:
... |
12f6e2029a3a1094fc9c472b151dce888a9b2975517d4fec4589453b53e4ac0f | @dispatch(Assignment)
def is_filled_by(self, input_val):
'\n Returns true\n '
return True | Returns true | templates/string_template.py | is_filled_by | KAIST-AILab/PyOpenDial | 9 | python | @dispatch(Assignment)
def is_filled_by(self, input_val):
'\n \n '
return True | @dispatch(Assignment)
def is_filled_by(self, input_val):
'\n \n '
return True<|docstring|>Returns true<|endoftext|> |
3bcf5e3bcbfccbd1277b0efadf02b25e087349ba915921b5398e5900ba593e6c | @dispatch(Assignment)
def fill_slots(self, fillers):
'\n Returns the string itself\n '
return self._str_val | Returns the string itself | templates/string_template.py | fill_slots | KAIST-AILab/PyOpenDial | 9 | python | @dispatch(Assignment)
def fill_slots(self, fillers):
'\n \n '
return self._str_val | @dispatch(Assignment)
def fill_slots(self, fillers):
'\n \n '
return self._str_val<|docstring|>Returns the string itself<|endoftext|> |
1ba35e4d840575640c06700c8d18e8b76ca3152b4b13087cb31beb0cc71535da | def __hash__(self):
'\n Returns the hashcode for the string\n '
return hash(self._str_val) | Returns the hashcode for the string | templates/string_template.py | __hash__ | KAIST-AILab/PyOpenDial | 9 | python | def __hash__(self):
'\n \n '
return hash(self._str_val) | def __hash__(self):
'\n \n '
return hash(self._str_val)<|docstring|>Returns the hashcode for the string<|endoftext|> |
86048ef0e6bba524272c0a9e6c61b3cfa39775cfa89c6bd784ea23d90819bc5e | def __str__(self):
'\n Returns the string itself\n '
return self._str_val | Returns the string itself | templates/string_template.py | __str__ | KAIST-AILab/PyOpenDial | 9 | python | def __str__(self):
'\n \n '
return self._str_val | def __str__(self):
'\n \n '
return self._str_val<|docstring|>Returns the string itself<|endoftext|> |
f2dcbb9fca24c7c8a45b16b643e615e191f61cebf67aaf43d30e1ef9f1fd2df4 | def __eq__(self, other):
'\n Returns true if the object is an identical string template\n '
if (not isinstance(other, StringTemplate)):
return False
return (self._str_val == other._str_val) | Returns true if the object is an identical string template | templates/string_template.py | __eq__ | KAIST-AILab/PyOpenDial | 9 | python | def __eq__(self, other):
'\n \n '
if (not isinstance(other, StringTemplate)):
return False
return (self._str_val == other._str_val) | def __eq__(self, other):
'\n \n '
if (not isinstance(other, StringTemplate)):
return False
return (self._str_val == other._str_val)<|docstring|>Returns true if the object is an identical string template<|endoftext|> |
c4e0c6dd6b3687f0cee91c59414cfd7910038349f8b6caadb27b1fe45e309f2b | def _open(self, *args, **kwargs):
'\n Do all that is necessary to open the zarr archive\n and set the DS length\n '
if (not os.path.exists(self.ds_path)):
logger.error(f'Path {self.ds_path} does not exists!')
self._raw_data = zarr.open(self.ds_rawdata_path, **kwargs)
first_k... | Do all that is necessary to open the zarr archive
and set the DS length | makaniino/data_handling/datasets/zarr.py | _open | ecmwf-projects/makaniino | 0 | python | def _open(self, *args, **kwargs):
'\n Do all that is necessary to open the zarr archive\n and set the DS length\n '
if (not os.path.exists(self.ds_path)):
logger.error(f'Path {self.ds_path} does not exists!')
self._raw_data = zarr.open(self.ds_rawdata_path, **kwargs)
first_k... | def _open(self, *args, **kwargs):
'\n Do all that is necessary to open the zarr archive\n and set the DS length\n '
if (not os.path.exists(self.ds_path)):
logger.error(f'Path {self.ds_path} does not exists!')
self._raw_data = zarr.open(self.ds_rawdata_path, **kwargs)
first_k... |
994f30808dbf1d8825e6bf86f66d648f54668cf8b6e6ca1ee12111a68497a7fb | def _do_insert(self, record):
'\n Append a dataset record\n Args:\n record:\n\n Returns:\n\n '
storage = zarr.open(self.ds_rawdata_path)
for (k, v) in record.items():
storage[k].append(v) | Append a dataset record
Args:
record:
Returns: | makaniino/data_handling/datasets/zarr.py | _do_insert | ecmwf-projects/makaniino | 0 | python | def _do_insert(self, record):
'\n Append a dataset record\n Args:\n record:\n\n Returns:\n\n '
storage = zarr.open(self.ds_rawdata_path)
for (k, v) in record.items():
storage[k].append(v) | def _do_insert(self, record):
'\n Append a dataset record\n Args:\n record:\n\n Returns:\n\n '
storage = zarr.open(self.ds_rawdata_path)
for (k, v) in record.items():
storage[k].append(v)<|docstring|>Append a dataset record
Args:
record:
Returns:<|endoftex... |
faf151da64d773264e9431596ad6a934f678d05ca6e3695f50f7dc596e537fcd | def _close(self):
'\n Nothing to close for ZARR ds\n '
pass | Nothing to close for ZARR ds | makaniino/data_handling/datasets/zarr.py | _close | ecmwf-projects/makaniino | 0 | python | def _close(self):
'\n \n '
pass | def _close(self):
'\n \n '
pass<|docstring|>Nothing to close for ZARR ds<|endoftext|> |
35a06b1518022a61ff361faeb400ad92e354b4877c6959243c9bed85e35ec1ce | def __str__(self):
'\n Brief description\n '
return f'Dataset serving {len(self)} batches of {self._batch_size} from path {self.ds_path}' | Brief description | makaniino/data_handling/datasets/zarr.py | __str__ | ecmwf-projects/makaniino | 0 | python | def __str__(self):
'\n \n '
return f'Dataset serving {len(self)} batches of {self._batch_size} from path {self.ds_path}' | def __str__(self):
'\n \n '
return f'Dataset serving {len(self)} batches of {self._batch_size} from path {self.ds_path}'<|docstring|>Brief description<|endoftext|> |
eceb8faeea44182396eeef144f8efdc231b3e1893c6c9b4efd1733fcdc6718f6 | def load_spins(fn, n_perm=10000):
'\n Loads spins from `fn`\n\n Parameters\n ----------\n fn : os.PathLike\n Filepath to file containing spins to load\n n_perm : int, optional\n Number of spins to retain (i.e., subset data)\n\n Returns\n -------\n spins : (N, P) array_like\n ... | Loads spins from `fn`
Parameters
----------
fn : os.PathLike
Filepath to file containing spins to load
n_perm : int, optional
Number of spins to retain (i.e., subset data)
Returns
-------
spins : (N, P) array_like
Loaded spins | parspin/parspin/simnulls.py | load_spins | netneurolab/markello_spatialnulls | 8 | python | def load_spins(fn, n_perm=10000):
'\n Loads spins from `fn`\n\n Parameters\n ----------\n fn : os.PathLike\n Filepath to file containing spins to load\n n_perm : int, optional\n Number of spins to retain (i.e., subset data)\n\n Returns\n -------\n spins : (N, P) array_like\n ... | def load_spins(fn, n_perm=10000):
'\n Loads spins from `fn`\n\n Parameters\n ----------\n fn : os.PathLike\n Filepath to file containing spins to load\n n_perm : int, optional\n Number of spins to retain (i.e., subset data)\n\n Returns\n -------\n spins : (N, P) array_like\n ... |
0b118ab945e2e83474d5b2baf945ff18765aff09ce005df33d9dff2dbc1f5d78 | def calc_pval(x, y, nulls):
'\n Calculates p-values for simulations in `x` and `y` using `spatnull`\n\n Parameters\n ----------\n {x, y} : (N,) array_like\n Simulated GRF brain maps\n nulls : (N, P) array_like\n Null versions of `y` GRF brain map\n\n Returns\n -------\n pval : ... | Calculates p-values for simulations in `x` and `y` using `spatnull`
Parameters
----------
{x, y} : (N,) array_like
Simulated GRF brain maps
nulls : (N, P) array_like
Null versions of `y` GRF brain map
Returns
-------
pval : float
P-value of correlation for `x` and `y` against `nulls`
perms : np.ndarray
... | parspin/parspin/simnulls.py | calc_pval | netneurolab/markello_spatialnulls | 8 | python | def calc_pval(x, y, nulls):
'\n Calculates p-values for simulations in `x` and `y` using `spatnull`\n\n Parameters\n ----------\n {x, y} : (N,) array_like\n Simulated GRF brain maps\n nulls : (N, P) array_like\n Null versions of `y` GRF brain map\n\n Returns\n -------\n pval : ... | def calc_pval(x, y, nulls):
'\n Calculates p-values for simulations in `x` and `y` using `spatnull`\n\n Parameters\n ----------\n {x, y} : (N,) array_like\n Simulated GRF brain maps\n nulls : (N, P) array_like\n Null versions of `y` GRF brain map\n\n Returns\n -------\n pval : ... |
fc8d3acdecdfe865fb47443ce9e081baf4e26824ad2fe7ea7eb78636205b3825 | def load_parc_data(alphadir, parcellation, scale, sim=None, n_sim=MAX_NSIM):
"\n Loads data for specified `parcellation`, `scale`, and `alpha`\n\n Parameters\n ----------\n alphadir : os.PathLike\n Filepath to directory for desired spatial autocorrelation nulls\n parcellation : {'atl-cammoun20... | Loads data for specified `parcellation`, `scale`, and `alpha`
Parameters
----------
alphadir : os.PathLike
Filepath to directory for desired spatial autocorrelation nulls
parcellation : {'atl-cammoun2012', 'atl-schaefer2018'}
Name of parcellation to use
scale : str
Scale of parcellation to use. Must be val... | parspin/parspin/simnulls.py | load_parc_data | netneurolab/markello_spatialnulls | 8 | python | def load_parc_data(alphadir, parcellation, scale, sim=None, n_sim=MAX_NSIM):
"\n Loads data for specified `parcellation`, `scale`, and `alpha`\n\n Parameters\n ----------\n alphadir : os.PathLike\n Filepath to directory for desired spatial autocorrelation nulls\n parcellation : {'atl-cammoun20... | def load_parc_data(alphadir, parcellation, scale, sim=None, n_sim=MAX_NSIM):
"\n Loads data for specified `parcellation`, `scale`, and `alpha`\n\n Parameters\n ----------\n alphadir : os.PathLike\n Filepath to directory for desired spatial autocorrelation nulls\n parcellation : {'atl-cammoun20... |
bcda4f312ce3354b392d7967cc86d3965a75bb091db8fcff6a901056a7b18959 | def load_vertex_data(alphadir, sim=None, n_sim=MAX_NSIM):
'\n Loads dense data for specified `alphadir`\n\n Parameters\n ----------\n alphadir : os.PathLike\n Filepath to directory for desired spatial autocorrelation nulls\n sim : {int, None}, optional\n Which simulation to load. If not... | Loads dense data for specified `alphadir`
Parameters
----------
alphadir : os.PathLike
Filepath to directory for desired spatial autocorrelation nulls
sim : {int, None}, optional
Which simulation to load. If not specified, will load first `n_sim`
simulations available. Default: None
n_sim : int, optional
... | parspin/parspin/simnulls.py | load_vertex_data | netneurolab/markello_spatialnulls | 8 | python | def load_vertex_data(alphadir, sim=None, n_sim=MAX_NSIM):
'\n Loads dense data for specified `alphadir`\n\n Parameters\n ----------\n alphadir : os.PathLike\n Filepath to directory for desired spatial autocorrelation nulls\n sim : {int, None}, optional\n Which simulation to load. If not... | def load_vertex_data(alphadir, sim=None, n_sim=MAX_NSIM):
'\n Loads dense data for specified `alphadir`\n\n Parameters\n ----------\n alphadir : os.PathLike\n Filepath to directory for desired spatial autocorrelation nulls\n sim : {int, None}, optional\n Which simulation to load. If not... |
668608705769f6058cbd9ffa96ff862348b07265d1c6e47bbc490608fc2c4a81 | def calc_moran(dist, nulls, n_jobs=1):
"\n Calculates Moran's I for every column of `nulls`\n\n Parameters\n ----------\n dist : (N, N) array_like\n Full distance matrix (inter-hemispheric distance should be np.inf)\n nulls : (N, P) array_like\n Null brain maps for which to compute Mora... | Calculates Moran's I for every column of `nulls`
Parameters
----------
dist : (N, N) array_like
Full distance matrix (inter-hemispheric distance should be np.inf)
nulls : (N, P) array_like
Null brain maps for which to compute Moran's I
n_jobs : int, optional
Number of parallel workers to use for calculatin... | parspin/parspin/simnulls.py | calc_moran | netneurolab/markello_spatialnulls | 8 | python | def calc_moran(dist, nulls, n_jobs=1):
"\n Calculates Moran's I for every column of `nulls`\n\n Parameters\n ----------\n dist : (N, N) array_like\n Full distance matrix (inter-hemispheric distance should be np.inf)\n nulls : (N, P) array_like\n Null brain maps for which to compute Mora... | def calc_moran(dist, nulls, n_jobs=1):
"\n Calculates Moran's I for every column of `nulls`\n\n Parameters\n ----------\n dist : (N, N) array_like\n Full distance matrix (inter-hemispheric distance should be np.inf)\n nulls : (N, P) array_like\n Null brain maps for which to compute Mora... |
53765877917772fdb502aa1034eae153738582ba03571e144ca7939ea7088655 | def load_full_distmat(data, distdir, parcellation, scale):
"\n Returns full distance matrix for given `parcellation` and `scale`\n\n Parameters\n ----------\n data : pd.DataFrame or array_like\n Data used to determine hemisphere designations for loaded distance\n matrices\n distdir : os... | Returns full distance matrix for given `parcellation` and `scale`
Parameters
----------
data : pd.DataFrame or array_like
Data used to determine hemisphere designations for loaded distance
matrices
distdir : os.PathLike
Filepath to directory containing geodesic distance files
parcellation : {'atl-cammoun20... | parspin/parspin/simnulls.py | load_full_distmat | netneurolab/markello_spatialnulls | 8 | python | def load_full_distmat(data, distdir, parcellation, scale):
"\n Returns full distance matrix for given `parcellation` and `scale`\n\n Parameters\n ----------\n data : pd.DataFrame or array_like\n Data used to determine hemisphere designations for loaded distance\n matrices\n distdir : os... | def load_full_distmat(data, distdir, parcellation, scale):
"\n Returns full distance matrix for given `parcellation` and `scale`\n\n Parameters\n ----------\n data : pd.DataFrame or array_like\n Data used to determine hemisphere designations for loaded distance\n matrices\n distdir : os... |
cbd2955494a4056c0fa409a536e712987824778bd09c7878028fb6c8714d0e32 | def make_tb_trie(tb_str_list):
'\n https://stackoverflow.com/a/11016430/2668831\n '
root = dict()
_end = None
for tb in tb_str_list:
current_dict = root
for key in tb:
current_dict = current_dict.setdefault(key, {})
current_dict[_end] = _end
return root | https://stackoverflow.com/a/11016430/2668831 | src/dx/share/scraper/traceback_utils.py | make_tb_trie | lmmx/dx | 0 | python | def make_tb_trie(tb_str_list):
'\n \n '
root = dict()
_end = None
for tb in tb_str_list:
current_dict = root
for key in tb:
current_dict = current_dict.setdefault(key, {})
current_dict[_end] = _end
return root | def make_tb_trie(tb_str_list):
'\n \n '
root = dict()
_end = None
for tb in tb_str_list:
current_dict = root
for key in tb:
current_dict = current_dict.setdefault(key, {})
current_dict[_end] = _end
return root<|docstring|>https://stackoverflow.com/a/11016430... |
802582490032ec601f64b29cb4346c050dc0c48e49046120c1095b2c0c82a1d3 | def test_olwidget_has_changed(self):
'\n Changes are accurately noticed by OpenLayersWidget.\n '
geoadmin = site._registry[City]
form = geoadmin.get_changelist_form(None)()
has_changed = form.fields['point'].has_changed
initial = Point(13.419745857296595, 52.51941085011498, srid=4326)
... | Changes are accurately noticed by OpenLayersWidget. | tests/gis_tests/geoadmin_deprecated/tests.py | test_olwidget_has_changed | mavisguan/django | 61,676 | python | def test_olwidget_has_changed(self):
'\n \n '
geoadmin = site._registry[City]
form = geoadmin.get_changelist_form(None)()
has_changed = form.fields['point'].has_changed
initial = Point(13.419745857296595, 52.51941085011498, srid=4326)
data_same = 'SRID=3857;POINT(1493879.2754093995... | def test_olwidget_has_changed(self):
'\n \n '
geoadmin = site._registry[City]
form = geoadmin.get_changelist_form(None)()
has_changed = form.fields['point'].has_changed
initial = Point(13.419745857296595, 52.51941085011498, srid=4326)
data_same = 'SRID=3857;POINT(1493879.2754093995... |
5f712a1c87c22802fa9e6ce725c560de864434845a451dc270ea135fd7a4d42c | def conv(input, kernel, biases, k_h, k_w, c_o, s_h, s_w, padding='VALID', group=1):
'From https://github.com/ethereon/caffe-tensorflow\n '
c_i = input.get_shape()[(- 1)]
assert ((c_i % group) == 0)
assert ((c_o % group) == 0)
convolve = (lambda i, k: tf.nn.conv2d(i, k, [1, s_h, s_w, 1], padding=p... | From https://github.com/ethereon/caffe-tensorflow | visual_search/classification.py | conv | GYXie/visual-search | 48 | python | def conv(input, kernel, biases, k_h, k_w, c_o, s_h, s_w, padding='VALID', group=1):
'\n '
c_i = input.get_shape()[(- 1)]
assert ((c_i % group) == 0)
assert ((c_o % group) == 0)
convolve = (lambda i, k: tf.nn.conv2d(i, k, [1, s_h, s_w, 1], padding=padding))
if (group == 1):
conv = conv... | def conv(input, kernel, biases, k_h, k_w, c_o, s_h, s_w, padding='VALID', group=1):
'\n '
c_i = input.get_shape()[(- 1)]
assert ((c_i % group) == 0)
assert ((c_o % group) == 0)
convolve = (lambda i, k: tf.nn.conv2d(i, k, [1, s_h, s_w, 1], padding=padding))
if (group == 1):
conv = conv... |
537a65fdde51552c0969f73595c1e6a66ab6a1f8585ec63d5126b70c17292874 | def __init__(self, label_obj, pyQt_app=None):
'\n Parameters\n ----------\n label_obj : Qt-Object with config method\n Any Tkinter Object whose text can be changed over label_obj.config(text=String)\n '
self.label_obj = label_obj
self.pyQt_app = pyQt_app | Parameters
----------
label_obj : Qt-Object with config method
Any Tkinter Object whose text can be changed over label_obj.config(text=String) | src/procedural_city_generation/additional_stuff/IOHelper.py | __init__ | kritika-srivastava/The-Conurbation-Algorithm | 4 | python | def __init__(self, label_obj, pyQt_app=None):
'\n Parameters\n ----------\n label_obj : Qt-Object with config method\n Any Tkinter Object whose text can be changed over label_obj.config(text=String)\n '
self.label_obj = label_obj
self.pyQt_app = pyQt_app | def __init__(self, label_obj, pyQt_app=None):
'\n Parameters\n ----------\n label_obj : Qt-Object with config method\n Any Tkinter Object whose text can be changed over label_obj.config(text=String)\n '
self.label_obj = label_obj
self.pyQt_app = pyQt_app<|docstring|>Pa... |
84d64609437e82368c53b1ae64157ac0e3b6bfc4a3b7fe9a3580c3a0d3cf6300 | def write(self, out):
'\n Method to be called by sys.stdout when text is written by print.\n\n Parameters\n ----------\n out : String\n Text to be printed\n '
self.label_obj.insertPlainText(out)
self.pyQt_app.processEvents() | Method to be called by sys.stdout when text is written by print.
Parameters
----------
out : String
Text to be printed | src/procedural_city_generation/additional_stuff/IOHelper.py | write | kritika-srivastava/The-Conurbation-Algorithm | 4 | python | def write(self, out):
'\n Method to be called by sys.stdout when text is written by print.\n\n Parameters\n ----------\n out : String\n Text to be printed\n '
self.label_obj.insertPlainText(out)
self.pyQt_app.processEvents() | def write(self, out):
'\n Method to be called by sys.stdout when text is written by print.\n\n Parameters\n ----------\n out : String\n Text to be printed\n '
self.label_obj.insertPlainText(out)
self.pyQt_app.processEvents()<|docstring|>Method to be called by sy... |
72e3dfe3f98c619737ba7fe16a18ffbf0b584e7ab50c6de4e4d41af9e17e10cb | def read_data_csv(file: str) -> DataFrame:
'\n Parse spam sms message dataset from a csv file.\n\n Takes a file containing the csv data and returns a pandas dataframe.\n '
try:
csv = pandas.read_csv(file, encoding='ISO-8859-1')
except FileNotFoundError:
print(f'ERROR: Could not open... | Parse spam sms message dataset from a csv file.
Takes a file containing the csv data and returns a pandas dataframe. | spam_obliterator/naive_bay.py | read_data_csv | Callum-Irving/spam-obliterator | 0 | python | def read_data_csv(file: str) -> DataFrame:
'\n Parse spam sms message dataset from a csv file.\n\n Takes a file containing the csv data and returns a pandas dataframe.\n '
try:
csv = pandas.read_csv(file, encoding='ISO-8859-1')
except FileNotFoundError:
print(f'ERROR: Could not open... | def read_data_csv(file: str) -> DataFrame:
'\n Parse spam sms message dataset from a csv file.\n\n Takes a file containing the csv data and returns a pandas dataframe.\n '
try:
csv = pandas.read_csv(file, encoding='ISO-8859-1')
except FileNotFoundError:
print(f'ERROR: Could not open... |
4721e95006975a67b83c99561f8798e81b017d33fcde248b84cb3505d585aa12 | def clean_data(data: Series) -> Series:
'\n Clean up dataset.\n\n Takes a pandas Series and applies normalizing operations to it.\n '
cleaned = data.apply(clean_message)
assert isinstance(cleaned, Series)
return cleaned | Clean up dataset.
Takes a pandas Series and applies normalizing operations to it. | spam_obliterator/naive_bay.py | clean_data | Callum-Irving/spam-obliterator | 0 | python | def clean_data(data: Series) -> Series:
'\n Clean up dataset.\n\n Takes a pandas Series and applies normalizing operations to it.\n '
cleaned = data.apply(clean_message)
assert isinstance(cleaned, Series)
return cleaned | def clean_data(data: Series) -> Series:
'\n Clean up dataset.\n\n Takes a pandas Series and applies normalizing operations to it.\n '
cleaned = data.apply(clean_message)
assert isinstance(cleaned, Series)
return cleaned<|docstring|>Clean up dataset.
Takes a pandas Series and applies normalizin... |
26ba43fff5ad24491772e29ebf22549575fdb34ae1ca5965fb0ba2e6951711d7 | def clean_message(message: str) -> str:
"\n Clean up a string.\n\n Converts all letters to lowercase, replaces '$' with 'dollar' and removes\n punctuation.\n "
return message.lower().replace('$', ' dollar ').translate(str.maketrans('', '', string.punctuation)) | Clean up a string.
Converts all letters to lowercase, replaces '$' with 'dollar' and removes
punctuation. | spam_obliterator/naive_bay.py | clean_message | Callum-Irving/spam-obliterator | 0 | python | def clean_message(message: str) -> str:
"\n Clean up a string.\n\n Converts all letters to lowercase, replaces '$' with 'dollar' and removes\n punctuation.\n "
return message.lower().replace('$', ' dollar ').translate(str.maketrans(, , string.punctuation)) | def clean_message(message: str) -> str:
"\n Clean up a string.\n\n Converts all letters to lowercase, replaces '$' with 'dollar' and removes\n punctuation.\n "
return message.lower().replace('$', ' dollar ').translate(str.maketrans(, , string.punctuation))<|docstring|>Clean up a string.
Converts al... |
18ba5291622cc8750e312344c3905a651782a3e6f5e2a7c4cb25bfe829a1753a | def create_bags_of_words(data: DataFrame) -> tuple[(dict[(str, float)], dict[(str, float)])]:
'\n Converts pandas DataFrame to 2 separate bags of words (spam and non-spam).\n\n Returns two dicts that map a word to the chance that it occurs given the\n message is spam or non-spam.\n '
spam_words = ' ... | Converts pandas DataFrame to 2 separate bags of words (spam and non-spam).
Returns two dicts that map a word to the chance that it occurs given the
message is spam or non-spam. | spam_obliterator/naive_bay.py | create_bags_of_words | Callum-Irving/spam-obliterator | 0 | python | def create_bags_of_words(data: DataFrame) -> tuple[(dict[(str, float)], dict[(str, float)])]:
'\n Converts pandas DataFrame to 2 separate bags of words (spam and non-spam).\n\n Returns two dicts that map a word to the chance that it occurs given the\n message is spam or non-spam.\n '
spam_words = ' ... | def create_bags_of_words(data: DataFrame) -> tuple[(dict[(str, float)], dict[(str, float)])]:
'\n Converts pandas DataFrame to 2 separate bags of words (spam and non-spam).\n\n Returns two dicts that map a word to the chance that it occurs given the\n message is spam or non-spam.\n '
spam_words = ' ... |
d08584509e5e8085272cf5836846609d23a0f82ef35b47410c50814449e722ae | def predict_on_test_set(test_set: DataFrame, spam_frac: float, spam_probs: dict[(str, float)], ham_probs: dict[(str, float)]) -> float:
'\n Run classifier on test set.\n\n Returns computed F-score.\n '
predictions = test.text.apply((lambda x: predict_on_string(x, spam_frac, spam_probs, ham_probs)))
... | Run classifier on test set.
Returns computed F-score. | spam_obliterator/naive_bay.py | predict_on_test_set | Callum-Irving/spam-obliterator | 0 | python | def predict_on_test_set(test_set: DataFrame, spam_frac: float, spam_probs: dict[(str, float)], ham_probs: dict[(str, float)]) -> float:
'\n Run classifier on test set.\n\n Returns computed F-score.\n '
predictions = test.text.apply((lambda x: predict_on_string(x, spam_frac, spam_probs, ham_probs)))
... | def predict_on_test_set(test_set: DataFrame, spam_frac: float, spam_probs: dict[(str, float)], ham_probs: dict[(str, float)]) -> float:
'\n Run classifier on test set.\n\n Returns computed F-score.\n '
predictions = test.text.apply((lambda x: predict_on_string(x, spam_frac, spam_probs, ham_probs)))
... |
25396ec1d3859f5f5c74a906f3589c113fa7081aed6bf97a7f12cefee4aa009a | def readworkbook(self):
' Reading through the generated report file from GibbsCam\n and passing on the time, tool and coordinate system to the \n timemagic method '
ws = self.wb.active
self.length_counter = 11
run_time = 12
cs_plane = 8
while (ws.cell(row=self.length_counte... | Reading through the generated report file from GibbsCam
and passing on the time, tool and coordinate system to the
timemagic method | Tidskalkyle.py | readworkbook | UniQueKakarot/Tidskalkyle | 0 | python | def readworkbook(self):
' Reading through the generated report file from GibbsCam\n and passing on the time, tool and coordinate system to the \n timemagic method '
ws = self.wb.active
self.length_counter = 11
run_time = 12
cs_plane = 8
while (ws.cell(row=self.length_counte... | def readworkbook(self):
' Reading through the generated report file from GibbsCam\n and passing on the time, tool and coordinate system to the \n timemagic method '
ws = self.wb.active
self.length_counter = 11
run_time = 12
cs_plane = 8
while (ws.cell(row=self.length_counte... |
57d0a3f951e0e4a39b4b9c256a00cc06805bb79b90b0d7cabfb81448b887972f | def timemagic(self, time, tool, cs):
' Taking each toolpath time and adds toolchanging times and idle time\n to them to get a better estiamte of machining time '
time = time
tool = tool
tool = int(tool)
cs = cs
cs = int(cs)
hour = time[:1]
hour = int(hour)
minute = time[2:... | Taking each toolpath time and adds toolchanging times and idle time
to them to get a better estiamte of machining time | Tidskalkyle.py | timemagic | UniQueKakarot/Tidskalkyle | 0 | python | def timemagic(self, time, tool, cs):
' Taking each toolpath time and adds toolchanging times and idle time\n to them to get a better estiamte of machining time '
time = time
tool = tool
tool = int(tool)
cs = cs
cs = int(cs)
hour = time[:1]
hour = int(hour)
minute = time[2:... | def timemagic(self, time, tool, cs):
' Taking each toolpath time and adds toolchanging times and idle time\n to them to get a better estiamte of machining time '
time = time
tool = tool
tool = int(tool)
cs = cs
cs = int(cs)
hour = time[:1]
hour = int(hour)
minute = time[2:... |
8305debc9547e460f04e26621c6e668c1b2f17c13db5e19798d39dc5ade03193 | def results(self):
' Converts the results to strings and returnes them '
self.second_hold = round(self.second_hold, 2)
self.hour_hold = str(self.hour_hold)
self.minute_hold = str(self.minute_hold)
self.second_hold = str(self.second_hold)
result = ((((self.hour_hold + ':') + self.minute_hold) + '... | Converts the results to strings and returnes them | Tidskalkyle.py | results | UniQueKakarot/Tidskalkyle | 0 | python | def results(self):
' '
self.second_hold = round(self.second_hold, 2)
self.hour_hold = str(self.hour_hold)
self.minute_hold = str(self.minute_hold)
self.second_hold = str(self.second_hold)
result = ((((self.hour_hold + ':') + self.minute_hold) + ':') + self.second_hold)
return result | def results(self):
' '
self.second_hold = round(self.second_hold, 2)
self.hour_hold = str(self.hour_hold)
self.minute_hold = str(self.minute_hold)
self.second_hold = str(self.second_hold)
result = ((((self.hour_hold + ':') + self.minute_hold) + ':') + self.second_hold)
return result<|docstr... |
84f6eb2030ba4ccbec79e0d89f297235a10240634fc7daa39fd2812f49da7a27 | def pnumber(self):
' Retrives and returnes the part code '
ws = self.wb.active
p_number = ws.cell(row=4, column=10).value
return p_number | Retrives and returnes the part code | Tidskalkyle.py | pnumber | UniQueKakarot/Tidskalkyle | 0 | python | def pnumber(self):
' '
ws = self.wb.active
p_number = ws.cell(row=4, column=10).value
return p_number | def pnumber(self):
' '
ws = self.wb.active
p_number = ws.cell(row=4, column=10).value
return p_number<|docstring|>Retrives and returnes the part code<|endoftext|> |
81997d9d707861ec1a9213c55638dd4362477490338cd65f32c1fc50751e3fb6 | def kill_task(self):
' Killing every open instance of excel '
os.system('taskkill /f /im EXCEL.EXE') | Killing every open instance of excel | Tidskalkyle.py | kill_task | UniQueKakarot/Tidskalkyle | 0 | python | def kill_task(self):
' '
os.system('taskkill /f /im EXCEL.EXE') | def kill_task(self):
' '
os.system('taskkill /f /im EXCEL.EXE')<|docstring|>Killing every open instance of excel<|endoftext|> |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.