hexsha string | size int64 | ext string | lang string | max_stars_repo_path string | max_stars_repo_name string | max_stars_repo_head_hexsha string | max_stars_repo_licenses list | max_stars_count int64 | max_stars_repo_stars_event_min_datetime string | max_stars_repo_stars_event_max_datetime string | max_issues_repo_path string | max_issues_repo_name string | max_issues_repo_head_hexsha string | max_issues_repo_licenses list | max_issues_count int64 | max_issues_repo_issues_event_min_datetime string | max_issues_repo_issues_event_max_datetime string | max_forks_repo_path string | max_forks_repo_name string | max_forks_repo_head_hexsha string | max_forks_repo_licenses list | max_forks_count int64 | max_forks_repo_forks_event_min_datetime string | max_forks_repo_forks_event_max_datetime string | content string | avg_line_length float64 | max_line_length int64 | alphanum_fraction float64 | qsc_code_num_words_quality_signal int64 | qsc_code_num_chars_quality_signal float64 | qsc_code_mean_word_length_quality_signal float64 | qsc_code_frac_words_unique_quality_signal float64 | qsc_code_frac_chars_top_2grams_quality_signal float64 | qsc_code_frac_chars_top_3grams_quality_signal float64 | qsc_code_frac_chars_top_4grams_quality_signal float64 | qsc_code_frac_chars_dupe_5grams_quality_signal float64 | qsc_code_frac_chars_dupe_6grams_quality_signal float64 | qsc_code_frac_chars_dupe_7grams_quality_signal float64 | qsc_code_frac_chars_dupe_8grams_quality_signal float64 | qsc_code_frac_chars_dupe_9grams_quality_signal float64 | qsc_code_frac_chars_dupe_10grams_quality_signal float64 | qsc_code_frac_chars_replacement_symbols_quality_signal float64 | qsc_code_frac_chars_digital_quality_signal float64 | qsc_code_frac_chars_whitespace_quality_signal float64 | qsc_code_size_file_byte_quality_signal float64 | qsc_code_num_lines_quality_signal float64 | qsc_code_num_chars_line_max_quality_signal float64 | qsc_code_num_chars_line_mean_quality_signal float64 | qsc_code_frac_chars_alphabet_quality_signal float64 | qsc_code_frac_chars_comments_quality_signal float64 | qsc_code_cate_xml_start_quality_signal float64 | qsc_code_frac_lines_dupe_lines_quality_signal float64 | qsc_code_cate_autogen_quality_signal float64 | qsc_code_frac_lines_long_string_quality_signal float64 | qsc_code_frac_chars_string_length_quality_signal float64 | qsc_code_frac_chars_long_word_length_quality_signal float64 | qsc_code_frac_lines_string_concat_quality_signal float64 | qsc_code_cate_encoded_data_quality_signal float64 | qsc_code_frac_chars_hex_words_quality_signal float64 | qsc_code_frac_lines_prompt_comments_quality_signal float64 | qsc_code_frac_lines_assert_quality_signal float64 | qsc_codepython_cate_ast_quality_signal float64 | qsc_codepython_frac_lines_func_ratio_quality_signal float64 | qsc_codepython_cate_var_zero_quality_signal bool | qsc_codepython_frac_lines_pass_quality_signal float64 | qsc_codepython_frac_lines_import_quality_signal float64 | qsc_codepython_frac_lines_simplefunc_quality_signal float64 | qsc_codepython_score_lines_no_logic_quality_signal float64 | qsc_codepython_frac_lines_print_quality_signal float64 | qsc_code_num_words int64 | qsc_code_num_chars int64 | qsc_code_mean_word_length int64 | qsc_code_frac_words_unique null | qsc_code_frac_chars_top_2grams int64 | qsc_code_frac_chars_top_3grams int64 | qsc_code_frac_chars_top_4grams int64 | qsc_code_frac_chars_dupe_5grams int64 | qsc_code_frac_chars_dupe_6grams int64 | qsc_code_frac_chars_dupe_7grams int64 | qsc_code_frac_chars_dupe_8grams int64 | qsc_code_frac_chars_dupe_9grams int64 | qsc_code_frac_chars_dupe_10grams int64 | qsc_code_frac_chars_replacement_symbols int64 | qsc_code_frac_chars_digital int64 | qsc_code_frac_chars_whitespace int64 | qsc_code_size_file_byte int64 | qsc_code_num_lines int64 | qsc_code_num_chars_line_max int64 | qsc_code_num_chars_line_mean int64 | qsc_code_frac_chars_alphabet int64 | qsc_code_frac_chars_comments int64 | qsc_code_cate_xml_start int64 | qsc_code_frac_lines_dupe_lines int64 | qsc_code_cate_autogen int64 | qsc_code_frac_lines_long_string int64 | qsc_code_frac_chars_string_length int64 | qsc_code_frac_chars_long_word_length int64 | qsc_code_frac_lines_string_concat null | qsc_code_cate_encoded_data int64 | qsc_code_frac_chars_hex_words int64 | qsc_code_frac_lines_prompt_comments int64 | qsc_code_frac_lines_assert int64 | qsc_codepython_cate_ast int64 | qsc_codepython_frac_lines_func_ratio int64 | qsc_codepython_cate_var_zero int64 | qsc_codepython_frac_lines_pass int64 | qsc_codepython_frac_lines_import int64 | qsc_codepython_frac_lines_simplefunc int64 | qsc_codepython_score_lines_no_logic int64 | qsc_codepython_frac_lines_print int64 | effective string | hits int64 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
4f6fe067666a65d05130d12c7b574511df13d077 | 14,748 | py | Python | gary/coordinates/tests/test_core.py | adrn/gary-old | 065b371534baa03deeb860893640068d90ba5881 | [
"MIT"
] | null | null | null | gary/coordinates/tests/test_core.py | adrn/gary-old | 065b371534baa03deeb860893640068d90ba5881 | [
"MIT"
] | null | null | null | gary/coordinates/tests/test_core.py | adrn/gary-old | 065b371534baa03deeb860893640068d90ba5881 | [
"MIT"
] | null | null | null | # coding: utf-8
"""
Test conversions in core.py
"""
from __future__ import absolute_import, division, print_function
__author__ = "adrn <adrn@astro.columbia.edu>"
# Standard library
import os
import pytest
import numpy as np
import tempfile
# Third-party
import astropy.coordinates as coord
import astropy.units as u
from astropy.utils.data import get_pkg_data_filename
# This package
from ..core import *
def test_vgsr_to_vhel():
filename = get_pkg_data_filename('idl_vgsr_vhel.txt')
data = np.genfromtxt(filename, names=True, skip_header=2)
# one row
row = data[0]
l = coord.Angle(row["lon"] * u.degree)
b = coord.Angle(row["lat"] * u.degree)
c = coord.Galactic(l, b)
vgsr = row["vgsr"] * u.km/u.s
vlsr = [row["vx"],row["vy"],row["vz"]]*u.km/u.s # this is right
vcirc = row["vcirc"]*u.km/u.s
vhel = vgsr_to_vhel(c, vgsr, vlsr=vlsr, vcirc=vcirc)
np.testing.assert_almost_equal(vhel.value, row['vhelio'], decimal=4)
# now check still get right answer passing in ICRS coordinates
vhel = vgsr_to_vhel(c.transform_to(coord.ICRS), vgsr,
vlsr=vlsr, vcirc=vcirc)
np.testing.assert_almost_equal(vhel.value, row['vhelio'], decimal=4)
# all together now
l = coord.Angle(data["lon"] * u.degree)
b = coord.Angle(data["lat"] * u.degree)
c = coord.Galactic(l, b)
vgsr = data["vgsr"] * u.km/u.s
vhel = vgsr_to_vhel(c, vgsr, vlsr=vlsr, vcirc=vcirc)
np.testing.assert_almost_equal(vhel.value, data['vhelio'], decimal=4)
# now check still get right answer passing in ICRS coordinates
vhel = vgsr_to_vhel(c.transform_to(coord.ICRS), vgsr,
vlsr=vlsr, vcirc=vcirc)
np.testing.assert_almost_equal(vhel.value, data['vhelio'], decimal=4)
def test_vgsr_to_vhel_misc():
# make sure it works with longitude in 0-360 or -180-180
l1 = coord.Angle(190.*u.deg)
l2 = coord.Angle(-170.*u.deg)
b = coord.Angle(30.*u.deg)
c1 = coord.Galactic(l1, b)
c2 = coord.Galactic(l2, b)
vgsr = -110.*u.km/u.s
vhel1 = vgsr_to_vhel(c1,vgsr)
vhel2 = vgsr_to_vhel(c2,vgsr)
np.testing.assert_almost_equal(vhel1.value, vhel2.value, decimal=9)
# make sure throws error if tuple elements are not Quantities
with pytest.raises(TypeError):
vgsr_to_vhel(c1, vgsr.value)
def test_vhel_to_vgsr():
filename = get_pkg_data_filename('idl_vgsr_vhel.txt')
data = np.genfromtxt(filename, names=True, skip_header=2)
# one row
row = data[0]
l = coord.Angle(row["lon"] * u.degree)
b = coord.Angle(row["lat"] * u.degree)
c = coord.Galactic(l, b)
vhel = row["vhelio"] * u.km/u.s
vlsr = [row["vx"],row["vy"],row["vz"]]*u.km/u.s # this is right
vcirc = row["vcirc"]*u.km/u.s
vgsr = vhel_to_vgsr(c, vhel, vlsr=vlsr, vcirc=vcirc)
np.testing.assert_almost_equal(vgsr.value, row['vgsr'], decimal=4)
# now check still get right answer passing in ICRS coordinates
vgsr = vhel_to_vgsr(c.transform_to(coord.ICRS), vhel,
vlsr=vlsr, vcirc=vcirc)
np.testing.assert_almost_equal(vgsr.value, row['vgsr'], decimal=4)
# all together now
l = coord.Angle(data["lon"] * u.degree)
b = coord.Angle(data["lat"] * u.degree)
c = coord.Galactic(l, b)
vhel = data["vhelio"] * u.km/u.s
vgsr = vhel_to_vgsr(c, vhel, vlsr=vlsr, vcirc=vcirc)
np.testing.assert_almost_equal(vgsr.value, data['vgsr'], decimal=4)
# now check still get right answer passing in ICRS coordinates
vgsr = vhel_to_vgsr(c.transform_to(coord.ICRS), vhel,
vlsr=vlsr, vcirc=vcirc)
np.testing.assert_almost_equal(vgsr.value, data['vgsr'], decimal=4)
def test_vhel_to_vgsr_misc():
vhel = 110*u.km/u.s
c1 = coord.Galactic(15*u.deg, -0.6*u.deg)
# make sure throws error if tuple elements are not Quantities
with pytest.raises(TypeError):
vhel_to_vgsr(c1, vhel.value)
_txt = """# from: XHIP catalog
# ra dec HIPID l b dist pml pmb rv U V W
0.022010 20.036114 7 106.82021040 -41.22316218 57.56 -253.69 -138.84 8.30 71.7 2.1 -34.0
2.208349 40.494550 714 114.23363142 -21.65650026 249.00 5.57 -9.00 -11.78 0.1 -16.3 -5.5
3.126297 14.563522 999 108.98177530 -47.25067692 40.94 296.66 -141.05 -15.30 -44.5 -47.6 -7.3
"""
class TestVHelGalConvert(object):
def setup(self):
with tempfile.NamedTemporaryFile(mode='w+b') as temp:
temp.write(_txt.encode('utf-8'))
temp.flush()
temp.seek(0)
self.data = np.genfromtxt(temp, names=True, skip_header=1)
def test_vhel_to_gal_single(self):
# test a single entry
row = self.data[0]
c = coord.SkyCoord(ra=row['ra']*u.deg, dec=row['dec']*u.deg, distance=row['dist']*u.pc)
pm = [row['pml'], row['pmb']]*u.mas/u.yr
rv = row['rv']*u.km/u.s
# stupid check
vxyz_i = vhel_to_gal(c.icrs, pm=pm, rv=rv,
vcirc=0*u.km/u.s,
vlsr=[0.,0,0]*u.km/u.s)
vxyz = vhel_to_gal(c.galactic, pm=pm, rv=rv,
vcirc=0*u.km/u.s,
vlsr=[0.,0,0]*u.km/u.s)
assert vxyz_i.shape == vxyz.shape
true_UVW = [row['U'],row['V'],row['W']]*u.km/u.s
found_UVW = vxyz
np.testing.assert_allclose(true_UVW.value, found_UVW.value, atol=1.)
# some sanity checks - first, some convenience definitions
g = coord.Galactic(l=0*u.deg, b=0*u.deg).transform_to(coord.ICRS)
galcen_frame = coord.Galactocentric(galcen_ra=g.ra,
galcen_dec=g.dec,
z_sun=0*u.kpc)
# --------------------------------------------------------------------
# l = 0
# without LSR and circular velocity
c = coord.SkyCoord(ra=galcen_frame.galcen_ra, dec=galcen_frame.galcen_dec, distance=2*u.kpc)
pm = [0., 0]*u.mas/u.yr
rv = 20*u.km/u.s
vxyz = vhel_to_gal(c.galactic, pm=pm, rv=rv,
vcirc=0*u.km/u.s,
vlsr=[0.,0,0]*u.km/u.s,
galactocentric_frame=galcen_frame)
np.testing.assert_allclose(vxyz.to(u.km/u.s).value, [20,0,0.], atol=1E-12)
# with LSR and circular velocity
c = coord.SkyCoord(ra=galcen_frame.galcen_ra, dec=galcen_frame.galcen_dec, distance=2*u.kpc)
pm = [0., 0]*u.mas/u.yr
rv = 20*u.km/u.s
vxyz = vhel_to_gal(c.galactic, pm=pm, rv=rv,
vcirc=200*u.km/u.s,
vlsr=[-20.,0,10]*u.km/u.s,
galactocentric_frame=galcen_frame)
np.testing.assert_allclose(vxyz.to(u.km/u.s).value, [0,200,10], atol=1E-12)
# l = 90
# with LSR and circular velocity
c = coord.SkyCoord(l=90*u.deg, b=0*u.deg, distance=2*u.kpc, frame=coord.Galactic)
pm = [0., 0]*u.mas/u.yr
rv = 20*u.km/u.s
vxyz = vhel_to_gal(c.galactic, pm=pm, rv=rv,
vcirc=200*u.km/u.s,
vlsr=[-20.,0,10]*u.km/u.s,
galactocentric_frame=galcen_frame)
np.testing.assert_allclose(vxyz.to(u.km/u.s).value, [-20,220,10], atol=1E-5)
# l = 180
# with LSR and circular velocity
c = coord.SkyCoord(l=180*u.deg, b=0*u.deg, distance=2*u.kpc, frame=coord.Galactic)
pm = [0., 0]*u.mas/u.yr
rv = 20*u.km/u.s
vxyz = vhel_to_gal(c.galactic, pm=pm, rv=rv,
vcirc=200*u.km/u.s,
vlsr=[-20.,0,10]*u.km/u.s,
galactocentric_frame=galcen_frame)
np.testing.assert_allclose(vxyz.to(u.km/u.s).value, [-40,200,10], atol=1E-12)
# l = 270
# with LSR and circular velocity
c = coord.SkyCoord(l=270*u.deg, b=0*u.deg, distance=2*u.kpc, frame=coord.Galactic)
pm = [0., 0]*u.mas/u.yr
rv = 20*u.km/u.s
vxyz = vhel_to_gal(c.galactic, pm=pm, rv=rv,
vcirc=200*u.km/u.s,
vlsr=[-20.,0,10]*u.km/u.s,
galactocentric_frame=galcen_frame)
np.testing.assert_allclose(vxyz.to(u.km/u.s).value, [-20,180,10], atol=1E-5)
def test_vhel_to_gal_array(self):
# test all together
d = self.data
c = coord.SkyCoord(ra=d['ra']*u.deg, dec=d['dec']*u.deg, distance=d['dist']*u.pc)
pm = np.vstack((d['pml'], d['pmb']))*u.mas/u.yr
rv = d['rv']*u.km/u.s
# stupid check
vxyz_i = vhel_to_gal(c.icrs, pm=pm, rv=rv,
vcirc=0*u.km/u.s,
vlsr=[0.,0,0]*u.km/u.s)
vxyz = vhel_to_gal(c.galactic, pm=pm, rv=rv,
vcirc=0*u.km/u.s,
vlsr=[0.,0,0]*u.km/u.s)
assert vxyz_i.shape == vxyz.shape
# check values
true_UVW = np.vstack((d['U'],d['V'],d['W']))*u.km/u.s
found_UVW = vxyz
np.testing.assert_allclose(true_UVW.value, found_UVW.value, atol=1.)
def test_vgal_to_hel_single(self):
# test a single entry
row = self.data[0]
c = coord.SkyCoord(ra=row['ra']*u.deg, dec=row['dec']*u.deg, distance=row['dist']*u.pc)
pm = [row['pml'],row['pmb']]*u.mas/u.yr
rv = row['rv']*u.km/u.s
true_pmrv = (pm[0], pm[1], rv)
vxyz = [row['U'],row['V'],row['W']]*u.km/u.s
pmrv = vgal_to_hel(c.galactic, vxyz=vxyz,
vcirc=0.*u.km/u.s,
vlsr=[0.,0,0]*u.km/u.s)
for i in range(3):
np.testing.assert_allclose(pmrv[i].to(true_pmrv[i].unit).value,
true_pmrv[i].value,
atol=1.)
# some sanity checks - first, some convenience definitions
g = coord.Galactic(l=0*u.deg, b=0*u.deg).transform_to(coord.ICRS)
frargs = dict(galcen_ra=g.ra,
galcen_dec=g.dec,
z_sun=0*u.kpc,
galcen_distance=8*u.kpc)
galcen_frame = coord.Galactocentric(**frargs)
# --------------------------------------------------------------------
# l = 0
# without LSR and circular velocity
# c = coord.Galactocentric([6,0,0]*u.kpc,**frargs)
c = coord.SkyCoord(l=0*u.deg, b=0*u.deg, distance=2*u.kpc, frame=coord.Galactic)
vxyz = [20.,0,0]*u.km/u.s
pmv = vgal_to_hel(c.galactic, vxyz,
vcirc=0*u.km/u.s,
vlsr=[0.,0,0]*u.km/u.s,
galactocentric_frame=galcen_frame)
np.testing.assert_allclose(pmv[0].to(u.mas/u.yr).value, 0., atol=1E-12)
np.testing.assert_allclose(pmv[1].to(u.mas/u.yr).value, 0., atol=1E-12)
np.testing.assert_allclose(pmv[2].to(u.km/u.s).value, 20., atol=1E-12)
# with LSR and circular velocity
c = coord.SkyCoord(l=0*u.deg, b=0*u.deg, distance=2*u.kpc, frame=coord.Galactic)
vxyz = [20.,0,0]*u.km/u.s
pmv = vgal_to_hel(c.galactic, vxyz,
vcirc=-200*u.km/u.s,
vlsr=[0.,0,10]*u.km/u.s,
galactocentric_frame=galcen_frame)
with u.set_enabled_equivalencies(u.dimensionless_angles()):
np.testing.assert_allclose(pmv[0].to(u.mas/u.yr).value,
((200.*u.km/u.s)/(2*u.kpc)).to(u.mas/u.yr).value,
atol=1E-12)
np.testing.assert_allclose(pmv[1].to(u.mas/u.yr).value,
((-10.*u.km/u.s)/(2*u.kpc)).to(u.mas/u.yr).value,
atol=1E-4)
np.testing.assert_allclose(pmv[2].to(u.km/u.s).value, 20., atol=1E-12)
def test_vgal_to_hel_array(self):
# test all together
d = self.data
c = coord.SkyCoord(ra=d['ra']*u.deg, dec=d['dec']*u.deg, distance=d['dist']*u.pc)
pm = np.vstack([d['pml'],d['pmb']])*u.mas/u.yr
rv = d['rv']*u.km/u.s
true_pmrv = (pm[0], pm[1], rv)
vxyz = np.vstack((d['U'],d['V'],d['W']))*u.km/u.s
pmrv = vgal_to_hel(c.galactic, vxyz=vxyz,
vcirc=0.*u.km/u.s,
vlsr=[0.,0,0]*u.km/u.s)
for i in range(3):
np.testing.assert_allclose(pmrv[i].to(true_pmrv[i].unit).value,
true_pmrv[i].value,
atol=1.)
def test_roundtrip_icrs(self):
np.random.seed(42)
n = 100
# yeahhhh, i know this isn't uniform on the sphere - shut up
c = coord.SkyCoord(ra=np.random.uniform(0,360,n)*u.degree,
dec=np.random.uniform(-90,90,n)*u.degree,
distance=np.random.uniform(0.1,10.,n)*u.kpc)
pm = np.random.uniform(-20,20,size=(2,n)) * u.mas/u.yr
vr = np.random.normal(0., 75., size=n)*u.km/u.s
mua,mud = pm # initial
# first to galactocentric
vxyz = vhel_to_gal(c.icrs, pm=pm, rv=vr)
# then back again, wooo
pmv = vgal_to_hel(c.icrs, vxyz=vxyz)
mua2,mud2 = pmv[:2]
vr2 = pmv[2]
np.testing.assert_allclose(mua.to(u.mas/u.yr).value, mua2.to(u.mas/u.yr).value, atol=1e-12)
np.testing.assert_allclose(mud.to(u.mas/u.yr).value, mud2.to(u.mas/u.yr).value, atol=1e-12)
np.testing.assert_allclose(vr.to(u.km/u.s).value, vr2.to(u.km/u.s).value, atol=1e-12)
def test_roundtrip_gal(self):
np.random.seed(42)
n = 100
# yeahhhh, i know this isn't uniform on the sphere - shut up
c = coord.SkyCoord(ra=np.random.uniform(0,360,n)*u.degree,
dec=np.random.uniform(-90,90,n)*u.degree,
distance=np.random.uniform(0.1,10.,n)*u.kpc)
pm = np.random.uniform(-20,20,size=(2,n)) * u.mas/u.yr
vr = np.random.normal(0., 75., size=n)*u.km/u.s
mul,mub = pm # initial
# first to galactocentric
vxyz = vhel_to_gal(c.galactic, pm=pm, rv=vr)
# then back again, wooo
pmv = vgal_to_hel(c.galactic, vxyz=vxyz)
mul2,mub2 = pmv[:2]
vr2 = pmv[2]
np.testing.assert_allclose(mul.to(u.mas/u.yr).value, mul2.to(u.mas/u.yr).value, rtol=1E-5, atol=1e-12)
np.testing.assert_allclose(mub.to(u.mas/u.yr).value, mub2.to(u.mas/u.yr).value, rtol=1E-5, atol=1e-12)
np.testing.assert_allclose(vr.to(u.km/u.s).value, vr2.to(u.km/u.s).value, rtol=1E-5, atol=1e-12)
| 40.295082 | 110 | 0.545566 | 2,360 | 14,748 | 3.317373 | 0.122881 | 0.025291 | 0.033721 | 0.042151 | 0.832162 | 0.799847 | 0.789117 | 0.783497 | 0.782986 | 0.749649 | 0 | 0.054309 | 0.28709 | 14,748 | 365 | 111 | 40.405479 | 0.690318 | 0.10042 | 0 | 0.621514 | 0 | 0.011952 | 0.048535 | 0.001893 | 0 | 0 | 0 | 0 | 0.12749 | 1 | 0.043825 | false | 0 | 0.035857 | 0 | 0.083665 | 0.003984 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6 |
4fa3f7148a96125af127047c4cb38197b76a3f8a | 19,196 | py | Python | pods/problems/test_functions.py | louisXW/PODS | e73210112de950533c9e11aed3d90bbd0c83fbed | [
"MIT"
] | null | null | null | pods/problems/test_functions.py | louisXW/PODS | e73210112de950533c9e11aed3d90bbd0c83fbed | [
"MIT"
] | 1 | 2022-03-24T18:17:50.000Z | 2022-03-24T18:17:50.000Z | pods/problems/test_functions.py | louisXW/PODS | e73210112de950533c9e11aed3d90bbd0c83fbed | [
"MIT"
] | 1 | 2021-08-01T12:57:30.000Z | 2021-08-01T12:57:30.000Z | """
"""
import random
from time import time
import numpy as np
import math
class Rastrigin:
"""Rastrigin function
.. math::
f(x_1,\\ldots,x_n)=10n-\\sum_{i=1}^n (x_i^2 - 10 \\cos(2 \\pi x_i))
subject to
.. math::
-5.12 \\leq x_i \\leq 5.12
Global optimum: :math:`f(0,0,...,0)=0`
:param dim: Number of dimensions
:type dim: int
:ivar dim: Number of dimensions
:type dim: int
:ivar xlow: Lower bound constraints
:type xlow: numpy.array
:ivar xup: Upper bound constraints
:type xup: numpy.array
:ivar info: Problem information
:type info: string
:ivar min: Global optimum
:type min: float
:ivar integer: Integer variables
:type integer: numpy.array
:ivar continuous: Continuous variables
:type continuous: numpy.array
"""
def __init__(self, dim=10):
self.xlow = -5.12 * np.ones(dim)
self.xup = 5.12 * np.ones(dim)
self.dim = dim
self.info = str(dim)+"-dimensional Rastrigin function \n" +\
"Global optimum: f(0,0,...,0) = 0"
self.min = 0
self.integer = []
self.continuous = np.arange(0, dim)
self.workdir = './'
def objfunction(self, x):
"""Evaluate the Rastrigin function at x
:param x: Data point
:type x: numpy.array
:return: Value at x
:rtype: float
"""
if len(x) != self.dim:
raise ValueError('Dimension mismatch')
return 10 * self.dim + sum(x**2 - 10 * np.cos(2 * np.pi * x))
class Ackley:
"""Ackley function
.. math::
f(x_1,\\ldots,x_n) = -20\\exp\\left( -0.2 \\sqrt{\\frac{1}{n} \
\\sum_{j=1}^n x_j^2} \\right) -\\exp \\left( \\frac{1}{n} \
\\sum{j=1}^n \\cos(2 \\pi x_j) \\right) + 20 - e
subject to
.. math::
-15 \\leq x_i \\leq 20
Global optimum: :math:`f(0,0,...,0)=0`
:param dim: Number of dimensions
:type dim: int
:ivar dim: Number of dimensions
:type dim: int
:ivar xlow: Lower bound constraints
:type xlow: numpy.array
:ivar xup: Upper bound constraints
:type xup: numpy.array
:ivar info: Problem information:
:type info: string
:ivar min: Global optimum
:type min: float
:ivar integer: Integer variables
:type integer: numpy.array
:ivar continuous: Continuous variables
:type continuous: numpy.array
"""
def __init__(self, dim=10):
self.xlow = -15 * np.ones(dim)
self.xup = 20 * np.ones(dim)
self.dim = dim
self.info = str(dim)+"-dimensional Ackley function \n" +\
"Global optimum: f(0,0,...,0) = 0"
self.min = 0
self.integer = []
self.continuous = np.arange(0, dim)
self.workdir = './'
def objfunction(self, x):
"""Evaluate the Ackley function at x
:param x: Data point
:type x: numpy.array
:return: Value at x
:rtype: float
"""
if len(x) != self.dim:
raise ValueError('Dimension mismatch')
n = float(len(x))
return -20.0 * np.exp(-0.2*np.sqrt(np.sum(x**2)/n)) - \
np.exp(np.sum(np.cos(2.0*np.pi*x))/n) + 20 + np.exp(1)
class Michalewicz:
"""Michalewicz function
.. math::
f(x_1,\\ldots,x_n) = -\\sum_{i=1}^n \\sin(x_i) \\sin^{20} \\left( \\frac{ix_i^2}{\\pi} \\right)
subject to
.. math::
0 \\leq x_i \\leq \\pi
:param dim: Number of dimensions
:type dim: int
:ivar dim: Number of dimensions
:type dim: int
:ivar xlow: Lower bound constraints
:type xlow: numpy.array
:ivar xup: Upper bound constraints
:type xup: numpy.array
:ivar info: Problem information
:type info: string
:ivar min: Global optimum
:type min: float
:ivar integer: Integer variables
:type integer: numpy.array
:ivar continuous: Continuous variables
:type continuous: numpy.array
"""
def __init__(self, dim=10):
self.xlow = np.zeros(dim)
self.xup = np.pi * np.ones(dim)
self.dim = dim
self.info = str(dim)+"-dimensional Michalewicz function \n" +\
"Global optimum: ??"
self.min = np.NaN
self.integer = []
self.continuous = np.arange(0, dim)
self.workdir = './'
def objfunction(self, x):
"""Evaluate the Michalewicz function at x
:param x: Data point
:type x: numpy.array
:return: Value at x
:rtype: float
"""
if len(x) != self.dim:
raise ValueError('Dimension mismatch')
return -np.sum(np.sin(x) * (np.sin(((1+np.arange(self.dim))
* x**2)/np.pi)) ** 20)
class Levy:
"""Levy function
Details: https://www.sfu.ca/~ssurjano/levy.html
Global optimum: :math:`f(1,1,...,1)=0`
:param dim: Number of dimensions
:type dim: int
:ivar dim: Number of dimensions
:type dim: int
:ivar xlow: Lower bound constraints
:type xlow: numpy.array
:ivar xup: Upper bound constraints
:type xup: numpy.array
:ivar info: Problem information
:type info: string
:ivar min: Global optimum
:type min: float
:ivar integer: Integer variables
:type integer: numpy.array
:ivar continuous: Continuous variables
:type continuous: numpy.array
"""
def __init__(self, dim=10):
self.xlow = -10 * np.ones(dim)
self.xup = 10 * np.ones(dim)
self.dim = dim
self.min = 0.0
self.info = str(dim)+"-dimensional Levy function \n" +\
"Global optimum: ?"
self.integer = []
self.continuous = np.arange(0, dim)
self.workdir = './'
def objfunction(self, x):
"""Evaluate the Levy function at x
:param x: Data point
:return: Value at x
"""
if len(x) != self.dim:
raise ValueError('Dimension mismatch')
w = 1 + (x - 1) / 4
wp = w[:-1]
wd = w[-1]
a = np.sin(np.pi * w[0]) ** 2
b = sum((wp - 1) ** 2 * (1 + 10 * np.sin(np.pi * wp + 1) ** 2))
c = (wd - 1) ** 2 * (1 + np.sin(2 * np.pi * wd) ** 2)
return a + b + c
class Griewank:
"""Griewank function
.. math::
f(x_1,\\ldots,x_n) = 1 + \\frac{1}{4000} \\sum_{j=1}^n x_j^2 - \
\\prod_{j=1}^n \\cos \\left( \\frac{x_i}{\\sqrt{i}} \\right)
subject to
.. math::
-512 \\leq x_i \\leq 512
Global optimum: :math:`f(0,0,...,0)=0`
:param dim: Number of dimensions
:type dim: int
:ivar dim: Number of dimensions
:type dim: int
:ivar xlow: Lower bound constraints
:type xlow: numpy.array
:ivar xup: Upper bound constraints
:type xup: numpy.array
:ivar info: Problem information
:type info: string
:ivar min: Global optimum
:type min: float
:ivar integer: Integer variables
:type integer: numpy.array
:ivar continuous: Continuous variables
:type continuous: numpy.array
"""
def __init__(self, dim=10):
self.xlow = -512 * np.ones(dim)
self.xup = 512 * np.ones(dim)
self.dim = dim
self.info = str(dim)+"-dimensional Griewank function \n" +\
"Global optimum: f(0,0,...,0) = 0"
self.min = 0
self.integer = []
self.continuous = np.arange(0, dim)
self.workdir = './'
def objfunction(self, x):
"""Evaluate the Griewank function at x
:param x: Data point
:type x: numpy.array
:return: Value at x
:rtype: float
"""
if len(x) != self.dim:
raise ValueError('Dimension mismatch')
total = 1
for i, y in enumerate(x):
total *= np.cos(y / np.sqrt(i+1))
return 1.0 / 4000.0 * sum([y**2 for y in x]) - total + 1
class Rosenbrock:
"""Rosenbrock function
.. math::
f(x_1,\\ldots,x_n) = \\sum_{j=1}^{n-1} \
\\left( 100(x_j^2-x_{j+1})^2 + (1-x_j)^2 \\right)
subject to
.. math::
-2.048 \\leq x_i \\leq 2.048
Global optimum: :math:`f(1,1,...,1)=0`
:param dim: Number of dimensions
:type dim: int
:ivar dim: Number of dimensions
:type dim: int
:ivar xlow: Lower bound constraints
:type xlow: numpy.array
:ivar xup: Upper bound constraints
:type xup: numpy.array
:ivar info: Problem information
:type info: string
:ivar min: Global optimum
:type min: float
:ivar integer: Integer variables
:type integer: numpy.array
:ivar continuous: Continuous variables
:type continuous: numpy.array
"""
def __init__(self, dim=10):
self.xlow = -2.048 * np.ones(dim)
self.xup = 2.048 * np.ones(dim)
self.dim = dim
self.info = str(dim)+"-dimensional Rosenbrock function \n" +\
"Global optimum: f(1,1,...,1) = 0"
self.min = 0
self.integer = []
self.continuous = np.arange(0, dim)
self.workdir = './'
def objfunction(self, x):
"""Evaluate the Rosenbrock function at x
:param x: Data point
:type x: numpy.array
:return: Value at x
:rtype: float
"""
if len(x) != self.dim:
raise ValueError('Dimension mismatch')
total = 0
for i in range(len(x) - 1):
total += 100 * (x[i] ** 2 - x[i+1]) ** 2 + (x[i] - 1) ** 2
return total
class Schwefel:
"""Schwefel function
.. math::
f(x_1,\\ldots,x_n) = \\sum_{j=1}^{n} \
\\left( -x_j \\sin(\\sqrt{|x_j|}) \\right) + 418.982997 n
subject to
.. math::
-512 \\leq x_i \\leq 512
Global optimum: :math:`f(420.968746,420.968746,...,420.968746)=0`
:param dim: Number of dimensions
:type dim: int
:ivar dim: Number of dimensions
:type dim: int
:ivar xlow: Lower bound constraints
:type xlow: numpy.array
:ivar xup: Upper bound constraints
:type xup: numpy.array
:ivar info: Problem information
:type info: string
:ivar min: Global optimum
:type min: float
:ivar integer: Integer variables
:type integer: numpy.array
:ivar continuous: Continuous variables
:type continuous: numpy.array
"""
def __init__(self, dim=10):
self.xlow = -512 * np.ones(dim)
self.xup = 512 * np.ones(dim)
self.dim = dim
self.info = str(dim)+"-dimensional Schwefel function \n" +\
"Global optimum: f(420.968746,...,420.968746) = 0"
self.min = 0
self.integer = []
self.continuous = np.arange(0, dim)
self.workdir = './'
def objfunction(self, x):
"""Evaluate the Schwefel function at x
:param x: Data point
:type x: numpy.array
:return: Value at x
:rtype: float
"""
if len(x) != self.dim:
raise ValueError('Dimension mismatch')
return 418.9829 * self.dim - \
sum([y * np.sin(np.sqrt(abs(y))) for y in x])
class Sphere:
"""Sphere function
.. math::
f(x_1,\\ldots,x_n) = \\sum_{j=1}^n x_j^2
subject to
.. math::
-5.12 \\leq x_i \\leq 5.12
Global optimum: :math:`f(0,0,...,0)=0`
:param dim: Number of dimensions
:type dim: int
:ivar dim: Number of dimensions
:type dim: int
:ivar xlow: Lower bound constraints
:type xlow: numpy.array
:ivar xup: Upper bound constraints
:type xup: numpy.array
:ivar info: Problem information
:type info: string
:ivar min: Global optimum
:type min: float
:ivar integer: Integer variables
:type integer: numpy.array
:ivar continuous: Continuous variables
:type continuous: numpy.array
"""
def __init__(self, dim=10):
self.xlow = -5.12 * np.ones(dim)
self.xup = 5.12 * np.ones(dim)
self.dim = dim
self.info = str(dim)+"-dimensional Sphere function \n" +\
"Global optimum: f(0,0,...,0) = 0"
self.min = 0
self.integer = []
self.continuous = np.arange(0, dim)
self.workdir = './'
def objfunction(self, x):
"""Evaluate the Sphere function at x
:param x: Data point
:type x: numpy.array
:return: Value at x
:rtype: float
"""
if len(x) != self.dim:
raise ValueError('Dimension mismatch')
return np.sum(x ** 2)
class StyblinskiTang:
"""StyblinskiTang function
.. math::
f(x_1,\\ldots,x_n) = \\frac{1}{2} \\sum_{j=1}^n \
\\left(x_j^4 -16x_j^2 +5x_j \\right)
subject to
.. math::
-5 \\leq x_i \\leq 5
Global optimum: :math:`f(-2.903534,-2.903534,...,-2.903534)=\
-39.16599 \\cdot n`
:param dim: Number of dimensions
:type dim: int
:ivar dim: Number of dimensions
:type dim: int
:ivar xlow: Lower bound constraints
:type xlow: numpy.array
:ivar xup: Upper bound constraints
:type xup: numpy.array
:ivar info: Problem information
:type info: string
:ivar min: Global optimum
:type min: float
:ivar integer: Integer variables
:type integer: numpy.array
:ivar continuous: Continuous variables
:type continuous: numpy.array
"""
def __init__(self, dim=10):
self.xlow = -5 * np.ones(dim)
self.xup = 5 * np.ones(dim)
self.dim = dim
self.info = str(dim)+"-dimensional Styblinski-Tang function \n" +\
"Global optimum: f(-2.903534,...,-2.903534) = " +\
str(-39.16599*dim)
self.min = -39.16599*dim
self.integer = []
self.continuous = np.arange(0, dim)
self.workdir = './'
def objfunction(self, x):
"""Evaluate the StyblinskiTang function at x
:param x: Data point
:type x: numpy.array
:return: Value at x
:rtype: float
"""
if len(x) != self.dim:
raise ValueError('Dimension mismatch')
return 0.5*np.sum(x ** 4 - 16 * x ** 2 + 5 * x)
class Whitley:
"""Quartic function
.. math::
f(x_1,\\ldots,x_n) = \\sum_{i=1}^n \\sum_{j=1}^n \
\\left( \\frac{(100(x_i^2-x_j)^2+(1-x_j)^2)^2}{4000} \
- \\cos(100(x_i^2-x_j)^2 + (1-x_j)^2 ) + 1 \\right)
subject to
.. math::
-10.24 \\leq x_i \\leq 10.24
Global optimum: :math:`f(1,1,...,1)=0`
:param dim: Number of dimensions
:type dim: int
:ivar dim: Number of dimensions
:type dim: int
:ivar xlow: Lower bound constraints
:type xlow: numpy.array
:ivar xup: Upper bound constraints
:type xup: numpy.array
:ivar info: Problem information
:type info: string
:ivar min: Global optimum
:type min: float
:ivar integer: Integer variables
:type integer: numpy.array
:ivar continuous: Continuous variables
:type continuous: numpy.array
"""
def __init__(self, dim=10):
self.xlow = -10.24 * np.ones(dim)
self.xup = 10.24 * np.ones(dim)
self.dim = dim
self.info = str(dim)+"-dimensional Whitley function \n" +\
"Global optimum: f(1,1,...,1) = 0"
self.min = 0
self.integer = []
self.continuous = np.arange(0, dim)
self.workdir = './'
def objfunction(self, x):
"""Evaluate the Whitley function at x
:param x: Data point
:type x: numpy.array
:return: Value at x
:rtype: float
"""
if len(x) != self.dim:
raise ValueError('Dimension mismatch')
total = 0
for i in range(len(x)):
for j in range(len(x)):
temp = 100*((x[i]**2)-x[j]) + (1-x[j])**2
total += (float(temp**2)/4000.0) - np.cos(temp) + 1
return total
class Weierstrass:
def __init__(self, dim=10):
self.xlow = -0.5 * np.ones(dim)
self.xup = 0.5 * np.ones(dim)
self.dim = dim
self.info = str(dim)+"-dimensional Weierstrass function \n" +\
"Global optimum: f(0,0,...,0) = 0"
self.min = 4.0
self.integer = []
self.continuous = np.arange(0, dim)
self.workdir = './'
def objfunction(self, x):
"""Evaluate the Weiestrass function at x
:param x: Data point
:type x: numpy.array
:return: Value at x
:rtype: float
"""
a = 0.5
b = 3
k_max = 20
def sub_sum(x):
return sum([a ** k * np.cos(2 * math.pi * (b ** k) * (x + 0.5)) for k in range(k_max)])
val = sum([sub_sum(x0) for x0 in x]) - (
len(x) * sum([a ** k * np.cos(2 * math.pi * (b ** k) * 0.5) for k in range(k_max)]))
return val
if __name__ == "__main__":
print("\n========================= Rastrigin =======================")
fun = Rastrigin(dim=3)
print(fun.info)
print("Rastrigin(1,1,1) = " + str(fun.objfunction(np.array([1, 1, 1]))))
print("Continuous variables: " + str(fun.continuous))
print("Integer variables: " + str(fun.integer))
print("\n========================= Ackley =======================")
fun = Ackley(dim=3)
print(fun.info)
print("Ackley(1,1,1) = " + str(fun.objfunction(np.array([1, 1, 1]))))
print("\n========================= Levy =======================")
fun = Levy(dim=3)
print(fun.info)
print("Levy(1,1,1) = " + str(fun.objfunction(np.array([1, 1, 1]))))
print("\n========================= Schwefel =======================")
fun = Schwefel(dim=3)
print(fun.info)
print("Schwefel(1,1,1) = " + str(fun.objfunction(np.array([1, 1, 1]))))
print("Continuous variables: " + str(fun.continuous))
print("Integer variables: " + str(fun.integer))
#
print("\n======================= Styblinski-Tang =====================")
fun = StyblinskiTang(dim=3)
print(fun.info)
print("StyblinskiTang(-2.903534,-2.903534,-2.903534) = " +
str(fun.objfunction(np.array([-2.903534, -2.903534, -2.903534]))))
print("Continuous variables: " + str(fun.continuous))
print("Integer variables: " + str(fun.integer))
#
print("\n========================= Whitley =======================")
fun = Whitley(dim=3)
print(fun.info)
print("Whitley(1,1,1) = " + str(fun.objfunction(np.array([1, 1, 1]))))
print("Continuous variables: " + str(fun.continuous))
print("Integer variables: " + str(fun.integer))
print("\n========================= Michalewicz =======================")
fun = Michalewicz(dim=2)
print(fun.info)
print("Michalewicz(2.20, 1.57) = " +
str(fun.objfunction(np.array([2.20, 1.57]))))
print("Continuous variables: " + str(fun.continuous))
print("Integer variables: " + str(fun.integer))
print("\n========================= Weiestrass =======================")
fun = Weierstrass(dim=10)
print(fun.info)
print(np.zeros((10,)))
print(fun.objfunction(np.zeros((10,))))
| 27.699856 | 104 | 0.533653 | 2,560 | 19,196 | 3.955469 | 0.060938 | 0.049378 | 0.041477 | 0.02696 | 0.825005 | 0.80239 | 0.767628 | 0.756073 | 0.742741 | 0.738297 | 0 | 0.044496 | 0.301052 | 19,196 | 692 | 105 | 27.739884 | 0.710218 | 0.405397 | 0 | 0.53719 | 0 | 0 | 0.180296 | 0.050223 | 0 | 0 | 0 | 0 | 0 | 1 | 0.095041 | false | 0 | 0.016529 | 0.004132 | 0.206612 | 0.144628 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6 |
4fadf8aa6d52d427e1b697f32bc88e5ffae4b722 | 28,411 | py | Python | test/test_dtypes.py | achilleas-k/odml-to-nix | e4f8727b4fa2524a7a3ac147bf065d9403efafcd | [
"BSD-3-Clause"
] | null | null | null | test/test_dtypes.py | achilleas-k/odml-to-nix | e4f8727b4fa2524a7a3ac147bf065d9403efafcd | [
"BSD-3-Clause"
] | 17 | 2018-07-24T11:34:23.000Z | 2021-06-21T14:57:53.000Z | test/test_dtypes.py | achilleas-k/odml-to-nix | e4f8727b4fa2524a7a3ac147bf065d9403efafcd | [
"BSD-3-Clause"
] | 5 | 2018-08-01T10:36:55.000Z | 2020-07-17T13:41:36.000Z | import datetime
import os
import shutil
import tempfile
import unittest
import numpy as np
import uuid
import nixio as nix
import odml
from nixodmlconverter import convert
class TestDtypes(unittest.TestCase):
def setUp(self):
self.test_dir = tempfile.mkdtemp("_odmlnix", "test_", tempfile.gettempdir())
self.odml_doc = odml.Document(author='me', date=datetime.date.today(),
version='0.0.1', repository='unknown')
odml.Section(name='first section', parent=self.odml_doc)
def tearDown(self):
# cleanup temporary files and folder
shutil.rmtree(self.test_dir)
def test_odml_to_nix_string(self):
file_name = 'tmp' + str(uuid.uuid4())
nix_path = os.path.join(self.test_dir, file_name + '.nix')
odml.Property(name='string property', values=["a", "b", "c"],
parent=self.odml_doc.sections[0], dtype='string')
convert.nixwrite(self.odml_doc, nix_path, 'overwrite')
nix_file = nix.File.open(nix_path)
nix_prop = nix_file.sections[0].sections[0].props[0]
vals = nix_prop.values
self.assertEqual(getattr(nix_prop, "odml_type"), nix.OdmlType("string"))
self.assertEqual(getattr(nix_prop, "data_type"), np.str_)
self.assertEqual(len(vals), 3)
self.assertEqual(vals, ("a", "b", "c"))
nix_file.close()
def test_odml_to_nix_int(self):
file_name = 'tmp' + str(uuid.uuid4())
nix_path = os.path.join(self.test_dir, file_name + '.nix')
odml.Property(name='int property', values=[1, 2, 3],
parent=self.odml_doc.sections[0], dtype='int')
convert.nixwrite(self.odml_doc, nix_path, 'overwrite')
nix_file = nix.File.open(nix_path)
nix_prop = nix_file.sections[0].sections[0].props[0]
vals = nix_prop.values
self.assertEqual(getattr(nix_prop, "odml_type"), nix.OdmlType("int"))
self.assertEqual(getattr(nix_prop, "data_type"), np.int64)
self.assertEqual(len(vals), 3)
self.assertEqual(vals, (1, 2, 3))
nix_file.close()
'''
# there seems to be a problem with float64 conversion in the nixpy lib
def test_odml_to_nix_float(self):
file_name = 'tmp' + str(uuid.uuid4())
nix_path = os.path.join(self.test_dir, file_name + '.nix')
odml.Property(name='float property', values=[1.1, 2.2, 3.3],
parent=self.odml_doc.sections[0], dtype='float')
convert.nixwrite(self.odml_doc, nix_path, 'overwrite')
nix_file = nix.File.open(nix_path)
nix_prop = nix_file.sections[0].sections[0].props[0]
vals = nix_prop.values
self.assertEqual(getattr(nix_prop, "odml_type"), nix.OdmlType("float"))
self.assertEqual(getattr(nix_prop, "data_type"), np.float_)
self.assertEqual(len(vals), 3)
self.assertEqual(vals, (1.1, 2.2, 3.2))
nix_file.close()
'''
def test_odml_to_nix_boolean(self):
file_name = 'tmp' + str(uuid.uuid4())
nix_path = os.path.join(self.test_dir, file_name + '.nix')
odml.Property(name='boolean property', values=[True, False, 1],
parent=self.odml_doc.sections[0], dtype='boolean')
convert.nixwrite(self.odml_doc, nix_path, 'overwrite')
nix_file = nix.File.open(nix_path)
nix_prop = nix_file.sections[0].sections[0].props[0]
vals = nix_prop.values
self.assertEqual(getattr(nix_prop, "odml_type"), nix.OdmlType("boolean"))
self.assertEqual(getattr(nix_prop, "data_type"), np.bool_)
self.assertEqual(len(vals), 3)
self.assertEqual(vals, (True, False, 1))
nix_file.close()
def test_odml_to_nix_date(self):
file_name = 'tmp' + str(uuid.uuid4())
nix_path = os.path.join(self.test_dir, file_name + '.nix')
odml.Property(name='date property', values=[datetime.date(2011, 12, 1), '2011-12-02'],
parent=self.odml_doc.sections[0], dtype='date')
convert.nixwrite(self.odml_doc, nix_path, 'overwrite')
nix_file = nix.File.open(nix_path)
nix_prop = nix_file.sections[0].sections[0].props[0]
vals = nix_prop.values
self.assertEqual(getattr(nix_prop, "odml_type"), nix.OdmlType("date"))
self.assertEqual(getattr(nix_prop, "data_type"), np.str_)
self.assertEqual(len(vals), 2)
self.assertEqual(vals, ('2011-12-01', '2011-12-02'))
nix_file.close()
def test_odml_to_nix_time(self):
file_name = 'tmp' + str(uuid.uuid4())
nix_path = os.path.join(self.test_dir, file_name + '.nix')
odml.Property(name='time property', values=[datetime.time(11, 11, 11), '02:02:02'],
parent=self.odml_doc.sections[0], dtype='time')
convert.nixwrite(self.odml_doc, nix_path, 'overwrite')
nix_file = nix.File.open(nix_path)
nix_prop = nix_file.sections[0].sections[0].props[0]
vals = nix_prop.values
self.assertEqual(getattr(nix_prop, "odml_type"), nix.OdmlType("time"))
self.assertEqual(getattr(nix_prop, "data_type"), np.str_)
self.assertEqual(len(vals), 2)
self.assertEqual(vals, ('11:11:11', '02:02:02'))
nix_file.close()
def test_odml_to_nix_datetime(self):
file_name = 'tmp' + str(uuid.uuid4())
nix_path = os.path.join(self.test_dir, file_name + '.nix')
odml.Property(name='datetime property',
values=[datetime.datetime(2011, 12, 1, 1, 1, 1), '2011-12-02 02:02:02'],
parent=self.odml_doc.sections[0], dtype='datetime')
convert.nixwrite(self.odml_doc, nix_path, 'overwrite')
nix_file = nix.File.open(nix_path)
nix_prop = nix_file.sections[0].sections[0].props[0]
vals = nix_prop.values
self.assertEqual(getattr(nix_prop, "odml_type"), nix.OdmlType("datetime"))
self.assertEqual(getattr(nix_prop, "data_type"), np.str_)
self.assertEqual(len(vals), 2)
self.assertEqual(vals, ('2011-12-01T01:01:01', '2011-12-02T02:02:02'))
nix_file.close()
def test_odml_to_nix_text(self):
file_name = 'tmp' + str(uuid.uuid4())
nix_path = os.path.join(self.test_dir, file_name + '.nix')
odml.Property(name='text property', values=["a\nb", "c", "d\ne"],
parent=self.odml_doc.sections[0], dtype='text')
convert.nixwrite(self.odml_doc, nix_path, 'overwrite')
nix_file = nix.File.open(nix_path)
nix_prop = nix_file.sections[0].sections[0].props[0]
vals = nix_prop.values
self.assertEqual(getattr(nix_prop, "odml_type"), nix.OdmlType("text"))
self.assertEqual(getattr(nix_prop, "data_type"), np.str_)
self.assertEqual(len(vals), 3)
self.assertEqual(vals, ("a\nb", "c", "d\ne"))
nix_file.close()
def test_odml_to_nix_tuple(self):
file_name_1 = 'tmp' + str(uuid.uuid4())
nix_path_1 = os.path.join(self.test_dir, file_name_1 + '.nix')
odml.Property(name='2-tuple property', values=["(1; 2)", "(3; 4)"],
parent=self.odml_doc.sections[0], dtype='2-tuple')
convert.nixwrite(self.odml_doc, nix_path_1, 'overwrite')
nix_file_1 = nix.File.open(nix_path_1)
nix_prop_1 = nix_file_1.sections[0].sections[0].props[0]
vals_1 = nix_prop_1.values
#assert None, such that backconversion works correctly
self.assertEqual(getattr(nix_prop_1, "odml_type"), None)
self.assertEqual(getattr(nix_prop_1, "data_type"), np.str_)
self.assertEqual(len(vals_1), 2)
self.assertEqual(vals_1, ("(1; 2)", "(3; 4)"))
nix_file_1.close()
file_name_2 = 'tmp' + str(uuid.uuid4())
nix_path_2 = os.path.join(self.test_dir, file_name_2 + '.nix')
odml.Property(name='3-tuple property', values=["(1; 2; 3)", "(4; 5; 6)"],
parent=self.odml_doc.sections[0], dtype='3-tuple')
convert.nixwrite(self.odml_doc, nix_path_2, 'overwrite')
nix_file_2 = nix.File.open(nix_path_2)
nix_prop_2 = nix_file_2.sections[0].sections[0].props[1]
vals_2 = nix_prop_2.values
#assert None, such that backconversion works correctly
self.assertEqual(getattr(nix_prop_2, "odml_type"), None)
self.assertEqual(getattr(nix_prop_2, "data_type"), np.str_)
self.assertEqual(len(vals_2), 2)
self.assertEqual(vals_2, ("(1; 2; 3)", "(4; 5; 6)"))
nix_file_2.close()
def test_nix_to_odml_string(self):
file_name_1 = 'tmp' + str(uuid.uuid4())
nix_path_1 = os.path.join(self.test_dir, file_name_1 + '.nix')
nix_file_1 = nix.File.open(nix_path_1, nix.FileMode.Overwrite)
odml_path_1 = os.path.join(self.test_dir, file_name_1 + '.xml')
sec_1 = nix_file_1.create_section(name="section")
prop_1 = sec_1.create_property(name="string property", values_or_dtype=np.str_)
prop_1.values = ['a', 'b', 'c']
convert.odmlwrite(nix_file_1, odml_path_1)
odml_doc_1 = odml.load(odml_path_1)
odml_prop_1 = odml_doc_1.sections[0].props[0]
vals_1 = odml_prop_1.values
self.assertEqual(getattr(odml_prop_1, "dtype"), odml.DType.string)
self.assertEqual(len(vals_1), 3)
self.assertEqual(vals_1, ['a', 'b', 'c'])
nix_file_1.close()
file_name_2 = 'tmp' + str(uuid.uuid4())
nix_path_2 = os.path.join(self.test_dir, file_name_2 + '.nix')
nix_file_2 = nix.File.open(nix_path_2, nix.FileMode.Overwrite)
odml_path_2 = os.path.join(self.test_dir, file_name_2 + '.xml')
sec_2 = nix_file_2.create_section(name="section")
prop_2 = sec_2.create_property(name="string property 2", values_or_dtype=np.str_)
prop_2.values = ['d', 'e', 'f']
setattr(prop_2, "odml_type", nix.OdmlType("string"))
convert.odmlwrite(nix_file_2, odml_path_2)
odml_doc_2 = odml.load(odml_path_2)
odml_prop_2 = odml_doc_2.sections[0].props[0]
vals = odml_prop_2.values
self.assertEqual(getattr(odml_prop_2, "dtype"), odml.DType.string)
self.assertEqual(len(vals), 3)
self.assertEqual(vals, ["d", "e", "f"])
nix_file_2.close()
def test_nix_to_odml_int(self):
file_name_1 = 'tmp' + str(uuid.uuid4())
nix_path_1 = os.path.join(self.test_dir, file_name_1 + '.nix')
nix_file_1 = nix.File.open(nix_path_1, nix.FileMode.Overwrite)
odml_path_1 = os.path.join(self.test_dir, file_name_1 + '.xml')
sec_1 = nix_file_1.create_section(name="section")
prop_1 = sec_1.create_property(name="int property", values_or_dtype=np.int64)
prop_1.values = [1, 2, 3]
convert.odmlwrite(nix_file_1, odml_path_1)
odml_doc_1 = odml.load(odml_path_1)
odml_prop_1 = odml_doc_1.sections[0].props[0]
vals_1 = odml_prop_1.values
self.assertEqual(getattr(odml_prop_1, "dtype"), odml.DType.int)
self.assertEqual(len(vals_1), 3)
self.assertEqual(vals_1, [1, 2, 3])
nix_file_1.close()
file_name_2 = 'tmp' + str(uuid.uuid4())
nix_path_2 = os.path.join(self.test_dir, file_name_2 + '.nix')
nix_file_2 = nix.File.open(nix_path_2, nix.FileMode.Overwrite)
odml_path_2 = os.path.join(self.test_dir, file_name_2 + '.xml')
sec_2 = nix_file_2.create_section(name="section")
prop_2 = sec_2.create_property(name="string int property", values_or_dtype=np.str_)
prop_2.values = ["4", "5", "6"]
convert.odmlwrite(nix_file_2, odml_path_2)
odml_doc_2 = odml.load(odml_path_2)
odml_prop_2 = odml_doc_2.sections[0].props[0]
vals = odml_prop_2.values
self.assertEqual(getattr(odml_prop_2, "dtype"), odml.DType.int)
self.assertEqual(len(vals), 3)
self.assertEqual(vals, [4, 5, 6])
nix_file_2.close()
file_name_3 = 'tmp' + str(uuid.uuid4())
nix_path_3 = os.path.join(self.test_dir, file_name_3 + '.nix')
nix_file_3 = nix.File.open(nix_path_3, nix.FileMode.Overwrite)
odml_path_3 = os.path.join(self.test_dir, file_name_3 + '.xml')
sec_3 = nix_file_3.create_section(name="section")
prop_3 = sec_3.create_property(name="int property 3", values_or_dtype=np.int64)
prop_3.values = [7, 8, 9]
setattr(prop_3, "odml_type", nix.OdmlType("int"))
convert.odmlwrite(nix_file_3, odml_path_3)
odml_doc_3 = odml.load(odml_path_3)
odml_prop_3 = odml_doc_3.sections[0].props[0]
vals = odml_prop_3.values
self.assertEqual(getattr(odml_prop_3, "dtype"), odml.DType.int)
self.assertEqual(len(vals), 3)
self.assertEqual(vals, [7, 8, 9])
nix_file_3.close()
def test_nix_to_odml_float(self):
file_name_1 = 'tmp' + str(uuid.uuid4())
nix_path_1 = os.path.join(self.test_dir, file_name_1 + '.nix')
nix_file_1 = nix.File.open(nix_path_1, nix.FileMode.Overwrite)
odml_path_1 = os.path.join(self.test_dir, file_name_1 + '.xml')
sec_1 = nix_file_1.create_section(name="section")
prop_1 = sec_1.create_property(name="float property", values_or_dtype=np.float_)
prop_1.values = [1.1, 2.2, 3.3]
convert.odmlwrite(nix_file_1, odml_path_1)
odml_doc_1 = odml.load(odml_path_1)
odml_prop_1 = odml_doc_1.sections[0].props[0]
vals_1 = odml_prop_1.values
self.assertEqual(getattr(odml_prop_1, "dtype"), odml.DType.float)
self.assertEqual(len(vals_1), 3)
self.assertEqual(vals_1, [1.1, 2.2, 3.3])
nix_file_1.close()
file_name_2 = 'tmp' + str(uuid.uuid4())
nix_path_2 = os.path.join(self.test_dir, file_name_2 + '.nix')
nix_file_2 = nix.File.open(nix_path_2, nix.FileMode.Overwrite)
odml_path_2 = os.path.join(self.test_dir, file_name_2 + '.xml')
sec_2 = nix_file_2.create_section(name="section")
prop_2 = sec_2.create_property(name="string float property", values_or_dtype=np.str_)
prop_2.values = ["4.4", "5.5", "6.6"]
convert.odmlwrite(nix_file_2, odml_path_2)
odml_doc_2 = odml.load(odml_path_2)
odml_prop_2 = odml_doc_2.sections[0].props[0]
vals = odml_prop_2.values
self.assertEqual(getattr(odml_prop_2, "dtype"), odml.DType.float)
self.assertEqual(len(vals), 3)
self.assertEqual(vals, [4.4, 5.5, 6.6])
nix_file_2.close()
'''
# there seems to be a problem with float64 conversion in the nixpy lib
file_name_2 = 'tmp' + str(uuid.uuid4())
nix_path_2 = os.path.join(self.test_dir, file_name_2 + '.nix')
nix_file_2 = nix.File.open(nix_path_2, nix.FileMode.Overwrite)
odml_path_2 = os.path.join(self.test_dir, file_name_2 + '.xml')
sec_2 = nix_file_2.create_section(name="section")
prop_2 = sec_2.create_property(name="string float property", values_or_dtype=np.float_)
prop_3.values = [7.7, 8.8, 9.9]
setattr(prop_3, "odml_type", nix.OdmlType("float"))
convert.odmlwrite(nix_file_2, odml_path_2)
odml_doc_2 = odml.load(odml_path_2)
odml_prop_2 = odml_doc_2.sections[0].props[0]
vals = odml_prop_2.values
self.assertEqual(getattr(odml_prop_2, "dtype"), odml.DType.float)
self.assertEqual(len(vals), 3)
self.assertEqual(vals, [7.7, 8.8, 9.9])
nix_file_3.close()
'''
def test_nix_to_odml_double(self):
file_name_1 = 'tmp' + str(uuid.uuid4())
nix_path_1 = os.path.join(self.test_dir, file_name_1 + '.nix')
nix_file_1 = nix.File.open(nix_path_1, nix.FileMode.Overwrite)
odml_path_1 = os.path.join(self.test_dir, file_name_1 + '.xml')
sec_1 = nix_file_1.create_section(name="section")
prop_1 = sec_1.create_property(name="double property", values_or_dtype=np.double)
prop_1.values = [1.1, 2.2, 3.3]
convert.odmlwrite(nix_file_1, odml_path_1)
odml_doc_1 = odml.load(odml_path_1)
odml_prop_1 = odml_doc_1.sections[0].props[0]
vals_1 = odml_prop_1.values
self.assertEqual(getattr(odml_prop_1, "dtype"), odml.DType.float)
self.assertEqual(len(vals_1), 3)
self.assertEqual(vals_1, [1.1, 2.2, 3.3])
nix_file_1.close()
'''
# there seems to be a problem with float64 conversion in the nixpy lib
prop_2 = sec.create_property(name="double property 2", values_or_dtype=np.double)
prop_2.values = [4.4, 5.5, 6.6]
setattr(prop_2, "odml_type", nix.OdmlType("float"))
convert.odmlwrite(nix_file, odml_path)
odml_doc = odml.load(odml_path)
odml_prop_2 = odml_doc.sections[0].props[1]
vals = odml_prop_2.values
self.assertEqual(getattr(odml_prop_2, "dtype"), odml.DType.float)
self.assertEqual(len(vals), 3)
self.assertEqual(vals, [4.4, 5.5, 6.6])
nix_file_2.close()
'''
def test_nix_to_odml_boolean(self):
file_name_1 = 'tmp' + str(uuid.uuid4())
nix_path_1 = os.path.join(self.test_dir, file_name_1 + '.nix')
nix_file_1 = nix.File.open(nix_path_1, nix.FileMode.Overwrite)
odml_path_1 = os.path.join(self.test_dir, file_name_1 + '.xml')
sec_1 = nix_file_1.create_section(name="section")
prop_1 = sec_1.create_property(name="boolean property", values_or_dtype=np.bool_)
prop_1.values = [True, False, True]
convert.odmlwrite(nix_file_1, odml_path_1)
odml_doc_1 = odml.load(odml_path_1)
odml_prop_1 = odml_doc_1.sections[0].props[0]
vals_1 = odml_prop_1.values
self.assertEqual(getattr(odml_prop_1, "dtype"), odml.DType.boolean)
self.assertEqual(len(vals_1), 3)
self.assertEqual(vals_1, [True, False, True])
nix_file_1.close()
file_name_2 = 'tmp' + str(uuid.uuid4())
nix_path_2 = os.path.join(self.test_dir, file_name_2 + '.nix')
nix_file_2 = nix.File.open(nix_path_2, nix.FileMode.Overwrite)
odml_path_2 = os.path.join(self.test_dir, file_name_2 + '.xml')
sec_2 = nix_file_2.create_section(name="section")
prop_2 = sec_2.create_property(name="string boolean property", values_or_dtype=np.str_)
prop_2.values = ["True", "False", "TRUE", "FALSE"]
convert.odmlwrite(nix_file_2, odml_path_2)
odml_doc_2 = odml.load(odml_path_2)
odml_prop_2 = odml_doc_2.sections[0].props[0]
vals = odml_prop_2.values
self.assertEqual(getattr(odml_prop_2, "dtype"), odml.DType.boolean)
self.assertEqual(len(vals), 4)
self.assertEqual(vals, [True, False, True, False])
nix_file_2.close()
file_name_3 = 'tmp' + str(uuid.uuid4())
nix_path_3 = os.path.join(self.test_dir, file_name_3 + '.nix')
nix_file_3 = nix.File.open(nix_path_3, nix.FileMode.Overwrite)
odml_path_3 = os.path.join(self.test_dir, file_name_3 + '.xml')
sec_3 = nix_file_3.create_section(name="section")
prop_3 = sec_3.create_property(name="boolean property 3", values_or_dtype=np.bool_)
prop_3.values = [False, True, False]
setattr(prop_3, "odml_type", nix.OdmlType("boolean"))
convert.odmlwrite(nix_file_3, odml_path_3)
odml_doc_3 = odml.load(odml_path_3)
odml_prop_3 = odml_doc_3.sections[0].props[0]
vals = odml_prop_3.values
self.assertEqual(getattr(odml_prop_3, "dtype"), odml.DType.boolean)
self.assertEqual(len(vals), 3)
self.assertEqual(vals, [False, True, False])
nix_file_3.close()
def test_nix_to_odml_date(self):
file_name_1 = 'tmp' + str(uuid.uuid4())
nix_path_1 = os.path.join(self.test_dir, file_name_1 + '.nix')
nix_file_1 = nix.File.open(nix_path_1, nix.FileMode.Overwrite)
odml_path_1 = os.path.join(self.test_dir, file_name_1 + '.xml')
sec_1 = nix_file_1.create_section(name="section")
prop_1 = sec_1.create_property(name="date property", values_or_dtype="date")
prop_1.values = ['2011-11-01', '2011-12-02']
convert.odmlwrite(nix_file_1, odml_path_1)
odml_doc_1 = odml.load(odml_path_1)
odml_prop_1 = odml_doc_1.sections[0].props[0]
vals_1 = odml_prop_1.values
self.assertEqual(getattr(odml_prop_1, "dtype"), odml.DType.date)
self.assertEqual(len(vals_1), 2)
self.assertEqual(vals_1, [datetime.date(2011, 11, 1), datetime.date(2011, 12, 2)])
nix_file_1.close()
file_name_2 = 'tmp' + str(uuid.uuid4())
nix_path_2 = os.path.join(self.test_dir, file_name_2 + '.nix')
nix_file_2 = nix.File.open(nix_path_2, nix.FileMode.Overwrite)
odml_path_2 = os.path.join(self.test_dir, file_name_2 + '.xml')
sec_2 = nix_file_2.create_section(name="section")
prop_2 = sec_2.create_property(name="date property 2", values_or_dtype=np.str_)
prop_2.values = ['2011-11-03', '2011-12-04']
setattr(prop_2, "odml_type", nix.OdmlType("date"))
convert.odmlwrite(nix_file_2, odml_path_2)
odml_doc_2 = odml.load(odml_path_2)
odml_prop_2 = odml_doc_2.sections[0].props[0]
vals = odml_prop_2.values
self.assertEqual(getattr(odml_prop_2, "dtype"), odml.DType.date)
self.assertEqual(len(vals), 2)
self.assertEqual(vals, [datetime.date(2011, 11, 3), datetime.date(2011, 12, 4)])
nix_file_2.close()
def test_nix_to_odml_time(self):
file_name_1 = 'tmp' + str(uuid.uuid4())
nix_path_1 = os.path.join(self.test_dir, file_name_1 + '.nix')
nix_file_1 = nix.File.open(nix_path_1, nix.FileMode.Overwrite)
odml_path_1 = os.path.join(self.test_dir, file_name_1 + '.xml')
sec_1 = nix_file_1.create_section(name="section")
prop_1 = sec_1.create_property(name="time property", values_or_dtype="time")
prop_1.values = ['11:11:11', '02:02:02']
convert.odmlwrite(nix_file_1, odml_path_1)
odml_doc_1 = odml.load(odml_path_1)
odml_prop_1 = odml_doc_1.sections[0].props[0]
vals_1 = odml_prop_1.values
self.assertEqual(getattr(odml_prop_1, "dtype"), odml.DType.time)
self.assertEqual(len(vals_1), 2)
self.assertEqual(vals_1, [datetime.time(11, 11, 11), datetime.time(2, 2, 2)])
nix_file_1.close()
file_name_2 = 'tmp' + str(uuid.uuid4())
nix_path_2 = os.path.join(self.test_dir, file_name_2 + '.nix')
nix_file_2 = nix.File.open(nix_path_2, nix.FileMode.Overwrite)
odml_path_2 = os.path.join(self.test_dir, file_name_2 + '.xml')
sec_2 = nix_file_2.create_section(name="section")
prop_2 = sec_2.create_property(name="time property 2", values_or_dtype=np.str_)
prop_2.values = ['12:12:12', '03:03:03']
setattr(prop_2, "odml_type", nix.OdmlType("time"))
convert.odmlwrite(nix_file_2, odml_path_2)
odml_doc_2 = odml.load(odml_path_2)
odml_prop_2 = odml_doc_2.sections[0].props[0]
vals = odml_prop_2.values
self.assertEqual(getattr(odml_prop_2, "dtype"), odml.DType.time)
self.assertEqual(len(vals), 2)
self.assertEqual(vals, [datetime.time(12, 12, 12), datetime.time(3, 3, 3)])
nix_file_2.close()
def test_nix_to_odml_datetime(self):
file_name_1 = 'tmp' + str(uuid.uuid4())
nix_path_1 = os.path.join(self.test_dir, file_name_1 + '.nix')
nix_file_1 = nix.File.open(nix_path_1, nix.FileMode.Overwrite)
odml_path_1 = os.path.join(self.test_dir, file_name_1 + '.xml')
sec_1 = nix_file_1.create_section(name="section")
prop_1 = sec_1.create_property(name="datetime property", values_or_dtype="datetime")
prop_1.values = ['2011-11-01 11:11:11', '2012-12-02 02:02:02', '2012-12-03T03:03:03']
convert.odmlwrite(nix_file_1, odml_path_1)
odml_doc_1 = odml.load(odml_path_1)
odml_prop_1 = odml_doc_1.sections[0].props[0]
vals_1 = odml_prop_1.values
self.assertEqual(getattr(odml_prop_1, "dtype"), odml.DType.datetime)
self.assertEqual(len(vals_1), 3)
self.assertEqual(vals_1, [datetime.datetime(2011, 11, 1, 11, 11, 11),
datetime.datetime(2012, 12, 2, 2, 2, 2),
datetime.datetime(2012, 12, 3, 3, 3, 3)])
nix_file_1.close()
file_name_2 = 'tmp' + str(uuid.uuid4())
nix_path_2 = os.path.join(self.test_dir, file_name_2 + '.nix')
nix_file_2 = nix.File.open(nix_path_2, nix.FileMode.Overwrite)
odml_path_2 = os.path.join(self.test_dir, file_name_2 + '.xml')
sec_2 = nix_file_2.create_section(name="section")
prop_2 = sec_2.create_property(name="datetime property 2", values_or_dtype=np.str_)
prop_2.values = ['2012-12-02 12:12:12', '2013-01-01 01:01:01', '2013-01-02T02:02:02']
setattr(prop_2, "odml_type", nix.OdmlType("datetime"))
convert.odmlwrite(nix_file_2, odml_path_2)
odml_doc_2 = odml.load(odml_path_2)
odml_prop_2 = odml_doc_2.sections[0].props[0]
vals = odml_prop_2.values
self.assertEqual(getattr(odml_prop_2, "dtype"), odml.DType.datetime)
self.assertEqual(len(vals), 3)
self.assertEqual(vals, [datetime.datetime(2012, 12, 2, 12, 12, 12),
datetime.datetime(2013, 1, 1, 1, 1, 1),
datetime.datetime(2013, 1, 2, 2, 2, 2)])
nix_file_2.close()
def test_nix_to_odml_text(self):
file_name_1 = 'tmp' + str(uuid.uuid4())
nix_path_1 = os.path.join(self.test_dir, file_name_1 + '.nix')
nix_file_1 = nix.File.open(nix_path_1, nix.FileMode.Overwrite)
odml_path_1 = os.path.join(self.test_dir, file_name_1 + '.xml')
sec_1 = nix_file_1.create_section(name="section")
prop_1 = sec_1.create_property(name="text property", values_or_dtype=np.str_)
prop_1.values = ['a\nb', 'c d', 'e\nix_path']
convert.odmlwrite(nix_file_1, odml_path_1)
odml_doc_1 = odml.load(odml_path_1)
odml_prop_1 = odml_doc_1.sections[0].props[0]
vals_1 = odml_prop_1.values
self.assertEqual(getattr(odml_prop_1, "dtype"), odml.DType.text)
# this does currently not work as there seems to be a problem
# in the odML core lib reading the file including a line break.
# self.assertEqual(len(vals), 3)
# self.assertEqual(vals, ['a\nb', 'c d', 'e\nix_path'])
nix_file_1.close()
def test_nix_to_odml_tuple(self):
file_name_1 = 'tmp' + str(uuid.uuid4())
nix_path_1 = os.path.join(self.test_dir, file_name_1 + '.nix')
nix_file_1 = nix.File.open(nix_path_1, nix.FileMode.Overwrite)
odml_path_1 = os.path.join(self.test_dir, file_name_1 + '.xml')
sec_1 = nix_file_1.create_section(name="section")
prop_1 = sec_1.create_property(name="2-tuple property", values_or_dtype=np.str_)
prop_1.values = ["(1; 2)", "(3; 4)"]
convert.odmlwrite(nix_file_1, odml_path_1)
odml_doc_1 = odml.load(odml_path_1)
odml_prop_1 = odml_doc_1.sections[0].props[0]
vals_1 = odml_prop_1.values
self.assertEqual(getattr(odml_prop_1, "dtype"), "2-tuple")
self.assertEqual(len(vals_1), 2)
self.assertEqual(vals_1, [["1", "2"], ["3", "4"]])
nix_file_1.close()
file_name_2 = 'tmp' + str(uuid.uuid4())
nix_path_2 = os.path.join(self.test_dir, file_name_2 + '.nix')
nix_file_2 = nix.File.open(nix_path_2, nix.FileMode.Overwrite)
odml_path_2 = os.path.join(self.test_dir, file_name_2 + '.xml')
sec_2 = nix_file_2.create_section(name="section")
prop_2 = sec_2.create_property(name="3-tuple property", values_or_dtype=np.str_)
prop_2.values = ["(1; 2; 3)", "(4; 5; 6)"]
convert.odmlwrite(nix_file_2, odml_path_2)
odml_doc_2 = odml.load(odml_path_2)
odml_prop_2 = odml_doc_2.sections[0].props[0]
vals = odml_prop_2.values
self.assertEqual(getattr(odml_prop_2, "dtype"), "3-tuple")
self.assertEqual(len(vals), 2)
self.assertEqual(vals, [["1", "2", "3"], ["4", "5", "6"]])
nix_file_2.close()
| 44.812303 | 95 | 0.63669 | 4,391 | 28,411 | 3.824869 | 0.033933 | 0.061268 | 0.035368 | 0.043346 | 0.920333 | 0.882584 | 0.861149 | 0.83513 | 0.781899 | 0.745698 | 0 | 0.053535 | 0.2209 | 28,411 | 633 | 96 | 44.883096 | 0.705218 | 0.012214 | 0 | 0.632035 | 0 | 0 | 0.075814 | 0 | 0 | 0 | 0 | 0 | 0.203463 | 1 | 0.04329 | false | 0 | 0.021645 | 0 | 0.0671 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6 |
8c329e3e23af45841816c136124e5d525e8e9bde | 23 | py | Python | actstream/runtests/testapp_nested/models/__init__.py | tcdent/django-activity-stream | f8b4fb80683dcae54b9795ba7d43f6827328fe75 | [
"BSD-3-Clause"
] | null | null | null | actstream/runtests/testapp_nested/models/__init__.py | tcdent/django-activity-stream | f8b4fb80683dcae54b9795ba7d43f6827328fe75 | [
"BSD-3-Clause"
] | null | null | null | actstream/runtests/testapp_nested/models/__init__.py | tcdent/django-activity-stream | f8b4fb80683dcae54b9795ba7d43f6827328fe75 | [
"BSD-3-Clause"
] | null | null | null | from . import my_model
| 11.5 | 22 | 0.782609 | 4 | 23 | 4.25 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.173913 | 23 | 1 | 23 | 23 | 0.894737 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 6 |
8c3945658076b76d7d6fcbc2d8841db3ba021c24 | 47 | py | Python | samples/field_attachments/__init__.py | zoho/zohocrm-python-sdk-2.1 | cde6fcd1c5c8f7a572154ebb2b947ec697c24209 | [
"Apache-2.0"
] | null | null | null | samples/field_attachments/__init__.py | zoho/zohocrm-python-sdk-2.1 | cde6fcd1c5c8f7a572154ebb2b947ec697c24209 | [
"Apache-2.0"
] | null | null | null | samples/field_attachments/__init__.py | zoho/zohocrm-python-sdk-2.1 | cde6fcd1c5c8f7a572154ebb2b947ec697c24209 | [
"Apache-2.0"
] | null | null | null | from .field_attachments import FieldAttachments | 47 | 47 | 0.914894 | 5 | 47 | 8.4 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.06383 | 47 | 1 | 47 | 47 | 0.954545 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 6 |
4fd1499b689757938db40a345415ff17cf678a7f | 340 | py | Python | vedadet/bridge/__init__.py | jie311/vedadet | aaf3b3bc3c7944aba1cc28138165d403023a9152 | [
"Apache-2.0"
] | 424 | 2020-10-19T03:56:49.000Z | 2022-03-28T02:47:39.000Z | vedadet/bridge/__init__.py | jie311/vedadet | aaf3b3bc3c7944aba1cc28138165d403023a9152 | [
"Apache-2.0"
] | 72 | 2020-11-27T17:10:00.000Z | 2022-03-17T02:40:53.000Z | vedadet/bridge/__init__.py | jie311/vedadet | aaf3b3bc3c7944aba1cc28138165d403023a9152 | [
"Apache-2.0"
] | 116 | 2020-11-03T02:31:17.000Z | 2022-03-08T08:20:48.000Z | from .converters import (BBoxAnchorConverter, PointAnchorConverter,
build_converter)
from .meshgrids import BBoxAnchorMeshGrid, PointAnchorMeshGrid, build_meshgrid
__all__ = [
'BBoxAnchorConverter', 'PointAnchorConverter', 'build_converter',
'BBoxAnchorMeshGrid', 'PointAnchorMeshGrid', 'build_meshgrid'
]
| 37.777778 | 78 | 0.752941 | 23 | 340 | 10.782609 | 0.521739 | 0.314516 | 0.354839 | 0.427419 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.164706 | 340 | 8 | 79 | 42.5 | 0.873239 | 0 | 0 | 0 | 0 | 0 | 0.308824 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.285714 | 0 | 0.285714 | 0 | 1 | 0 | 1 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6 |
4fea880a4e0a295a220a82126f6f14eb464d5b83 | 40 | py | Python | xam/linear_model/__init__.py | topolphukhanh/xam | 3fa958ba8b0c8e8e266cac9997b7a7d0c309f55c | [
"MIT"
] | 357 | 2017-03-23T19:07:31.000Z | 2022-03-11T09:08:07.000Z | xam/linear_model/__init__.py | topolphukhanh/xam | 3fa958ba8b0c8e8e266cac9997b7a7d0c309f55c | [
"MIT"
] | 8 | 2018-07-05T09:18:36.000Z | 2022-03-04T05:10:09.000Z | xam/linear_model/__init__.py | topolphukhanh/xam | 3fa958ba8b0c8e8e266cac9997b7a7d0c309f55c | [
"MIT"
] | 89 | 2017-03-24T22:12:39.000Z | 2022-02-14T15:47:41.000Z | from .auc_regressor import AUCRegressor
| 20 | 39 | 0.875 | 5 | 40 | 6.8 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.1 | 40 | 1 | 40 | 40 | 0.944444 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 6 |
8b18489858aa2ef22421ecfb04beca605bd0781c | 7,530 | py | Python | tests/integration/backward_compatible/proxy/transactional_map_test.py | tonytheonlypony/hazelcast-python-client | 3aafeaf2ebc05aee4f2386c62c079db496a7c81f | [
"Apache-2.0"
] | 98 | 2015-12-08T14:26:27.000Z | 2022-03-23T17:44:11.000Z | tests/integration/backward_compatible/proxy/transactional_map_test.py | tonytheonlypony/hazelcast-python-client | 3aafeaf2ebc05aee4f2386c62c079db496a7c81f | [
"Apache-2.0"
] | 396 | 2016-02-23T11:07:55.000Z | 2022-03-31T14:26:34.000Z | tests/integration/backward_compatible/proxy/transactional_map_test.py | tonytheonlypony/hazelcast-python-client | 3aafeaf2ebc05aee4f2386c62c079db496a7c81f | [
"Apache-2.0"
] | 62 | 2015-12-09T11:20:53.000Z | 2022-01-28T01:30:54.000Z | from hazelcast.predicate import sql
from tests.base import SingleMemberTestCase
from tests.util import random_string
class TransactionalMapTest(SingleMemberTestCase):
@classmethod
def configure_client(cls, config):
config["cluster_name"] = cls.cluster.id
return config
def setUp(self):
self.map = self.client.get_map(random_string()).blocking()
def test_put(self):
with self.client.new_transaction() as tx:
tx_map = tx.get_map(self.map.name)
self.assertIsNone(tx_map.put("key", "value"))
self.assertEqual(self.map.get("key"), "value")
def test_put_when_present(self):
self.map.put("key", "value")
with self.client.new_transaction() as tx:
tx_map = tx.get_map(self.map.name)
self.assertEqual(tx_map.put("key", "new_value"), "value")
self.assertEqual(self.map.get("key"), "new_value")
def test_put_if_absent(self):
with self.client.new_transaction() as tx:
tx_map = tx.get_map(self.map.name)
self.assertIsNone(tx_map.put_if_absent("key", "value"))
self.assertEqual(self.map.get("key"), "value")
def test_put_if_absent_when_present(self):
self.map.put("key", "value")
with self.client.new_transaction() as tx:
tx_map = tx.get_map(self.map.name)
self.assertEqual(tx_map.put_if_absent("key", "new_value"), "value")
self.assertEqual(self.map.get("key"), "value")
def test_get(self):
self.map.put("key", "value")
with self.client.new_transaction() as tx:
tx_map = tx.get_map(self.map.name)
self.assertEqual(tx_map.get("key"), "value")
def test_get_for_update(self):
self.map.put("key", "value")
with self.client.new_transaction() as tx:
tx_map = tx.get_map(self.map.name)
self.assertEqual(tx_map.get_for_update("key"), "value")
self.assertTrue(self.map.is_locked("key"))
self.assertFalse(self.map.is_locked("key"))
def test_contains_key(self):
self.map.put("key", "value")
with self.client.new_transaction() as tx:
tx_map = tx.get_map(self.map.name)
self.assertTrue(tx_map.contains_key("key"))
def test_contains_key_when_missing(self):
with self.client.new_transaction() as tx:
tx_map = tx.get_map(self.map.name)
self.assertFalse(tx_map.contains_key("key"))
def test_size(self):
self.map.put("key", "value")
with self.client.new_transaction() as tx:
tx_map = tx.get_map(self.map.name)
self.assertTrue(tx_map.size(), 1)
def test_is_empty(self):
with self.client.new_transaction() as tx:
tx_map = tx.get_map(self.map.name)
self.assertTrue(tx_map.is_empty())
def test_is_empty_when_not_empty(self):
self.map.put("key", "value")
with self.client.new_transaction() as tx:
tx_map = tx.get_map(self.map.name)
self.assertFalse(tx_map.is_empty())
def test_set(self):
self.map.put("key", "value")
with self.client.new_transaction() as tx:
tx_map = tx.get_map(self.map.name)
self.assertIsNone(tx_map.set("key", "new_value"))
self.assertEqual(self.map.get("key"), "new_value")
def test_replace(self):
self.map.put("key", "value")
with self.client.new_transaction() as tx:
tx_map = tx.get_map(self.map.name)
self.assertEqual("value", tx_map.replace("key", "new_value"))
self.assertEqual(self.map.get("key"), "new_value")
def test_replace_when_missing(self):
with self.client.new_transaction() as tx:
tx_map = tx.get_map(self.map.name)
self.assertIsNone(tx_map.replace("key", "new_value"))
self.assertIsNone(self.map.get("key"))
def test_replace_if_same_when_same(self):
self.map.put("key", "value")
with self.client.new_transaction() as tx:
tx_map = tx.get_map(self.map.name)
self.assertTrue(tx_map.replace_if_same("key", "value", "new_value"))
self.assertEqual(self.map.get("key"), "new_value")
def test_replace_if_same_when_different(self):
self.map.put("key", "value")
with self.client.new_transaction() as tx:
tx_map = tx.get_map(self.map.name)
self.assertFalse(tx_map.replace_if_same("key", "another_value", "new_value"))
self.assertEqual(self.map.get("key"), "value")
def test_remove(self):
self.map.put("key", "value")
with self.client.new_transaction() as tx:
tx_map = tx.get_map(self.map.name)
self.assertEqual("value", tx_map.remove("key"))
self.assertFalse(self.map.contains_key("key"))
def test_remove_when_missing(self):
with self.client.new_transaction() as tx:
tx_map = tx.get_map(self.map.name)
self.assertIsNone(tx_map.remove("key"))
def test_remove_if_same_when_same(self):
self.map.put("key", "value")
with self.client.new_transaction() as tx:
tx_map = tx.get_map(self.map.name)
self.assertTrue(tx_map.remove_if_same("key", "value"))
self.assertFalse(self.map.contains_key("key"))
def test_remove_if_same_when_different(self):
self.map.put("key", "value")
with self.client.new_transaction() as tx:
tx_map = tx.get_map(self.map.name)
self.assertFalse(tx_map.remove_if_same("key", "another_value"))
self.assertEqual(self.map.get("key"), "value")
def test_delete(self):
self.map.put("key", "value")
with self.client.new_transaction() as tx:
tx_map = tx.get_map(self.map.name)
self.assertIsNone(tx_map.delete("key"))
self.assertFalse(self.map.contains_key("key"))
def test_key_set(self):
self.map.put("key-1", "value-1")
self.map.put("key-2", "value-2")
self.map.put("key-3", "value-3")
with self.client.new_transaction() as tx:
tx_map = tx.get_map(self.map.name)
self.assertCountEqual(tx_map.key_set(), ["key-1", "key-2", "key-3"])
def test_key_set_with_predicate(self):
self.map.put("key-1", "value-1")
self.map.put("key-2", "value-2")
self.map.put("key-3", "value-3")
with self.client.new_transaction() as tx:
tx_map = tx.get_map(self.map.name)
self.assertCountEqual(tx_map.key_set(predicate=sql("this == value-1")), ["key-1"])
def test_values(self):
self.map.put("key-1", "value-1")
self.map.put("key-2", "value-2")
self.map.put("key-3", "value-3")
with self.client.new_transaction() as tx:
tx_map = tx.get_map(self.map.name)
self.assertCountEqual(list(tx_map.values()), ["value-1", "value-2", "value-3"])
def test_values_with_predicate(self):
self.map.put("key-1", "value-1")
self.map.put("key-2", "value-2")
self.map.put("key-3", "value-3")
with self.client.new_transaction() as tx:
tx_map = tx.get_map(self.map.name)
self.assertCountEqual(tx_map.values(predicate=sql("this == value-1")), ["value-1"])
def test_str(self):
with self.client.new_transaction() as tx:
tx_map = tx.get_map(self.map.name)
self.assertTrue(str(tx_map).startswith("TransactionalMap"))
| 35.023256 | 95 | 0.61421 | 1,077 | 7,530 | 4.091922 | 0.065924 | 0.109598 | 0.059224 | 0.079646 | 0.867937 | 0.836624 | 0.803721 | 0.779215 | 0.779215 | 0.776265 | 0 | 0.006074 | 0.234794 | 7,530 | 214 | 96 | 35.186916 | 0.758764 | 0 | 0 | 0.583333 | 0 | 0 | 0.088845 | 0 | 0 | 0 | 0 | 0 | 0.262821 | 1 | 0.179487 | false | 0 | 0.019231 | 0 | 0.211538 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6 |
8c850b04b86cc34461c6efda8534130dc01f64a9 | 8,442 | py | Python | python/src/nnabla/backward_function/backward_function.py | daniel-falk/nnabla | 3fe132ea52dc10521cc029a5d6ba8f565cf65ccf | [
"Apache-2.0"
] | 2,792 | 2017-06-26T13:05:44.000Z | 2022-03-28T07:55:26.000Z | python/src/nnabla/backward_function/backward_function.py | daniel-falk/nnabla | 3fe132ea52dc10521cc029a5d6ba8f565cf65ccf | [
"Apache-2.0"
] | 138 | 2017-06-27T07:04:44.000Z | 2022-02-28T01:37:15.000Z | python/src/nnabla/backward_function/backward_function.py | daniel-falk/nnabla | 3fe132ea52dc10521cc029a5d6ba8f565cf65ccf | [
"Apache-2.0"
] | 380 | 2017-06-26T13:23:52.000Z | 2022-03-25T16:51:30.000Z | # Copyright 2019,2020,2021 Sony Corporation.
# Copyright 2021 Sony Group Corporation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import nnabla as nn
from nnabla.function import PythonFunction
class UnaryDataGrad(PythonFunction):
"""
Input is the dy and output is the dx.
Use the function.backward in the forward_impl.
Use the function.forward in the backward_impl.
"""
def __init__(self, ctx):
super(UnaryDataGrad, self).__init__(ctx)
self._func = None
@property
def name(self):
return self.__class__.__name__
@property
def args(self):
return self._func.args
def _create_fwd_inputs_outputs(self, inputs, outputs):
dy = inputs[0].data
ishape = self.xshape
oshape = dy.shape
inputs_fwd = [nn.Variable(ishape, need_grad=True)]
outputs_fwd = [nn.Variable(oshape)]
return inputs_fwd, outputs_fwd
def min_inputs(self):
return 1
def min_outputs(self):
return 1
def grad_depends_output_data(self, i, o):
return False
def grad_depends_input_data(self, i, j):
return False
@property
def xshape(self):
return self._xshape
@xshape.setter
def xshape(self, xshape):
self._xshape = xshape
def setup_impl(self, inputs, outputs):
inputs_fwd, outputs_fwd = self._create_fwd_inputs_outputs(
inputs, outputs)
self._func.setup(inputs_fwd, outputs_fwd)
oshape = self.xshape
outputs[0].reset_shape(oshape, True)
def forward_impl(self, inputs, outputs):
dy = inputs[0].data
dx = outputs[0].data
inputs_fwd, outputs_fwd = self._create_fwd_inputs_outputs(
inputs, outputs)
vx = inputs_fwd[0].apply(need_grad=True)
vy = outputs_fwd[0]
vx.grad = dx
vy.grad = dy
self._func.backward(inputs_fwd, outputs_fwd, [False])
def backward_impl(self, inputs, outputs, propagate_down, accum):
if not propagate_down[0]:
return
gdy = inputs[0].grad
gdx = outputs[0].grad
inputs_fwd, outputs_fwd = self._create_fwd_inputs_outputs(
inputs, outputs)
vx = inputs_fwd[0]
vy = outputs_fwd[0]
vx.data = gdx
if accum[0]:
self._func.forward(inputs_fwd, outputs_fwd)
gdy += vy.data
else:
vy.data = gdy
self._func.forward(inputs_fwd, outputs_fwd)
class LinearDataGrad(PythonFunction):
@property
def name(self):
return self.__class__.__name__
@property
def args(self):
return self._linear.args
def min_inputs(self):
return 1
def min_outputs(self):
return 1
def grad_depends_output_data(self, i, o):
return False
def grad_depends_input_data(self, i, j):
return True
@property
def xshape(self):
return self._xshape
@xshape.setter
def xshape(self, xshape):
self._xshape = xshape
def _create_fwd_inputs_outputs(self, inputs, outputs):
dy = inputs[0].data
w0 = inputs[1].data
ishape = self.xshape
wshape = w0.shape
oshape = dy.shape
inputs_fwd = [nn.Variable(ishape, need_grad=True),
nn.Variable(wshape, need_grad=True)]
outputs_fwd = [nn.Variable(oshape)]
return inputs_fwd, outputs_fwd
def setup_impl(self, inputs, outputs):
inputs_fwd, outputs_fwd = self._create_fwd_inputs_outputs(
inputs, outputs)
self._linear.setup(inputs_fwd, outputs_fwd)
oshape = self.xshape
outputs[0].reset_shape(oshape, True)
def forward_impl(self, inputs, outputs):
dy = inputs[0].data
w0 = inputs[1].data
dx = outputs[0].data
inputs_fwd, outputs_fwd = self._create_fwd_inputs_outputs(
inputs, outputs)
vx = inputs_fwd[0].apply(need_grad=True)
vw = inputs_fwd[1].apply(need_grad=False)
vy = outputs_fwd[0]
vx.grad = dx
vw.data = w0
vy.grad = dy
self._linear.backward(inputs_fwd, outputs_fwd, [False, False])
def backward_impl(self, inputs, outputs, propagate_down=[], accum=[]):
dy = inputs[0].data
w0 = inputs[1].data
dx = outputs[0].data
gdy = inputs[0].grad
gw0 = inputs[1].grad
gdx = outputs[0].grad
inputs_fwd, outputs_fwd = self._create_fwd_inputs_outputs(
inputs, outputs)
vx = inputs_fwd[0].apply(need_grad=False)
vw = inputs_fwd[1].apply(need_grad=propagate_down[1])
vy = outputs_fwd[0]
# w.r.t. w0
if propagate_down[1]:
vx.data = gdx
vy.grad = dy
vw.grad = gw0
self._linear.backward(inputs_fwd, outputs_fwd, [False, accum[1]])
# w.r.t. dy
if propagate_down[0]:
vx.data = gdx
vw.data = w0
if accum[0]:
self._linear.forward(inputs_fwd, outputs_fwd)
gdy += vy.data
else:
vy.data = gdy
self._linear.forward(inputs_fwd, outputs_fwd)
class LinearFilterGrad(PythonFunction):
@property
def name(self):
return self.__class__.__name__
@property
def args(self):
return self._linear.args
def min_inputs(self):
return 1
def min_outputs(self):
return 1
def grad_depends_output_data(self, i, o):
return False
def grad_depends_input_data(self, i, j):
return True
@property
def wshape(self):
return self._wshape
@wshape.setter
def wshape(self, wshape):
self._wshape = wshape
def _create_fwd_inputs_outputs(self, inputs, outputs):
dy = inputs[0].data
x0 = inputs[1].data
ishape = x0.shape
wshape = self.wshape
oshape = dy.shape
inputs_fwd = [nn.Variable(ishape, need_grad=True),
nn.Variable(wshape, need_grad=True)]
outputs_fwd = [nn.Variable(oshape)]
return inputs_fwd, outputs_fwd
def setup_impl(self, inputs, outputs):
inputs_fwd, outputs_fwd = self._create_fwd_inputs_outputs(
inputs, outputs)
self._linear.setup(inputs_fwd, outputs_fwd)
oshape = self.wshape
outputs[0].reset_shape(oshape, True)
def forward_impl(self, inputs, outputs):
dy = inputs[0].data
x0 = inputs[1].data
dw = outputs[0].data
inputs_fwd, outputs_fwd = self._create_fwd_inputs_outputs(
inputs, outputs)
vx = inputs_fwd[0].apply(need_grad=False)
vw = inputs_fwd[1].apply(need_grad=True)
vy = outputs_fwd[0]
vx.data = x0
vy.grad = dy
vw.grad = dw
self._linear.backward(inputs_fwd, outputs_fwd, [False, False])
def backward_impl(self, inputs, outputs, propagate_down=[], accum=[]):
dy = inputs[0].data
x0 = inputs[1].data
dw = outputs[0].data
gdy = inputs[0].grad
gx0 = inputs[1].grad
gdw = outputs[0].grad
inputs_fwd, outputs_fwd = self._create_fwd_inputs_outputs(
inputs, outputs)
vx = inputs_fwd[0].apply(need_grad=True)
vw = inputs_fwd[1].apply(need_grad=False)
vy = outputs_fwd[0]
# w.r.t. x0
if propagate_down[1]:
vx.grad = gx0
vw.data = gdw
vy.grad = dy
self._linear.backward(inputs_fwd, outputs_fwd, [accum[1], False])
# w.r.t. dy
if propagate_down[0]:
vx.data = x0
vw.data = gdw
if accum[0]:
self._linear.forward(inputs_fwd, outputs_fwd)
gdy += vy.data
else:
vy.data = gdy
self._linear.forward(inputs_fwd, outputs_fwd)
| 27.861386 | 77 | 0.601161 | 1,091 | 8,442 | 4.432631 | 0.127406 | 0.072581 | 0.086022 | 0.102151 | 0.769644 | 0.75641 | 0.744003 | 0.723532 | 0.714847 | 0.707816 | 0 | 0.017162 | 0.30289 | 8,442 | 302 | 78 | 27.953642 | 0.804588 | 0.091921 | 0 | 0.83871 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.170507 | false | 0 | 0.009217 | 0.096774 | 0.308756 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6 |
8ca36efe1c0d71480ad6f611b45d6656d6008b3f | 3,008 | py | Python | devilry/utils/management.py | aless80/devilry-django | 416c262e75170d5662542f15e2d7fecf5ab84730 | [
"BSD-3-Clause"
] | 29 | 2015-01-18T22:56:23.000Z | 2020-11-10T21:28:27.000Z | devilry/utils/management.py | aless80/devilry-django | 416c262e75170d5662542f15e2d7fecf5ab84730 | [
"BSD-3-Clause"
] | 786 | 2015-01-06T16:10:18.000Z | 2022-03-16T11:10:50.000Z | devilry/utils/management.py | aless80/devilry-django | 416c262e75170d5662542f15e2d7fecf5ab84730 | [
"BSD-3-Clause"
] | 15 | 2015-04-06T06:18:43.000Z | 2021-02-24T12:28:30.000Z | import sys
from optparse import make_option
DEFAULT_ENCODING = 'utf-8'
def get_input_encoding():
""" Get the input encoding used for input to management commands.
:return: ``sys.stdin.encoding``
"""
return sys.stdin.encoding or sys.getdefaultencoding() or DEFAULT_ENCODING
def make_input_encoding_option():
"""
Make optparse ``--input-encoding`` option that should be used on management
commands using input/output.
``dest`` is set to ``inputencoding``.
"""
return make_option('--input-encoding',
dest='inputencoding',
default=get_input_encoding(),
help=('Input encoding. Defaults to ``sys.stdin.encoding``, falling back '
'to ``sys.getdefaultencoding()`` and back to utf-8 if both are undefined. '
'It is currently is set to: {0}').format(get_input_encoding()))
def add_input_encoding_argument(parser):
"""
Add argparse ``--input-encoding`` option that should be used on management
commands using input/output.
``dest`` is set to ``inputencoding``.
"""
return parser.add_argument(
'--input-encoding',
dest='inputencoding',
default=get_input_encoding(),
help=('Input encoding. Defaults to ``sys.stdin.encoding``, falling back '
'to ``sys.getdefaultencoding()`` and back to utf-8 if both are undefined. '
'It is currently is set to: {0}').format(get_input_encoding()))
def get_output_encoding():
""" Get the output encoding used for output to management commands.
:return: ``sys.stdout.encoding``
"""
return sys.stdin.encoding or sys.getdefaultencoding() or DEFAULT_ENCODING
def make_output_encoding_option():
"""
Make optparse ``--output-encoding`` option that should be used on
management commands using output/output.
``dest`` is set to ``outputencoding``.
"""
return make_option('--output-encoding',
dest='outputencoding',
default=get_output_encoding(),
help=('Output encoding. Defaults to ``sys.stdout.encoding``, falling back '
'to ``sys.getdefaultencoding()`` and back to utf-8 if both are undefined. '
'It is currently is set to: {0}').format(get_output_encoding()))
def add_output_encoding_argument(parser):
"""
Add argparse ``--output-encoding`` option that should be used on
management commands using output/output.
``dest`` is set to ``outputencoding``.
"""
return parser.add_argument(
'--output-encoding',
dest='outputencoding',
default=get_output_encoding(),
help=('Output encoding. Defaults to ``sys.stdout.encoding``, falling back '
'to ``sys.getdefaultencoding()`` and back to utf-8 if both are undefined. '
'It is currently is set to: {0}').format(get_output_encoding()))
| 37.135802 | 104 | 0.620346 | 347 | 3,008 | 5.262248 | 0.149856 | 0.099671 | 0.030668 | 0.052574 | 0.833516 | 0.765608 | 0.765608 | 0.765608 | 0.765608 | 0.765608 | 0 | 0.004043 | 0.259973 | 3,008 | 80 | 105 | 37.6 | 0.816262 | 0.256649 | 0 | 0.648649 | 0 | 0 | 0.379082 | 0.097492 | 0 | 0 | 0 | 0 | 0 | 1 | 0.162162 | false | 0 | 0.054054 | 0 | 0.378378 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6 |
8cabc5f165a4cbd8f34096d81b912cc2d0db4227 | 46 | py | Python | testharness/__init__.py | kovarus/network-healthcheck | 640c5c4541a106d5de4321a3725dd4cddc16fd25 | [
"Apache-2.0"
] | null | null | null | testharness/__init__.py | kovarus/network-healthcheck | 640c5c4541a106d5de4321a3725dd4cddc16fd25 | [
"Apache-2.0"
] | null | null | null | testharness/__init__.py | kovarus/network-healthcheck | 640c5c4541a106d5de4321a3725dd4cddc16fd25 | [
"Apache-2.0"
] | 2 | 2018-05-16T02:08:27.000Z | 2020-02-09T22:41:09.000Z | #!/usr/bin/env python
from .devices import *
| 11.5 | 22 | 0.695652 | 7 | 46 | 4.571429 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.152174 | 46 | 3 | 23 | 15.333333 | 0.820513 | 0.434783 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 6 |
50c3944493262e5557258d6a3d5eda1c22a9b916 | 153 | py | Python | src/utils/repr.py | riccardomusmeci/easy_byol | 20099e0e55609b047f262539e7e2de4f00b988a4 | [
"MIT"
] | null | null | null | src/utils/repr.py | riccardomusmeci/easy_byol | 20099e0e55609b047f262539e7e2de4f00b988a4 | [
"MIT"
] | 1 | 2022-03-14T13:01:18.000Z | 2022-03-14T15:33:22.000Z | src/utils/repr.py | riccardomusmeci/easy_byol | 20099e0e55609b047f262539e7e2de4f00b988a4 | [
"MIT"
] | null | null | null | import torch
import random
import numpy as np
def reproducibility(seed=42):
torch.manual_seed(seed)
np.random.seed(seed)
random.seed(seed)
| 15.3 | 29 | 0.732026 | 23 | 153 | 4.826087 | 0.478261 | 0.216216 | 0.252252 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.015873 | 0.176471 | 153 | 9 | 30 | 17 | 0.865079 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.142857 | false | 0 | 0.428571 | 0 | 0.571429 | 0 | 1 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 6 |
50c4af7bbeaf92e33734b02f7922d22a887d1685 | 48 | py | Python | deep_da/data/iterator/__init__.py | asahi417/DeepDomainAdaptation | e8e384d0aea2825a879c8f981bfc9f177b59b1b6 | [
"MIT"
] | 22 | 2019-01-31T16:36:44.000Z | 2021-08-24T11:09:04.000Z | deep_da/data/iterator/__init__.py | asahi417/DeepDomainAdaptation | e8e384d0aea2825a879c8f981bfc9f177b59b1b6 | [
"MIT"
] | null | null | null | deep_da/data/iterator/__init__.py | asahi417/DeepDomainAdaptation | e8e384d0aea2825a879c8f981bfc9f177b59b1b6 | [
"MIT"
] | 8 | 2019-02-10T03:52:25.000Z | 2021-02-11T22:44:54.000Z | from .mnist import MNIST
from .svhn import SVHN
| 16 | 24 | 0.791667 | 8 | 48 | 4.75 | 0.5 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.166667 | 48 | 2 | 25 | 24 | 0.95 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 6 |
0fa99f96053fb2b136ce0e011104a7a18ac75297 | 126 | py | Python | chapter02_best_practices/first.py | shelly77/cookbook-2nd-code | 507744c13b7eb2eaec759345f78e6b8ae76ce58a | [
"MIT"
] | null | null | null | chapter02_best_practices/first.py | shelly77/cookbook-2nd-code | 507744c13b7eb2eaec759345f78e6b8ae76ce58a | [
"MIT"
] | null | null | null | chapter02_best_practices/first.py | shelly77/cookbook-2nd-code | 507744c13b7eb2eaec759345f78e6b8ae76ce58a | [
"MIT"
] | null | null | null | def first(l):
return l[0] if l else None
def test_first():
assert first([1, 2, 3]) == 1
assert first([]) is None
| 18 | 32 | 0.579365 | 23 | 126 | 3.130435 | 0.608696 | 0.305556 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.053763 | 0.261905 | 126 | 6 | 33 | 21 | 0.72043 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.4 | 1 | 0.4 | false | 0 | 0 | 0.2 | 0.6 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 6 |
0fc3166afe97d1a0e4b3466877ac63a1cb29455f | 148 | py | Python | appengine_config.py | robertkohl125/MathQuizer | 5e489c1e5af4d3994fe597be8107e5b8caefe81a | [
"Apache-2.0"
] | null | null | null | appengine_config.py | robertkohl125/MathQuizer | 5e489c1e5af4d3994fe597be8107e5b8caefe81a | [
"Apache-2.0"
] | null | null | null | appengine_config.py | robertkohl125/MathQuizer | 5e489c1e5af4d3994fe597be8107e5b8caefe81a | [
"Apache-2.0"
] | null | null | null | def webapp_add_wsgi_middleware(app):
from google.appengine.ext.appstats import recording
app = recording.appstats_wsgi_middleware(app)
return app | 37 | 52 | 0.844595 | 21 | 148 | 5.714286 | 0.666667 | 0.233333 | 0.283333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.087838 | 148 | 4 | 53 | 37 | 0.888889 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.25 | 0 | 0.75 | 0 | 1 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 6 |
ba1bc917ef378f42a92f74ad6775776db9a8e270 | 55 | py | Python | sonorus/experimental/modules/__init__.py | imbesat-rizvi/sonorus | 38698d55b00c67fb3bcff4e4349b6c214a29e6f5 | [
"MIT"
] | null | null | null | sonorus/experimental/modules/__init__.py | imbesat-rizvi/sonorus | 38698d55b00c67fb3bcff4e4349b6c214a29e6f5 | [
"MIT"
] | null | null | null | sonorus/experimental/modules/__init__.py | imbesat-rizvi/sonorus | 38698d55b00c67fb3bcff4e4349b6c214a29e6f5 | [
"MIT"
] | 2 | 2021-01-17T22:53:02.000Z | 2021-03-03T01:11:43.000Z | from .DataCollatorWav2Vec2 import DataCollatorWav2Vec2
| 27.5 | 54 | 0.909091 | 4 | 55 | 12.5 | 0.75 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.078431 | 0.072727 | 55 | 1 | 55 | 55 | 0.901961 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 6 |
ba2a24a4e746ef7bb5d2b95adc82434eb738330b | 19,190 | py | Python | models/backbone_module_scale.py | zaiweizhang/H3DNet | e69f2855634807b37ae12e6db5963c924e64d3e7 | [
"MIT"
] | 212 | 2020-06-11T01:03:36.000Z | 2022-03-17T17:29:21.000Z | models/backbone_module_scale.py | zaiweizhang/H3DNet | e69f2855634807b37ae12e6db5963c924e64d3e7 | [
"MIT"
] | 25 | 2020-06-15T13:35:13.000Z | 2022-03-10T05:44:05.000Z | models/backbone_module_scale.py | zaiweizhang/H3DNet | e69f2855634807b37ae12e6db5963c924e64d3e7 | [
"MIT"
] | 24 | 2020-06-11T01:17:24.000Z | 2022-03-30T13:34:45.000Z | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
import sys
import os
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
ROOT_DIR = os.path.dirname(BASE_DIR)
sys.path.append(ROOT_DIR)
sys.path.append(os.path.join(ROOT_DIR, 'utils'))
sys.path.append(os.path.join(ROOT_DIR, 'pointnet2'))
from pointnet2_modules import PointnetSAModuleVotes, PointnetSAModuleVotesWith, PointnetFPModule, PointnetPlaneVotes
class Pointnet2Backbone(nn.Module):
r"""
Backbone network for point cloud feature learning.
Based on Pointnet++ single-scale grouping network.
Parameters
----------
input_feature_dim: int
Number of input channels in the feature descriptor for each point.
e.g. 3 for RGB.
"""
def __init__(self, input_feature_dim=0, scale=1):
super().__init__()
self.sa1 = PointnetSAModuleVotes(
npoint=2048,
radius=0.2,
nsample=64,
mlp=[input_feature_dim, 64*scale, 64*scale, 128*scale],
use_xyz=True,
normalize_xyz=True
)
self.sa2 = PointnetSAModuleVotes(
npoint=1024,
radius=0.4,
nsample=32,
mlp=[128*scale, 128*scale, 128*scale, 256*scale],
use_xyz=True,
normalize_xyz=True
)
self.sa3 = PointnetSAModuleVotes(
npoint=512,
radius=0.8,
nsample=16,
mlp=[256*scale, 128*scale, 128*scale, 256*scale],
use_xyz=True,
normalize_xyz=True
)
self.sa4 = PointnetSAModuleVotes(
npoint=256,
radius=1.2,
nsample=16,
mlp=[256*scale, 128*scale, 128*scale, 256*scale],
use_xyz=True,
normalize_xyz=True
)
if scale == 1:
self.fp1 = PointnetFPModule(mlp=[256+256,512,512])
self.fp2 = PointnetFPModule(mlp=[512+256,512,512])
else:
self.fp1 = PointnetFPModule(mlp=[256*scale+256*scale,256*scale,256*scale])
self.fp2 = PointnetFPModule(mlp=[256*scale+256*scale,256*scale,256*scale])
def _break_up_pc(self, pc):
xyz = pc[..., 0:3].contiguous()
features = (
pc[..., 3:].transpose(1, 2).contiguous()
if pc.size(-1) > 3 else None
)
return xyz, features
def forward(self, pointcloud: torch.cuda.FloatTensor, end_points=None, mode=''):
r"""
Forward pass of the network
Parameters
----------
pointcloud: Variable(torch.cuda.FloatTensor)
(B, N, 3 + input_feature_dim) tensor
Point cloud to run predicts on
Each point in the point-cloud MUST
be formated as (x, y, z, features...)
Returns
----------
end_points: {XXX_xyz, XXX_features, XXX_inds}
XXX_xyz: float32 Tensor of shape (B,K,3)
XXX_features: float32 Tensor of shape (B,K,D)
XXX-inds: int64 Tensor of shape (B,K) values in [0,N-1]
"""
if not end_points: end_points = {}
batch_size = pointcloud.shape[0]
xyz, features = self._break_up_pc(pointcloud)
end_points['sa0_xyz'+mode] = xyz
end_points['sa0_features'+mode] = features
# --------- 4 SET ABSTRACTION LAYERS ---------
if mode != '':
### Reuse inds from point
xyz, features, fps_inds = self.sa1(xyz, features, inds=end_points['sa1_inds'])
else:
xyz, features, fps_inds = self.sa1(xyz, features)
end_points['sa1_inds'+mode] = fps_inds
end_points['sa1_xyz'+mode] = xyz
end_points['sa1_features'+mode] = features
if mode != '':
xyz, features, fps_inds = self.sa2(xyz, features, inds=end_points['sa2_inds']) # this fps_inds is just 0,1,...,1023
else:
xyz, features, fps_inds = self.sa2(xyz, features) # this fps_inds is just 0,1,...,1023
end_points['sa2_inds'+mode] = fps_inds
end_points['sa2_xyz'+mode] = xyz
end_points['sa2_features'+mode] = features
if mode != '':
xyz, features, fps_inds = self.sa3(xyz, features, inds=end_points['sa3_inds']) # this fps_inds is just 0,1,...,511
else:
xyz, features, fps_inds = self.sa3(xyz, features) # this fps_inds is just 0,1,...,1023
end_points['sa3_inds'+mode] = fps_inds
end_points['sa3_xyz'+mode] = xyz
end_points['sa3_features'+mode] = features
if mode != '':
xyz, features, fps_inds = self.sa4(xyz, features, inds=end_points['sa4_inds']) # this fps_inds is just 0,1,...,255
else:
xyz, features, fps_inds = self.sa4(xyz, features) # this fps_inds is just 0,1,...,255
end_points['sa4_inds'+mode] = fps_inds
end_points['sa4_xyz'+mode] = xyz
end_points['sa4_features'+mode] = features
# --------- 2 FEATURE UPSAMPLING LAYERS --------
features = self.fp1(end_points['sa3_xyz'+mode], end_points['sa4_xyz'+mode], end_points['sa3_features'+mode], end_points['sa4_features'+mode])
features = self.fp2(end_points['sa2_xyz'+mode], end_points['sa3_xyz'+mode], end_points['sa2_features'+mode], features)
end_points['fp2_features'+mode] = features
end_points['fp2_xyz'+mode] = end_points['sa2_xyz'+mode]
num_seed = end_points['fp2_xyz'+mode].shape[1]
end_points['fp2_inds'+mode] = end_points['sa1_inds'+mode][:,0:num_seed] # indices among the entire input point clouds
return end_points
class Pointnet2BackboneRefine(nn.Module):
r"""
Backbone network for point cloud feature learning.
Based on Pointnet++ single-scale grouping network.
Parameters
----------
input_feature_dim: int
Number of input channels in the feature descriptor for each point.
e.g. 3 for RGB.
"""
def __init__(self, input_feature_dim=0):
super().__init__()
self.sa1 = PointnetSAModuleVotesWith(
npoint=2048,
radius=0.2,
nsample=64,
mlp=[input_feature_dim+18+1, 64, 64, 128],
use_xyz=True,
normalize_xyz=True
)
self.sa2 = PointnetSAModuleVotesWith(
npoint=1024,
radius=0.4,
nsample=32,
mlp=[128, 128, 128, 256],
use_xyz=True,
normalize_xyz=True
)
self.sa3 = PointnetSAModuleVotesWith(
npoint=512,
radius=0.8,
nsample=16,
mlp=[256, 128, 128, 256],### Add the indicator info here
use_xyz=True,
normalize_xyz=True
)
self.sa4 = PointnetSAModuleVotesWith(
npoint=256,
radius=1.2,
nsample=16,
mlp=[256, 128, 128, 256],
use_xyz=True,
normalize_xyz=True
)
self.fp1 = PointnetFPModule(mlp=[256+256,256,256])
self.fp2 = PointnetFPModule(mlp=[256+256,256,256])
#self.fp1 = PointnetFPModule(mlp=[128+128,128,128])
#self.fp2 = PointnetFPModule(mlp=[128+128,128,128])
#self.fp3 = PointnetFPModule(mlp=[256+128,256,256])
#self.fp4 = PointnetFPModule(mlp=[256,128,128])
def _break_up_pc(self, pc):
xyz = pc[..., 0:3].contiguous()
features = (
pc[..., 3:].transpose(1, 2).contiguous()
if pc.size(-1) > 3 else None
)
return xyz, features
def forward(self, pointcloud: torch.cuda.FloatTensor, center_points: torch.cuda.FloatTensor, cue_points: torch.cuda.FloatTensor, matching: torch.cuda.FloatTensor, matching_sem: torch.cuda.FloatTensor, floor_height: torch.cuda.FloatTensor, end_points=None, mode=''):
r"""
Forward pass of the network
Parameters
----------
pointcloud: Variable(torch.cuda.FloatTensor)
(B, N, 3 + input_feature_dim) tensor
Point cloud to run predicts on
Each point in the point-cloud MUST
be formated as (x, y, z, features...)
Returns
----------
end_points: {XXX_xyz, XXX_features, XXX_inds}
XXX_xyz: float32 Tensor of shape (B,K,3)
XXX_features: float32 Tensor of shape (B,K,D)
XXX-inds: int64 Tensor of shape (B,K) values in [0,N-1]
"""
if not end_points: end_points = {}
batch_size = pointcloud.shape[0]
xyz, features = self._break_up_pc(pointcloud)
end_points['sa0_xyz'+mode] = xyz
end_points['sa0_features'+mode] = features
#center_points = end_points['center_points']
#cue_points = end_points['cue_points']#.view(batch_size, -1, 3).float()
obj_points = torch.cat((center_points, cue_points), dim=1)
#center_matching = torch.max(matching.view(batch_size, 18, 256), dim=1)[0]
center_matching = end_points['match_center']
center_sem = torch.cuda.FloatTensor(batch_size, 256, 18).zero_()### Need to change to config sem later
center_sem.scatter_(2, matching_sem[:,:256].unsqueeze(-1), 1) # src==1 so it's *one-hot* (B,K,num_size_cluster)
cue_sem = torch.cuda.FloatTensor(batch_size, 256*18, 18).zero_()
cue_sem.scatter_(2, matching_sem[:,256:].unsqueeze(-1), 1) # src==1 so it's *one-hot* (B,K,num_size_cluster)
center_feature = torch.cat(((center_points[:,:,2] - floor_height.unsqueeze(-1)).unsqueeze(1), center_matching.unsqueeze(1), center_sem.transpose(2,1).contiguous()), dim=1) ### Need to make the floor height an option
cue_feature = torch.cat(((cue_points[:,:,2] - floor_height.unsqueeze(-1)).unsqueeze(1), matching.unsqueeze(1), cue_sem.transpose(2,1).contiguous()), dim=1)
other_features = torch.cat((features, torch.cuda.FloatTensor(batch_size, 19, features.shape[-1]).zero_()), dim=1)
features = torch.cat((center_feature, cue_feature, other_features), dim=2)
#features = torch.cat((cue_feature, other_features), dim=2)
# --------- 4 SET ABSTRACTION LAYERS ---------
### Concatenate the
#xyz, features, fps_inds = self.sa1(obj_points, xyz, features, inds=end_points['sa1_inds'])
xyz, features, fps_inds = self.sa1(obj_points, xyz, features)
end_points['sa1_inds'+mode] = fps_inds
end_points['sa1_xyz'+mode] = xyz
end_points['sa1_features'+mode] = features
#xyz, features, fps_inds = self.sa2(xyz[:,:256*18,:].contiguous(), xyz[:,256*18:,:].contiguous(), features) # this fps_inds is just 0,1,...,1023
xyz, features, fps_inds = self.sa2(xyz[:,:256*19,:].contiguous(), xyz[:,256*19:,:].contiguous(), features, inds=end_points['sa2_inds']) # this fps_inds is just 0,1,...,1023
end_points['sa2_inds'+mode] = fps_inds
end_points['sa2_xyz'+mode] = xyz
end_points['sa2_features'+mode] = features
### Append the surface and line info here
'''
center_ind = torch.cuda.FloatTensor(batch_size, 4, 256).zero_()
center_ind[:,0,:] = 1.0
surfacez_ind = torch.cuda.FloatTensor(batch_size, 4, 256*2).zero_()
surfacez_ind[:,1,:] = 1.0
surfacexy_ind = torch.cuda.FloatTensor(batch_size, 4, 256*4).zero_()
surfacexy_ind[:,2,:] = 1.0
line_ind = torch.cuda.FloatTensor(batch_size, 4, 256*12).zero_()
line_ind[:,3,:] = 1.0
cue_ind = torch.cat((torch.cuda.FloatTensor(batch_size, 1, 1024).zero_(), end_points["pred_z_ind"].unsqueeze(1), end_points["pred_xy_ind"].unsqueeze(1), end_points["pred_line_ind"].unsqueeze(1)), dim=1)
ind_feature = torch.cat((center_ind, surfacez_ind, surfacexy_ind, line_ind, cue_ind), dim=2)
features = torch.cat((features, ind_feature), dim=1)
'''
#xyz, features, fps_inds = self.sa3(xyz[:,:256*18,:].contiguous(), xyz[:,256*18:,:].contiguous(), features) # this fps_inds is just 0,1,...,1023
xyz, features, fps_inds = self.sa3(xyz[:,:256*19,:].contiguous(), xyz[:,256*19:,:].contiguous(), features, inds=end_points['sa3_inds']) # this fps_inds is just 0,1,...,1023
end_points['sa3_inds'+mode] = fps_inds
end_points['sa3_xyz'+mode] = xyz
end_points['sa3_features'+mode] = features
#xyz, features, fps_inds = self.sa4(xyz[:,:256*18,:].contiguous(), xyz[:,256*18:,:].contiguous(), features) # this fps_inds is just 0,1,...,1023
xyz, features, fps_inds = self.sa4(xyz[:,:256*19,:].contiguous(), xyz[:,256*19:,:].contiguous(), features, inds=end_points['sa4_inds']) # this fps_inds is just 0,1,...,1023
end_points['sa4_inds'+mode] = fps_inds
end_points['sa4_xyz'+mode] = xyz
end_points['sa4_features'+mode] = features
# --------- 2 FEATURE UPSAMPLING LAYERS --------
#features = self.fp1(end_points['sa3_xyz'+mode], end_points['sa4_xyz'+mode], end_points['sa3_features'+mode], end_points['sa4_features'+mode])
#features = self.fp2(end_points['sa2_xyz'+mode], end_points['sa3_xyz'+mode], end_points['sa2_features'+mode], features)
features = self.fp1(end_points['sa3_xyz'+mode], end_points['sa4_xyz'+mode][:,256*19:,:].contiguous(), end_points['sa3_features'+mode], end_points['sa4_features'+mode][:,:,256*19:].contiguous())
features = self.fp2(end_points['sa2_xyz'+mode][:,:256*19,:].contiguous(), end_points['sa3_xyz'+mode][:,256*19:,:].contiguous(), end_points['sa2_features'+mode][:,:,:256*19].contiguous(), features[:,:,256*19:].contiguous())
end_points['fp2_features'+mode] = features
end_points['fp2_xyz'+mode] = end_points['sa2_xyz'+mode][:,:256*19,:].contiguous()
num_seed = end_points['fp2_xyz'+mode].shape[1]
end_points['fp2_inds'+mode] = end_points['sa1_inds'+mode][:,0:num_seed] # indices among the entire input point clouds
return end_points
class Pointnet2BackbonePlane(nn.Module):
r"""
Backbone network for point cloud feature learning.
Based on Pointnet++ single-scale grouping network.
Parameters
----------
input_feature_dim: int
Number of input channels in the feature descriptor for each point.
e.g. 3 for RGB.
"""
def __init__(self, input_feature_dim=0):
super().__init__()
self.sa1 = PointnetPlaneVotes(
npoint=2048,
radius=0.2,
nsample=64,
mlp=[input_feature_dim, 64, 64, 128],
use_xyz=True,
normalize_xyz=True
)
self.sa2 = PointnetPlaneVotes(
npoint=1024,
radius=0.4,
nsample=32,
mlp=[128*2, 128, 128, 128],
use_xyz=True,
normalize_xyz=True
)
self.sa3 = PointnetPlaneVotes(
npoint=512,
radius=0.8,
nsample=16,
mlp=[256, 128, 128, 128],
use_xyz=True,
normalize_xyz=True
)
self.sa4 = PointnetPlaneVotes(
npoint=256,
radius=1.2,
nsample=16,
mlp=[256, 128, 128, 128],
use_xyz=True,
normalize_xyz=True
)
self.fp1 = PointnetFPModule(mlp=[256+256,256,256])
self.fp2 = PointnetFPModule(mlp=[256+256,256,256])
#self.fp3 = PointnetFPModule(mlp=[256+128,256,256])
#self.fp4 = PointnetFPModule(mlp=[256,128,128])
def _break_up_pc(self, pc):
xyz = pc[..., 0:3].contiguous()
features = (
pc[..., 3:].transpose(1, 2).contiguous()
if pc.size(-1) > 3 else None
)
return xyz, features
def forward(self, pointcloud: torch.cuda.FloatTensor, end_points=None, mode='plane'):
r"""
Forward pass of the network
Parameters
----------
pointcloud: Variable(torch.cuda.FloatTensor)
(B, N, 3 + input_feature_dim) tensor
Point cloud to run predicts on
Each point in the point-cloud MUST
be formated as (x, y, z, features...)
Returns
----------
end_points: {XXX_xyz, XXX_features, XXX_inds}
XXX_xyz: float32 Tensor of shape (B,K,3)
XXX_features: float32 Tensor of shape (B,K,D)
XXX-inds: int64 Tensor of shape (B,K) values in [0,N-1]
"""
if not end_points: end_points = {}
batch_size = pointcloud.shape[0]
xyz, features = self._break_up_pc(pointcloud)
end_points['sa0_xyz'+mode] = xyz
end_points['sa0_features'+mode] = features
# --------- 4 SET ABSTRACTION LAYERS ---------
xyz, features, fps_inds = self.sa1(xyz, features)
end_points['sa1_inds'+mode] = fps_inds
end_points['sa1_xyz'+mode] = xyz
end_points['sa1_features'+mode] = features
xyz, features, fps_inds = self.sa2(xyz, features) # this fps_inds is just 0,1,...,1023
end_points['sa2_inds'+mode] = fps_inds
end_points['sa2_xyz'+mode] = xyz
end_points['sa2_features'+mode] = features
xyz, features, fps_inds = self.sa3(xyz, features) # this fps_inds is just 0,1,...,511
end_points['sa3_xyz'+mode] = xyz
end_points['sa3_features'+mode] = features
xyz, features, fps_inds = self.sa4(xyz, features) # this fps_inds is just 0,1,...,255
end_points['sa4_xyz'+mode] = xyz
end_points['sa4_features'+mode] = features
# --------- 2 FEATURE UPSAMPLING LAYERS --------
features = self.fp1(end_points['sa3_xyz'+mode], end_points['sa4_xyz'+mode], end_points['sa3_features'+mode], end_points['sa4_features'+mode])
features = self.fp2(end_points['sa2_xyz'+mode], end_points['sa3_xyz'+mode], end_points['sa2_features'+mode], features)
end_points['fp2_features'+mode] = features
end_points['fp2_xyz'+mode] = end_points['sa2_xyz'+mode]
num_seed = end_points['fp2_xyz'+mode].shape[1]
end_points['fp2_inds'+mode] = end_points['sa1_inds'+mode][:,0:num_seed] # indices among the entire input point clouds
return end_points
if __name__=='__main__':
backbone_net = Pointnet2Backbone(input_feature_dim=3).cuda()
print(backbone_net)
backbone_net.eval()
out = backbone_net(torch.rand(4,8192,6).cuda())
for key in sorted(out.keys()):
print(key, '\t', out[key].shape)
| 43.026906 | 269 | 0.58223 | 2,453 | 19,190 | 4.360783 | 0.09417 | 0.096756 | 0.044872 | 0.033654 | 0.814621 | 0.802842 | 0.783771 | 0.765448 | 0.70674 | 0.694307 | 0 | 0.0649 | 0.278166 | 19,190 | 445 | 270 | 43.123596 | 0.707335 | 0.246483 | 0 | 0.660448 | 0 | 0 | 0.062442 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.033582 | false | 0 | 0.026119 | 0 | 0.093284 | 0.007463 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6 |
e86aa6e57c10c1eb1b665a58155e3c78c2685b6f | 535 | py | Python | senza/components/weighted_dns_elastic_load_balancer_v2.py | mschwitalla/senza | 301a43fde41db194cbb80c68271692d1fe2212db | [
"Apache-2.0"
] | 106 | 2015-03-30T14:15:15.000Z | 2021-07-26T07:30:11.000Z | senza/components/weighted_dns_elastic_load_balancer_v2.py | mschwitalla/senza | 301a43fde41db194cbb80c68271692d1fe2212db | [
"Apache-2.0"
] | 547 | 2015-04-13T09:58:50.000Z | 2021-01-26T11:20:35.000Z | senza/components/weighted_dns_elastic_load_balancer_v2.py | mschwitalla/senza | 301a43fde41db194cbb80c68271692d1fe2212db | [
"Apache-2.0"
] | 102 | 2015-04-01T08:09:53.000Z | 2020-11-05T09:05:28.000Z |
from senza.components.weighted_dns_elastic_load_balancer import component_weighted_dns_elastic_load_balancer
from senza.components.elastic_load_balancer_v2 import component_elastic_load_balancer_v2
def component_weighted_dns_elastic_load_balancer_v2(definition, configuration, args, info, force, account_info):
return component_weighted_dns_elastic_load_balancer(definition, configuration, args, info, force, account_info,
lb_component=component_elastic_load_balancer_v2)
| 59.444444 | 115 | 0.8 | 64 | 535 | 6.15625 | 0.3125 | 0.195431 | 0.337563 | 0.22335 | 0.763959 | 0.535533 | 0.238579 | 0 | 0 | 0 | 0 | 0.008909 | 0.160748 | 535 | 8 | 116 | 66.875 | 0.868597 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0 | 0.4 | 0.2 | 0.8 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 6 |
e89cafdde490cb1a0cb94bd31e995a45ddf87570 | 174 | py | Python | 104-maximum-depth-of-binary-tree/104-maximum-depth-of-binary-tree.py | Atri10/Leet-code---Atri_Patel | 49fc59b9147a44ab04a66128fbb2ef259b5f7b7c | [
"MIT"
] | 1 | 2021-10-10T20:21:18.000Z | 2021-10-10T20:21:18.000Z | 104-maximum-depth-of-binary-tree/104-maximum-depth-of-binary-tree.py | Atri10/Leet-code---Atri_Patel | 49fc59b9147a44ab04a66128fbb2ef259b5f7b7c | [
"MIT"
] | null | null | null | 104-maximum-depth-of-binary-tree/104-maximum-depth-of-binary-tree.py | Atri10/Leet-code---Atri_Patel | 49fc59b9147a44ab04a66128fbb2ef259b5f7b7c | [
"MIT"
] | null | null | null | class Solution:
def maxDepth(self, root: Optional[TreeNode]) -> int:
if not root:return 0
return max(self.maxDepth(root.left),self.maxDepth(root.right))+1 | 43.5 | 72 | 0.678161 | 25 | 174 | 4.72 | 0.68 | 0.20339 | 0.271186 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.014184 | 0.189655 | 174 | 4 | 72 | 43.5 | 0.822695 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0 | 0 | 0.75 | 0 | 1 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 6 |
e8b23be50f8d37e0729eaf3cd7c41d8a5d82a02e | 20 | py | Python | likurai/layer/__init__.py | bglick13/likurai | 4cf22978bbe7bdb6b77a236cba8ced65f020b772 | [
"MIT"
] | null | null | null | likurai/layer/__init__.py | bglick13/likurai | 4cf22978bbe7bdb6b77a236cba8ced65f020b772 | [
"MIT"
] | 1 | 2019-03-14T13:12:51.000Z | 2019-03-14T13:12:51.000Z | likurai/layer/__init__.py | bglick13/likurai | 4cf22978bbe7bdb6b77a236cba8ced65f020b772 | [
"MIT"
] | null | null | null | from .layer import * | 20 | 20 | 0.75 | 3 | 20 | 5 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.15 | 20 | 1 | 20 | 20 | 0.882353 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 6 |
2cde0a8d2a62387744d5ffc9b88569ad1a0af139 | 41,090 | py | Python | bonk/tests.py | loofjj/bonk | e306ffbdef50dcdad7949d9b7c249ccf415887e6 | [
"Apache-2.0"
] | null | null | null | bonk/tests.py | loofjj/bonk | e306ffbdef50dcdad7949d9b7c249ccf415887e6 | [
"Apache-2.0"
] | null | null | null | bonk/tests.py | loofjj/bonk | e306ffbdef50dcdad7949d9b7c249ccf415887e6 | [
"Apache-2.0"
] | null | null | null | # Copyright 2017 Klarna Bank AB
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from __future__ import absolute_import
import base64
import json
import os
import netaddr
from django.test import TestCase, override_settings
from django.conf import settings
from django.core import management
from django.urls import reverse
from django.contrib.auth import get_user_model
from django.contrib.auth.models import Group
from django.contrib.auth.hashers import make_password
import rethinkdb as r
from bonk.serializers import *
@override_settings(
RETHINK_DB_DB=os.environ.get('RETHINK_DB_DB', 'bonkci'),
)
class APITests(TestCase):
@classmethod
def setUpClass(cls):
super(APITests, cls).setUpClass()
cls.conn = r.connect(host=settings.RETHINK_DB_HOST, port=settings.RETHINK_DB_PORT)
try:
r.db_drop(settings.RETHINK_DB_DB).run(cls.conn)
except:
pass
r.db_create(settings.RETHINK_DB_DB).run(cls.conn)
cls.conn.db = settings.RETHINK_DB_DB
management.call_command('syncrethinkdb', verbosity=0)
@classmethod
def tearDownClass(cls):
r.db_drop(settings.RETHINK_DB_DB).run(cls.conn)
super(APITests, cls).tearDownClass()
def tearDown(self):
for t in ["vrf", "ip_prefix", "ip_block", "ip_address", "dns_zone", "dns_record", "dhcp_server_set"]:
r.table(t).delete().run(self.conn)
super(APITests, self).tearDown()
def create_user(self, username='tester', password='tester', is_superuser=True, groups=[], **kwargs):
user = get_user_model().objects.create(
username=username,
password=make_password(password),
is_superuser=is_superuser,
**kwargs
)
for name in groups:
group, created = Group.objects.get_or_create(name=name)
user.groups.add(group)
auth = "Basic %s" % (base64.b64encode(("%s:%s" % (username, password)).encode("ascii")).decode("ascii"))
return auth
def create_common_objects(self):
auth = self.create_user()
response = self.client.post(reverse('bonk:vrf_list'), data=json.dumps({
'vrf': 0, 'name': 'default'
}), content_type="application/json", HTTP_AUTHORIZATION=auth)
self.assertEqual(response.status_code, 201)
return auth
def create_ip_block(self, auth, vrf, network, length, name, **fields):
response = self.client.post(reverse('bonk:block_list'), data=json.dumps(dict(fields,
vrf=vrf,
name=name,
network=network,
length=length,
)), content_type="application/json", HTTP_AUTHORIZATION=auth)
self.assertEqual(response.status_code, 201)
return json.loads(response.content)
def create_ip_prefix(self, auth, vrf, network, length, name, **fields):
response = self.client.post(reverse('bonk:prefix_list'), data=json.dumps(dict(fields,
vrf=vrf,
network=network,
length=length,
name=name,
state=fields.get('state', 'allocated'),
)), content_type="application/json", HTTP_AUTHORIZATION=auth)
self.assertEqual(response.status_code, 201)
return json.loads(response.content)
def create_ip_address(self, auth, vrf, ip, name, **fields):
response = self.client.post(reverse('bonk:address_list'), data=json.dumps(dict(fields,
vrf=vrf,
ip=ip,
name=name,
state=fields.get('state', 'allocated'),
)), content_type="application/json", HTTP_AUTHORIZATION=auth)
self.assertEqual(response.status_code, 201)
return json.loads(response.content)
def _create_zone(self, auth, name, **fields):
return self.client.post(reverse('bonk:zone_list'), data=json.dumps(dict(fields,
name=name,
type=fields.get('type', 'internal'),
)), content_type="application/json", HTTP_AUTHORIZATION=auth)
def create_zone(self, auth, name, **fields):
response = self._create_zone(auth, name, **fields)
self.assertEqual(response.status_code, 201)
return json.loads(response.content)
def _create_record(self, auth, name, zone, type, value, **fields):
return self.client.post(reverse('bonk:record_list'), data=json.dumps(dict(fields,
name=name,
zone=zone,
type=type,
value=value,
)), content_type="application/json", HTTP_AUTHORIZATION=auth)
def create_record(self, *args, **fields):
response = self._create_record(*args, **fields)
self.assertEqual(response.status_code, 201)
return json.loads(response.content)
def _allocate_ip_prefix(self, auth, vrf, block_network, block_length, **fields):
return self.client.post(reverse('bonk:block_allocate', kwargs={
'vrf': vrf,
'network': block_network,
'length': block_length,
}), data=json.dumps(dict(fields,
state=fields.get('state', 'allocated'),
)), content_type="application/json", HTTP_AUTHORIZATION=auth)
def allocate_ip_prefix(self, *args, **fields):
response = self._allocate_ip_prefix(*args, **fields)
self.assertEqual(response.status_code, 201)
return json.loads(response.content)
def _allocate_ip_address(self, auth, vrf, prefix_network, prefix_length, name, **fields):
return self.client.post(reverse('bonk:prefix_allocate', kwargs={
'vrf': vrf,
'network': prefix_network,
'length': prefix_length
}), data=json.dumps(dict(fields,
name=name,
state=fields.get('state', 'allocated'),
)), content_type="application/json", HTTP_AUTHORIZATION=auth)
def allocate_ip_address(self, *args, **fields):
response = self._allocate_ip_address(*args, **fields)
self.assertEqual(response.status_code, 201)
return json.loads(response.content)
def test_ip_block_get_by_ip(self):
auth = self.create_common_objects()
ip_block = self.create_ip_block(auth, 0, '10.0.0.0', 16, 'block1')
self.assertEqual(IPBlockSerializer.get_by_ip(0, '10.0.0.0')['id'], ip_block['id'])
self.assertEqual(IPBlockSerializer.get_by_ip(0, '10.0.255.255')['id'], ip_block['id'])
with self.assertRaises(RethinkObjectNotFound):
IPBlockSerializer.get_by_ip(0, '10.1.0.0')
def test_ip_block_invalid_vrf(self):
auth = self.create_common_objects()
response = self.client.post(reverse('bonk:block_list'), data=json.dumps({
'vrf': 1,
'network': '10.0.0.0',
'length': 16,
'name': 'block1'
}), content_type="application/json", HTTP_AUTHORIZATION=auth)
self.assertEqual(response.status_code, 400)
self.assertIn('vrf', json.loads(response.content))
def test_ip_block_invalid_network(self):
auth = self.create_common_objects()
response = self.client.post(reverse('bonk:block_list'), data=json.dumps({
'vrf': 0,
'network': '10.0.1.0',
'length': 16,
'name': 'block1'
}), content_type="application/json", HTTP_AUTHORIZATION=auth)
self.assertEqual(response.status_code, 400)
self.assertIn('non_field_errors', json.loads(response.content))
def test_ip_prefix_invalid_vrf(self):
auth = self.create_common_objects()
ip_block = self.create_ip_block(auth, 0, '10.0.0.0', 16, 'block1')
response = self._allocate_ip_prefix(auth, 1, '10.0.0.0', 16, length=24, name='prefix1', permissions={})
self.assertEqual(response.status_code, 404)
def test_ip_prefix_get_by_ip(self):
auth = self.create_common_objects()
ip_block = self.create_ip_block(auth, 0, '10.0.0.0', 16, 'block1')
ip_prefix = self.create_ip_prefix(auth, 0, '10.0.1.0', 24, 'prefix1')
self.assertEqual(IPPrefixSerializer.get_by_ip(0, '10.0.1.0')['id'], ip_prefix['id'])
self.assertEqual(IPPrefixSerializer.get_by_ip(0, '10.0.1.255')['id'], ip_prefix['id'])
with self.assertRaises(RethinkObjectNotFound):
IPPrefixSerializer.get_by_ip(0, '10.0.0.0')
with self.assertRaises(RethinkObjectNotFound):
IPPrefixSerializer.get_by_ip(0, '10.0.2.0')
def test_ip_prefix_list_as_user(self):
auth = self.create_common_objects()
user1_auth = self.create_user('user1', is_superuser=False, groups=['group1'])
user2_auth = self.create_user('user2', is_superuser=False, groups=['group2'])
ip_block = self.create_ip_block(auth, 0, '10.0.0.0', 16, 'block1', permissions={'create': ['group1', 'group2']})
ip_prefix1 = self.allocate_ip_prefix(user1_auth, 0, '10.0.0.0', 16, length=24, name='prefix1', permissions={'write': ['group1']})
ip_prefix2 = self.allocate_ip_prefix(user2_auth, 0, '10.0.0.0', 16, length=24, name='prefix2', permissions={'write': ['group2']})
response = self.client.get(reverse('bonk:prefix_list'), HTTP_AUTHORIZATION=user1_auth)
self.assertEqual(response.status_code, 200)
data = json.loads(response.content)
self.assertEqual(len(data), 1)
self.assertEqual(data[0]['id'], ip_prefix1['id'])
response = self.client.get(reverse('bonk:prefix_list'), HTTP_AUTHORIZATION=user2_auth)
self.assertEqual(response.status_code, 200)
data = json.loads(response.content)
self.assertEqual(len(data), 1)
self.assertEqual(data[0]['id'], ip_prefix2['id'])
def test_ip_prefix_allocate_forbidden(self):
auth = self.create_common_objects()
user1_auth = self.create_user('user1', is_superuser=False, groups=['group1'])
ip_block = self.create_ip_block(auth, 0, '10.0.0.0', 16, 'block1', permissions={})
response = self._allocate_ip_prefix(user1_auth, 0, '10.0.0.0', 16, length=24, name='prefix1', permissions={'write': ['group1']})
self.assertEqual(response.status_code, 403)
def test_ip_prefix_allocate_hosts(self):
auth = self.create_common_objects()
user1_auth = self.create_user('user1', is_superuser=False, groups=['group1'])
ip_block = self.create_ip_block(auth, 0, '10.0.0.0', 16, 'block1', permissions={'create': ['group1']})
ip_prefix1 = self.allocate_ip_prefix(user1_auth, 0, '10.0.0.0', 16, hosts=13, name='prefix1', permissions={'write': ['group1']})
self.assertEqual(ip_prefix1['length'], 28)
def test_ip_prefix_allocate_nothing(self):
auth = self.create_common_objects()
user1_auth = self.create_user('user1', is_superuser=False, groups=['group1'])
ip_block = self.create_ip_block(auth, 0, '10.0.0.0', 16, 'block1', permissions={'create': ['group1']})
response = self._allocate_ip_prefix(user1_auth, 0, '10.0.0.0', 16, name='prefix1', permissions={'write': ['group1']})
self.assertEqual(response.status_code, 400)
self.assertIn(b'length', response.content)
def test_ip_prefix_allocate_exhaustive(self):
auth = self.create_common_objects()
user1_auth = self.create_user('user1', is_superuser=False, groups=['group1'])
ip_block = self.create_ip_block(auth, 0, '10.0.0.0', 16, 'block1', permissions={'create': ['group1']})
ip_prefix1 = self.allocate_ip_prefix(user1_auth, 0, '10.0.0.0', 16, length=17, name='prefix1', permissions={'write': ['group1']})
ip_prefix2 = self.allocate_ip_prefix(user1_auth, 0, '10.0.0.0', 16, length=17, name='prefix2', permissions={'write': ['group1']})
response = self._allocate_ip_prefix(user1_auth, 0, '10.0.0.0', 16, length=17, name='prefix3', permissions={'write': ['group1']})
self.assertEqual(response.status_code, 400)
self.assertIn(b'exhausted', response.content)
def test_ip_prefix_allocate_no_permissions(self):
auth = self.create_common_objects()
user1_auth = self.create_user('user1', is_superuser=False, groups=['group1'])
ip_block = self.create_ip_block(auth, 0, '10.0.0.0', 16, 'block1', permissions={'create': ['group1']})
response = self._allocate_ip_prefix(user1_auth, 0, '10.0.0.0', 16, length=17, name='prefix1')
self.assertEqual(response.status_code, 400)
self.assertIn(b'permissions', response.content)
def test_ip_prefix_no_block(self):
auth = self.create_common_objects()
response = self.client.post(reverse('bonk:prefix_list'), data=json.dumps({
'vrf': 0,
'network': '10.0.0.0',
'length': 24,
'state': 'allocated',
'name': 'prefix1',
}), content_type="application/json", HTTP_AUTHORIZATION=auth)
self.assertEqual(response.status_code, 400)
self.assertIn('non_field_errors', json.loads(response.content))
def test_ip_prefix_larger_than_block(self):
auth = self.create_common_objects()
ip_block = self.create_ip_block(auth, 0, '10.0.0.0', 16, 'block1', permissions={})
response = self.client.post(reverse('bonk:prefix_list'), data=json.dumps({
'vrf': 0,
'network': '10.0.0.0',
'length': 8,
'state': 'allocated',
'name': 'prefix1',
}), content_type="application/json", HTTP_AUTHORIZATION=auth)
self.assertEqual(response.status_code, 400)
self.assertIn('non_field_errors', json.loads(response.content))
def test_ip_prefix_overlap(self):
auth = self.create_common_objects()
ip_block = self.create_ip_block(auth, 0, '10.0.0.0', 16, 'block1', allocators=[])
response = self.client.post(reverse('bonk:prefix_list'), data=json.dumps({
'vrf': 0,
'network': '10.0.0.0',
'length': 24,
'state': 'allocated',
'name': 'prefix1',
}), content_type="application/json", HTTP_AUTHORIZATION=auth)
self.assertEqual(response.status_code, 201)
response = self.client.post(reverse('bonk:prefix_list'), data=json.dumps({
'vrf': 0,
'network': '10.0.0.128',
'length': 28,
'state': 'allocated',
'name': 'prefix2',
}), content_type="application/json", HTTP_AUTHORIZATION=auth)
self.assertEqual(response.status_code, 400)
self.assertIn('non_field_errors', json.loads(response.content))
def test_ip_prefix_underlap(self):
auth = self.create_common_objects()
ip_block = self.create_ip_block(auth, 0, '10.0.0.0', 16, 'block1', allocators=[])
response = self.client.post(reverse('bonk:prefix_list'), data=json.dumps({
'vrf': 0,
'network': '10.0.0.128',
'length': 28,
'state': 'allocated',
'name': 'prefix1',
}), content_type="application/json", HTTP_AUTHORIZATION=auth)
self.assertEqual(response.status_code, 201)
response = self.client.post(reverse('bonk:prefix_list'), data=json.dumps({
'vrf': 0,
'network': '10.0.0.0',
'length': 24,
'state': 'allocated',
'name': 'prefix2',
}), content_type="application/json", HTTP_AUTHORIZATION=auth)
self.assertEqual(response.status_code, 400)
self.assertIn('non_field_errors', json.loads(response.content))
def test_ip_prefix_invalid_network(self):
auth = self.create_common_objects()
ip_block = self.create_ip_block(auth, 0, '10.0.0.0', 16, 'block1', allocators=[])
response = self.client.post(reverse('bonk:prefix_list'), data=json.dumps({
'vrf': 0,
'network': '10.0.0.128',
'length': 24,
'state': 'allocated',
'name': 'prefix1',
}), content_type="application/json", HTTP_AUTHORIZATION=auth)
self.assertEqual(response.status_code, 400)
self.assertIn('non_field_errors', json.loads(response.content))
def test_ip_prefix_high_ip(self):
auth = self.create_common_objects()
ip_block = self.create_ip_block(auth, 0, '128.0.0.0', 24, 'block1')
ip_prefix1 = self.allocate_ip_prefix(auth, 0, '128.0.0.0', 24, length=28, name='prefix1', permissions={})
def test_ip_prefix_delete_addresses(self):
auth = self.create_common_objects()
ip_block = self.create_ip_block(auth, 0, '10.0.0.0', 16, 'block1')
ip_prefix = self.allocate_ip_prefix(auth, 0, '10.0.0.0', 16, length=24, name='prefix1', permissions={})
zone = self.create_zone(auth, 'my.zone')
ip1 = self.allocate_ip_address(auth, 0, ip_prefix['network'], ip_prefix['length'], 'test1.my.zone', permissions={})
response = self.client.delete(reverse('bonk:prefix_detail', kwargs={
'vrf': ip_prefix['vrf'], 'network': ip_prefix['network'], 'length': ip_prefix['length']
}), HTTP_AUTHORIZATION=auth)
self.assertEqual(response.status_code, 204)
response = self.client.get(reverse('bonk:address_list'), HTTP_AUTHORIZATION=auth)
self.assertEqual(response.status_code, 200)
data = json.loads(response.content)
self.assertEqual(len(data), 0)
def test_create_prefix_without_permission(self):
auth = self.create_common_objects()
ip_block = self.create_ip_block(auth, 0, '10.0.0.0', 16, 'block1', permissions={})
user1_auth = self.create_user('user1', is_superuser=False, groups=['group1'])
response = self.client.post(reverse('bonk:prefix_list'), data=json.dumps({
'vrf': 0,
'network': '10.0.1.0',
'length': 24,
'state': 'allocated',
'name': 'prefix1',
}), content_type="application/json", HTTP_AUTHORIZATION=user1_auth)
self.assertEqual(response.status_code, 400)
data = json.loads(response.content)
self.assertIn('non_field_errors', data)
self.assertIn('permission', data['non_field_errors'][0])
def test_ip_address_allocate(self):
auth = self.create_common_objects()
user1_auth = self.create_user('user1', is_superuser=False, groups=['group1'])
user2_auth = self.create_user('user2', is_superuser=False, groups=['group2'])
ip_block = self.create_ip_block(auth, 0, '10.0.0.0', 16, 'block1', permissions={'create': ['group1', 'group2']})
zone = self.create_zone(auth, 'my.zone', permissions={'write': ['group1', 'group2']})
ip_prefix1 = self.allocate_ip_prefix(user1_auth, 0, '10.0.0.0', 16, length=24, name='prefix1', permissions={'write': ['group1']})
ip_prefix2 = self.allocate_ip_prefix(user2_auth, 0, '10.0.0.0', 16, length=24, name='prefix2', permissions={'write': ['group2']})
ip1 = self.allocate_ip_address(user1_auth, 0, ip_prefix1['network'], ip_prefix1['length'], 'test1.my.zone')
ip2 = self.allocate_ip_address(user2_auth, 0, ip_prefix2['network'], ip_prefix2['length'], 'test2.my.zone')
self.assertIn(netaddr.IPAddress(ip1['ip']), netaddr.IPNetwork("%s/%d" % (ip_prefix1['network'], ip_prefix1['length'])))
self.assertIn(netaddr.IPAddress(ip2['ip']), netaddr.IPNetwork("%s/%d" % (ip_prefix2['network'], ip_prefix2['length'])))
response = self.client.get(reverse('bonk:address_list'), HTTP_AUTHORIZATION=user1_auth)
self.assertEqual(response.status_code, 200)
data = json.loads(response.content)
self.assertEqual(len(data), 1)
self.assertEqual(data[0]['id'], ip1['id'])
response = self.client.get(reverse('bonk:address_list'), HTTP_AUTHORIZATION=user2_auth)
self.assertEqual(response.status_code, 200)
data = json.loads(response.content)
self.assertEqual(len(data), 1)
self.assertEqual(data[0]['id'], ip2['id'])
def test_ip_address_allocate_no_zone(self):
auth = self.create_common_objects()
user1_auth = self.create_user('user1', is_superuser=False, groups=['group1'])
ip_block = self.create_ip_block(auth, 0, '10.0.0.0', 16, 'block1', permissions={'create': ['group1']})
ip_prefix1 = self.allocate_ip_prefix(user1_auth, 0, '10.0.0.0', 16, length=24, name='prefix1', permissions={'write': ['group1']})
response = self._allocate_ip_address(user1_auth, 0, ip_prefix1['network'], ip_prefix1['length'], 'test1.my.zone')
self.assertEqual(response.status_code, 400)
data = json.loads(response.content)
self.assertIn('name', data)
self.assertIn('matching', data['name'][0])
def test_ip_address_allocate_no_zone_permission(self):
auth = self.create_common_objects()
user1_auth = self.create_user('user1', is_superuser=False, groups=['group1'])
ip_block = self.create_ip_block(auth, 0, '10.0.0.0', 16, 'block1', permissions={'create': ['group1']})
ip_prefix1 = self.allocate_ip_prefix(user1_auth, 0, '10.0.0.0', 16, length=24, name='prefix1', permissions={'write': ['group1']})
zone = self.create_zone(auth, 'my.zone', permissions={})
response = self._allocate_ip_address(user1_auth, 0, ip_prefix1['network'], ip_prefix1['length'], 'test1.my.zone')
self.assertEqual(response.status_code, 400)
data = json.loads(response.content)
self.assertIn('name', data)
self.assertIn('permission', data['name'][0])
def test_ip_address_allocate_duplicate_name(self):
auth = self.create_common_objects()
user1_auth = self.create_user('user1', is_superuser=False, groups=['group1'])
ip_block = self.create_ip_block(auth, 0, '10.0.0.0', 16, 'block1', permissions={'create': ['group1']})
ip_prefix1 = self.allocate_ip_prefix(user1_auth, 0, '10.0.0.0', 16, length=24, name='prefix1', permissions={'write': ['group1']})
zone = self.create_zone(auth, 'my.zone', permissions={'write': ['group1']})
ip1 = self.allocate_ip_address(user1_auth, 0, ip_prefix1['network'], ip_prefix1['length'], 'test1.my.zone')
response = self._allocate_ip_address(user1_auth, 0, ip_prefix1['network'], ip_prefix1['length'], 'test1.my.zone')
self.assertEqual(response.status_code, 400)
data = json.loads(response.content)
self.assertIn('name', data)
self.assertIn('already', data['name'][0])
def test_ip_address_create_no_prefix(self):
auth = self.create_common_objects()
ip_block = self.create_ip_block(auth, 0, '10.0.0.0', 16, 'block1', permissions={})
user1_auth = self.create_user('user1', is_superuser=False, groups=['group1'])
zone = self.create_zone(auth, 'my.zone', permissions={'create': ['group1']})
response = self.client.post(reverse('bonk:address_list'), data=json.dumps({
'vrf': 0,
'ip': '10.0.0.2',
'name': 'test1.my.zone',
'state': 'allocated',
}), content_type="application/json", HTTP_AUTHORIZATION=user1_auth)
self.assertEqual(response.status_code, 400)
data = json.loads(response.content)
self.assertIn('non_field_errors', data)
self.assertIn('no prefix found', data['non_field_errors'][0])
def test_ip_address_allocate_no_name(self):
auth = self.create_common_objects()
user1_auth = self.create_user('user1', is_superuser=False, groups=['group1'])
ip_block = self.create_ip_block(auth, 0, '10.0.0.0', 16, 'block1', permissions={'create': ['group1']})
zone = self.create_zone(auth, 'my.zone', permissions={'create': ['group1']})
ip_prefix1 = self.allocate_ip_prefix(user1_auth, 0, '10.0.0.0', 16, length=24, name='prefix1', permissions={'write': ['group1']})
response = self.client.post(reverse('bonk:prefix_allocate', kwargs={
'vrf': 0,
'network': ip_prefix1['network'],
'length': ip_prefix1['length']
}), data=json.dumps({
'vrf': 0,
'ip': '10.0.0.2',
'state': 'allocated',
}), content_type="application/json", HTTP_AUTHORIZATION=user1_auth)
self.assertEqual(response.status_code, 400)
data = json.loads(response.content)
self.assertIn('name', data[0])
def test_ip_address_allocate_exhaustive(self):
auth = self.create_common_objects()
user1_auth = self.create_user('user1', is_superuser=False, groups=['group1'])
ip_block = self.create_ip_block(auth, 0, '10.0.0.0', 16, 'block1', permissions={'create': ['group1']})
zone = self.create_zone(auth, 'my.zone', permissions={'write': ['group1']})
ip_prefix1 = self.allocate_ip_prefix(user1_auth, 0, '10.0.0.0', 16, length=28, name='prefix1', permissions={'write': ['group1']})
for i in range(0, 14):
self.allocate_ip_address(user1_auth, ip_prefix1['vrf'], ip_prefix1['network'], ip_prefix1['length'], "ip%d.my.zone" % i)
response = self._allocate_ip_address(user1_auth, ip_prefix1['vrf'], ip_prefix1['network'], ip_prefix1['length'], "ip-fail.my.zone")
self.assertEqual(response.status_code, 400)
self.assertIn(b'exhausted', response.content)
def test_ip_address_allocate_specific(self):
auth = self.create_common_objects()
user1_auth = self.create_user('user1', is_superuser=False, groups=['group1'])
ip_block = self.create_ip_block(auth, 0, '10.0.0.0', 16, 'block1', permissions={'create': ['group1']})
zone = self.create_zone(auth, 'my.zone', permissions={'write': ['group1']})
ip_prefix1 = self.allocate_ip_prefix(user1_auth, 0, '10.0.0.0', 16, length=24, name='prefix1', permissions={'write': ['group1']})
self.allocate_ip_address(user1_auth, ip_prefix1['vrf'], ip_prefix1['network'], ip_prefix1['length'], "ip2.my.zone", ip='10.0.0.2')
response = self._allocate_ip_address(user1_auth, ip_prefix1['vrf'], ip_prefix1['network'], ip_prefix1['length'], "ip2.my.zone", ip='10.0.0.2')
self.assertEqual(response.status_code, 400)
self.assertIn(b'already in use', response.content)
def test_ip_address_allocate_ttl(self):
auth = self.create_common_objects()
user1_auth = self.create_user('user1', is_superuser=False, groups=['group1'])
ip_block = self.create_ip_block(auth, 0, '10.0.0.0', 16, 'block1', permissions={'create': ['group1']})
zone = self.create_zone(auth, 'my.zone', permissions={'write': ['group1']})
ip_prefix1 = self.allocate_ip_prefix(user1_auth, 0, '10.0.0.0', 16, length=24, name='prefix1', permissions={'write': ['group1']})
response = self.client.post(reverse('bonk:prefix_allocate', kwargs={
'vrf': 0,
'network': ip_prefix1['network'],
'length': ip_prefix1['length']
}), data=json.dumps({
'vrf': 0,
'ip': '10.0.0.2',
'name': 'test1.my.zone',
'state': 'allocated',
'ttl': 300,
}), content_type="application/json", HTTP_AUTHORIZATION=user1_auth)
self.assertEqual(response.status_code, 201)
data = json.loads(response.content)
self.assertEqual(data['ttl'], 300)
def test_ip_address_detail(self):
auth = self.create_common_objects()
user1_auth = self.create_user('user1', is_superuser=False, groups=['group1'])
user2_auth = self.create_user('user2', is_superuser=False, groups=['group2'])
ip_block = self.create_ip_block(auth, 0, '10.0.0.0', 16, 'block1', permissions={'create': ['group1']})
ip_prefix1 = self.allocate_ip_prefix(user1_auth, 0, '10.0.0.0', 16, length=24, name='prefix1', permissions={'write': ['group1']})
zone = self.create_zone(auth, 'my.zone', permissions={'write': ['group1']})
ip1 = self.allocate_ip_address(user1_auth, 0, ip_prefix1['network'], ip_prefix1['length'], 'test1.my.zone')
for iter_auth, code in [(user2_auth, 403), (user1_auth, 200)]:
response = self.client.patch(reverse('bonk:address_detail', kwargs={
'vrf': ip1['vrf'],
'ip': ip1['ip'],
}), data=json.dumps({
'version': ip1['version'],
'dhcp_mac': ['de:ad:be:ef:00:01'],
}), content_type="application/json", HTTP_AUTHORIZATION=iter_auth)
self.assertEqual(response.status_code, code)
def test_dns_zones_list(self):
auth = self.create_common_objects()
user1_auth = self.create_user('user1', is_superuser=False, groups=['group1'])
user2_auth = self.create_user('user2', is_superuser=False, groups=['group2'])
zone1 = self.create_zone(auth, 'my1.zone', permissions={'write': ['group1']})
zone2 = self.create_zone(auth, 'my2.zone', permissions={'write': ['group2']})
zone3 = self.create_zone(auth, 'my3.zone', permissions={'write': ['group1', 'group2']})
response = self.client.get(reverse('bonk:zone_list'), HTTP_AUTHORIZATION=user1_auth)
self.assertEqual(response.status_code, 200)
data = json.loads(response.content)
self.assertEqual(len(data), 2)
self.assertEqual(set(map(lambda x: x['id'], data)), set([zone1['id'], zone3['id']]))
response = self.client.get(reverse('bonk:zone_list'), HTTP_AUTHORIZATION=user2_auth)
self.assertEqual(response.status_code, 200)
data = json.loads(response.content)
self.assertEqual(len(data), 2)
self.assertEqual(set(map(lambda x: x['id'], data)), set([zone2['id'], zone3['id']]))
def test_dns_zone_create_without_permission(self):
auth = self.create_common_objects()
user1_auth = self.create_user('user1', is_superuser=False, groups=['group1'])
response = self._create_zone(user1_auth, 'my1.zone', permissions={'write': ['group1']})
self.assertEqual(response.status_code, 400)
data = json.loads(response.content)
self.assertIn('non_field_errors', data)
self.assertIn('permission', data['non_field_errors'][0])
def test_dns_zone_create_with_permission(self):
auth = self.create_common_objects()
user1_auth = self.create_user('user1', is_superuser=False, groups=['group1'])
root_zone = self.create_zone(auth, 'zone', permissions={'create': ['group1']})
my_zone = self.create_zone(user1_auth, 'my1.zone', permissions={'write': ['group1']})
def test_dns_zone_rename_without_records(self):
auth = self.create_common_objects()
zone = self.create_zone(auth, 'my1.zone')
response = self.client.patch(
reverse('bonk:zone_detail', kwargs={'slug': zone['name']}),
data=json.dumps({
'name': 'my2.zone',
}),
content_type="application/json",
HTTP_AUTHORIZATION=auth
)
self.assertEqual(response.status_code, 200)
def test_dns_zone_rename_with_records(self):
auth = self.create_common_objects()
zone = self.create_zone(auth, 'my1.zone')
record_apex1 = self.create_record(auth, zone['name'], zone['name'], 'A', ['127.0.0.1'])
response = self.client.patch(
reverse('bonk:zone_detail', kwargs={'slug': zone['name']}),
data=json.dumps({
'name': 'my2.zone',
}),
content_type="application/json",
HTTP_AUTHORIZATION=auth
)
self.assertEqual(response.status_code, 400)
def test_dns_records_list(self):
auth = self.create_common_objects()
user1_auth = self.create_user('user1', is_superuser=False, groups=['group1'])
user2_auth = self.create_user('user2', is_superuser=False, groups=['group2'])
zone1 = self.create_zone(auth, 'my1.zone', permissions={'write': ['group1']})
zone2 = self.create_zone(auth, 'my2.zone', permissions={'write': ['group2']})
record_apex1 = self.create_record(user1_auth, 'my1.zone', 'my1.zone', 'A', ['127.0.0.1'])
record_www1 = self.create_record(user1_auth, 'www.my1.zone', 'my1.zone', 'A', ['127.0.0.1'])
record_apex2 = self.create_record(user2_auth, 'my2.zone', 'my2.zone', 'A', ['127.0.0.1'])
record_www2 = self.create_record(user2_auth, 'www.my2.zone', 'my2.zone', 'A', ['127.0.0.1'])
response = self.client.get(reverse('bonk:record_list'), HTTP_AUTHORIZATION=user1_auth)
self.assertEqual(response.status_code, 200)
data = json.loads(response.content)
self.assertEqual(len(data), 2)
self.assertEqual(set(map(lambda x: x['id'], data)), set([record_apex1['id'], record_www1['id']]))
response = self.client.get(reverse('bonk:record_list'), HTTP_AUTHORIZATION=user2_auth)
self.assertEqual(response.status_code, 200)
data = json.loads(response.content)
self.assertEqual(len(data), 2)
self.assertEqual(set(map(lambda x: x['id'], data)), set([record_apex2['id'], record_www2['id']]))
def test_dns_records_no_zone(self):
auth = self.create_common_objects()
user1_auth = self.create_user('user1', is_superuser=False, groups=['group1'])
response = self._create_record(user1_auth, 'my1.zone', 'my1.zone', 'A', ['127.0.0.1'])
self.assertEqual(response.status_code, 400)
data = json.loads(response.content)
self.assertIn('zone', data)
def test_dns_records_no_manager(self):
auth = self.create_common_objects()
user1_auth = self.create_user('user1', is_superuser=False, groups=['group1'])
user2_auth = self.create_user('user2', is_superuser=False, groups=['group2'])
zone1 = self.create_zone(auth, 'my1.zone', permissions={'write': ['group1']})
response = self._create_record(user2_auth, 'my1.zone', 'my1.zone', 'A', ['127.0.0.1'])
self.assertEqual(response.status_code, 400)
data = json.loads(response.content)
self.assertIn('zone', data)
def test_dns_records_name_not_in_zone(self):
auth = self.create_common_objects()
user1_auth = self.create_user('user1', is_superuser=False, groups=['group1'])
zone1 = self.create_zone(auth, 'my1.zone', permissions={'write': ['group1']})
response = self._create_record(user1_auth, 'my2.zone', 'my1.zone', 'A', ['127.0.0.1'])
self.assertEqual(response.status_code, 400)
data = json.loads(response.content)
self.assertIn('non_field_errors', data)
def test_dns_records_cname_for_existing(self):
auth = self.create_common_objects()
user1_auth = self.create_user('user1', is_superuser=False, groups=['group1'])
zone1 = self.create_zone(auth, 'my1.zone', permissions={'write': ['group1']})
self.create_record(user1_auth, 'service.my1.zone', 'my1.zone', 'A', ['127.0.0.1'])
response = self._create_record(user1_auth, 'service.my1.zone', 'my1.zone', 'CNAME', ['service2.my2.zone'])
self.assertEqual(response.status_code, 400)
data = json.loads(response.content)
self.assertIn('non_field_errors', data)
def test_dns_records_a_for_cname(self):
auth = self.create_common_objects()
user1_auth = self.create_user('user1', is_superuser=False, groups=['group1'])
zone1 = self.create_zone(auth, 'my1.zone', permissions={'write': ['group1']})
self.create_record(user1_auth, 'service.my1.zone', 'my1.zone', 'CNAME', ['service.my2.zone'])
response = self._create_record(user1_auth, 'service.my1.zone', 'my1.zone', 'A', ['127.0.0.1'])
self.assertEqual(response.status_code, 400)
data = json.loads(response.content)
self.assertIn('non_field_errors', data)
def test_dns_records_invalid_a(self):
auth = self.create_common_objects()
user1_auth = self.create_user('user1', is_superuser=False, groups=['group1'])
zone1 = self.create_zone(auth, 'my1.zone', permissions={'write': ['group1']})
response = self._create_record(user1_auth, 'service.my1.zone', 'my1.zone', 'A', ['service.my2.zone.'])
self.assertEqual(response.status_code, 400)
data = json.loads(response.content)
self.assertIn('non_field_errors', data)
def test_dns_records_aname(self):
auth = self.create_common_objects()
user1_auth = self.create_user('user1', is_superuser=False, groups=['group1'])
zone1 = self.create_zone(auth, 'my1.zone', permissions={'write': ['group1']})
self.create_record(user1_auth, 'service.my1.zone', 'my1.zone', 'ANAME', ['service.my2.zone'])
def test_dns_record_detail(self):
auth = self.create_common_objects()
user1_auth = self.create_user('user1', is_superuser=False, groups=['group1'])
zone1 = self.create_zone(auth, 'my1.zone', permissions={'write': ['group1']})
record = self.create_record(user1_auth, 'service.my1.zone', 'my1.zone', 'CNAME', ['service.my2.zone'])
response = self.client.patch(reverse('bonk:record_detail', kwargs={
'name': record['name'],
'type': record['type'],
}), data=json.dumps({
'version': record['version'],
'type': 'A',
'value': ['127.0.0.1'],
}), content_type="application/json", HTTP_AUTHORIZATION=user1_auth)
self.assertEqual(response.status_code, 200)
def test_dns_records_reviews(self):
auth = self.create_common_objects()
user1_auth = self.create_user('user1', is_superuser=False, groups=['group1'])
user2_auth = self.create_user('user2', is_superuser=False, groups=['group2'])
zone1 = self.create_zone(auth, 'my1.zone', permissions={'write': ['group1'], 'create': ['group2']}, needs_review=True)
response = self._create_record(user2_auth, 'www.my1.zone', 'my1.zone', 'A', ['127.0.0.1'], permissions={'write': ['group2']})
self.assertEqual(response.status_code, 202)
data = json.loads(response.content)
self.assertEqual(data[0], 'review created')
response = self.client.patch(reverse('django_rethink:review_detail', kwargs={'id': data[1]}), data=json.dumps({
'approvals': ['user1'],
}), content_type="application/json", HTTP_AUTHORIZATION=user1_auth)
self.assertEqual(response.status_code, 200)
response = self.client.patch(reverse('django_rethink:review_detail', kwargs={'id': data[1]}), data=json.dumps({
'state': 'executed',
}), content_type="application/json", HTTP_AUTHORIZATION=user1_auth)
self.assertEqual(response.status_code, 200)
response = self.client.get(reverse('bonk:record_list'), HTTP_AUTHORIZATION=user2_auth)
self.assertEqual(response.status_code, 200)
data = json.loads(response.content)
self.assertEqual(len(data), 1)
self.assertEqual(data[0]['name'], 'www.my1.zone')
def test_dhcp_server_set_list(self):
auth = self.create_common_objects()
user1_auth = self.create_user('user1', is_superuser=False, groups=['group1'])
response = self.client.post(reverse('bonk:dhcp_server_set_list'), data=json.dumps({
'name': 'dhcp-set-1',
'servers': ['10.0.0.2', '10.0.0.3'],
}), content_type="application/json", HTTP_AUTHORIZATION=auth)
self.assertEqual(response.status_code, 201)
response = self.client.get(reverse('bonk:dhcp_server_set_list'), HTTP_AUTHORIZATION=user1_auth)
self.assertEqual(response.status_code, 200)
data = json.loads(response.content)
self.assertEqual(len(data), 1)
response = self.client.get(reverse('bonk:dhcp_server_set_list'), HTTP_AUTHORIZATION=auth)
self.assertEqual(response.status_code, 200)
data = json.loads(response.content)
self.assertEqual(len(data), 1)
def test_dhcp_server_set_detail(self):
auth = self.create_common_objects()
user1_auth = self.create_user('user1', is_superuser=False, groups=['group1'])
response = self.client.post(reverse('bonk:dhcp_server_set_list'), data=json.dumps({
'name': 'dhcp-set-1',
'servers': ['10.0.0.2', '10.0.0.3'],
}), content_type="application/json", HTTP_AUTHORIZATION=auth)
self.assertEqual(response.status_code, 201)
response = self.client.get(reverse('bonk:dhcp_server_set_detail', kwargs={'slug': 'dhcp-set-1'}), HTTP_AUTHORIZATION=auth)
self.assertEqual(response.status_code, 200)
| 53.782723 | 150 | 0.64074 | 5,248 | 41,090 | 4.810785 | 0.055831 | 0.062978 | 0.047689 | 0.070068 | 0.86644 | 0.836377 | 0.814513 | 0.79253 | 0.771814 | 0.754268 | 0 | 0.043 | 0.201971 | 41,090 | 763 | 151 | 53.853211 | 0.726937 | 0.013434 | 0 | 0.641256 | 0 | 0 | 0.14584 | 0.004516 | 0 | 0 | 0 | 0 | 0.186846 | 1 | 0.092676 | false | 0.007474 | 0.020927 | 0.005979 | 0.134529 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6 |
fa1be6416ed633dc140dccc9ae9e76ea3bd49bb3 | 16,529 | py | Python | datasets.py | jklee-mit/maximal_correlation_weighting | 8d6ad762f69161c6ed6cddbb6ee2cccf36702662 | [
"MIT"
] | 4 | 2019-12-31T20:46:47.000Z | 2021-09-01T00:17:00.000Z | datasets.py | jklee-mit/maximal_correlation_weighting | 8d6ad762f69161c6ed6cddbb6ee2cccf36702662 | [
"MIT"
] | null | null | null | datasets.py | jklee-mit/maximal_correlation_weighting | 8d6ad762f69161c6ed6cddbb6ee2cccf36702662 | [
"MIT"
] | 3 | 2019-12-15T09:20:07.000Z | 2020-07-08T13:16:33.000Z | """
Datasets for testing
"""
import torch
import torchvision.transforms as transforms
import os
import numpy as np
import pickle
import random
from PIL import Image
dataset_path = os.path.join('datasets','cifar-10-batches-py')
class CifarBinaryDataset(torch.utils.data.Dataset):
"""Binary Cifar Dataset"""
def __init__(self, filepath, num_samps=None, train=True, transform=None, target_transform=None, offset = 0):
self.transform = transform
self.target_transform = target_transform
self.offset = offset
self.train = train # training set or test set
self.data = []
self.targets = []
self.num_samps = num_samps
# now load the picked numpy arrays
with open(filepath, 'rb') as f:
entry = pickle.load(f, encoding='latin1')
self.data.append(entry[0])
self.targets.extend(entry[1])
self.data = np.vstack(self.data).reshape(-1, 3, 32, 32)
self.data = self.data.transpose((0, 2, 3, 1)) # convert to HWC
self.true_len = self.data.shape[0]
def __getitem__(self, index):
"""
Args:
index (int): Index
Returns:
tuple: (image, target) where target is index of the target class.
"""
# if self.num_samps:
# img, target = self.data[index*(self.true_len//self.num_samps)], self.targets[index*(self.true_len//self.num_samps)]
# else:
img, target = self.data[index + self.offset], self.targets[index + self.offset]
# doing this so that it is consistent with all other datasets
# to return a PIL Image
img = Image.fromarray(img)
if self.transform is not None:
img = self.transform(img)
if self.target_transform is not None:
target = self.target_transform(target)
return img, target
def __len__(self):
return self.num_samps if self.num_samps else self.true_len
class DogsBinaryDataset(torch.utils.data.Dataset):
"""Binary Cifar Dataset"""
def __init__(self, folder_base, num_samps=10, classes = [0,1], train=True, transform=None, target_transform=None, offset = 0):
self.transform = transform
self.target_transform = target_transform
self.train = train # training set or test set
self.offset = offset
self.data = []
self.targets = []
self.num_samps = num_samps #num_samples per class
self.classes = classes
# Load images
folders = sorted(os.listdir(folder_base))
for i in range(len(self.classes)):
folderpath = os.path.join(folder_base,folders[i])
image_list = sorted(os.listdir(folderpath))
for j in range(num_samps):
if self.train:
im = Image.open(os.path.join(folderpath,image_list[j+offset]))
else:
im = Image.open(os.path.join(folderpath,image_list[-j-offset]))
im = im.resize((144,144))
self.data.append(im)
self.targets.append(i)
def __getitem__(self, index):
"""
Args:
index (int): Index
Returns:
tuple: (image, target) where target is index of the target class.
"""
img, target = self.data[index], self.targets[index]
if self.transform is not None:
img = self.transform(img)
if self.target_transform is not None:
target = self.target_transform(target)
return img, target
def __len__(self):
return self.num_samps * len(self.classes)
class ImageNetBinaryDataset(torch.utils.data.Dataset):
"""Binary Cifar Dataset"""
def __init__(self, folder_base, num_samps=10, classes = [0,1], mode="train", transform=None, target_transform=None, offset=0):
self.transform = transform
self.target_transform = target_transform
self.mode = mode # training set or test set
self.offset = offset
self.data = []
self.targets = []
self.num_samps = num_samps #num_samples per class
self.classes = classes
# Load images
for i in range(len(self.classes)):
folderpath = os.path.join(folder_base,'train',self.classes[i],"images")
image_list = sorted(os.listdir(folderpath))
counter=0
j=0
while counter < num_samps:
if self.mode == "train":
im = Image.open(os.path.join(folderpath,image_list[j + offset]))
else:
im = Image.open(os.path.join(folderpath,image_list[-j - offset]))
if im.mode == "RGB":
counter+=1
im = im.resize((64,64))
self.data.append(im)
self.targets.append(i)
j+=1
def __getitem__(self, index):
"""
Args:
index (int): Index
Returns:
tuple: (image, target) where target is index of the target class.
"""
img, target = self.data[index], self.targets[index]
if self.transform is not None:
img = self.transform(img)
if self.target_transform is not None:
target = self.target_transform(target)
return img, target
def __len__(self):
return self.num_samps * len(self.classes)
transform = transforms.Compose(
[transforms.ToTensor(),
transforms.Normalize((0.5, 0.5, 0.5), (0.5, 0.5, 0.5))])
def generate_dataset(mode, num_source_samps, num_target_samps):
if mode == "cifar":
#Cifar100
#num_train_samps = 500 is the recommended number
cf100_folder = os.path.join('datasets','cifar-100-python')
#Get target set
trainset_target = CifarBinaryDataset(filepath=os.path.join(cf100_folder,'data_batch_0_1.p'), num_samps=num_target_samps, train=False,
transform=transform, offset = random.randint(0,100))
trainloader_target = torch.utils.data.DataLoader(trainset_target, batch_size=len(trainset_target),
shuffle=False, num_workers=0)
testset = CifarBinaryDataset(filepath=os.path.join(cf100_folder,'test_batch_0_1.p'), train=False,
transform=transform)
testloader = torch.utils.data.DataLoader(testset, batch_size=len(testset),
shuffle=False, num_workers=0)
#compile source datasets
trainset_source = []
trainset_source.append(CifarBinaryDataset(filepath=os.path.join(cf100_folder,'data_batch_5_6.p'),num_samps=num_source_samps, train=False,
transform=transform))
trainset_source.append(CifarBinaryDataset(filepath=os.path.join(cf100_folder,'data_batch_10_11.p'),num_samps=num_source_samps, train=False,
transform=transform))
trainset_source.append(CifarBinaryDataset(filepath=os.path.join(cf100_folder,'data_batch_15_16.p'),num_samps=num_source_samps, train=False,
transform=transform))
trainset_source.append(CifarBinaryDataset(filepath=os.path.join(cf100_folder,'data_batch_20_21.p'),num_samps=num_source_samps, train=False,
transform=transform))
trainset_source.append(CifarBinaryDataset(filepath=os.path.join(cf100_folder,'data_batch_25_26.p'),num_samps=num_source_samps, train=False,
transform=transform))
trainset_source.append(CifarBinaryDataset(filepath=os.path.join(cf100_folder,'data_batch_30_31.p'),num_samps=num_source_samps, train=False,
transform=transform))
trainset_source.append(CifarBinaryDataset(filepath=os.path.join(cf100_folder,'data_batch_35_36.p'),num_samps=num_source_samps, train=False,
transform=transform))
trainset_source.append(CifarBinaryDataset(filepath=os.path.join(cf100_folder,'data_batch_40_41.p'),num_samps=num_source_samps, train=False,
transform=transform))
trainset_source.append(CifarBinaryDataset(filepath=os.path.join(cf100_folder,'data_batch_45_46.p'),num_samps=num_source_samps, train=False,
transform=transform))
trainset_source.append(CifarBinaryDataset(filepath=os.path.join(cf100_folder,'data_batch_50_51.p'),num_samps=num_source_samps, train=False,
transform=transform))
# trainset_source.append(CifarBinaryDataset(filepath=os.path.join(cf100_folder,'data_batch_55_56.p'),num_samps=num_source_samps, train=False,
# transform=transform))
trainloader_source = []
for i in range(len(trainset_source)):
trainloader_source.append(torch.utils.data.DataLoader(trainset_source[i], batch_size=len(trainset_source[i])//100,
shuffle=True, num_workers=0))
return trainloader_source, trainloader_target, testloader
elif mode == "dogs":
#Dogs
#num_samps=50 is the recommended number
#Get target set
trainset_target = DogsBinaryDataset(folder_base=os.path.join("datasets","dogs","Images"),num_samps=num_target_samps, classes=[51,9,10,11,12], train=True,
transform=transform, offset=random.randint(0,60))
trainloader_target = torch.utils.data.DataLoader(trainset_target, batch_size=len(trainset_target),
shuffle=False, num_workers=0)
testset = DogsBinaryDataset(folder_base=os.path.join("datasets","dogs","Images"),num_samps=100, classes=[51,9,10,11,12], train=False,
transform=transform)
testloader = torch.utils.data.DataLoader(testset, batch_size=len(testset),
shuffle=False, num_workers=0)
#compile source datasets
trainset_source = []
trainset_source.append(DogsBinaryDataset(folder_base=os.path.join("datasets","dogs","Images"),num_samps=num_source_samps, classes=[0,1,2,3,4], train=True,
transform=transform))
trainset_source.append(DogsBinaryDataset(folder_base=os.path.join("datasets","dogs","Images"),num_samps=num_source_samps, classes=[70,75,76,77,78], train=True,
transform=transform))
trainset_source.append(DogsBinaryDataset(folder_base=os.path.join("datasets","dogs","Images"),num_samps=num_source_samps, classes=[32,33,41,54,60], train=True,
transform=transform))
trainset_source.append(DogsBinaryDataset(folder_base=os.path.join("datasets","dogs","Images"),num_samps=num_source_samps, classes=[73,17,18,19,20], train=True,
transform=transform))
trainset_source.append(DogsBinaryDataset(folder_base=os.path.join("datasets","dogs","Images"),num_samps=num_source_samps, classes=[14,21,29,23,24], train=True,
transform=transform))
trainloader_source = []
for i in range(len(trainset_source)):
trainloader_source.append(torch.utils.data.DataLoader(trainset_source[i], batch_size=len(trainset_source[i])//100,
shuffle=True, num_workers=0))
return trainloader_source, trainloader_target, testloader
elif mode == "tiny_imagenet":
#TinyImageNet
#num_samps=250 is the recommended number
#Get target set
trainset_target = ImageNetBinaryDataset(folder_base=os.path.join("datasets","tiny-imagenet-200"),num_samps=num_target_samps, classes=['n02814860', 'n04099969', 'n02788148', 'n01910747', 'n02999410'], mode="train",
transform=transform)
trainloader_target = torch.utils.data.DataLoader(trainset_target, batch_size=len(trainset_target),
shuffle=False, num_workers=0)
testset = ImageNetBinaryDataset(folder_base=os.path.join("datasets","tiny-imagenet-200"),num_samps=250, classes=['n02814860', 'n04099969', 'n02788148', 'n01910747', 'n02999410'], mode="test",
transform=transform)
testloader = torch.utils.data.DataLoader(testset, batch_size=len(testset),
shuffle=False, num_workers=0)
#compile source datasets
trainset_source = []
trainset_source.append(ImageNetBinaryDataset(folder_base=os.path.join("datasets","tiny-imagenet-200"),num_samps=num_source_samps, classes=['n01983481', 'n02165456', 'n02699494', 'n07871810', 'n04275548'], mode="train",
transform=transform))
trainset_source.append(ImageNetBinaryDataset(folder_base=os.path.join("datasets","tiny-imagenet-200"),num_samps=num_source_samps, classes=['n03617480', 'n04366367', 'n02841315', 'n09193705', 'n03026506'], mode="train",
transform=transform))
trainset_source.append(ImageNetBinaryDataset(folder_base=os.path.join("datasets","tiny-imagenet-200"),num_samps=num_source_samps, classes=['n02669723', 'n07768694', 'n03814639', 'n07749582', 'n03649909'], mode="train",
transform=transform))
trainset_source.append(ImageNetBinaryDataset(folder_base=os.path.join("datasets","tiny-imagenet-200"),num_samps=num_source_samps, classes=['n04074963', 'n02099712', 'n03444034', 'n02410509', 'n03977966'], mode="train",
transform=transform))
trainset_source.append(ImageNetBinaryDataset(folder_base=os.path.join("datasets","tiny-imagenet-200"),num_samps=num_source_samps, classes=['n03970156', 'n07695742', 'n02909870', 'n02226429', 'n04070727'], mode="train",
transform=transform))
trainset_source.append(ImageNetBinaryDataset(folder_base=os.path.join("datasets","tiny-imagenet-200"),num_samps=num_source_samps, classes=['n02123394', 'n01774750', 'n02395406', 'n02279972', 'n04486054'], mode="train",
transform=transform))
trainset_source.append(ImageNetBinaryDataset(folder_base=os.path.join("datasets","tiny-imagenet-200"),num_samps=num_source_samps, classes=['n02364673', 'n03976657', 'n04259630', 'n06596364', 'n02129165'], mode="train",
transform=transform))
trainset_source.append(ImageNetBinaryDataset(folder_base=os.path.join("datasets","tiny-imagenet-200"),num_samps=num_source_samps, classes=['n02281406', 'n04596742', 'n04398044', 'n02099601', 'n02769748'], mode="train",
transform=transform))
trainset_source.append(ImageNetBinaryDataset(folder_base=os.path.join("datasets","tiny-imagenet-200"),num_samps=num_source_samps, classes=['n09428293', 'n02892201', 'n02002724', 'n02123045', 'n03544143'], mode="train",
transform=transform))
trainset_source.append(ImageNetBinaryDataset(folder_base=os.path.join("datasets","tiny-imagenet-200"),num_samps=num_source_samps, classes=['n01443537', 'n03670208', 'n01984695', 'n03179701', 'n01629819'], mode="train",
transform=transform))
trainloader_source = []
for i in range(len(trainset_source)):
trainloader_source.append(torch.utils.data.DataLoader(trainset_source[i], batch_size=len(trainset_source[i])//100,
shuffle=True, num_workers=0))
return trainloader_source, trainloader_target, testloader
else:
raise Exception('Invalid dataset type') | 54.01634 | 226 | 0.603908 | 1,814 | 16,529 | 5.316428 | 0.139471 | 0.042306 | 0.041477 | 0.045832 | 0.822377 | 0.808275 | 0.786603 | 0.760473 | 0.753422 | 0.729054 | 0 | 0.064661 | 0.284228 | 16,529 | 306 | 227 | 54.01634 | 0.750486 | 0.079981 | 0 | 0.59901 | 0 | 0 | 0.090564 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.049505 | false | 0 | 0.034653 | 0.014851 | 0.143564 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6 |
d7345ddbe44f9b76239f1e27199546a4a4162914 | 39 | py | Python | GiTils/__init__.py | gieseladev/GiTils | 88b2a0c3c808435c2df2f74ed354320e2fae5125 | [
"MIT"
] | 1 | 2018-04-13T15:59:04.000Z | 2018-04-13T15:59:04.000Z | GiTils/__init__.py | GieselaDev/GiTils | 88b2a0c3c808435c2df2f74ed354320e2fae5125 | [
"MIT"
] | 2 | 2018-05-04T10:52:18.000Z | 2018-07-30T15:05:10.000Z | GiTils/__init__.py | GieselaDev/GiTils | 88b2a0c3c808435c2df2f74ed354320e2fae5125 | [
"MIT"
] | null | null | null | # flake8: noqa
from .gitils import app
| 13 | 23 | 0.74359 | 6 | 39 | 4.833333 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.03125 | 0.179487 | 39 | 2 | 24 | 19.5 | 0.875 | 0.307692 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 6 |
d734906469c4619a1f23e5483d0f2ede753fcd60 | 27 | py | Python | packages/WelcomeScreen/__init__.py | lihaochen910/Candy | d12cb964768459c22f30c22531d3e1734901e814 | [
"MIT"
] | 1 | 2021-11-06T14:38:37.000Z | 2021-11-06T14:38:37.000Z | packages/WelcomeScreen/__init__.py | lihaochen910/Candy | d12cb964768459c22f30c22531d3e1734901e814 | [
"MIT"
] | 5 | 2021-11-06T04:23:06.000Z | 2022-03-12T01:03:25.000Z | packages/WelcomeScreen/__init__.py | lihaochen910/Candy | d12cb964768459c22f30c22531d3e1734901e814 | [
"MIT"
] | 1 | 2021-11-07T05:19:51.000Z | 2021-11-07T05:19:51.000Z | from . import WelcomeScreen | 27 | 27 | 0.851852 | 3 | 27 | 7.666667 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.111111 | 27 | 1 | 27 | 27 | 0.958333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 6 |
d76efe0fead2278df78b07e7fe007a8678933642 | 18,529 | py | Python | test/test_core/test_split_bytes.py | abravalheri/linesep | 1898267e6c6827364e21c37d2d88f483f1140c92 | [
"MIT"
] | null | null | null | test/test_core/test_split_bytes.py | abravalheri/linesep | 1898267e6c6827364e21c37d2d88f483f1140c92 | [
"MIT"
] | 1 | 2022-03-06T03:15:41.000Z | 2022-03-06T03:15:41.000Z | test/test_core/test_split_bytes.py | abravalheri/linesep | 1898267e6c6827364e21c37d2d88f483f1140c92 | [
"MIT"
] | 2 | 2017-01-20T19:39:23.000Z | 2022-03-06T02:19:07.000Z | from io import BytesIO
import re
import linesep
scenarios = [
(
"empty",
{
"text": b"",
"sep": b"\n",
"preceded": [],
"terminated": [],
"separated": [b""],
"preceded_retained": [],
"terminated_retained": [],
"separated_retained": [b""],
},
),
(
"no_sep",
{
"text": b"foo",
"sep": b"\n",
"preceded": [b"foo"],
"terminated": [b"foo"],
"separated": [b"foo"],
"preceded_retained": [b"foo"],
"terminated_retained": [b"foo"],
"separated_retained": [b"foo"],
},
),
(
"one_sep",
{
"text": b"\n",
"sep": b"\n",
"preceded": [b""],
"terminated": [b""],
"separated": [b"", b""],
"preceded_retained": [b"\n"],
"terminated_retained": [b"\n"],
"separated_retained": [b"", b"\n", b""],
},
),
(
"two_seps",
{
"text": b"\n\n",
"sep": b"\n",
"preceded": [b"", b""],
"terminated": [b"", b""],
"separated": [b"", b"", b""],
"preceded_retained": [b"\n", b"\n"],
"terminated_retained": [b"\n", b"\n"],
"separated_retained": [b"", b"\n", b"", b"\n", b""],
},
),
(
"text_sep",
{
"text": b"foo\n",
"sep": b"\n",
"preceded": [b"foo", b""],
"preceded_retained": [b"foo", b"\n"],
"separated": [b"foo", b""],
"separated_retained": [b"foo", b"\n", b""],
"terminated": [b"foo"],
"terminated_retained": [b"foo\n"],
},
),
(
"sep_text",
{
"text": b"\nfoo",
"sep": b"\n",
"preceded": [b"foo"],
"preceded_retained": [b"\nfoo"],
"separated": [b"", b"foo"],
"separated_retained": [b"", b"\n", b"foo"],
"terminated": [b"", b"foo"],
"terminated_retained": [b"\n", b"foo"],
},
),
(
"text_sep_text",
{
"text": b"foo\nbar",
"sep": b"\n",
"preceded": [b"foo", b"bar"],
"preceded_retained": [b"foo", b"\nbar"],
"separated": [b"foo", b"bar"],
"separated_retained": [b"foo", b"\n", b"bar"],
"terminated": [b"foo", b"bar"],
"terminated_retained": [b"foo\n", b"bar"],
},
),
(
"sep_text_sep",
{
"text": b"\nfoo\n",
"sep": b"\n",
"preceded": [b"foo", b""],
"preceded_retained": [b"\nfoo", b"\n"],
"separated": [b"", b"foo", b""],
"separated_retained": [b"", b"\n", b"foo", b"\n", b""],
"terminated": [b"", b"foo"],
"terminated_retained": [b"\n", b"foo\n"],
},
),
(
"sep_sep_text",
{
"text": b"\n\nfoo",
"sep": b"\n",
"preceded": [b"", b"foo"],
"preceded_retained": [b"\n", b"\nfoo"],
"separated": [b"", b"", b"foo"],
"separated_retained": [b"", b"\n", b"", b"\n", b"foo"],
"terminated": [b"", b"", b"foo"],
"terminated_retained": [b"\n", b"\n", b"foo"],
},
),
(
"text_sep_sep",
{
"text": b"foo\n\n",
"sep": b"\n",
"preceded": [b"foo", b"", b""],
"preceded_retained": [b"foo", b"\n", b"\n"],
"separated": [b"foo", b"", b""],
"separated_retained": [b"foo", b"\n", b"", b"\n", b""],
"terminated": [b"foo", b""],
"terminated_retained": [b"foo\n", b"\n"],
},
),
(
"regex01",
{
"text": b"abca|bc",
"sep": re.compile(br"a|b"),
"preceded": [b"", b"c", b"|", b"c"],
"preceded_retained": [b"a", b"bc", b"a|", b"bc"],
"separated": [b"", b"", b"c", b"|", b"c"],
"separated_retained": [b"", b"a", b"", b"b", b"c", b"a", b"|", b"b", b"c"],
"terminated": [b"", b"", b"c", b"|", b"c"],
"terminated_retained": [b"a", b"b", b"ca", b"|b", b"c"],
},
),
(
"regex_literal",
{
"text": b"abca|bc",
"sep": b"a|b",
"preceded": [b"abc", b"c"],
"preceded_retained": [b"abc", b"a|bc"],
"separated": [b"abc", b"c"],
"separated_retained": [b"abc", b"a|b", b"c"],
"terminated": [b"abc", b"c"],
"terminated_retained": [b"abca|b", b"c"],
},
),
(
"regex_groups",
{
"text": b"abca|bc",
"sep": re.compile(br"(a)|(b)"),
"preceded": [b"", b"c", b"|", b"c"],
"preceded_retained": [b"a", b"bc", b"a|", b"bc"],
"separated": [b"", b"", b"c", b"|", b"c"],
"separated_retained": [b"", b"a", b"", b"b", b"c", b"a", b"|", b"b", b"c"],
"terminated": [b"", b"", b"c", b"|", b"c"],
"terminated_retained": [b"a", b"b", b"ca", b"|b", b"c"],
},
),
(
"straddling_delim",
{
"text": b"This test is intended to test splitting when the separator"
b" is a multicharacter delimiter that straddles the boundary"
b" between the 512-character chunks that the `read_*`"
b" functions divide their input into. Unfortunately, I'm"
b" already bored of writing this test, and I still have 237"
b" characters left to go. Lorem ipsum dolor sit amet,"
b" consectetur adipisicing elit, sed do eiusmod tempor"
b" incididunt ut labore et dolore magna aliqua. Ut enim ad"
b" minim veniam, quis nostrud exercitation ullamco Here it"
b" comes ---> |\r\n| <--- There should be a split right"
b" there; is there?",
"sep": b"\r\n",
"preceded": [
b"This test is intended to test splitting when the separator is a"
b" multicharacter delimiter that straddles the boundary between"
b" the 512-character chunks that the `read_*` functions divide"
b" their input into. Unfortunately, I'm already bored of writing"
b" this test, and I still have 237 characters left to go. Lorem"
b" ipsum dolor sit amet, consectetur adipisicing elit, sed do"
b" eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut"
b" enim ad minim veniam, quis nostrud exercitation ullamco Here it"
b" comes ---> |",
b"| <--- There should be a split right there; is there?",
],
"preceded_retained": [
b"This test is intended to test splitting when the separator is a"
b" multicharacter delimiter that straddles the boundary between"
b" the 512-character chunks that the `read_*` functions divide"
b" their input into. Unfortunately, I'm already bored of writing"
b" this test, and I still have 237 characters left to go. Lorem"
b" ipsum dolor sit amet, consectetur adipisicing elit, sed do"
b" eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut"
b" enim ad minim veniam, quis nostrud exercitation ullamco Here it"
b" comes ---> |",
b"\r\n| <--- There should be a split right there; is there?",
],
"separated": [
b"This test is intended to test splitting when the separator is a"
b" multicharacter delimiter that straddles the boundary between"
b" the 512-character chunks that the `read_*` functions divide"
b" their input into. Unfortunately, I'm already bored of writing"
b" this test, and I still have 237 characters left to go. Lorem"
b" ipsum dolor sit amet, consectetur adipisicing elit, sed do"
b" eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut"
b" enim ad minim veniam, quis nostrud exercitation ullamco Here it"
b" comes ---> |",
b"| <--- There should be a split right there; is there?",
],
"separated_retained": [
b"This test is intended to test splitting when the separator is a"
b" multicharacter delimiter that straddles the boundary between"
b" the 512-character chunks that the `read_*` functions divide"
b" their input into. Unfortunately, I'm already bored of writing"
b" this test, and I still have 237 characters left to go. Lorem"
b" ipsum dolor sit amet, consectetur adipisicing elit, sed do"
b" eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut"
b" enim ad minim veniam, quis nostrud exercitation ullamco Here it"
b" comes ---> |",
b"\r\n",
b"| <--- There should be a split right there; is there?",
],
"terminated": [
b"This test is intended to test splitting when the separator is a"
b" multicharacter delimiter that straddles the boundary between"
b" the 512-character chunks that the `read_*` functions divide"
b" their input into. Unfortunately, I'm already bored of writing"
b" this test, and I still have 237 characters left to go. Lorem"
b" ipsum dolor sit amet, consectetur adipisicing elit, sed do"
b" eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut"
b" enim ad minim veniam, quis nostrud exercitation ullamco Here it"
b" comes ---> |",
b"| <--- There should be a split right there; is there?",
],
"terminated_retained": [
b"This test is intended to test splitting when the separator is a"
b" multicharacter delimiter that straddles the boundary between"
b" the 512-character chunks that the `read_*` functions divide"
b" their input into. Unfortunately, I'm already bored of writing"
b" this test, and I still have 237 characters left to go. Lorem"
b" ipsum dolor sit amet, consectetur adipisicing elit, sed do"
b" eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut"
b" enim ad minim veniam, quis nostrud exercitation ullamco Here it"
b" comes ---> |\r\n",
b"| <--- There should be a split right there; is there?",
],
},
),
(
"big_entry",
{
"text": b"This test is intended to test splitting when a single entry"
b" is longer than the 512-character chunk size. Lorem ipsum"
b" dolor sit amet, consectetur adipisicing elit, sed do"
b" eiusmod tempor incididunt ut labore et dolore magna aliqua."
b" Ut enim ad minim veniam, quis nostrud exercitation ullamco"
b" laboris nisi ut aliquip ex ea commodo consequat. Duis aute"
b" irure dolor in reprehenderit in voluptate velit esse cillum"
b" dolore eu fugiat nulla pariatur. Excepteur sint occaecat"
b" cupidatat non proident, sunt in culpa qui officia|\r\n|"
b" deserunt mollit anim id est laborum.",
"sep": b"\r\n",
"preceded": [
b"This test is intended to test splitting when a single entry is"
b" longer than the 512-character chunk size. Lorem ipsum dolor"
b" sit amet, consectetur adipisicing elit, sed do eiusmod tempor"
b" incididunt ut labore et dolore magna aliqua. Ut enim ad minim"
b" veniam, quis nostrud exercitation ullamco laboris nisi ut"
b" aliquip ex ea commodo consequat. Duis aute irure dolor in"
b" reprehenderit in voluptate velit esse cillum dolore eu fugiat"
b" nulla pariatur. Excepteur sint occaecat cupidatat non"
b" proident, sunt in culpa qui officia|",
b"| deserunt mollit anim id est laborum.",
],
"preceded_retained": [
b"This test is intended to test splitting when a single entry is"
b" longer than the 512-character chunk size. Lorem ipsum dolor"
b" sit amet, consectetur adipisicing elit, sed do eiusmod tempor"
b" incididunt ut labore et dolore magna aliqua. Ut enim ad minim"
b" veniam, quis nostrud exercitation ullamco laboris nisi ut"
b" aliquip ex ea commodo consequat. Duis aute irure dolor in"
b" reprehenderit in voluptate velit esse cillum dolore eu fugiat"
b" nulla pariatur. Excepteur sint occaecat cupidatat non"
b" proident, sunt in culpa qui officia|",
b"\r\n| deserunt mollit anim id est laborum.",
],
"separated": [
b"This test is intended to test splitting when a single entry is"
b" longer than the 512-character chunk size. Lorem ipsum dolor"
b" sit amet, consectetur adipisicing elit, sed do eiusmod tempor"
b" incididunt ut labore et dolore magna aliqua. Ut enim ad minim"
b" veniam, quis nostrud exercitation ullamco laboris nisi ut"
b" aliquip ex ea commodo consequat. Duis aute irure dolor in"
b" reprehenderit in voluptate velit esse cillum dolore eu fugiat"
b" nulla pariatur. Excepteur sint occaecat cupidatat non"
b" proident, sunt in culpa qui officia|",
b"| deserunt mollit anim id est laborum.",
],
"separated_retained": [
b"This test is intended to test splitting when a single entry is"
b" longer than the 512-character chunk size. Lorem ipsum dolor"
b" sit amet, consectetur adipisicing elit, sed do eiusmod tempor"
b" incididunt ut labore et dolore magna aliqua. Ut enim ad minim"
b" veniam, quis nostrud exercitation ullamco laboris nisi ut"
b" aliquip ex ea commodo consequat. Duis aute irure dolor in"
b" reprehenderit in voluptate velit esse cillum dolore eu fugiat"
b" nulla pariatur. Excepteur sint occaecat cupidatat non"
b" proident, sunt in culpa qui officia|",
b"\r\n",
b"| deserunt mollit anim id est laborum.",
],
"terminated": [
b"This test is intended to test splitting when a single entry is"
b" longer than the 512-character chunk size. Lorem ipsum dolor"
b" sit amet, consectetur adipisicing elit, sed do eiusmod tempor"
b" incididunt ut labore et dolore magna aliqua. Ut enim ad minim"
b" veniam, quis nostrud exercitation ullamco laboris nisi ut"
b" aliquip ex ea commodo consequat. Duis aute irure dolor in"
b" reprehenderit in voluptate velit esse cillum dolore eu fugiat"
b" nulla pariatur. Excepteur sint occaecat cupidatat non"
b" proident, sunt in culpa qui officia|",
b"| deserunt mollit anim id est laborum.",
],
"terminated_retained": [
b"This test is intended to test splitting when a single entry is"
b" longer than the 512-character chunk size. Lorem ipsum dolor"
b" sit amet, consectetur adipisicing elit, sed do eiusmod tempor"
b" incididunt ut labore et dolore magna aliqua. Ut enim ad minim"
b" veniam, quis nostrud exercitation ullamco laboris nisi ut"
b" aliquip ex ea commodo consequat. Duis aute irure dolor in"
b" reprehenderit in voluptate velit esse cillum dolore eu fugiat"
b" nulla pariatur. Excepteur sint occaecat cupidatat non"
b" proident, sunt in culpa qui officia|\r\n",
b"| deserunt mollit anim id est laborum.",
],
},
),
]
def test_split_preceded(text, sep, preceded):
assert linesep.split_preceded(text, sep, retain=False) == preceded
def test_split_terminated(text, sep, terminated):
assert linesep.split_terminated(text, sep, retain=False) == terminated
def test_split_separated(text, sep, separated):
assert linesep.split_separated(text, sep, retain=False) == separated
def test_split_preceded_retained(text, sep, preceded_retained):
assert linesep.split_preceded(text, sep, retain=True) == preceded_retained
def test_split_terminated_retained(text, sep, terminated_retained):
assert linesep.split_terminated(text, sep, retain=True) == terminated_retained
def test_split_separated_retained(text, sep, separated_retained):
assert linesep.split_separated(text, sep, retain=True) == separated_retained
def test_read_preceded(text, sep, preceded):
assert list(linesep.read_preceded(BytesIO(text), sep, retain=False)) == preceded
def test_read_terminated(text, sep, terminated):
assert list(linesep.read_terminated(BytesIO(text), sep, retain=False)) == terminated
def test_read_separated(text, sep, separated):
assert list(linesep.read_separated(BytesIO(text), sep, retain=False)) == separated
def test_read_preceded_retained(text, sep, preceded_retained):
assert (
list(linesep.read_preceded(BytesIO(text), sep, retain=True))
== preceded_retained
)
def test_read_terminated_retained(text, sep, terminated_retained):
assert (
list(linesep.read_terminated(BytesIO(text), sep, retain=True))
== terminated_retained
)
def test_read_separated_retained(text, sep, separated_retained):
assert (
list(linesep.read_separated(BytesIO(text), sep, retain=True))
== separated_retained
)
| 44.973301 | 88 | 0.533812 | 2,235 | 18,529 | 4.37047 | 0.072036 | 0.013104 | 0.006143 | 0.015766 | 0.929566 | 0.88319 | 0.834152 | 0.748976 | 0.713554 | 0.667076 | 0 | 0.00536 | 0.345458 | 18,529 | 411 | 89 | 45.082725 | 0.800049 | 0 | 0 | 0.505181 | 0 | 0 | 0.527443 | 0 | 0 | 0 | 0 | 0 | 0.031088 | 1 | 0.031088 | false | 0 | 0.007772 | 0 | 0.03886 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6 |
d7844b92e5e19bfeedce3b874ebf68fb44d26f73 | 27 | py | Python | n2kparser/__init__.py | iotfablab/n2kparser | 0453398034da5a11756d72f1b3c4459a13a5b39c | [
"MIT"
] | 6 | 2019-09-24T15:40:45.000Z | 2022-02-19T19:25:53.000Z | n2kparser/__init__.py | iotfablab/n2kparser | 0453398034da5a11756d72f1b3c4459a13a5b39c | [
"MIT"
] | 1 | 2020-03-03T12:41:57.000Z | 2020-03-03T16:45:39.000Z | n2kparser/__init__.py | iotfablab/n2kparser | 0453398034da5a11756d72f1b3c4459a13a5b39c | [
"MIT"
] | 1 | 2021-08-30T08:03:34.000Z | 2021-08-30T08:03:34.000Z | from .n2kparser import main | 27 | 27 | 0.851852 | 4 | 27 | 5.75 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.041667 | 0.111111 | 27 | 1 | 27 | 27 | 0.916667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 6 |
ad1f2af9fbd1299945aed234e9920a0b4d038107 | 2,875 | py | Python | test/test_unit_connection.py | fhoehle/snowflake-connector-python | f4fe2277b82d98f2122478d5df712c59420ea0bd | [
"Apache-2.0"
] | 1 | 2021-02-05T03:55:35.000Z | 2021-02-05T03:55:35.000Z | test/test_unit_connection.py | fhoehle/snowflake-connector-python | f4fe2277b82d98f2122478d5df712c59420ea0bd | [
"Apache-2.0"
] | null | null | null | test/test_unit_connection.py | fhoehle/snowflake-connector-python | f4fe2277b82d98f2122478d5df712c59420ea0bd | [
"Apache-2.0"
] | 1 | 2021-02-09T17:52:35.000Z | 2021-02-09T17:52:35.000Z | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2012-2019 Snowflake Computing Inc. All right reserved.
#
import pytest
from mock import patch
import snowflake.connector
@patch(
'snowflake.connector.network.SnowflakeRestful._post_request'
)
def test_connect_with_service_name(mockSnowflakeRestfulPostRequest):
def mock_post_request(url, headers, json_body, **kwargs):
global mock_cnt
ret = None
if mock_cnt == 0:
# return from /v1/login-request
ret = {
'success': True,
'message': None,
'data': {
'token': 'TOKEN',
'masterToken': 'MASTER_TOKEN',
'idToken': None,
'parameters': [
{'name': 'SERVICE_NAME', 'value': "FAKE_SERVICE_NAME"}
],
}}
return ret
# POST requests mock
mockSnowflakeRestfulPostRequest.side_effect = mock_post_request
global mock_cnt
mock_cnt = 0
account = 'testaccount'
user = 'testuser'
# connection
con = snowflake.connector.connect(
account=account,
user=user,
password='testpassword',
database='TESTDB',
warehouse='TESTWH',
)
assert con.service_name == 'FAKE_SERVICE_NAME'
@pytest.mark.skip(reason="Mock doesn't work as expected.")
@patch(
'snowflake.connector.network.SnowflakeRestful._post_request'
)
def test_connection_ignore_exception(mockSnowflakeRestfulPostRequest):
def mock_post_request(url, headers, json_body, **kwargs):
global mock_cnt
ret = None
if mock_cnt == 0:
# return from /v1/login-request
ret = {
'success': True,
'message': None,
'data': {
'token': 'TOKEN',
'masterToken': 'MASTER_TOKEN',
'idToken': None,
'parameters': [
{'name': 'SERVICE_NAME', 'value': "FAKE_SERVICE_NAME"}
],
}}
elif mock_cnt == 1:
ret = {
'success': False,
'message': "Session gone",
'data': None,
'code': 390111
}
mock_cnt += 1
return ret
# POST requests mock
mockSnowflakeRestfulPostRequest.side_effect = mock_post_request
global mock_cnt
mock_cnt = 0
account = 'testaccount'
user = 'testuser'
# connection
con = snowflake.connector.connect(
account=account,
user=user,
password='testpassword',
database='TESTDB',
warehouse='TESTWH',
)
# Test to see if closing connection works or raises an exception. If an exception is raised, test will fail.
con.close()
| 27.644231 | 112 | 0.545043 | 268 | 2,875 | 5.682836 | 0.38806 | 0.045962 | 0.039396 | 0.039396 | 0.720946 | 0.720946 | 0.720946 | 0.720946 | 0.720946 | 0.636901 | 0 | 0.012372 | 0.353391 | 2,875 | 103 | 113 | 27.912621 | 0.806885 | 0.117565 | 0 | 0.75641 | 0 | 0 | 0.19604 | 0.045941 | 0 | 0 | 0 | 0 | 0.012821 | 1 | 0.051282 | false | 0.025641 | 0.038462 | 0 | 0.115385 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6 |
ad579b3a1843da61d0b67770526b81510016ec6e | 2,707 | py | Python | test/python/dijkstra.py | timvdm/Helium | 79db85da43f20606710263f800deac52534d437e | [
"BSD-3-Clause"
] | 13 | 2015-02-04T17:02:25.000Z | 2018-04-25T22:48:52.000Z | test/python/dijkstra.py | timvdm/Helium | 79db85da43f20606710263f800deac52534d437e | [
"BSD-3-Clause"
] | null | null | null | test/python/dijkstra.py | timvdm/Helium | 79db85da43f20606710263f800deac52534d437e | [
"BSD-3-Clause"
] | 4 | 2015-11-27T06:19:40.000Z | 2021-04-20T17:35:41.000Z | import helium
import unittest
SMILES = helium.Smiles()
class TestDijkstra(unittest.TestCase):
def test_dijkstra(self):
mol = helium.Molecule()
SMILES.read('C1CCCC2C1CCC2', mol)
d = helium.Dijkstra(mol, mol.atom(0))
self.assertEqual(0, d.distance(mol.atom(0)))
self.assertEqual(1, d.distance(mol.atom(1)))
self.assertEqual(2, d.distance(mol.atom(2)))
self.assertEqual(3, d.distance(mol.atom(3)))
self.assertEqual(2, d.distance(mol.atom(4)))
self.assertEqual(1, d.distance(mol.atom(5)))
self.assertEqual(2, d.distance(mol.atom(6)))
self.assertEqual(3, d.distance(mol.atom(7)))
self.assertEqual(3, d.distance(mol.atom(8)))
path = d.path(mol.atom(0))
self.assertEqual(1, len(path))
self.assertEqual(0, path[0].index())
path = d.path(mol.atom(1))
self.assertEqual(2, len(path))
self.assertEqual(0, path[0].index())
self.assertEqual(1, path[1].index())
path = d.path(mol.atom(2))
self.assertEqual(3, len(path))
self.assertEqual(0, path[0].index())
self.assertEqual(1, path[1].index())
self.assertEqual(2, path[2].index())
path = d.path(mol.atom(3))
self.assertEqual(4, len(path))
self.assertEqual(0, path[0].index())
self.assertEqual(1, path[1].index())
self.assertEqual(2, path[2].index())
self.assertEqual(3, path[3].index())
path = d.path(mol.atom(4))
self.assertEqual(3, len(path))
self.assertEqual(0, path[0].index())
self.assertEqual(5, path[1].index())
self.assertEqual(4, path[2].index())
path = d.path(mol.atom(5))
self.assertEqual(2, len(path))
self.assertEqual(0, path[0].index())
self.assertEqual(5, path[1].index())
path = d.path(mol.atom(6))
self.assertEqual(3, len(path))
self.assertEqual(0, path[0].index())
self.assertEqual(5, path[1].index())
self.assertEqual(6, path[2].index())
path = d.path(mol.atom(7))
self.assertEqual(4, len(path))
self.assertEqual(0, path[0].index())
self.assertEqual(5, path[1].index())
self.assertEqual(6, path[2].index())
self.assertEqual(7, path[3].index())
path = d.path(mol.atom(8))
self.assertEqual(4, len(path))
self.assertEqual(0, path[0].index())
self.assertEqual(5, path[1].index())
self.assertEqual(4, path[2].index())
self.assertEqual(8, path[3].index())
# is long on windows 32-bit...
#self.assertTrue(isinstance(d.infinity(), int))
if __name__ == '__main__':
unittest.main()
| 33.012195 | 55 | 0.585519 | 373 | 2,707 | 4.225201 | 0.117962 | 0.418782 | 0.215736 | 0.091371 | 0.835025 | 0.78236 | 0.746827 | 0.584391 | 0.479695 | 0.479695 | 0 | 0.045717 | 0.232361 | 2,707 | 81 | 56 | 33.419753 | 0.712705 | 0.027337 | 0 | 0.492063 | 0 | 0 | 0.007985 | 0 | 0 | 0 | 0 | 0 | 0.698413 | 1 | 0.015873 | false | 0 | 0.031746 | 0 | 0.063492 | 0 | 0 | 0 | 0 | null | 1 | 1 | 0 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6 |
ad5ef53b13733b1caa6d00d6bd2a79df6da2f64e | 978 | py | Python | tests/test_disable_enable.py | pengyan510/torchtest | f84e4a7f1c3e0cda2430ba09880af4a964b1d3ba | [
"MIT"
] | 24 | 2021-06-09T16:12:45.000Z | 2022-03-08T17:50:47.000Z | tests/test_disable_enable.py | pengyan510/torchtest | f84e4a7f1c3e0cda2430ba09880af4a964b1d3ba | [
"MIT"
] | 1 | 2021-11-19T09:17:30.000Z | 2021-11-19T09:17:30.000Z | tests/test_disable_enable.py | pengyan510/torchtest | f84e4a7f1c3e0cda2430ba09880af4a964b1d3ba | [
"MIT"
] | 1 | 2021-06-11T05:23:33.000Z | 2021-06-11T05:23:33.000Z | import pytest
import torcheck
def test_disable(
unchanging_model_optimizer, unchanging_model, dataloader, run_training
):
torcheck.register(unchanging_model_optimizer)
torcheck.add_module_changing_check(unchanging_model, module_name="NeuralNet")
torcheck.disable()
run_training(unchanging_model, dataloader, unchanging_model_optimizer)
def test_disable_enable(
unchanging_model_optimizer, unchanging_model, dataloader, run_training
):
torcheck.register(unchanging_model_optimizer)
torcheck.add_module_changing_check(unchanging_model, module_name="NeuralNet")
torcheck.disable()
run_training(unchanging_model, dataloader, unchanging_model_optimizer)
torcheck.enable()
with pytest.raises(
RuntimeError,
match=(
r"Module NeuralNet's fc1\.weight should change\.\n"
r".*fc1.bias should change"
),
):
run_training(unchanging_model, dataloader, unchanging_model_optimizer)
| 32.6 | 81 | 0.757669 | 106 | 978 | 6.641509 | 0.301887 | 0.298295 | 0.238636 | 0.136364 | 0.764205 | 0.764205 | 0.764205 | 0.764205 | 0.678977 | 0.678977 | 0 | 0.002451 | 0.165644 | 978 | 29 | 82 | 33.724138 | 0.860294 | 0 | 0 | 0.56 | 0 | 0 | 0.092025 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.08 | false | 0 | 0.08 | 0 | 0.16 | 0 | 0 | 0 | 0 | null | 1 | 1 | 0 | 0 | 1 | 1 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6 |
ad640eac93f9dc4a2d6d1abfb65c4f4bc726a01d | 93 | py | Python | scheduler/api/views.py | NaskoVasilev/Scheduler | 02633e38e8bb803c04371ab3e1ee27e3d8997a53 | [
"MIT"
] | 1 | 2021-03-04T19:08:27.000Z | 2021-03-04T19:08:27.000Z | scheduler/api/views.py | NaskoVasilev/Scheduler | 02633e38e8bb803c04371ab3e1ee27e3d8997a53 | [
"MIT"
] | 23 | 2021-03-11T16:45:41.000Z | 2021-06-28T21:38:44.000Z | scheduler/api/views.py | NaskoVasilev/Scheduler | 02633e38e8bb803c04371ab3e1ee27e3d8997a53 | [
"MIT"
] | null | null | null | from django.shortcuts import render
from django.http import HttpRequest,HttpResponse
| 13.285714 | 48 | 0.795699 | 11 | 93 | 6.727273 | 0.727273 | 0.27027 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.172043 | 93 | 6 | 49 | 15.5 | 0.961039 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 6 |
ad7f0c72d663a8a9853d015782ddfa8c1914e1e6 | 4,845 | py | Python | tests/functional/test_day_9.py | JavierLuna/intcode | 9d44b1d7dbaa706724b6feaa64b3b41a719551f6 | [
"MIT"
] | null | null | null | tests/functional/test_day_9.py | JavierLuna/intcode | 9d44b1d7dbaa706724b6feaa64b3b41a719551f6 | [
"MIT"
] | null | null | null | tests/functional/test_day_9.py | JavierLuna/intcode | 9d44b1d7dbaa706724b6feaa64b3b41a719551f6 | [
"MIT"
] | null | null | null | from typing import List
import pytest
from intcode import IntCodeMachine
from intcode.handlers.io.stack import StackIOHandler
@pytest.fixture
def day_9_input() -> List[int]:
str_code = "1102,34463338,34463338,63,1007,63,34463338,63,1005,63,53,1102,1,3,1000,109,988,209,12,9,1000,209,6,209,3,203,0,1008,1000,1,63,1005,63,65,1008,1000,2,63,1005,63,904,1008,1000,0,63,1005,63,58,4,25,104,0,99,4,0,104,0,99,4,17,104,0,99,0,0,1101,234,0,1027,1101,0,568,1023,1102,844,1,1025,1101,0,23,1008,1102,1,1,1021,1102,27,1,1011,1101,0,26,1004,1102,1,586,1029,1102,29,1,1014,1101,0,22,1015,1102,36,1,1016,1101,35,0,1013,1102,20,1,1003,1102,1,37,1019,1101,30,0,1006,1102,34,1,1000,1101,571,0,1022,1102,1,28,1005,1101,39,0,1009,1102,38,1,1017,1102,591,1,1028,1102,1,31,1007,1102,24,1,1010,1101,0,33,1001,1101,0,21,1018,1101,0,0,1020,1101,25,0,1002,1102,32,1,1012,1101,0,237,1026,1101,0,853,1024,109,29,1206,-9,195,4,187,1106,0,199,1001,64,1,64,1002,64,2,64,109,-26,2102,1,0,63,1008,63,23,63,1005,63,223,1001,64,1,64,1105,1,225,4,205,1002,64,2,64,109,16,2106,0,8,1106,0,243,4,231,1001,64,1,64,1002,64,2,64,109,-19,21101,40,0,10,1008,1010,40,63,1005,63,265,4,249,1106,0,269,1001,64,1,64,1002,64,2,64,109,-2,2107,31,8,63,1005,63,289,1001,64,1,64,1105,1,291,4,275,1002,64,2,64,109,2,1208,7,28,63,1005,63,307,1106,0,313,4,297,1001,64,1,64,1002,64,2,64,109,-1,1207,9,24,63,1005,63,335,4,319,1001,64,1,64,1105,1,335,1002,64,2,64,109,5,1201,0,0,63,1008,63,25,63,1005,63,355,1105,1,361,4,341,1001,64,1,64,1002,64,2,64,109,-13,1202,9,1,63,1008,63,34,63,1005,63,383,4,367,1105,1,387,1001,64,1,64,1002,64,2,64,109,32,1205,-3,403,1001,64,1,64,1106,0,405,4,393,1002,64,2,64,109,-14,2108,31,-2,63,1005,63,423,4,411,1105,1,427,1001,64,1,64,1002,64,2,64,109,11,1206,1,439,1105,1,445,4,433,1001,64,1,64,1002,64,2,64,109,-21,1208,4,20,63,1005,63,467,4,451,1001,64,1,64,1105,1,467,1002,64,2,64,109,6,1207,-5,33,63,1005,63,487,1001,64,1,64,1106,0,489,4,473,1002,64,2,64,109,-12,1202,8,1,63,1008,63,34,63,1005,63,509,1106,0,515,4,495,1001,64,1,64,1002,64,2,64,109,28,1205,0,529,4,521,1106,0,533,1001,64,1,64,1002,64,2,64,109,3,21101,41,0,-9,1008,1015,38,63,1005,63,557,1001,64,1,64,1106,0,559,4,539,1002,64,2,64,109,-11,2105,1,10,1105,1,577,4,565,1001,64,1,64,1002,64,2,64,109,23,2106,0,-8,4,583,1105,1,595,1001,64,1,64,1002,64,2,64,109,-15,21108,42,42,-6,1005,1015,613,4,601,1106,0,617,1001,64,1,64,1002,64,2,64,109,-14,21107,43,44,8,1005,1015,639,4,623,1001,64,1,64,1106,0,639,1002,64,2,64,109,11,2107,38,-9,63,1005,63,661,4,645,1001,64,1,64,1106,0,661,1002,64,2,64,109,-2,21107,44,43,3,1005,1019,677,1105,1,683,4,667,1001,64,1,64,1002,64,2,64,109,-7,21108,45,42,1,1005,1010,703,1001,64,1,64,1106,0,705,4,689,1002,64,2,64,109,-5,2102,1,1,63,1008,63,28,63,1005,63,727,4,711,1106,0,731,1001,64,1,64,1002,64,2,64,109,13,21102,46,1,0,1008,1017,46,63,1005,63,753,4,737,1106,0,757,1001,64,1,64,1002,64,2,64,109,-4,2101,0,-5,63,1008,63,20,63,1005,63,781,1001,64,1,64,1105,1,783,4,763,1002,64,2,64,109,1,21102,47,1,0,1008,1014,48,63,1005,63,803,1105,1,809,4,789,1001,64,1,64,1002,64,2,64,109,-3,2101,0,-4,63,1008,63,31,63,1005,63,835,4,815,1001,64,1,64,1105,1,835,1002,64,2,64,109,6,2105,1,7,4,841,1001,64,1,64,1105,1,853,1002,64,2,64,109,-21,2108,33,10,63,1005,63,873,1001,64,1,64,1105,1,875,4,859,1002,64,2,64,109,6,1201,4,0,63,1008,63,30,63,1005,63,901,4,881,1001,64,1,64,1105,1,901,4,64,99,21102,27,1,1,21102,1,915,0,1106,0,922,21201,1,64720,1,204,1,99,109,3,1207,-2,3,63,1005,63,964,21201,-2,-1,1,21102,1,942,0,1105,1,922,21202,1,1,-1,21201,-2,-3,1,21101,957,0,0,1105,1,922,22201,1,-1,-2,1105,1,968,21202,-2,1,-2,109,-3,2106,0,0" # noqa: E501
return [int(i.strip()) for i in str_code.split(',') if i.strip()]
def test_quine():
stack_io_handler = StackIOHandler()
code = "109,1,204,-1,1001,100,1,100,1008,100,16,101,1006,101,0,99"
machine = IntCodeMachine(code, io_handler=stack_io_handler)
machine.run()
assert code.split(',') == stack_io_handler.io_stack
def test_16_length_number():
stack_io_handler = StackIOHandler()
code = "1102,34915192,34915192,7,4,7,99,0"
machine = IntCodeMachine(code, io_handler=stack_io_handler)
machine.run()
assert len(stack_io_handler.io_stack[-1]) == 16
def test_middle_number():
stack_io_handler = StackIOHandler()
code = "104,1125899906842624,99"
machine = IntCodeMachine(code, io_handler=stack_io_handler)
machine.run()
assert stack_io_handler.io_stack[-1] == "1125899906842624"
@pytest.mark.parametrize("input, expected_output", [("1", "3638931938"),
("2", "86025")])
def test_day_9(day_9_input, input, expected_output):
stack_io_handler = StackIOHandler([input])
machine = IntCodeMachine(day_9_input, io_handler=stack_io_handler)
machine.run()
assert stack_io_handler.io_stack[-1] == expected_output
| 105.326087 | 3,432 | 0.700929 | 1,170 | 4,845 | 2.858974 | 0.223932 | 0.057399 | 0.066966 | 0.086099 | 0.36861 | 0.34559 | 0.203288 | 0.203288 | 0.191928 | 0.110314 | 0 | 0.550327 | 0.052632 | 4,845 | 45 | 3,433 | 107.666667 | 0.178431 | 0.002064 | 0 | 0.30303 | 0 | 0.060606 | 0.738879 | 0.727085 | 0 | 0 | 0 | 0 | 0.121212 | 1 | 0.151515 | false | 0 | 0.121212 | 0 | 0.30303 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6 |
ad8bdb64dfc9ce3def59c1e88e132508409d6c8c | 240 | py | Python | tests/emoji_names/test_emoji_names.py | myii/zulip-terminal | 63156539d7373fefe329f5afc9e2e5c484e467df | [
"Apache-2.0"
] | null | null | null | tests/emoji_names/test_emoji_names.py | myii/zulip-terminal | 63156539d7373fefe329f5afc9e2e5c484e467df | [
"Apache-2.0"
] | null | null | null | tests/emoji_names/test_emoji_names.py | myii/zulip-terminal | 63156539d7373fefe329f5afc9e2e5c484e467df | [
"Apache-2.0"
] | 1 | 2020-10-21T13:14:20.000Z | 2020-10-21T13:14:20.000Z | from zulipterminal.emoji_names import EMOJI_NAMES
def test_generated_emoji_list_sorted():
assert EMOJI_NAMES == sorted(EMOJI_NAMES)
def test_emojis_fixture_sorted(emojis_fixture):
assert emojis_fixture == sorted(emojis_fixture)
| 24 | 51 | 0.820833 | 32 | 240 | 5.71875 | 0.40625 | 0.218579 | 0.142077 | 0.185792 | 0.349727 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.116667 | 240 | 9 | 52 | 26.666667 | 0.863208 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.4 | 1 | 0.4 | false | 0 | 0.2 | 0 | 0.6 | 0 | 0 | 0 | 0 | null | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 6 |
d13f87c9e14fb4af7b94583cc537098d971f1e9b | 142 | py | Python | users/admin.py | JackShen1/movie-finder | 4cfb4836a0183678ceec0dce2e4fb95df28832aa | [
"MIT"
] | 1 | 2021-07-08T21:36:19.000Z | 2021-07-08T21:36:19.000Z | users/admin.py | JackShen1/movie-finder | 4cfb4836a0183678ceec0dce2e4fb95df28832aa | [
"MIT"
] | null | null | null | users/admin.py | JackShen1/movie-finder | 4cfb4836a0183678ceec0dce2e4fb95df28832aa | [
"MIT"
] | null | null | null | from django.contrib import admin
from .models import Review, Watchlist
# Register your models here.
admin.site.register((Review, Watchlist))
| 23.666667 | 40 | 0.795775 | 19 | 142 | 5.947368 | 0.631579 | 0.265487 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.119718 | 142 | 5 | 41 | 28.4 | 0.904 | 0.183099 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.666667 | 0 | 0.666667 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 6 |
d15f36a4007103384755a63064fdfaf5eb7250b3 | 63,209 | py | Python | src/tests/api/test_order_change.py | tixl/tixl | 9f515a4b4e17a14d1990b29385475195438969be | [
"Apache-2.0"
] | null | null | null | src/tests/api/test_order_change.py | tixl/tixl | 9f515a4b4e17a14d1990b29385475195438969be | [
"Apache-2.0"
] | 8 | 2015-01-06T10:50:27.000Z | 2015-01-18T18:38:18.000Z | src/tests/api/test_order_change.py | tixl/tixl | 9f515a4b4e17a14d1990b29385475195438969be | [
"Apache-2.0"
] | null | null | null | #
# This file is part of pretix (Community Edition).
#
# Copyright (C) 2014-2020 Raphael Michel and contributors
# Copyright (C) 2020-2021 rami.io GmbH and contributors
#
# This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General
# Public License as published by the Free Software Foundation in version 3 of the License.
#
# ADDITIONAL TERMS APPLY: Pursuant to Section 7 of the GNU Affero General Public License, additional terms are
# applicable granting you additional permissions and placing additional restrictions on your usage of this software.
# Please refer to the pretix LICENSE file to obtain the full terms applicable to this work. If you did not receive
# this file, see <https://pretix.eu/about/en/license>.
#
# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along with this program. If not, see
# <https://www.gnu.org/licenses/>.
#
import datetime
import json
from decimal import Decimal
from unittest import mock
import pytest
from django.core import mail as djmail
from django.core.files.base import ContentFile
from django.utils.timezone import now
from django_countries.fields import Country
from django_scopes import scopes_disabled
from pytz import UTC
from pretix.base.models import (
InvoiceAddress, Order, OrderPosition, Question, SeatingPlan,
)
from pretix.base.models.orders import OrderFee
from pretix.base.services.invoices import generate_invoice
@pytest.fixture
def item(event):
return event.items.create(name="Budget Ticket", default_price=23)
@pytest.fixture
def item2(event2):
return event2.items.create(name="Budget Ticket", default_price=23)
@pytest.fixture
def taxrule(event):
return event.tax_rules.create(rate=Decimal('19.00'))
@pytest.fixture
def question(event, item):
q = event.questions.create(question="T-Shirt size", type="S", identifier="ABC")
q.items.add(item)
q.options.create(answer="XL", identifier="LVETRWVU")
return q
@pytest.fixture
def question2(event2, item2):
q = event2.questions.create(question="T-Shirt size", type="S", identifier="ABC")
q.items.add(item2)
return q
@pytest.fixture
def quota(event, item):
q = event.quotas.create(name="Budget Quota", size=200)
q.items.add(item)
return q
@pytest.fixture
def seat(event, organizer, item):
SeatingPlan.objects.create(
name="Plan", organizer=organizer, layout="{}"
)
event.seat_category_mappings.create(
layout_category='Stalls', product=item
)
return event.seats.create(seat_number="A1", product=item, seat_guid="A1")
@pytest.fixture
def order(event, item, taxrule, question):
testtime = datetime.datetime(2017, 12, 1, 10, 0, 0, tzinfo=UTC)
event.plugins += ",pretix.plugins.stripe"
event.save()
with mock.patch('django.utils.timezone.now') as mock_now:
mock_now.return_value = testtime
o = Order.objects.create(
code='FOO', event=event, email='dummy@dummy.test',
status=Order.STATUS_PENDING, secret="k24fiuwvu8kxz3y1",
datetime=datetime.datetime(2017, 12, 1, 10, 0, 0, tzinfo=UTC),
expires=datetime.datetime(2017, 12, 10, 10, 0, 0, tzinfo=UTC),
total=23, locale='en'
)
p1 = o.payments.create(
provider='stripe',
state='refunded',
amount=Decimal('23.00'),
payment_date=testtime,
)
o.refunds.create(
provider='stripe',
state='done',
source='admin',
amount=Decimal('23.00'),
execution_date=testtime,
payment=p1,
)
o.payments.create(
provider='banktransfer',
state='pending',
amount=Decimal('23.00'),
)
o.fees.create(fee_type=OrderFee.FEE_TYPE_PAYMENT, value=Decimal('0.25'), tax_rate=Decimal('19.00'),
tax_value=Decimal('0.05'), tax_rule=taxrule)
o.fees.create(fee_type=OrderFee.FEE_TYPE_PAYMENT, value=Decimal('0.25'), tax_rate=Decimal('19.00'),
tax_value=Decimal('0.05'), tax_rule=taxrule, canceled=True)
InvoiceAddress.objects.create(order=o, company="Sample company", country=Country('NZ'),
vat_id="DE123", vat_id_validated=True)
op = OrderPosition.objects.create(
order=o,
item=item,
variation=None,
price=Decimal("23"),
attendee_name_parts={"full_name": "Peter", "_scheme": "full"},
secret="z3fsn8jyufm5kpk768q69gkbyr5f4h6w",
pseudonymization_id="ABCDEFGHKL",
positionid=1,
)
OrderPosition.objects.create(
order=o,
item=item,
variation=None,
price=Decimal("23"),
attendee_name_parts={"full_name": "Peter", "_scheme": "full"},
secret="YBiYJrmF5ufiTLdV1iDf",
pseudonymization_id="JKLM",
canceled=True,
positionid=2,
)
op.answers.create(question=question, answer='S')
return o
@pytest.mark.django_db
def test_order_update_ignore_fields(token_client, organizer, event, order):
resp = token_client.patch(
'/api/v1/organizers/{}/events/{}/orders/{}/'.format(
organizer.slug, event.slug, order.code
), format='json', data={
'status': 'c'
}
)
assert resp.status_code == 200
order.refresh_from_db()
assert order.status == 'n'
@pytest.mark.django_db
def test_order_update_only_partial(token_client, organizer, event, order):
resp = token_client.put(
'/api/v1/organizers/{}/events/{}/orders/{}/'.format(
organizer.slug, event.slug, order.code
), format='json', data={
'status': 'c'
}
)
assert resp.status_code == 405
@pytest.mark.django_db
def test_order_update_state_validation(token_client, organizer, event, order):
resp = token_client.patch(
'/api/v1/organizers/{}/events/{}/orders/{}/'.format(
organizer.slug, event.slug, order.code
), format='json', data={
'invoice_address': {
"is_business": False,
"company": "This is my company name",
"name": "John Doe",
"name_parts": {},
"street": "",
"state": "",
"zipcode": "",
"city": "Paris",
"country": "NONEXISTANT",
"internal_reference": "",
"vat_id": "",
}
}
)
assert resp.status_code == 400
resp = token_client.patch(
'/api/v1/organizers/{}/events/{}/orders/{}/'.format(
organizer.slug, event.slug, order.code
), format='json', data={
'invoice_address': {
"is_business": False,
"company": "This is my company name",
"name": "John Doe",
"name_parts": {},
"street": "",
"state": "NONEXISTANT",
"zipcode": "",
"city": "Test",
"country": "AU",
"internal_reference": "",
"vat_id": "",
}
}
)
assert resp.status_code == 400
resp = token_client.patch(
'/api/v1/organizers/{}/events/{}/orders/{}/'.format(
organizer.slug, event.slug, order.code
), format='json', data={
'invoice_address': {
"is_business": False,
"company": "This is my company name",
"name": "John Doe",
"name_parts": {},
"street": "",
"state": "QLD",
"zipcode": "",
"city": "Test",
"country": "AU",
"internal_reference": "",
"vat_id": "",
}
}
)
assert resp.status_code == 200
order.invoice_address.refresh_from_db()
assert order.invoice_address.state == "QLD"
assert order.invoice_address.country == "AU"
@pytest.mark.django_db
def test_order_update_allowed_fields(token_client, organizer, event, order):
event.settings.locales = ['de', 'en']
resp = token_client.patch(
'/api/v1/organizers/{}/events/{}/orders/{}/'.format(
organizer.slug, event.slug, order.code
), format='json', data={
'comment': 'Here is a comment',
'custom_followup_at': '2021-06-12',
'checkin_attention': True,
'email': 'foo@bar.com',
'phone': '+4962219999',
'locale': 'de',
'invoice_address': {
"is_business": False,
"company": "This is my company name",
"name": "John Doe",
"name_parts": {},
"street": "",
"state": "",
"zipcode": "",
"city": "Paris",
"country": "FR",
"internal_reference": "",
"vat_id": "",
}
}
)
assert resp.status_code == 200
order.refresh_from_db()
assert order.comment == 'Here is a comment'
assert order.custom_followup_at.isoformat() == '2021-06-12'
assert order.checkin_attention
assert order.email == 'foo@bar.com'
assert order.phone == '+4962219999'
assert order.locale == 'de'
assert order.invoice_address.company == "This is my company name"
assert order.invoice_address.name_cached == "John Doe"
assert order.invoice_address.name_parts == {'_legacy': 'John Doe'}
assert str(order.invoice_address.country) == "FR"
assert not order.invoice_address.vat_id_validated
assert order.invoice_address.city == "Paris"
with scopes_disabled():
assert order.all_logentries().get(action_type='pretix.event.order.comment')
assert order.all_logentries().get(action_type='pretix.event.order.custom_followup_at')
assert order.all_logentries().get(action_type='pretix.event.order.checkin_attention')
assert order.all_logentries().get(action_type='pretix.event.order.contact.changed')
assert order.all_logentries().get(action_type='pretix.event.order.phone.changed')
assert order.all_logentries().get(action_type='pretix.event.order.locale.changed')
assert order.all_logentries().get(action_type='pretix.event.order.modified')
@pytest.mark.django_db
def test_order_update_validated_vat_id(token_client, organizer, event, order):
resp = token_client.patch(
'/api/v1/organizers/{}/events/{}/orders/{}/'.format(
organizer.slug, event.slug, order.code
), format='json', data={
'invoice_address': {
"is_business": False,
"company": "This is my company name",
"name": "John Doe",
"name_parts": {},
"street": "",
"state": "",
"zipcode": "",
"city": "Paris",
"country": "FR",
"internal_reference": "",
"vat_id": "FR123",
"vat_id_validated": True
}
}
)
assert resp.status_code == 200
order.refresh_from_db()
assert order.invoice_address.vat_id == "FR123"
assert order.invoice_address.vat_id_validated
@pytest.mark.django_db
def test_order_update_invoiceaddress_delete_create(token_client, organizer, event, order):
event.settings.locales = ['de', 'en']
resp = token_client.patch(
'/api/v1/organizers/{}/events/{}/orders/{}/'.format(
organizer.slug, event.slug, order.code
), format='json', data={
'invoice_address': None,
}
)
assert resp.status_code == 200
order.refresh_from_db()
with pytest.raises(InvoiceAddress.DoesNotExist):
order.invoice_address
resp = token_client.patch(
'/api/v1/organizers/{}/events/{}/orders/{}/'.format(
organizer.slug, event.slug, order.code
), format='json', data={
'invoice_address': {
"is_business": False,
"company": "This is my company name",
"name": "",
"name_parts": {},
"street": "",
"state": "",
"zipcode": "",
"city": "Paris",
"country": "Fr",
"internal_reference": "",
"vat_id": "",
}
}
)
assert resp.status_code == 200
order.refresh_from_db()
assert order.invoice_address.company == "This is my company name"
assert str(order.invoice_address.country) == "FR"
assert order.invoice_address.city == "Paris"
@pytest.mark.django_db
def test_order_update_email_to_none(token_client, organizer, event, order):
resp = token_client.patch(
'/api/v1/organizers/{}/events/{}/orders/{}/'.format(
organizer.slug, event.slug, order.code
), format='json', data={
'email': None,
}
)
assert resp.status_code == 200
order.refresh_from_db()
assert order.email is None
@pytest.mark.django_db
def test_order_update_locale_to_invalid(token_client, organizer, event, order):
resp = token_client.patch(
'/api/v1/organizers/{}/events/{}/orders/{}/'.format(
organizer.slug, event.slug, order.code
), format='json', data={
'locale': 'de',
}
)
assert resp.status_code == 400
assert resp.data == {'locale': ['"de" is not a supported locale for this event.']}
@pytest.mark.django_db
def test_order_create_invoice(token_client, organizer, event, order):
event.settings.invoice_generate = 'True'
event.settings.invoice_generate_sales_channels = []
resp = token_client.post(
'/api/v1/organizers/{}/events/{}/orders/{}/create_invoice/'.format(
organizer.slug, event.slug, order.code
), format='json', data={}
)
assert resp.status_code == 400
event.settings.invoice_generate_sales_channels = ['web']
resp = token_client.post(
'/api/v1/organizers/{}/events/{}/orders/{}/create_invoice/'.format(
organizer.slug, event.slug, order.code
), format='json', data={}
)
assert resp.status_code == 201
with scopes_disabled():
pos = order.positions.first()
assert json.loads(json.dumps(resp.data)) == {
'order': 'FOO',
'number': 'DUMMY-00001',
'is_cancellation': False,
"invoice_from_name": "",
"invoice_from": "",
"invoice_from_zipcode": "",
"invoice_from_city": "",
"invoice_from_country": None,
"invoice_from_tax_id": "",
"invoice_from_vat_id": "",
"invoice_to": "Sample company\nNew Zealand\nVAT-ID: DE123",
"invoice_to_company": "Sample company",
"invoice_to_name": "",
"invoice_to_street": "",
"invoice_to_zipcode": "",
"invoice_to_city": "",
"invoice_to_state": "",
"invoice_to_country": "NZ",
"invoice_to_vat_id": "DE123",
"invoice_to_beneficiary": "",
"custom_field": None,
'date': now().date().isoformat(),
'refers': None,
'locale': 'en',
'introductory_text': '',
'additional_text': '',
'payment_provider_text': '',
'footer_text': '',
'lines': [
{
'position': 1,
'description': 'Budget Ticket<br />Attendee: Peter',
'subevent': None,
'event_date_from': '2017-12-27T10:00:00Z',
'event_date_to': None,
'event_location': None,
'fee_type': None,
'fee_internal_type': None,
'attendee_name': 'Peter',
'item': pos.item_id,
'variation': None,
'gross_value': '23.00',
'tax_value': '0.00',
'tax_rate': '0.00',
'tax_name': ''
},
{
'position': 2,
'description': 'Payment fee',
'subevent': None,
'event_date_from': '2017-12-27T10:00:00Z',
'event_date_to': None,
'event_location': None,
'fee_type': "payment",
'fee_internal_type': None,
'attendee_name': None,
'item': None,
'variation': None,
'gross_value': '0.25',
'tax_value': '0.05',
'tax_rate': '19.00',
'tax_name': ''
}
],
'foreign_currency_display': None,
'foreign_currency_rate': None,
'foreign_currency_rate_date': None,
'internal_reference': ''
}
resp = token_client.post(
'/api/v1/organizers/{}/events/{}/orders/{}/create_invoice/'.format(
organizer.slug, event.slug, order.code
), format='json', data={}
)
assert resp.data == {'detail': 'An invoice for this order already exists.'}
assert resp.status_code == 400
event.settings.invoice_generate = 'False'
resp = token_client.post(
'/api/v1/organizers/{}/events/{}/orders/{}/create_invoice/'.format(
organizer.slug, event.slug, order.code
), format='json', data={}
)
assert resp.status_code == 400
assert resp.data == {'detail': 'You cannot generate an invoice for this order.'}
@pytest.mark.django_db
def test_order_regenerate_secrets(token_client, organizer, event, order):
s = order.secret
with scopes_disabled():
ps = order.positions.first().secret
resp = token_client.post(
'/api/v1/organizers/{}/events/{}/orders/{}/regenerate_secrets/'.format(
organizer.slug, event.slug, order.code
), format='json', data={}
)
assert resp.status_code == 200
order.refresh_from_db()
assert s != order.secret
with scopes_disabled():
assert ps != order.positions.first().secret
@pytest.mark.django_db
def test_position_regenerate_secrets(token_client, organizer, event, order):
with scopes_disabled():
p = order.positions.first()
ps = p.secret
resp = token_client.post(
'/api/v1/organizers/{}/events/{}/orderpositions/{}/regenerate_secrets/'.format(
organizer.slug, event.slug, p.pk,
), format='json', data={}
)
assert resp.status_code == 200
p.refresh_from_db()
with scopes_disabled():
assert ps != p.secret
@pytest.mark.django_db
def test_order_resend_link(token_client, organizer, event, order):
djmail.outbox = []
resp = token_client.post(
'/api/v1/organizers/{}/events/{}/orders/{}/resend_link/'.format(
organizer.slug, event.slug, order.code
), format='json', data={}
)
assert resp.status_code == 204
assert len(djmail.outbox) == 1
order.email = None
order.save()
resp = token_client.post(
'/api/v1/organizers/{}/events/{}/orders/{}/resend_link/'.format(
organizer.slug, event.slug, order.code
), format='json', data={}
)
assert resp.status_code == 400
@pytest.mark.django_db
def test_orderposition_price_calculation(token_client, organizer, event, order, item):
with scopes_disabled():
op = order.positions.first()
resp = token_client.post(
'/api/v1/organizers/{}/events/{}/orderpositions/{}/price_calc/'.format(organizer.slug, event.slug, op.pk),
data={
}
)
assert resp.status_code == 200
assert resp.data == {
'gross': Decimal('23.00'),
'gross_formatted': '23.00',
'name': '',
'net': Decimal('23.00'),
'rate': Decimal('0.00'),
'tax_rule': None,
'tax': Decimal('0.00')
}
@pytest.mark.django_db
def test_orderposition_price_calculation_item_with_tax(token_client, organizer, event, order, item, taxrule):
with scopes_disabled():
item2 = event.items.create(name="Budget Ticket", default_price=23, tax_rule=taxrule)
op = order.positions.first()
resp = token_client.post(
'/api/v1/organizers/{}/events/{}/orderpositions/{}/price_calc/'.format(organizer.slug, event.slug, op.pk),
data={
'item': item2.pk
}
)
assert resp.status_code == 200
assert resp.data == {
'gross': Decimal('23.00'),
'gross_formatted': '23.00',
'name': '',
'net': Decimal('19.33'),
'rate': Decimal('19.00'),
'tax_rule': taxrule.pk,
'tax': Decimal('3.67')
}
@pytest.mark.django_db
def test_orderposition_price_calculation_item_with_variation(token_client, organizer, event, order):
with scopes_disabled():
item2 = event.items.create(name="Budget Ticket", default_price=23)
var = item2.variations.create(default_price=12, value="XS")
op = order.positions.first()
resp = token_client.post(
'/api/v1/organizers/{}/events/{}/orderpositions/{}/price_calc/'.format(organizer.slug, event.slug, op.pk),
data={
'item': item2.pk,
'variation': var.pk
}
)
assert resp.status_code == 200
assert resp.data == {
'gross': Decimal('12.00'),
'gross_formatted': '12.00',
'name': '',
'net': Decimal('12.00'),
'rate': Decimal('0.00'),
'tax_rule': None,
'tax': Decimal('0.00')
}
@pytest.mark.django_db
def test_orderposition_price_calculation_subevent(token_client, organizer, event, order, subevent):
with scopes_disabled():
item2 = event.items.create(name="Budget Ticket", default_price=23)
op = order.positions.first()
op.subevent = subevent
op.save()
resp = token_client.post(
'/api/v1/organizers/{}/events/{}/orderpositions/{}/price_calc/'.format(organizer.slug, event.slug, op.pk),
data={
'item': item2.pk,
'subevent': subevent.pk
}
)
assert resp.status_code == 200
assert resp.data == {
'gross': Decimal('23.00'),
'gross_formatted': '23.00',
'name': '',
'net': Decimal('23.00'),
'rate': Decimal('0.00'),
'tax_rule': None,
'tax': Decimal('0.00')
}
@pytest.mark.django_db
def test_orderposition_price_calculation_subevent_with_override(token_client, organizer, event, order, subevent):
with scopes_disabled():
item2 = event.items.create(name="Budget Ticket", default_price=23)
se2 = event.subevents.create(name="Foobar", date_from=datetime.datetime(2017, 12, 27, 10, 0, 0, tzinfo=UTC))
se2.subeventitem_set.create(item=item2, price=12)
op = order.positions.first()
op.subevent = subevent
op.save()
resp = token_client.post(
'/api/v1/organizers/{}/events/{}/orderpositions/{}/price_calc/'.format(organizer.slug, event.slug, op.pk),
data={
'item': item2.pk,
'subevent': se2.pk
}
)
assert resp.status_code == 200
assert resp.data == {
'gross': Decimal('12.00'),
'gross_formatted': '12.00',
'name': '',
'net': Decimal('12.00'),
'rate': Decimal('0.00'),
'tax_rule': None,
'tax': Decimal('0.00')
}
@pytest.mark.django_db
def test_orderposition_price_calculation_voucher_matching(token_client, organizer, event, order, subevent, item):
with scopes_disabled():
item2 = event.items.create(name="Budget Ticket", default_price=23)
q = event.quotas.create(name="Quota")
q.items.add(item)
q.items.add(item2)
voucher = event.vouchers.create(price_mode="set", value=15, quota=q)
op = order.positions.first()
op.voucher = voucher
op.save()
resp = token_client.post(
'/api/v1/organizers/{}/events/{}/orderpositions/{}/price_calc/'.format(organizer.slug, event.slug, op.pk),
data={
'item': item2.pk,
}
)
assert resp.status_code == 200
assert resp.data == {
'gross': Decimal('15.00'),
'gross_formatted': '15.00',
'name': '',
'net': Decimal('15.00'),
'rate': Decimal('0.00'),
'tax_rule': None,
'tax': Decimal('0.00')
}
@pytest.mark.django_db
def test_orderposition_price_calculation_voucher_not_matching(token_client, organizer, event, order, subevent, item):
with scopes_disabled():
item2 = event.items.create(name="Budget Ticket", default_price=23)
q = event.quotas.create(name="Quota")
q.items.add(item)
voucher = event.vouchers.create(price_mode="set", value=15, quota=q)
op = order.positions.first()
op.voucher = voucher
op.save()
resp = token_client.post(
'/api/v1/organizers/{}/events/{}/orderpositions/{}/price_calc/'.format(organizer.slug, event.slug, op.pk),
data={
'item': item2.pk,
}
)
assert resp.status_code == 200
assert resp.data == {
'gross': Decimal('23.00'),
'gross_formatted': '23.00',
'name': '',
'net': Decimal('23.00'),
'rate': Decimal('0.00'),
'tax_rule': None,
'tax': Decimal('0.00')
}
@pytest.mark.django_db
def test_orderposition_price_calculation_net_price(token_client, organizer, event, order, subevent, item, taxrule):
taxrule.price_includes_tax = False
taxrule.save()
with scopes_disabled():
item2 = event.items.create(name="Budget Ticket", default_price=10, tax_rule=taxrule)
op = order.positions.first()
resp = token_client.post(
'/api/v1/organizers/{}/events/{}/orderpositions/{}/price_calc/'.format(organizer.slug, event.slug, op.pk),
data={
'item': item2.pk,
}
)
assert resp.status_code == 200
assert resp.data == {
'gross': Decimal('11.90'),
'gross_formatted': '11.90',
'name': '',
'net': Decimal('10.00'),
'rate': Decimal('19.00'),
'tax_rule': taxrule.pk,
'tax': Decimal('1.90')
}
@pytest.mark.django_db
def test_orderposition_price_calculation_reverse_charge(token_client, organizer, event, order, subevent, item, taxrule):
taxrule.price_includes_tax = False
taxrule.eu_reverse_charge = True
taxrule.home_country = Country('DE')
taxrule.save()
order.invoice_address.is_business = True
order.invoice_address.vat_id = 'ATU1234567'
order.invoice_address.vat_id_validated = True
order.invoice_address.country = Country('AT')
order.invoice_address.save()
with scopes_disabled():
item2 = event.items.create(name="Budget Ticket", default_price=10, tax_rule=taxrule)
op = order.positions.first()
resp = token_client.post(
'/api/v1/organizers/{}/events/{}/orderpositions/{}/price_calc/'.format(organizer.slug, event.slug, op.pk),
data={
'item': item2.pk,
}
)
assert resp.status_code == 200
assert resp.data == {
'gross': Decimal('10.00'),
'gross_formatted': '10.00',
'name': '',
'net': Decimal('10.00'),
'rate': Decimal('0.00'),
'tax_rule': taxrule.pk,
'tax': Decimal('0.00')
}
@pytest.mark.django_db
def test_position_update_ignore_fields(token_client, organizer, event, order):
with scopes_disabled():
op = order.positions.first()
resp = token_client.patch(
'/api/v1/organizers/{}/events/{}/orderpositions/{}/'.format(
organizer.slug, event.slug, op.pk
), format='json', data={
'tax_rate': '99.99'
}
)
assert resp.status_code == 200
op.refresh_from_db()
assert op.tax_rate == Decimal('0.00')
@pytest.mark.django_db
def test_position_update_only_partial(token_client, organizer, event, order):
with scopes_disabled():
op = order.positions.first()
resp = token_client.put(
'/api/v1/organizers/{}/events/{}/orderpositions/{}/'.format(
organizer.slug, event.slug, op.pk
), format='json', data={
'price': '99.99'
}
)
assert resp.status_code == 405
@pytest.mark.django_db
def test_position_update_info(token_client, organizer, event, order, question):
with scopes_disabled():
op = order.positions.first()
question.type = Question.TYPE_CHOICE_MULTIPLE
question.save()
opt = question.options.create(answer="L")
payload = {
'company': 'VILE',
'attendee_name_parts': {
'full_name': 'Max Mustermann'
},
'street': 'Sesame Street 21',
'zipcode': '99999',
'city': 'Springfield',
'country': 'US',
'state': 'CA',
'attendee_email': 'foo@example.org',
'answers': [
{
'question': question.pk,
'answer': 'ignored',
'options': [opt.pk]
}
]
}
resp = token_client.patch(
'/api/v1/organizers/{}/events/{}/orderpositions/{}/'.format(
organizer.slug, event.slug, op.pk
), format='json', data=payload
)
assert resp.status_code == 200
assert resp.data['answers'] == [
{
'question': question.pk,
'question_identifier': question.identifier,
'answer': 'L',
'options': [opt.pk],
'option_identifiers': [opt.identifier],
}
]
op.refresh_from_db()
assert op.company == 'VILE'
assert op.attendee_name_cached == 'Max Mustermann'
assert op.attendee_name_parts == {
'_scheme': 'full',
'full_name': 'Max Mustermann'
}
with scopes_disabled():
assert op.answers.get().answer == 'L'
assert op.street == 'Sesame Street 21'
assert op.zipcode == '99999'
assert op.city == 'Springfield'
assert str(op.country) == 'US'
assert op.state == 'CA'
assert op.attendee_email == 'foo@example.org'
le = order.all_logentries().last()
assert le.action_type == 'pretix.event.order.modified'
assert le.parsed_data == {
'data': [
{
'position': op.pk,
'company': 'VILE',
'attendee_name_parts': {
'_scheme': 'full',
'full_name': 'Max Mustermann'
},
'street': 'Sesame Street 21',
'zipcode': '99999',
'city': 'Springfield',
'country': 'US',
'state': 'CA',
'attendee_email': 'foo@example.org',
f'question_{question.pk}': 'L'
}
]
}
resp = token_client.patch(
'/api/v1/organizers/{}/events/{}/orderpositions/{}/'.format(
organizer.slug, event.slug, op.pk
), format='json', data=payload
)
assert resp.status_code == 200
with scopes_disabled():
assert order.all_logentries().last().pk == le.pk
@pytest.mark.django_db
def test_position_update_legacy_name(token_client, organizer, event, order):
with scopes_disabled():
op = order.positions.first()
payload = {
'attendee_name': 'Max Mustermann',
'attendee_name_parts': {
'_legacy': 'maria'
},
}
resp = token_client.patch(
'/api/v1/organizers/{}/events/{}/orderpositions/{}/'.format(
organizer.slug, event.slug, op.pk
), format='json', data=payload
)
assert resp.status_code == 400
payload = {
'attendee_name': 'Max Mustermann',
}
resp = token_client.patch(
'/api/v1/organizers/{}/events/{}/orderpositions/{}/'.format(
organizer.slug, event.slug, op.pk
), format='json', data=payload
)
assert resp.status_code == 200
op.refresh_from_db()
assert op.attendee_name_cached == 'Max Mustermann'
assert op.attendee_name_parts == {
'_legacy': 'Max Mustermann'
}
with scopes_disabled():
assert op.answers.count() == 1 # answer does not get deleted
@pytest.mark.django_db
def test_position_update_state_validation(token_client, organizer, event, order):
with scopes_disabled():
op = order.positions.first()
payload = {
'country': 'DE',
'state': 'BW'
}
resp = token_client.patch(
'/api/v1/organizers/{}/events/{}/orderpositions/{}/'.format(
organizer.slug, event.slug, op.pk
), format='json', data=payload
)
assert resp.status_code == 400
@pytest.mark.django_db
def test_position_update_question_handling(token_client, organizer, event, order, question):
with scopes_disabled():
op = order.positions.first()
payload = {
'answers': [
{
'question': question.pk,
'answer': 'FOOBAR',
},
{
'question': question.pk,
'answer': 'FOOBAR',
},
]
}
resp = token_client.patch(
'/api/v1/organizers/{}/events/{}/orderpositions/{}/'.format(
organizer.slug, event.slug, op.pk
), format='json', data=payload
)
assert resp.status_code == 400
payload = {
'answers': [
{
'question': question.pk,
'answer': 'FOOBAR',
},
]
}
resp = token_client.patch(
'/api/v1/organizers/{}/events/{}/orderpositions/{}/'.format(
organizer.slug, event.slug, op.pk
), format='json', data=payload
)
assert resp.status_code == 200
with scopes_disabled():
assert op.answers.count() == 1
payload = {
'answers': [
]
}
resp = token_client.patch(
'/api/v1/organizers/{}/events/{}/orderpositions/{}/'.format(
organizer.slug, event.slug, op.pk
), format='json', data=payload
)
assert resp.status_code == 200
with scopes_disabled():
assert op.answers.count() == 0
r = token_client.post(
'/api/v1/upload',
data={
'media_type': 'image/png',
'file': ContentFile('file.png', 'invalid png content')
},
format='upload',
HTTP_CONTENT_DISPOSITION='attachment; filename="file.png"',
)
assert r.status_code == 201
file_id_png = r.data['id']
payload = {
'answers': [
{
"question": question.id,
"answer": file_id_png
}
]
}
question.type = Question.TYPE_FILE
question.save()
resp = token_client.patch(
'/api/v1/organizers/{}/events/{}/orderpositions/{}/'.format(
organizer.slug, event.slug, op.pk
), format='json', data=payload
)
assert resp.status_code == 200
with scopes_disabled():
answ = op.answers.get()
assert answ.file
assert answ.answer.startswith("file://")
payload = {
'answers': [
{
"question": question.id,
"answer": "file:keep"
}
]
}
question.type = Question.TYPE_FILE
question.save()
resp = token_client.patch(
'/api/v1/organizers/{}/events/{}/orderpositions/{}/'.format(
organizer.slug, event.slug, op.pk
), format='json', data=payload
)
assert resp.status_code == 200
with scopes_disabled():
answ = op.answers.get()
assert answ.file
assert answ.answer.startswith("file://")
@pytest.mark.django_db
def test_position_update_change_item(token_client, organizer, event, order, quota):
with scopes_disabled():
item2 = event.items.create(name="Budget Ticket", default_price=23)
quota.items.add(item2)
op = order.positions.first()
payload = {
'item': item2.pk,
}
assert op.item != item2
resp = token_client.patch(
'/api/v1/organizers/{}/events/{}/orderpositions/{}/'.format(
organizer.slug, event.slug, op.pk
), format='json', data=payload
)
assert resp.status_code == 200
op.refresh_from_db()
assert op.item == item2
@pytest.mark.django_db
def test_position_update_change_item_wrong_event(token_client, organizer, event, event2, order, quota):
with scopes_disabled():
item2 = event2.items.create(name="Budget Ticket", default_price=23)
quota.items.add(item2)
op = order.positions.first()
payload = {
'item': item2.pk,
}
assert op.item != item2
resp = token_client.patch(
'/api/v1/organizers/{}/events/{}/orderpositions/{}/'.format(
organizer.slug, event.slug, op.pk
), format='json', data=payload
)
assert resp.status_code == 400
assert 'object does not exist.' in str(resp.data)
@pytest.mark.django_db
def test_position_update_change_item_no_quota(token_client, organizer, event, order):
with scopes_disabled():
item2 = event.items.create(name="Budget Ticket", default_price=23)
op = order.positions.first()
payload = {
'item': item2.pk,
}
assert op.item != item2
resp = token_client.patch(
'/api/v1/organizers/{}/events/{}/orderpositions/{}/'.format(
organizer.slug, event.slug, op.pk
), format='json', data=payload
)
assert resp.status_code == 400
assert 'quota' in str(resp.data)
@pytest.mark.django_db
def test_position_update_change_item_variation(token_client, organizer, event, order, quota):
with scopes_disabled():
item2 = event.items.create(name="Budget Ticket", default_price=23)
v = item2.variations.create(value="foo")
quota.items.add(item2)
quota.variations.add(v)
op = order.positions.first()
payload = {
'item': item2.pk,
'variation': v.pk,
}
assert op.item != item2
resp = token_client.patch(
'/api/v1/organizers/{}/events/{}/orderpositions/{}/'.format(
organizer.slug, event.slug, op.pk
), format='json', data=payload
)
assert resp.status_code == 200
op.refresh_from_db()
assert op.item == item2
assert op.variation == v
@pytest.mark.django_db
def test_position_update_change_item_variation_required(token_client, organizer, event, order, quota):
with scopes_disabled():
item2 = event.items.create(name="Budget Ticket", default_price=23)
v = item2.variations.create(value="foo")
quota.items.add(item2)
quota.variations.add(v)
op = order.positions.first()
payload = {
'item': item2.pk,
}
assert op.item != item2
resp = token_client.patch(
'/api/v1/organizers/{}/events/{}/orderpositions/{}/'.format(
organizer.slug, event.slug, op.pk
), format='json', data=payload
)
assert resp.status_code == 400
assert 'variation' in str(resp.data)
@pytest.mark.django_db
def test_position_update_change_item_variation_mismatch(token_client, organizer, event, order, quota):
with scopes_disabled():
item2 = event.items.create(name="Budget Ticket", default_price=23)
v = item2.variations.create(value="foo")
item3 = event.items.create(name="Budget Ticket", default_price=23)
v3 = item3.variations.create(value="foo")
quota.items.add(item2)
quota.items.add(item3)
quota.variations.add(v)
quota.variations.add(v3)
op = order.positions.first()
payload = {
'item': item2.pk,
'variation': v3.pk,
}
assert op.item != item2
resp = token_client.patch(
'/api/v1/organizers/{}/events/{}/orderpositions/{}/'.format(
organizer.slug, event.slug, op.pk
), format='json', data=payload
)
assert resp.status_code == 400
assert 'variation' in str(resp.data)
@pytest.mark.django_db
def test_position_update_change_subevent(token_client, organizer, event, order, quota, item, subevent):
with scopes_disabled():
se2 = event.subevents.create(name="Foobar", date_from=datetime.datetime(2017, 12, 27, 10, 0, 0, tzinfo=UTC))
q2 = se2.quotas.create(name="foo", size=1, event=event)
q2.items.add(item)
op = order.positions.first()
op.subevent = subevent
op.save()
payload = {
'subevent': se2.pk,
}
resp = token_client.patch(
'/api/v1/organizers/{}/events/{}/orderpositions/{}/'.format(
organizer.slug, event.slug, op.pk
), format='json', data=payload
)
assert resp.status_code == 200
op.refresh_from_db()
assert op.subevent == se2
@pytest.mark.django_db
def test_position_update_change_subevent_quota_empty(token_client, organizer, event, order, quota, item, subevent):
with scopes_disabled():
se2 = event.subevents.create(name="Foobar", date_from=datetime.datetime(2017, 12, 27, 10, 0, 0, tzinfo=UTC))
q2 = se2.quotas.create(name="foo", size=0, event=event)
q2.items.add(item)
op = order.positions.first()
op.subevent = subevent
op.save()
payload = {
'subevent': se2.pk,
}
resp = token_client.patch(
'/api/v1/organizers/{}/events/{}/orderpositions/{}/'.format(
organizer.slug, event.slug, op.pk
), format='json', data=payload
)
assert resp.status_code == 400
assert 'quota' in str(resp.data)
@pytest.mark.django_db
def test_position_update_change_seat(token_client, organizer, event, order, quota, item, seat):
with scopes_disabled():
seat2 = event.seats.create(seat_number="A2", product=item, seat_guid="A2")
op = order.positions.first()
op.seat = seat
op.save()
payload = {
'seat': seat2.seat_guid,
}
resp = token_client.patch(
'/api/v1/organizers/{}/events/{}/orderpositions/{}/'.format(
organizer.slug, event.slug, op.pk
), format='json', data=payload
)
assert resp.status_code == 200
op.refresh_from_db()
assert op.seat == seat2
@pytest.mark.django_db
def test_position_update_unset_seat(token_client, organizer, event, order, quota, item, seat):
with scopes_disabled():
op = order.positions.first()
op.seat = seat
op.save()
payload = {
'seat': None,
}
resp = token_client.patch(
'/api/v1/organizers/{}/events/{}/orderpositions/{}/'.format(
organizer.slug, event.slug, op.pk
), format='json', data=payload
)
assert resp.status_code == 200
op.refresh_from_db()
assert op.seat is None
@pytest.mark.django_db
def test_position_update_change_seat_taken(token_client, organizer, event, order, quota, item, seat):
with scopes_disabled():
seat2 = event.seats.create(seat_number="A2", product=item, seat_guid="A2", blocked=True)
op = order.positions.first()
op.seat = seat
op.save()
payload = {
'seat': seat2.seat_guid,
}
resp = token_client.patch(
'/api/v1/organizers/{}/events/{}/orderpositions/{}/'.format(
organizer.slug, event.slug, op.pk
), format='json', data=payload
)
assert resp.status_code == 400
assert 'seat' in str(resp.data)
@pytest.mark.django_db
def test_position_update_change_subevent_keep_seat(token_client, organizer, event, order, quota, item, subevent, seat):
with scopes_disabled():
seat.subevent = subevent
seat.save()
se2 = event.subevents.create(name="Foobar", date_from=datetime.datetime(2017, 12, 27, 10, 0, 0, tzinfo=UTC))
seat2 = event.seats.create(seat_number="A1", product=item, seat_guid="A1", subevent=se2)
q2 = se2.quotas.create(name="foo", size=1, event=event)
q2.items.add(item)
op = order.positions.first()
op.subevent = subevent
op.seat = seat
op.save()
payload = {
'subevent': se2.pk,
}
resp = token_client.patch(
'/api/v1/organizers/{}/events/{}/orderpositions/{}/'.format(
organizer.slug, event.slug, op.pk
), format='json', data=payload
)
assert resp.status_code == 200
op.refresh_from_db()
assert op.subevent == se2
assert op.seat == seat2
@pytest.mark.django_db
def test_position_update_change_subevent_missing_seat(token_client, organizer, event, order, quota, item, subevent, seat):
with scopes_disabled():
seat.subevent = subevent
seat.save()
se2 = event.subevents.create(name="Foobar", date_from=datetime.datetime(2017, 12, 27, 10, 0, 0, tzinfo=UTC))
q2 = se2.quotas.create(name="foo", size=1, event=event)
q2.items.add(item)
op = order.positions.first()
op.subevent = subevent
op.seat = seat
op.save()
payload = {
'subevent': se2.pk,
}
resp = token_client.patch(
'/api/v1/organizers/{}/events/{}/orderpositions/{}/'.format(
organizer.slug, event.slug, op.pk
), format='json', data=payload
)
assert resp.status_code == 400
assert 'seat' in str(resp.data)
@pytest.mark.django_db
def test_position_update_change_price(token_client, organizer, event, order, quota):
with scopes_disabled():
op = order.positions.first()
payload = {
'price': Decimal('119.00')
}
resp = token_client.patch(
'/api/v1/organizers/{}/events/{}/orderpositions/{}/'.format(
organizer.slug, event.slug, op.pk
), format='json', data=payload
)
assert resp.status_code == 200
op.refresh_from_db()
assert op.price == Decimal('119.00')
assert op.tax_rate == Decimal('0.00')
assert op.tax_value == Decimal('0.00')
@pytest.mark.django_db
def test_position_update_change_price_and_tax_rule(token_client, organizer, event, order, quota):
with scopes_disabled():
op = order.positions.first()
tr = event.tax_rules.create(rate=19)
payload = {
'price': Decimal('119.00'),
'tax_rule': tr.pk
}
resp = token_client.patch(
'/api/v1/organizers/{}/events/{}/orderpositions/{}/'.format(
organizer.slug, event.slug, op.pk
), format='json', data=payload
)
assert resp.status_code == 200
op.refresh_from_db()
assert op.price == Decimal('119.00')
assert op.tax_rate == Decimal('19.00')
assert op.tax_value == Decimal('19.00')
assert op.tax_rule == tr
@pytest.mark.django_db
def test_position_add_simple(token_client, organizer, event, order, quota, item):
with scopes_disabled():
assert order.positions.count() == 1
payload = {
'order': order.code,
'item': item.pk,
}
resp = token_client.post(
'/api/v1/organizers/{}/events/{}/orderpositions/'.format(
organizer.slug, event.slug,
), format='json', data=payload
)
assert resp.status_code == 201
with scopes_disabled():
assert order.positions.count() == 2
op = order.positions.last()
assert op.item == item
assert op.price == item.default_price
assert op.positionid == 3
@pytest.mark.django_db
def test_position_add_price(token_client, organizer, event, order, quota, item):
with scopes_disabled():
assert order.positions.count() == 1
payload = {
'order': order.code,
'item': item.pk,
'price': '99.99'
}
resp = token_client.post(
'/api/v1/organizers/{}/events/{}/orderpositions/'.format(
organizer.slug, event.slug,
), format='json', data=payload
)
assert resp.status_code == 201
with scopes_disabled():
assert order.positions.count() == 2
op = order.positions.last()
assert op.item == item
assert op.price == Decimal('99.99')
assert op.positionid == 3
@pytest.mark.django_db
def test_position_add_subevent(token_client, organizer, event, order, quota, item, subevent):
with scopes_disabled():
assert order.positions.count() == 1
quota.subevent = subevent
quota.save()
payload = {
'order': order.code,
'item': item.pk,
'subevent': subevent.pk,
}
resp = token_client.post(
'/api/v1/organizers/{}/events/{}/orderpositions/'.format(
organizer.slug, event.slug,
), format='json', data=payload
)
assert resp.status_code == 201
with scopes_disabled():
assert order.positions.count() == 2
op = order.positions.last()
assert op.item == item
assert op.price == item.default_price
assert op.positionid == 3
assert op.subevent == subevent
@pytest.mark.django_db
def test_position_add_subevent_required(token_client, organizer, event, order, quota, item, subevent):
with scopes_disabled():
assert order.positions.count() == 1
payload = {
'order': order.code,
'item': item.pk,
}
resp = token_client.post(
'/api/v1/organizers/{}/events/{}/orderpositions/'.format(
organizer.slug, event.slug,
), format='json', data=payload
)
assert resp.status_code == 400
assert 'subevent' in str(resp.data)
@pytest.mark.django_db
def test_position_add_quota_empty(token_client, organizer, event, order, quota, item):
with scopes_disabled():
assert order.positions.count() == 1
quota.size = 1
quota.save()
payload = {
'order': order.code,
'item': item.pk,
}
resp = token_client.post(
'/api/v1/organizers/{}/events/{}/orderpositions/'.format(
organizer.slug, event.slug,
), format='json', data=payload
)
assert resp.status_code == 400
assert 'quota' in str(resp.data)
@pytest.mark.django_db
def test_position_add_seat(token_client, organizer, event, order, quota, item, seat):
with scopes_disabled():
assert order.positions.count() == 1
payload = {
'order': order.code,
'item': item.pk,
'seat': seat.seat_guid,
}
resp = token_client.post(
'/api/v1/organizers/{}/events/{}/orderpositions/'.format(
organizer.slug, event.slug,
), format='json', data=payload
)
assert resp.status_code == 201
with scopes_disabled():
assert order.positions.count() == 2
op = order.positions.last()
assert op.item == item
assert op.price == item.default_price
assert op.positionid == 3
assert op.seat == seat
@pytest.mark.django_db
def test_position_add_seat_required(token_client, organizer, event, order, quota, item, seat):
with scopes_disabled():
assert order.positions.count() == 1
payload = {
'order': order.code,
'item': item.pk,
}
resp = token_client.post(
'/api/v1/organizers/{}/events/{}/orderpositions/'.format(
organizer.slug, event.slug,
), format='json', data=payload
)
assert resp.status_code == 400
assert 'seat' in str(resp.data)
@pytest.mark.django_db
def test_position_add_addon_to(token_client, organizer, event, order, quota, item):
with scopes_disabled():
cat = event.categories.create(name="Workshops")
item2 = event.items.create(name="WS1", default_price=23, category=cat)
quota.items.add(item2)
item.addons.create(addon_category=cat)
assert order.positions.count() == 1
payload = {
'order': order.code,
'item': item2.pk,
'addon_to': 1,
}
resp = token_client.post(
'/api/v1/organizers/{}/events/{}/orderpositions/'.format(
organizer.slug, event.slug,
), format='json', data=payload
)
assert resp.status_code == 201
with scopes_disabled():
assert order.positions.count() == 2
op = order.positions.last()
assert op.positionid == 3
assert op.addon_to.positionid == 1
@pytest.mark.django_db
def test_position_add_addon_to_canceled_position(token_client, organizer, event, order, quota, item):
with scopes_disabled():
cat = event.categories.create(name="Workshops")
item2 = event.items.create(name="WS1", default_price=23, category=cat)
quota.items.add(item2)
item.addons.create(addon_category=cat)
assert order.positions.count() == 1
payload = {
'order': order.code,
'item': item2.pk,
'addon_to': 2,
}
resp = token_client.post(
'/api/v1/organizers/{}/events/{}/orderpositions/'.format(
organizer.slug, event.slug,
), format='json', data=payload
)
assert resp.status_code == 400
assert 'unknown position' in str(resp.data)
@pytest.mark.django_db
def test_position_add_addon_to_wrong_product(token_client, organizer, event, order, quota, item):
with scopes_disabled():
assert order.positions.count() == 1
payload = {
'order': order.code,
'item': item.pk,
'addon_to': 1,
}
resp = token_client.post(
'/api/v1/organizers/{}/events/{}/orderpositions/'.format(
organizer.slug, event.slug,
), format='json', data=payload
)
assert resp.status_code == 400
assert 'selected base position does not allow you to add this product as an add-on' in str(resp.data)
@pytest.mark.django_db
def test_position_add_and_set_info(token_client, organizer, event, order, question, quota, item):
with scopes_disabled():
assert order.positions.count() == 1
payload = {
'order': order.code,
'item': item.pk,
'attendee_name': 'John Doe',
'answers': [
{
'question': question.pk,
'answer': 'FOOBAR',
},
]
}
resp = token_client.post(
'/api/v1/organizers/{}/events/{}/orderpositions/'.format(
organizer.slug, event.slug,
), format='json', data=payload
)
assert resp.status_code == 201
with scopes_disabled():
assert order.positions.count() == 2
op = order.positions.last()
assert op.item == item
assert op.price == item.default_price
assert op.positionid == 3
assert op.attendee_name == 'John Doe'
assert op.answers.count() == 1
@pytest.mark.django_db
def test_order_change_patch(token_client, organizer, event, order, quota):
with scopes_disabled():
item2 = event.items.create(name="Budget Ticket", default_price=23)
quota.items.add(item2)
p = order.positions.first()
f = order.fees.first()
payload = {
'patch_positions': [
{
'position': p.pk,
'body': {
'item': item2.pk,
'price': '99.44',
},
},
],
'patch_fees': [
{
'fee': f.pk,
'body': {
'value': '10.00',
}
}
]
}
resp = token_client.post(
'/api/v1/organizers/{}/events/{}/orders/{}/change/'.format(
organizer.slug, event.slug, order.code,
), format='json', data=payload
)
assert resp.status_code == 200
with scopes_disabled():
p.refresh_from_db()
assert p.price == Decimal('99.44')
assert p.item == item2
f.refresh_from_db()
assert f.value == Decimal('10.00')
@pytest.mark.django_db
def test_order_change_cancel_and_create(token_client, organizer, event, order, quota, item):
with scopes_disabled():
p = order.positions.first()
f = order.fees.first()
quota.size = 0
quota.save()
payload = {
'cancel_positions': [
{
'position': p.pk,
},
],
'create_positions': [
{
'item': item.pk,
'price': '99.99'
},
],
'cancel_fees': [
{
'fee': f.pk,
}
]
}
resp = token_client.post(
'/api/v1/organizers/{}/events/{}/orders/{}/change/'.format(
organizer.slug, event.slug, order.code,
), format='json', data=payload
)
assert resp.status_code == 200
with scopes_disabled():
p.refresh_from_db()
assert p.canceled
p_new = order.positions.last()
assert p_new != p
assert p_new.item == item
assert p_new.price == Decimal('99.99')
f.refresh_from_db()
assert f.canceled
@pytest.mark.django_db
def test_order_change_send_email_reissue_invoice(token_client, organizer, event, order, quota, item):
djmail.outbox = []
with scopes_disabled():
f = order.fees.first()
generate_invoice(order)
payload = {
'send_email': False,
'reissue_invoice': True,
'create_positions': [
{
'item': item.pk,
'price': '99.99'
},
],
}
resp = token_client.post(
'/api/v1/organizers/{}/events/{}/orders/{}/change/'.format(
organizer.slug, event.slug, order.code,
), format='json', data=payload
)
assert resp.status_code == 200
assert len(djmail.outbox) == 0
with scopes_disabled():
assert order.invoices.count() == 3
payload = {
'send_email': True,
'reissue_invoice': False,
'cancel_fees': [
{
'fee': f.pk,
}
]
}
resp = token_client.post(
'/api/v1/organizers/{}/events/{}/orders/{}/change/'.format(
organizer.slug, event.slug, order.code,
), format='json', data=payload
)
assert resp.status_code == 200
assert len(djmail.outbox) == 1
with scopes_disabled():
assert order.invoices.count() == 3
@pytest.mark.django_db
def test_order_change_recalculate_taxes(token_client, organizer, event, order, quota, item):
djmail.outbox = []
with scopes_disabled():
tax_rule = event.tax_rules.create(rate=7)
p = order.positions.first()
p.tax_rule = tax_rule
p.save()
assert p.tax_rate == 0
payload = {
'recalculate_taxes': 'keep_gross',
}
resp = token_client.post(
'/api/v1/organizers/{}/events/{}/orders/{}/change/'.format(
organizer.slug, event.slug, order.code,
), format='json', data=payload
)
assert resp.status_code == 200
with scopes_disabled():
p.refresh_from_db()
assert p.tax_rule == tax_rule
assert p.tax_rate == Decimal('7.00')
assert p.price == Decimal('23.00')
assert p.tax_value == Decimal('1.50')
tax_rule.rate = 10
tax_rule.save()
payload = {
'recalculate_taxes': 'keep_net',
}
resp = token_client.post(
'/api/v1/organizers/{}/events/{}/orders/{}/change/'.format(
organizer.slug, event.slug, order.code,
), format='json', data=payload
)
assert resp.status_code == 200
with scopes_disabled():
p.refresh_from_db()
assert p.tax_rule == tax_rule
assert p.tax_rate == Decimal('10.00')
assert p.price == Decimal('23.65')
assert p.tax_value == Decimal('2.15')
@pytest.mark.django_db
def test_order_change_split(token_client, organizer, event, order):
djmail.outbox = []
with scopes_disabled():
p_canceled = order.all_positions.filter(canceled=True).first()
p_canceled.canceled = False
p_canceled.save()
assert event.orders.count() == 1
payload = {
'split_positions': [
{'position': p_canceled.pk}
]
}
resp = token_client.post(
'/api/v1/organizers/{}/events/{}/orders/{}/change/'.format(
organizer.slug, event.slug, order.code,
), format='json', data=payload
)
assert resp.status_code == 200
with scopes_disabled():
assert event.orders.count() == 2
@pytest.mark.django_db
def test_order_change_invalid_input(token_client, organizer, event, order, quota, item, item2):
djmail.outbox = []
with scopes_disabled():
tax_rule = event.tax_rules.create(rate=7)
p = order.positions.first()
p_canceled = order.all_positions.filter(canceled=True).first()
f_canceled = order.all_fees.filter(canceled=True).first()
p.tax_rule = tax_rule
p.save()
assert p.tax_rate == 0
payload = {
'cancel_fees': [
{'fee': f_canceled.pk}
]
}
resp = token_client.post(
'/api/v1/organizers/{}/events/{}/orders/{}/change/'.format(
organizer.slug, event.slug, order.code,
), format='json', data=payload
)
assert 'does not exist' in str(resp.data)
assert resp.status_code == 400
payload = {
'patch_positions': [
{'position': p_canceled.pk, 'body': {'price': '99.00'}}
],
}
resp = token_client.post(
'/api/v1/organizers/{}/events/{}/orders/{}/change/'.format(
organizer.slug, event.slug, order.code,
), format='json', data=payload
)
assert 'does not exist' in str(resp.data)
assert resp.status_code == 400
payload = {
'patch_positions': [
{'position': p.pk, 'body': {'item': item2.pk}}
],
}
resp = token_client.post(
'/api/v1/organizers/{}/events/{}/orders/{}/change/'.format(
organizer.slug, event.slug, order.code,
), format='json', data=payload
)
assert 'does not exist' in str(resp.data)
assert resp.status_code == 400
payload = {
'cancel_positions': [
{'position': p.pk}
],
}
resp = token_client.post(
'/api/v1/organizers/{}/events/{}/orders/{}/change/'.format(
organizer.slug, event.slug, order.code,
), format='json', data=payload
)
assert 'empty' in str(resp.data)
assert resp.status_code == 400
payload = {
'split_positions': [
{'position': p.pk}
],
}
resp = token_client.post(
'/api/v1/organizers/{}/events/{}/orders/{}/change/'.format(
organizer.slug, event.slug, order.code,
), format='json', data=payload
)
assert 'empty' in str(resp.data)
assert resp.status_code == 400
payload = {
'patch_positions': [
{'position': p.pk, 'body': {}},
{'position': p.pk, 'body': {}},
],
}
resp = token_client.post(
'/api/v1/organizers/{}/events/{}/orders/{}/change/'.format(
organizer.slug, event.slug, order.code,
), format='json', data=payload
)
assert 'twice' in str(resp.data)
assert resp.status_code == 400
| 32.955683 | 122 | 0.585217 | 7,189 | 63,209 | 4.994019 | 0.068855 | 0.042588 | 0.033007 | 0.046209 | 0.827336 | 0.803047 | 0.780514 | 0.755585 | 0.718651 | 0.69517 | 0 | 0.024338 | 0.271306 | 63,209 | 1,917 | 123 | 32.972874 | 0.755124 | 0.018415 | 0 | 0.648138 | 0 | 0 | 0.165989 | 0.071716 | 0 | 0 | 0 | 0 | 0.143266 | 1 | 0.038395 | false | 0 | 0.008023 | 0.001719 | 0.051003 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6 |
0f06e5693915cc019b199945f132170a6ccdfb3f | 3,808 | py | Python | authors/apps/article/tests/test_like_an_article.py | andela/-ah-orcas | 22aaff9eaf89504a79905042959bb23a6e71b421 | [
"BSD-3-Clause"
] | null | null | null | authors/apps/article/tests/test_like_an_article.py | andela/-ah-orcas | 22aaff9eaf89504a79905042959bb23a6e71b421 | [
"BSD-3-Clause"
] | 48 | 2018-10-23T10:09:50.000Z | 2022-03-11T23:33:12.000Z | authors/apps/article/tests/test_like_an_article.py | andela/ah-orcas | 22aaff9eaf89504a79905042959bb23a6e71b421 | [
"BSD-3-Clause"
] | null | null | null | from .base_like_test import BaseLikeTest
import os
from rest_framework import status
class TestLikeArticle(BaseLikeTest):
"""Test like article class"""
def test_like_article_without_token(self):
"""
Test whether like request without token will fail
"""
response = self.client.post(self.like_url, self.data, format='json')
self.assertIn(
"Authentication credentials were not provided", str(
response.data))
self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN)
def test_like_article_of_article_not_found(self):
"""test whether like request with
an article slug that doesn't exist will fail"""
slug = "s-sss-ss-s"
self.like_url = os.environ["URL"] + \
"api/article/" + "like/" + slug + "/"
self.client.credentials(HTTP_AUTHORIZATION='Bearer ' + self.token)
response = self.client.post(self.like_url, self.data, format='json')
self.assertIn("No article found", str(response.data))
self.assertEqual(response.status_code, status.HTTP_204_NO_CONTENT)
def test_like_article(self):
"""
test whether like request with
an article slug that doesn't exist will fail
"""
self.like_url = os.environ["URL"] + \
"api/article/" + "like/" + self.slug + "/"
self.client.credentials(HTTP_AUTHORIZATION='Bearer ' + self.token)
response = self.client.post(self.like_url, self.data, format='json')
self.assertIn("article successfully liked", str(response.data))
self.assertEqual(response.status_code, status.HTTP_200_OK)
def test_like_twice_article(self):
"""
test whether like request to an
already liked article will unlike it
"""
self.like_url = os.environ["URL"] + \
"api/article/" + "like/" + self.slug + "/"
self.client.credentials(HTTP_AUTHORIZATION='Bearer ' + self.token)
self.client.post(self.like_url, self.data, format='json')
response = self.client.post(self.like_url, self.data, format='json')
self.assertIn("article successfully unliked", str(response.data))
self.assertEqual(response.status_code, status.HTTP_200_OK)
def test_get_likes_article_with_no_likes(self):
"""
test whether quality
"""
self.like_url = os.environ["URL"] + \
"api/article/" + "like/" + self.slug + "/"
self.client.credentials(HTTP_AUTHORIZATION='Bearer ' + self.token)
response = self.client.get(self.like_url, format='json')
self.assertIn("0", str(response.data))
self.assertEqual(response.status_code, status.HTTP_200_OK)
def test_get_likes_article(self):
"""
test get likes of an article
"""
self.like_url = os.environ["URL"] + \
"api/article/" + "like/" + self.slug + "/"
self.client.credentials(HTTP_AUTHORIZATION='Bearer ' + self.token)
response = self.client.post(self.like_url, self.data, format='json')
response = self.client.get(self.like_url, format='json')
self.assertIn("1", str(response.data))
self.assertEqual(response.status_code, status.HTTP_200_OK)
def test_get_like_article_of_article_not_found(self):
"""
test like article with a non-existing slug
"""
slug = "s-sss-ss-s"
self.like_url = os.environ["URL"] + \
"api/article/" + "like/" + slug + "/"
self.client.credentials(HTTP_AUTHORIZATION='Bearer ' + self.token)
response = self.client.get(self.like_url, format='json')
self.assertIn("No article found", str(response.data))
self.assertEqual(response.status_code, status.HTTP_204_NO_CONTENT)
| 40.946237 | 76 | 0.635242 | 470 | 3,808 | 4.980851 | 0.16383 | 0.064075 | 0.070483 | 0.065784 | 0.83255 | 0.821444 | 0.804357 | 0.804357 | 0.777018 | 0.777018 | 0 | 0.007923 | 0.237658 | 3,808 | 92 | 77 | 41.391304 | 0.798484 | 0.101628 | 0 | 0.642857 | 0 | 0 | 0.109606 | 0 | 0 | 0 | 0 | 0 | 0.25 | 1 | 0.125 | false | 0 | 0.053571 | 0 | 0.196429 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6 |
0f4876f8b3ff7ddeaea950bf5dc73a1cdccc5b76 | 111,702 | py | Python | tests/test_plotting.py | WeilerP/cellrank | c8c2b9f6bd2448861fb414435aee7620ca5a0bad | [
"BSD-3-Clause"
] | 172 | 2020-03-19T19:50:53.000Z | 2022-03-28T09:36:04.000Z | tests/test_plotting.py | WeilerP/cellrank | c8c2b9f6bd2448861fb414435aee7620ca5a0bad | [
"BSD-3-Clause"
] | 702 | 2020-03-19T08:09:04.000Z | 2022-03-30T09:55:14.000Z | tests/test_plotting.py | WeilerP/cellrank | c8c2b9f6bd2448861fb414435aee7620ca5a0bad | [
"BSD-3-Clause"
] | 17 | 2020-04-07T03:11:02.000Z | 2022-02-02T20:39:16.000Z | from typing import Tuple, Union, Callable
import os
import pytest
from pathlib import Path
from _helpers import (
gamr_skip,
create_model,
create_failed_model,
resize_images_to_same_sizes,
)
from packaging import version
import scvelo as scv
import cellrank as cr
from anndata import AnnData
from cellrank.tl import Lineage
from cellrank._key import Key
from cellrank.ul.models import GAMR
from cellrank.tl.kernels import VelocityKernel, PseudotimeKernel, ConnectivityKernel
from cellrank.tl.estimators import GPCCA, CFLARE
import numpy as np
import pandas as pd
from scipy.sparse import issparse
from pandas.api.types import is_categorical_dtype
import matplotlib.cm as cm
import matplotlib.pyplot as plt
from matplotlib.testing import setup
from matplotlib.testing.compare import compare_images
setup()
HERE: str = Path(__file__).parent
GT_FIGS = HERE / "_ground_truth_figures"
FIGS = HERE / "figures"
DPI = 40
TOL = 150
# both are for `50` adata
GENES = [
"Tcea1",
"Tmeff2",
"Ndufb3",
"Rpl37a",
"Arpc2",
"Ptma",
"Cntnap5b",
"Cntnap5a",
"Mpc2",
"2010300C02Rik",
]
RAW_GENES = [
"Synpr",
"Rps24",
"Erc2",
"Mbnl2",
"Thoc7",
"Itm2b",
"Pcdh9",
"Fgf14",
"Rpl37",
"Cdh9",
]
cr.settings.figdir = FIGS
scv.settings.figdir = str(FIGS)
scv.set_figure_params(transparent=True)
try:
from importlib_metadata import version as get_version
except ImportError:
# >=Python3.8
from importlib.metadata import version as get_version
scvelo_paga_skip = pytest.mark.skipif(
version.parse(get_version(scv.__name__)) < version.parse("0.1.26.dev189+gc441c72"),
reason="scVelo < `0.1.26.dev189+gc441c72` supports new PAGA, including node colors and confidence",
)
del version, get_version
def compare(
*,
kind: str = "adata",
dirname: Union[str, Path] = None,
tol: int = TOL,
) -> Callable:
def _compare_images(
expected_path: Union[str, Path], actual_path: Union[str, Path]
) -> None:
resize_images_to_same_sizes(expected_path, actual_path)
res = compare_images(expected_path, actual_path, tol=tol)
assert res is None, res
# TODO: refactor (we can remove the prefix from scvelo
def _prepare_fname(func: Callable) -> Tuple[str, str]:
fpath = f"{func.__name__.replace('test_', '')}"
# scvelo saves figures as pdf
return fpath, str(fpath[7:] + ".png" if fpath.startswith("scvelo_") else fpath)
def _assert_equal(fpath: str) -> None:
if not fpath.endswith(".png"):
fpath += ".png"
if dirname is not None:
for file in os.listdir(FIGS / dirname):
if "-diff" in file:
continue
_compare_images(GT_FIGS / dirname / file, FIGS / dirname / file)
else:
_compare_images(GT_FIGS / fpath, FIGS / fpath)
def compare_cflare_fwd(
func: Callable,
) -> Callable: # mustn't use functools.wraps - it think's the fact that `adata` is fixture
def decorator(self, adata_cflare_fwd) -> None:
adata, mc = adata_cflare_fwd
fpath, path = _prepare_fname(func)
func(self, adata if kind == "adata" else mc, path)
_assert_equal(fpath)
return decorator
def compare_gpcca_fwd(func: Callable) -> Callable:
def decorator(self, adata_gpcca_fwd) -> None:
adata, gpcca = adata_gpcca_fwd
fpath, path = _prepare_fname(func)
func(self, adata if kind == "adata" else gpcca, path)
_assert_equal(fpath)
return decorator
def compare_gpcca_bwd(func: Callable) -> Callable:
def decorator(self, adata_gpcca_bwd) -> None:
adata, gpcca = adata_gpcca_bwd
fpath, path = _prepare_fname(func)
func(self, adata, path)
_assert_equal(fpath)
return decorator
def compare_lineage(func: Callable):
def decorator(self, lineage):
path, fpath = _prepare_fname(func)
func(self, lineage, path)
_assert_equal(fpath)
assert (
kind == "lineage"
), "Function `compare_lineage` only supports `kind='lineage'`."
return decorator
def compare_gamr(func: Callable):
def decorator(self, gamr_model: GAMR):
path, fpath = _prepare_fname(func)
func(self, gamr_model, path)
_assert_equal(fpath)
assert kind == "gamr", "Function `compare_gamr` only supports `kind='gamr'`."
return decorator
if kind not in ("adata", "cflare", "gpcca", "lineage", "bwd", "gamr"):
raise ValueError(
f"Invalid kind `{kind!r}`. Valid options are: `['adata', 'cflare', 'gpcca', 'lineage', 'bwd', 'gamr']`."
)
if kind == "adata":
# `kind='adata'` - don't changes this, otherwise some tests in `TestHighLvlStates` are meaningless
return compare_gpcca_fwd
if kind == "cflare":
return compare_cflare_fwd
if kind == "gpcca":
return compare_gpcca_fwd
if kind == "lineage":
return compare_lineage
if kind == "bwd":
return compare_gpcca_bwd
if kind == "gamr":
return compare_gamr
raise NotImplementedError(f"Invalid kind `{kind!r}`.")
class TestClusterFates:
@compare()
def test_bar(self, adata: AnnData, fpath: str):
cr.pl.cluster_fates(
adata, cluster_key="clusters", mode="bar", dpi=DPI, save=fpath
)
@compare(kind="bwd")
def test_bar_bwd(self, adata: AnnData, fpath: str):
cr.pl.cluster_fates(
adata,
cluster_key="clusters",
backward=True,
mode="bar",
dpi=DPI,
save=fpath,
)
@compare()
def test_bar_cluster_subset(self, adata: AnnData, fpath: str):
cr.pl.cluster_fates(
adata,
cluster_key="clusters",
mode="bar",
clusters=["Astrocytes", "GABA"],
dpi=DPI,
save=fpath,
)
@compare()
def test_bar_lineage_subset(self, adata: AnnData, fpath: str):
cr.pl.cluster_fates(
adata,
cluster_key="clusters",
mode="bar",
lineages=["0"],
dpi=DPI,
save=fpath,
)
@compare(tol=250)
def test_paga_pie(self, adata: AnnData, fpath: str):
cr.pl.cluster_fates(
adata, cluster_key="clusters", mode="paga_pie", dpi=DPI, save=fpath
)
@compare(tol=250)
def test_paga_pie_title(self, adata: AnnData, fpath: str):
cr.pl.cluster_fates(
adata,
cluster_key="clusters",
mode="paga_pie",
title="foo bar baz",
dpi=DPI,
save=fpath,
)
@scvelo_paga_skip
@compare()
def test_paga_pie_embedding(self, adata: AnnData, fpath: str):
cr.pl.cluster_fates(
adata,
cluster_key="clusters",
mode="paga_pie",
basis="umap",
dpi=DPI,
save=fpath,
)
@scvelo_paga_skip
@compare()
def test_paga(self, adata: AnnData, fpath: str):
cr.pl.cluster_fates(
adata, cluster_key="clusters", mode="paga", dpi=DPI, save=fpath
)
@scvelo_paga_skip
@compare()
def test_paga_lineage_subset(self, adata: AnnData, fpath: str):
cr.pl.cluster_fates(
adata,
cluster_key="clusters",
mode="paga",
lineages=["0"],
dpi=DPI,
save=fpath,
)
@compare()
def test_violin(self, adata: AnnData, fpath: str):
cr.pl.cluster_fates(
adata, cluster_key="clusters", mode="violin", dpi=DPI, save=fpath
)
@compare()
def test_violin_no_cluster_key(self, adata: AnnData, fpath: str):
cr.pl.cluster_fates(adata, mode="violin", cluster_key=None, dpi=DPI, save=fpath)
@compare()
def test_violin_cluster_subset(self, adata: AnnData, fpath: str):
cr.pl.cluster_fates(
adata, cluster_key="clusters", mode="violin", dpi=DPI, save=fpath
)
@compare()
def test_violin_lineage_subset(self, adata: AnnData, fpath: str):
cr.pl.cluster_fates(
adata,
cluster_key="clusters",
mode="violin",
lineages=["1"],
dpi=DPI,
save=fpath,
)
@compare()
def test_violin_lineage_subset(self, adata: AnnData, fpath: str):
cr.pl.cluster_fates(
adata,
cluster_key="clusters",
mode="violin",
lineages=["1"],
dpi=DPI,
save=fpath,
)
@compare()
def test_paga_pie_legend_simple(self, adata: AnnData, fpath: str):
cr.pl.cluster_fates(
adata,
cluster_key="clusters",
mode="paga_pie",
save=fpath,
dpi=DPI,
legend_kwargs=(dict(loc="top")),
)
@scvelo_paga_skip
@compare()
def test_paga_pie_legend_position(self, adata: AnnData, fpath: str):
cr.pl.cluster_fates(
adata,
cluster_key="clusters",
mode="paga_pie",
basis="umap",
save=fpath,
dpi=DPI,
legend_kwargs=(dict(loc="lower")),
legend_loc="upper",
)
@scvelo_paga_skip
@compare()
def test_paga_pie_no_legend(self, adata: AnnData, fpath: str):
cr.pl.cluster_fates(
adata,
cluster_key="clusters",
mode="paga_pie",
basis="umap",
save=fpath,
dpi=DPI,
legend_kwargs=(dict(loc=None)),
legend_loc=None,
)
@scvelo_paga_skip
@compare()
def test_paga_pie_only_abs_prob(self, adata: AnnData, fpath: str):
cr.pl.cluster_fates(
adata,
cluster_key="clusters",
mode="paga_pie",
basis="umap",
save=fpath,
dpi=DPI,
legend_kwargs=(dict(loc="center")),
legend_loc=None,
)
@scvelo_paga_skip
@compare()
def test_paga_pie_only_clusters(self, adata: AnnData, fpath: str):
cr.pl.cluster_fates(
adata,
cluster_key="clusters",
mode="paga_pie",
basis="umap",
save=fpath,
dpi=DPI,
legend_kwargs=(dict(loc=None)),
legend_loc="on data",
)
@scvelo_paga_skip
@compare()
def test_paga_pie_legend_position_out(self, adata: AnnData, fpath: str):
cr.pl.cluster_fates(
adata,
cluster_key="clusters",
mode="paga_pie",
basis="umap",
save=fpath,
dpi=DPI,
legend_kwargs=(dict(loc="lower left out")),
legend_loc="center right out",
)
def test_invalid_mode(self, adata_cflare_fwd):
adata, _ = adata_cflare_fwd
with pytest.raises(ValueError):
cr.pl.cluster_fates(
adata,
cluster_key="clusters",
mode="foobar",
)
def test_paga_pie_wrong_legend_kind_1(self, adata_cflare_fwd):
adata, _ = adata_cflare_fwd
with pytest.raises(ValueError):
cr.pl.cluster_fates(
adata,
cluster_key="clusters",
mode="paga_pie",
legend_kwargs=(dict(loc="foo")),
)
def test_paga_pie_wrong_legend_kind_2(self, adata_cflare_fwd):
adata, _ = adata_cflare_fwd
with pytest.raises(ValueError):
cr.pl.cluster_fates(
adata,
cluster_key="clusters",
mode="paga_pie",
legend_kwargs=(dict(loc="lower foo")),
)
def test_paga_pie_wrong_legend_kind_3(self, adata_cflare_fwd):
adata, _ = adata_cflare_fwd
with pytest.raises(ValueError):
cr.pl.cluster_fates(
adata,
cluster_key="clusters",
mode="paga_pie",
legend_kwargs=(dict(loc="lower left bar")),
)
def test_paga_pie_wrong_legend_kind_4(self, adata_cflare_fwd):
adata, _ = adata_cflare_fwd
with pytest.raises(ValueError):
cr.pl.cluster_fates(
adata,
cluster_key="clusters",
mode="paga_pie",
legend_kwargs=(dict(loc="lower left foo bar")),
)
@compare()
def test_mode_heatmap(self, adata: AnnData, fpath: str):
cr.pl.cluster_fates(
adata, cluster_key="clusters", mode="heatmap", dpi=DPI, save=fpath
)
@compare()
def test_mode_heatmap_format(self, adata: AnnData, fpath: str):
cr.pl.cluster_fates(
adata,
cluster_key="clusters",
mode="heatmap",
fmt=".10f",
dpi=DPI,
save=fpath,
)
@compare()
def test_mode_heatmap_title(self, adata: AnnData, fpath: str):
cr.pl.cluster_fates(
adata,
cluster_key="clusters",
mode="heatmap",
title="foo",
dpi=DPI,
save=fpath,
)
@compare()
def test_mode_heatmap_cmap(self, adata: AnnData, fpath: str):
cr.pl.cluster_fates(
adata,
cluster_key="clusters",
mode="heatmap",
cmap="inferno",
dpi=DPI,
save=fpath,
)
@compare()
def test_mode_heatmap_xticks_rotation(self, adata: AnnData, fpath: str):
cr.pl.cluster_fates(
adata,
cluster_key="clusters",
mode="heatmap",
xrot=45,
dpi=DPI,
save=fpath,
)
@compare()
def test_mode_heatmap_clusters(self, adata: AnnData, fpath: str):
cr.pl.cluster_fates(
adata,
cluster_key="clusters",
mode="heatmap",
clusters=["Astrocytes", "GABA"],
dpi=DPI,
save=fpath,
)
@compare()
def test_mode_heatmap_lineages(self, adata: AnnData, fpath: str):
cr.pl.cluster_fates(
adata,
cluster_key="clusters",
mode="heatmap",
lineages=["0"],
dpi=DPI,
save=fpath,
)
@compare()
def test_mode_clustermap(self, adata: AnnData, fpath: str):
cr.pl.cluster_fates(
adata, cluster_key="clusters", mode="clustermap", dpi=DPI, save=fpath
)
@compare()
def test_mode_clustermap_format(self, adata: AnnData, fpath: str):
cr.pl.cluster_fates(
adata,
cluster_key="clusters",
mode="clustermap",
fmt=".10f",
dpi=DPI,
save=fpath,
)
class TestClusterLineage:
@compare()
def test_cluster_lineage(self, adata: AnnData, fpath: str):
model = create_model(adata)
cr.pl.cluster_lineage(
adata,
model,
GENES[:10],
"1",
random_state=0,
time_key="latent_time",
dpi=DPI,
save=fpath,
)
@compare(kind="bwd")
def test_cluster_lineage_bwd(self, adata: AnnData, fpath: str):
model = create_model(adata)
cr.pl.cluster_lineage(
adata,
model,
GENES[:10],
"0",
random_state=0,
backward=True,
time_key="latent_time",
dpi=DPI,
save=fpath,
)
@compare()
def test_cluster_lineage_raw(self, adata: AnnData, fpath: str):
model = create_model(adata)
cr.pl.cluster_lineage(
adata,
model,
RAW_GENES[:5],
"1",
random_state=0,
time_key="latent_time",
dpi=DPI,
save=fpath,
use_raw=True,
)
@compare()
def test_cluster_lineage_no_norm(self, adata: AnnData, fpath: str):
model = create_model(adata)
cr.pl.cluster_lineage(
adata,
model,
GENES[:10],
"1",
random_state=0,
time_key="latent_time",
norm=False,
dpi=DPI,
save=fpath,
)
@compare()
def test_cluster_lineage_data_key(self, adata: AnnData, fpath: str):
model = create_model(adata)
cr.pl.cluster_lineage(
adata,
model,
GENES[:10],
"1",
random_state=0,
time_key="latent_time",
data_key="Ms",
norm=False,
dpi=DPI,
save=fpath,
)
@compare()
def test_cluster_lineage_random_state(self, adata: AnnData, fpath: str):
model = create_model(adata)
cr.pl.cluster_lineage(
adata,
model,
GENES[:10],
"1",
time_key="latent_time",
random_state=42,
dpi=DPI,
save=fpath,
)
@compare()
def test_cluster_lineage_leiden(self, adata: AnnData, fpath: str):
model = create_model(adata)
cr.pl.cluster_lineage(
adata,
model,
GENES[:10],
"1",
random_state=0,
time_key="latent_time",
dpi=DPI,
save=fpath,
)
@compare()
def test_cluster_lineage_2_failed_genes(self, adata: AnnData, fpath: str):
fm = create_failed_model(adata)
cr.pl.cluster_lineage(
adata,
{GENES[0]: fm, GENES[5]: fm, "*": fm.model},
GENES[:10],
"1",
random_state=0,
time_key="latent_time",
key="foobar",
dpi=DPI,
save=fpath,
)
assert isinstance(adata.uns["foobar"], AnnData)
assert adata.uns["foobar"].shape == (8, 200)
def test_cluster_lineage_returns_fitted_models(self, adata_cflare: AnnData):
fm = create_failed_model(adata_cflare)
models = cr.pl.cluster_lineage(
adata_cflare,
{GENES[0]: fm, "*": fm.model},
GENES[:10],
"1",
random_state=0,
time_key="latent_time",
return_models=True,
)
models = pd.DataFrame(models).T
np.testing.assert_array_equal(models.index, GENES[:10])
np.testing.assert_array_equal(models.columns, ["1"])
assert isinstance(models.loc[GENES[0], "1"], cr.ul.models.FailedModel)
mask = models.astype(bool)
assert not mask.loc[GENES[0], "1"]
mask.loc[GENES[0], "1"] = True
assert np.all(mask)
def test_cluster_lineage_random_state_same_pca(self, adata_cflare: AnnData):
model = create_model(adata_cflare)
cr.pl.cluster_lineage(
adata_cflare,
model,
GENES[:10],
"1",
time_key="latent_time",
random_state=42,
key="foo",
)
cr.pl.cluster_lineage(
adata_cflare,
model,
GENES[:10],
"1",
time_key="latent_time",
random_state=42,
key="bar",
)
np.allclose(
adata_cflare.uns["foo"].obsm["X_pca"], adata_cflare.uns["bar"].obsm["X_pca"]
)
def test_cluster_lineage_writes(self, adata_cflare: AnnData):
model = create_model(adata_cflare)
cr.pl.cluster_lineage(adata_cflare, model, GENES[:10], "0", n_test_points=200)
assert isinstance(adata_cflare.uns["lineage_0_trend"], AnnData)
assert adata_cflare.uns["lineage_0_trend"].shape == (10, 200)
assert is_categorical_dtype(adata_cflare.uns["lineage_0_trend"].obs["clusters"])
def test_cluster_lineage_key(self, adata_cflare: AnnData):
model = create_model(adata_cflare)
cr.pl.cluster_lineage(
adata_cflare, model, GENES[:10], "0", n_test_points=200, key="foobar"
)
assert isinstance(adata_cflare.uns["foobar"], AnnData)
assert adata_cflare.uns["foobar"].shape == (10, 200)
assert is_categorical_dtype(adata_cflare.uns["foobar"].obs["clusters"])
@compare()
def test_cluster_lineage_covariates(self, adata: AnnData, fpath: str):
model = create_model(adata)
cr.pl.cluster_lineage(
adata,
model,
GENES[:10],
"1",
covariate_key=["clusters", "latent_time"],
random_state=0,
time_key="latent_time",
dpi=DPI,
save=fpath,
)
@compare()
def test_cluster_lineage_covariates_cmap(self, adata: AnnData, fpath: str):
model = create_model(adata)
cr.pl.cluster_lineage(
adata,
model,
GENES[:10],
"1",
covariate_key="latent_time",
cmap="inferno",
random_state=0,
time_key="latent_time",
dpi=DPI,
save=fpath,
)
@compare()
def test_cluster_lineage_covariates_ratio(self, adata: AnnData, fpath: str):
model = create_model(adata)
cr.pl.cluster_lineage(
adata,
model,
GENES[:10],
"1",
covariate_key="latent_time",
ratio=0.25,
random_state=0,
time_key="latent_time",
dpi=DPI,
save=fpath,
)
@compare()
def test_cluster_lineage_gene_symbols(self, adata: AnnData, fpath: str):
model = create_model(adata)
cr.pl.cluster_lineage(
adata,
model,
[f"{g}:gs" for g in GENES[:10]],
"1",
gene_symbols="symbol",
random_state=0,
time_key="latent_time",
dpi=DPI,
save=fpath,
)
class TestHeatmap:
@compare(dirname="heatmap_lineages")
def test_heatmap_lineages(self, adata: AnnData, fpath: str):
model = create_model(adata)
cr.pl.heatmap(
adata,
model,
GENES[:10],
mode="lineages",
time_key="latent_time",
dpi=DPI,
save=fpath,
)
@compare(kind="bwd", dirname="heatmap_lineages_bwd")
def test_heatmap_lineages_bwd(self, adata: AnnData, fpath: str):
model = create_model(adata)
cr.pl.heatmap(
adata,
model,
GENES[:10],
backward=True,
mode="lineages",
time_key="latent_time",
dpi=DPI,
save=fpath,
)
@compare(dirname="heatmap_lineages_raw")
def test_heatmap_lineages_raw(self, adata: AnnData, fpath: str):
model = create_model(adata)
cr.pl.heatmap(
adata,
model,
RAW_GENES[:5],
mode="lineages",
time_key="latent_time",
use_raw=True,
dpi=DPI,
save=fpath,
)
@compare()
def test_heatmap_genes(self, adata: AnnData, fpath: str):
model = create_model(adata)
cr.pl.heatmap(
adata,
model,
GENES[:10],
mode="genes",
time_key="latent_time",
dpi=DPI,
save=fpath,
)
@compare(dirname="heatmap_no_cluster_genes")
def test_heatmap_no_cluster_genes(self, adata: AnnData, fpath: str):
model = create_model(adata)
cr.pl.heatmap(
adata,
model,
GENES[:10],
cluster_genes=False,
mode="lineages",
time_key="latent_time",
dpi=DPI,
save=fpath,
)
@compare()
def test_heatmap_cluster_genes(self, adata: AnnData, fpath: str):
model = create_model(adata)
cr.pl.heatmap(
adata,
model,
GENES[:10],
lineages="1",
mode="lineages",
time_key="latent_time",
cluster_genes=True,
dpi=DPI,
save=fpath,
)
@compare(dirname="heatmap_lineage_height")
def test_heatmap_lineage_height(self, adata: AnnData, fpath: str):
model = create_model(adata)
cr.pl.heatmap(
adata,
model,
GENES[:10],
mode="lineages",
time_key="latent_time",
lineage_height=0.2,
dpi=DPI,
save=fpath,
)
@compare(dirname="heatmap_time_range")
def test_heatmap_time_range(self, adata: AnnData, fpath: str):
model = create_model(adata)
cr.pl.heatmap(
adata,
model,
GENES[:10],
mode="lineages",
time_key="latent_time",
time_range=(0.2, 0.5),
dpi=DPI,
save=fpath,
)
@compare(tol=250)
def test_heatmap_cmap(self, adata: AnnData, fpath: str):
model = create_model(adata)
cr.pl.heatmap(
adata,
model,
GENES[:5],
mode="genes",
time_key="latent_time",
cmap=cm.viridis,
dpi=DPI,
save=fpath,
)
@compare(dirname="heatmap_no_cbar_lineages")
def test_heatmap_no_cbar_lineages(self, adata: AnnData, fpath: str):
model = create_model(adata)
cr.pl.heatmap(
adata,
model,
GENES[:5],
mode="lineages",
time_key="latent_time",
cbar=False,
dpi=DPI,
save=fpath,
)
@compare()
def test_heatmap_no_cbar_genes(self, adata: AnnData, fpath: str):
model = create_model(adata)
cr.pl.heatmap(
adata,
model,
GENES[:5],
mode="genes",
time_key="latent_time",
cbar=False,
dpi=DPI,
save=fpath,
)
@compare(dirname="heatmap_abs_probs_lineages")
def test_heatmap_abs_probs_lineages(self, adata: AnnData, fpath: str):
model = create_model(adata)
cr.pl.heatmap(
adata,
model,
GENES[:5],
mode="lineages",
time_key="latent_time",
show_absorption_probabilities=True,
dpi=DPI,
save=fpath,
)
@compare()
def test_heatmap_abs_probs_genes(self, adata: AnnData, fpath: str):
model = create_model(adata)
cr.pl.heatmap(
adata,
model,
GENES[:5],
mode="genes",
time_key="latent_time",
show_absorption_probabilities=True,
dpi=DPI,
save=fpath,
)
@compare(dirname="heatmap_no_convolve")
def test_heatmap_no_convolve(self, adata: AnnData, fpath: str):
model = create_model(adata)
cr.pl.heatmap(
adata,
model,
GENES[:5],
mode="lineages",
time_key="latent_time",
n_convolve=None,
dpi=DPI,
save=fpath,
)
@compare(dirname="heatmap_no_scale_lineages")
def test_heatmap_no_scale_lineages(self, adata: AnnData, fpath: str):
model = create_model(adata)
cr.pl.heatmap(
adata,
model,
GENES[:5],
mode="lineages",
time_key="latent_time",
scale=False,
dpi=DPI,
save=fpath,
)
@compare()
def test_heatmap_no_scale_genes(self, adata: AnnData, fpath: str):
model = create_model(adata)
cr.pl.heatmap(
adata,
model,
GENES[:5],
mode="genes",
time_key="latent_time",
scale=False,
dpi=DPI,
save=fpath,
)
@compare()
def test_heatmap_cluster_no_scale(self, adata: AnnData, fpath: str):
model = create_model(adata)
cr.pl.heatmap(
adata,
model,
GENES[:5],
lineages="1",
mode="lineages",
time_key="latent_time",
scale=False,
cluster_genes=True,
dpi=DPI,
save=fpath,
)
@compare(dirname="heatmap_no_cluster")
def test_heatmap_no_cluster(self, adata: AnnData, fpath: str):
model = create_model(adata)
cr.pl.heatmap(
adata,
model,
GENES[:5],
mode="lineages",
time_key="latent_time",
cluster_genes=False,
dpi=DPI,
save=fpath,
)
@compare(dirname="heatmap_cluster_key_no_abs_probs")
def test_heatmap_cluster_key_no_abs_probs(self, adata: AnnData, fpath: str):
model = create_model(adata)
cr.pl.heatmap(
adata,
model,
GENES[:5],
cluster_key="clusters",
show_absorption_probabilities=False,
mode="lineages",
time_key="latent_time",
dpi=DPI,
save=fpath,
)
@compare(dirname="heatmap_cluster_key_abs_probs")
def test_heatmap_cluster_key_abs_probs(self, adata: AnnData, fpath: str):
model = create_model(adata)
cr.pl.heatmap(
adata,
model,
GENES[:5],
cluster_key="clusters",
show_absorption_probabilities=True,
mode="lineages",
time_key="latent_time",
dpi=DPI,
save=fpath,
)
@compare(dirname="heatmap_multiple_cluster_keys")
def test_heatmap_multiple_cluster_keys(self, adata: AnnData, fpath: str):
model = create_model(adata)
cr.pl.heatmap(
adata,
model,
GENES[:5],
cluster_key=["clusters", "clusters_enlarged", "clusters"],
show_absorption_probabilities=True,
mode="lineages",
time_key="latent_time",
dpi=DPI,
save=fpath,
)
@compare(dirname="heatmap_multiple_cluster_keys_show_all_genes")
def test_heatmap_multiple_cluster_keys_show_all_genes(
self, adata: AnnData, fpath: str
):
model = create_model(adata)
cr.pl.heatmap(
adata,
model,
GENES[:10],
mode="lineages",
time_key="latent_time",
dpi=DPI,
save=fpath,
)
@pytest.mark.skip("Hangs using pytest-xdist")
@compare(dirname="heatmap_n_jobs")
def test_heatmap_n_jobs(self, adata: AnnData, fpath: str):
model = create_model(adata)
cr.pl.heatmap(
adata,
model,
GENES[:5],
n_jobs=2,
backend="threading",
cluster_key=["clusters", "clusters_enlarged", "clusters"],
show_absorption_probabilities=True,
mode="lineages",
time_key="latent_time",
dpi=DPI,
save=fpath,
)
@pytest.mark.skip("Hangs using pytest-xdist")
@compare(dirname="heatmap_n_jobs_multiprocessing")
def test_heatmap_n_jobs_multiprocessing(self, adata: AnnData, fpath: str):
model = create_model(adata)
cr.pl.heatmap(
adata,
model,
GENES[:5],
n_jobs=2,
backend="loky", # uses pickling of objects, such as Lineage
cluster_key=["clusters", "clusters_enlarged", "clusters"],
show_absorption_probabilities=True,
mode="lineages",
time_key="latent_time",
dpi=DPI,
save=fpath,
)
@compare(dirname="heatmap_keep_gene_order")
def test_heatmap_keep_gene_order(self, adata: AnnData, fpath: str):
model = create_model(adata)
cr.pl.heatmap(
adata,
model,
GENES[:10],
mode="lineages",
time_key="latent_time",
keep_gene_order=True,
dpi=DPI,
save=fpath,
)
@compare()
def test_heatmap_show_dendrogram(self, adata: AnnData, fpath: str):
model = create_model(adata)
cr.pl.heatmap(
adata,
model,
GENES[:10],
mode="lineages",
lineages="1",
time_key="latent_time",
cluster_genes=True,
dendrogram=True,
dpi=DPI,
save=fpath,
)
@compare(dirname="heatmap_lineages_1_lineage_failed")
def test_heatmap_lineages_1_lineage_failed(self, adata: AnnData, fpath: str):
fm = create_failed_model(adata)
cr.pl.heatmap(
adata,
{g: {"0": fm, "*": fm.model} for g in GENES[:10]},
GENES[:10],
mode="lineages",
time_key="latent_time",
dpi=DPI,
save=fpath,
)
@compare()
def test_heatmap_genes_1_gene_failed(self, adata: AnnData, fpath: str):
fm = create_failed_model(adata)
cr.pl.heatmap(
adata,
{GENES[0]: fm, "*": fm.model},
GENES[:10],
mode="genes",
time_key="latent_time",
dpi=DPI,
save=fpath,
)
@compare(dirname="heatmap_gene_symbols")
def test_heatmap_gene_symbols(self, adata: AnnData, fpath: str):
model = create_model(adata)
cr.pl.heatmap(
adata,
model,
[f"{g}:gs" for g in GENES[:10]],
gene_symbols="symbol",
time_key="latent_time",
dpi=DPI,
save=fpath,
)
class TestHeatmapReturns:
def test_heatmap_lineages_return_genes(self, adata_cflare: AnnData):
model = create_model(adata_cflare)
df = cr.pl.heatmap(
adata_cflare,
model,
GENES[:10],
mode="lineages",
time_key="latent_time",
return_genes=True,
dpi=DPI,
)
assert isinstance(df, pd.DataFrame)
np.testing.assert_array_equal(
df.columns, adata_cflare.obsm[Key.obsm.abs_probs(False)].names
)
assert len(df) == 10
assert set(df.iloc[:, 0].values) == set(GENES[:10])
def test_heatmap_lineages_return_models(self, adata_cflare: AnnData):
model = create_model(adata_cflare)
models = cr.pl.heatmap(
adata_cflare,
model,
GENES[:10],
mode="lineages",
time_key="latent_time",
return_models=True,
dpi=DPI,
)
models = pd.DataFrame(models).T
np.testing.assert_array_equal(models.index, GENES[:10])
np.testing.assert_array_equal(
models.columns, adata_cflare.obsm[Key.obsm.abs_probs(False)].names
)
assert np.all(models.astype(bool))
def test_heatmap_lineages_return_models_and_genes(self, adata_cflare: AnnData):
model = create_model(adata_cflare)
models, df = cr.pl.heatmap(
adata_cflare,
model,
GENES[:10],
mode="lineages",
time_key="latent_time",
return_models=True,
return_genes=True,
dpi=DPI,
)
lnames = adata_cflare.obsm[Key.obsm.abs_probs(False)].names
models = pd.DataFrame(models).T
np.testing.assert_array_equal(models.index, GENES[:10])
np.testing.assert_array_equal(models.columns, lnames)
assert np.all(models.astype(bool))
assert isinstance(df, pd.DataFrame)
np.testing.assert_array_equal(df.columns, lnames)
assert len(df) == 10
assert set(df.iloc[:, 0].values) == set(GENES[:10])
def test_heatmap_lineages_return_genes_large_number(self, adata_cflare: AnnData):
model = create_model(adata_cflare)
genes = adata_cflare.var_names[:100]
df = cr.pl.heatmap(
adata_cflare,
model,
genes,
mode="lineages",
time_key="latent_time",
return_genes=True,
dpi=DPI,
)
assert isinstance(df, pd.DataFrame)
np.testing.assert_array_equal(
df.columns, adata_cflare.obsm[Key.obsm.abs_probs(False)].names
)
assert len(df) == len(genes)
assert set(df.iloc[:, 0].values) == set(genes)
def test_heatmap_lineages_return_genes_same_order(self, adata_cflare: AnnData):
model = create_model(adata_cflare)
df = cr.pl.heatmap(
adata_cflare,
model,
GENES[:10],
keep_gene_order=True,
mode="lineages",
time_key="latent_time",
return_genes=True,
dpi=DPI,
)
assert isinstance(df, pd.DataFrame)
np.testing.assert_array_equal(
df.columns, adata_cflare.obsm[Key.obsm.abs_probs(False)].names
)
assert len(df) == 10
assert set(df.iloc[:, 0].values) == set(GENES[:10])
ref = df.iloc[:, 0].values
for i in range(1, len(df.columns)):
np.testing.assert_array_equal(df.iloc[:, i].values, ref)
def test_heatmap_genes_return_no_genes(self, adata_cflare: AnnData):
model = create_model(adata_cflare)
df = cr.pl.heatmap(
adata_cflare,
model,
GENES[:10],
mode="genes",
time_key="latent_time",
cluster_genes=True,
dendrogram=True,
return_genes=True,
dpi=DPI,
)
assert df is None
class TestGeneTrend:
@compare()
def test_trends(self, adata: AnnData, fpath: str):
model = create_model(adata)
cr.pl.gene_trends(
adata,
model,
GENES[:3],
data_key="Ms",
dpi=DPI,
save=fpath,
)
@compare(kind="bwd")
def test_trends_bwd(self, adata: AnnData, fpath: str):
model = create_model(adata)
cr.pl.gene_trends(
adata,
model,
GENES[:3],
backward=True,
data_key="Ms",
dpi=DPI,
save=fpath,
)
@compare()
def test_trends_raw(self, adata: AnnData, fpath: str):
model = create_model(adata)
cr.pl.gene_trends(
adata,
model,
RAW_GENES[:5],
data_key="X",
use_raw=True,
dpi=DPI,
save=fpath,
)
@compare()
def test_trends_same_plot(self, adata: AnnData, fpath: str):
model = create_model(adata)
cr.pl.gene_trends(
adata,
model,
GENES[:3],
data_key="Ms",
same_plot=True,
dpi=DPI,
save=fpath,
)
@compare()
def test_trends_hide_cells(self, adata: AnnData, fpath: str):
model = create_model(adata)
cr.pl.gene_trends(
adata,
model,
GENES[0],
data_key="Ms",
same_plot=True,
hide_cells=True,
dpi=DPI,
save=fpath,
)
@compare()
def test_trends_conf_int(self, adata: AnnData, fpath: str):
model = create_model(adata)
cr.pl.gene_trends(
adata,
model,
GENES[0],
data_key="Ms",
same_plot=True,
conf_int=False,
dpi=DPI,
save=fpath,
)
@compare()
def test_trends_sharey(self, adata: AnnData, fpath: str):
model = create_model(adata)
cr.pl.gene_trends(
adata,
model,
GENES[:3],
data_key="Ms",
sharey="row",
dpi=DPI,
save=fpath,
)
@compare()
def test_trends_sharex(self, adata: AnnData, fpath: str):
model = create_model(adata)
cr.pl.gene_trends(
adata,
model,
GENES[:10],
ncols=3,
data_key="Ms",
sharex="all",
dpi=DPI,
save=fpath,
)
@compare()
def test_trends_gene_as_title(self, adata: AnnData, fpath: str):
model = create_model(adata)
cr.pl.gene_trends(
adata,
model,
GENES[:10],
gene_as_title=False,
same_plot=True,
data_key="Ms",
sharex="all",
dpi=DPI,
save=fpath,
)
@compare()
def test_trends_gene_no_legend(self, adata: AnnData, fpath: str):
model = create_model(adata)
cr.pl.gene_trends(
adata,
model,
GENES[:10],
legend_loc=None,
data_key="Ms",
dpi=DPI,
save=fpath,
)
@compare()
def test_trends_gene_legend_out(self, adata: AnnData, fpath: str):
model = create_model(adata)
cr.pl.gene_trends(
adata,
model,
GENES[:2],
same_plot=True,
legend_loc="bottom right out",
data_key="Ms",
dpi=DPI,
save=fpath,
)
@compare()
def test_trends_no_cbar(self, adata: AnnData, fpath: str):
model = create_model(adata)
cr.pl.gene_trends(
adata,
model,
GENES[0],
data_key="Ms",
same_plot=True,
cbar=False,
dpi=DPI,
save=fpath,
)
@compare()
def test_trends_lineage_cmap(self, adata: AnnData, fpath: str):
model = create_model(adata)
cr.pl.gene_trends(
adata,
model,
GENES[0],
data_key="Ms",
same_plot=True,
lineage_cmap=cm.Set2,
dpi=DPI,
save=fpath,
)
@compare()
def test_trends_abs_prob_cmap(self, adata: AnnData, fpath: str):
model = create_model(adata)
cr.pl.gene_trends(
adata,
model,
GENES[0],
data_key="Ms",
same_plot=False,
hide_cells=False,
abs_prob_cmap=cm.inferno,
dpi=DPI,
save=fpath,
)
@compare()
def test_trends_lineage_cell_color(self, adata: AnnData, fpath: str):
model = create_model(adata)
cr.pl.gene_trends(
adata,
model,
GENES[0],
data_key="Ms",
same_plot=True,
cell_color="red",
dpi=DPI,
save=fpath,
)
@compare()
def test_trends_lineage_cell_color_gene(self, adata: AnnData, fpath: str):
model = create_model(adata)
cr.pl.gene_trends(
adata,
model,
GENES[0],
data_key="Ms",
same_plot=True,
cell_color=adata.var_names[0],
dpi=DPI,
save=fpath,
)
@compare()
def test_trends_lineage_cell_color_clusters(self, adata: AnnData, fpath: str):
model = create_model(adata)
cr.pl.gene_trends(
adata,
model,
GENES[0],
data_key="Ms",
same_plot=True,
cell_color="clusters",
dpi=DPI,
save=fpath,
)
@compare()
def test_trends_lineage_cell_color_clusters_obs_legend_loc(
self, adata: AnnData, fpath: str
):
model = create_model(adata)
cr.pl.gene_trends(
adata,
model,
GENES[0],
data_key="Ms",
same_plot=True,
cell_color="clusters",
obs_legend_loc="top left out",
dpi=DPI,
save=fpath,
)
@compare()
def test_trends_lw(self, adata: AnnData, fpath: str):
model = create_model(adata)
cr.pl.gene_trends(
adata,
model,
GENES[0],
data_key="Ms",
same_plot=True,
lw=10,
dpi=DPI,
save=fpath,
)
@compare()
def test_trends_suptitle(self, adata: AnnData, fpath: str):
model = create_model(adata)
cr.pl.gene_trends(
adata,
model,
GENES[:10],
suptitle="FOOBAR",
data_key="Ms",
dpi=DPI,
save=fpath,
)
@compare()
def test_trends_size(self, adata: AnnData, fpath: str):
model = create_model(adata)
cr.pl.gene_trends(
adata,
model,
GENES[0],
data_key="Ms",
same_plot=True,
size=30,
dpi=DPI,
save=fpath,
)
@compare()
def test_trends_margins(self, adata: AnnData, fpath: str):
model = create_model(adata)
cr.pl.gene_trends(
adata,
model,
GENES[0],
data_key="Ms",
same_plot=True,
margins=0.2,
dpi=DPI,
save=fpath,
)
@compare()
def test_trends_cell_alpha(self, adata: AnnData, fpath: str):
model = create_model(adata)
cr.pl.gene_trends(
adata,
model,
GENES[0],
data_key="Ms",
same_plot=True,
cell_alpha=0,
dpi=DPI,
save=fpath,
)
@compare()
def test_trends_lineage_alpha(self, adata: AnnData, fpath: str):
model = create_model(adata)
cr.pl.gene_trends(
adata,
model,
GENES[0],
data_key="Ms",
same_plot=True,
lineage_alpha=1,
dpi=DPI,
save=fpath,
)
@compare()
def test_trends_time_range(self, adata: AnnData, fpath: str):
model = create_model(adata)
cr.pl.gene_trends(
adata,
model,
GENES[:10],
data_key="Ms",
same_plot=False,
time_range=(0, 0.5),
dpi=DPI,
save=fpath,
)
@compare()
def test_trends_perc(self, adata: AnnData, fpath: str):
model = create_model(adata)
cr.pl.gene_trends(
adata,
model,
GENES[:10],
data_key="Ms",
same_plot=False,
perc=(0, 50),
dpi=DPI,
save=fpath,
)
@compare()
def test_trends_perc_per_lineage(self, adata: AnnData, fpath: str):
model = create_model(adata)
cr.pl.gene_trends(
adata,
model,
GENES[:3],
figsize=(5, 5),
data_key="Ms",
same_plot=False,
perc=[(0, 50), (5, 95), (50, 100)],
dpi=DPI,
save=fpath,
)
@compare()
def test_trends_time_key(self, adata: AnnData, fpath: str):
model = create_model(adata)
cr.pl.gene_trends(
adata,
model,
GENES[:10],
data_key="Ms",
same_plot=False,
time_key="dpt_pseudotime",
dpi=DPI,
save=fpath,
)
@compare()
def test_trends_show_lineage_ignores_no_transpose(self, adata: AnnData, fpath: str):
model = create_model(adata)
cr.pl.gene_trends(
adata,
model,
GENES[:5],
transpose=False,
data_key="Ms",
same_plot=True,
plot_kwargs=dict(lineage_probability=True),
dpi=DPI,
save=fpath,
)
@compare()
def test_trends_show_lineage_same_plot(self, adata: AnnData, fpath: str):
model = create_model(adata)
cr.pl.gene_trends(
adata,
model,
GENES[:5],
transpose=True,
data_key="Ms",
same_plot=True,
plot_kwargs=dict(lineage_probability=True),
dpi=DPI,
save=fpath,
)
@compare()
def test_trends_show_lineage_diff_plot(self, adata: AnnData, fpath: str):
model = create_model(adata)
cr.pl.gene_trends(
adata,
model,
GENES[0],
data_key="Ms",
same_plot=False,
transpose=True,
plot_kwargs=dict(lineage_probability=True),
figsize=(5, 5),
dpi=DPI,
save=fpath,
)
@compare()
def test_trends_show_lineage_ci(self, adata: AnnData, fpath: str):
model = create_model(adata)
cr.pl.gene_trends(
adata,
model,
GENES[0],
data_key="Ms",
same_plot=True,
transpose=True,
plot_kwargs=dict(
lineage_probability=True, lineage_probability_conf_int=True
),
dpi=DPI,
save=fpath,
)
@compare()
def test_trends_time_key_del_latent_time(self, adata: AnnData, fpath: str):
# this ensures that the callback passes the correct values
del adata.obs["latent_time"]
assert "latent_time" not in adata.obs
model = create_model(adata)
cr.pl.gene_trends(
adata,
model,
GENES[:10],
data_key="Ms",
same_plot=False,
time_key="dpt_pseudotime",
dpi=DPI,
save=fpath,
)
def test_invalid_time_key(self, adata_cflare: AnnData):
model = create_model(adata_cflare)
with pytest.raises(KeyError):
cr.pl.gene_trends(
adata_cflare,
model,
GENES[:10],
data_key="Ms",
same_plot=False,
time_key="foobar",
)
def test_all_models_failed(self, adata_cflare: AnnData):
fm = create_failed_model(adata_cflare)
with pytest.raises(RuntimeError):
cr.pl.gene_trends(
adata_cflare,
fm,
GENES[:10],
data_key="Ms",
mode="lineages",
time_key="latent_time",
dpi=DPI,
)
def test_return_models_no_failures(self, adata_cflare: AnnData):
model = create_model(adata_cflare)
models = cr.pl.gene_trends(
adata_cflare,
model,
GENES[:10],
data_key="Ms",
lineages=["0", "1"],
time_key="latent_time",
dpi=DPI,
return_models=True,
)
models = pd.DataFrame(models).T
np.testing.assert_array_equal(models.index, GENES[:10])
np.testing.assert_array_equal(models.columns, [str(i) for i in range(2)])
assert np.all(models.astype(bool))
def test_return_models_with_failures(self, adata_cflare: AnnData):
fm = create_failed_model(adata_cflare)
models = cr.pl.gene_trends(
adata_cflare,
{GENES[0]: {"0": fm, "*": fm.model}, "*": fm.model},
GENES[:10],
lineages=["0", "1"],
time_key="latent_time",
dpi=DPI,
return_models=True,
)
models = pd.DataFrame(models).T
np.testing.assert_array_equal(models.index, GENES[:10])
np.testing.assert_array_equal(models.columns, [str(i) for i in range(2)])
assert isinstance(models.loc[GENES[0], "0"], cr.ul.models.FailedModel)
mask = models.astype(bool)
assert not mask.loc[GENES[0], "0"]
mask.loc[GENES[0], "0"] = True
assert np.all(mask)
@compare()
def test_all_models_for_1_gene_failed(self, adata: AnnData, fpath: str):
fm = create_failed_model(adata)
cr.pl.gene_trends(
adata,
{GENES[0]: fm, "*": fm.model},
GENES[:3],
figsize=(5, 5),
data_key="Ms",
time_key="latent_time",
dpi=DPI,
save=fpath,
)
@compare()
def test_all_models_for_1_lineage_failed(self, adata: AnnData, fpath: str):
fm = create_failed_model(adata)
cr.pl.gene_trends(
adata,
{g: {"0": fm, "*": fm.model} for g in GENES[:3]},
GENES[:3],
figsize=(5, 5),
data_key="Ms",
time_key="latent_time",
dpi=DPI,
save=fpath,
)
@compare()
def test_all_models_for_1_gene_failed_same_plot(self, adata: AnnData, fpath: str):
fm = create_failed_model(adata)
cr.pl.gene_trends(
adata,
{GENES[0]: fm, "*": fm.model},
GENES[:10],
data_key="Ms",
time_key="latent_time",
same_plot=True,
dpi=DPI,
save=fpath,
)
@compare()
def test_failed_only_main_diagonal(self, adata: AnnData, fpath: str):
fm = create_failed_model(adata)
cr.pl.gene_trends(
adata,
{g: {str(ln): fm.model, "*": fm} for ln, g in enumerate(GENES[:3])},
GENES[:3],
lineages=["0", "1", "2"],
data_key="Ms",
time_key="latent_time",
dpi=DPI,
save=fpath,
)
@compare()
def test_failed_only_off_diagonal(self, adata: AnnData, fpath: str):
fm = create_failed_model(adata)
cr.pl.gene_trends(
adata,
{
g: {str(ln): fm.model, "*": fm}
for ln, g in zip(range(3)[::-1], GENES[:3])
},
GENES[:3],
data_key="Ms",
time_key="latent_time",
dpi=DPI,
save=fpath,
)
@compare()
def test_transpose(self, adata: AnnData, fpath: str):
model = create_model(adata)
cr.pl.gene_trends(
adata,
model,
GENES[:4],
transpose=True,
data_key="Ms",
time_key="latent_time",
dpi=DPI,
save=fpath,
)
@compare()
def test_transpose_same_plot(self, adata: AnnData, fpath: str):
model = create_model(adata)
cr.pl.gene_trends(
adata,
model,
GENES[:3],
transpose=True,
same_plot=True,
data_key="Ms",
time_key="latent_time",
dpi=DPI,
save=fpath,
)
@compare()
def test_transpose_all_models_for_1_gene_failed(self, adata: AnnData, fpath: str):
fm = create_failed_model(adata)
cr.pl.gene_trends(
adata,
{GENES[0]: fm, "*": fm.model},
GENES[:10],
transpose=True,
time_key="latent_time",
dpi=DPI,
save=fpath,
)
@compare()
def test_transpose_all_models_for_1_lineage_failed(
self, adata: AnnData, fpath: str
):
fm = create_failed_model(adata)
cr.pl.gene_trends(
adata,
{g: {"0": fm, "*": fm.model} for g in GENES[:10]},
GENES[:10],
transpose=True,
data_key="Ms",
time_key="latent_time",
dpi=DPI,
save=fpath,
)
@compare()
def test_transpose_failed_only_off_diagonal(self, adata: AnnData, fpath: str):
fm = create_failed_model(adata)
cr.pl.gene_trends(
adata,
{
g: {str(ln): fm.model, "*": fm}
for ln, g in zip(range(3)[::-1], GENES[:3])
},
GENES[:3],
transpose=True,
data_key="Ms",
time_key="latent_time",
dpi=DPI,
save=fpath,
)
@compare()
def test_transpose_all_models_for_1_lineage_failed_same_plot(
self, adata: AnnData, fpath: str
):
fm = create_failed_model(adata)
cr.pl.gene_trends(
adata,
{g: {"0": fm, "*": fm.model} for g in GENES[:10]},
GENES[:10],
transpose=True,
same_plot=True,
data_key="Ms",
time_key="latent_time",
dpi=DPI,
save=fpath,
)
@compare()
def test_trends_gene_symbols(self, adata: AnnData, fpath: str):
model = create_model(adata)
cr.pl.gene_trends(
adata,
model,
[f"{g}:gs" for g in GENES[:3]],
gene_symbols="symbol",
data_key="Ms",
dpi=DPI,
save=fpath,
)
class TestGraph:
@compare()
def test_graph(self, adata: AnnData, fpath: str):
cr.pl.graph(
adata, "T_fwd", ixs=range(10), edge_use_curved=False, dpi=DPI, save=fpath
)
@compare(kind="bwd")
def test_graph_bwd(self, adata: AnnData, fpath: str):
cr.pl.graph(
adata, "T_bwd", ixs=range(10), edge_use_curved=False, dpi=DPI, save=fpath
)
@compare()
def test_graph_layout(self, adata: AnnData, fpath: str):
cr.pl.graph(
adata,
"T_fwd",
ixs=range(10),
edge_use_curved=False,
layout="umap",
dpi=DPI,
save=fpath,
)
@compare()
def test_graph_title(self, adata: AnnData, fpath: str):
cr.pl.graph(
adata,
"T_fwd",
ixs=range(10),
title="foo bar baz quux",
edge_use_curved=False,
dpi=DPI,
save=fpath,
)
@compare()
def test_graph_titles(self, adata: AnnData, fpath: str):
cr.pl.graph(
adata,
"T_fwd",
ixs=range(10),
edge_use_curved=False,
keys=["incoming", "self_loops"],
title=["foo", "bar"],
dpi=DPI,
save=fpath,
)
@compare()
def test_graph_keys(self, adata: AnnData, fpath: str):
cr.pl.graph(
adata,
"T_fwd",
ixs=range(10),
edge_use_curved=False,
keys=("outgoing", "self_loops"),
dpi=DPI,
save=fpath,
)
@compare()
def test_graph_edge_weight_scale(self, adata: AnnData, fpath: str):
cr.pl.graph(
adata,
"T_fwd",
ixs=range(10),
edge_use_curved=False,
edge_weight_scale=100,
dpi=DPI,
save=fpath,
)
@compare()
def test_graph_show_arrows(self, adata: AnnData, fpath: str):
cr.pl.graph(
adata,
"T_fwd",
ixs=range(15),
edge_use_curved=False,
arrows=False,
edge_weight_scale=100,
dpi=DPI,
save=fpath,
)
@compare()
def test_graph_curved_edges(self, adata: AnnData, fpath: str):
cr.pl.graph(
adata, "T_fwd", ixs=range(10), edge_use_curved=True, dpi=DPI, save=fpath
)
@compare()
def test_graph_labels(self, adata: AnnData, fpath: str):
cr.pl.graph(
adata,
"T_fwd",
ixs=range(10),
edge_use_curved=False,
labels=range(10),
dpi=DPI,
save=fpath,
)
@compare()
def test_graph_cmap(self, adata: AnnData, fpath: str):
cr.pl.graph(
adata,
"T_fwd",
ixs=range(10),
edge_use_curved=False,
cont_cmap=cm.inferno,
dpi=DPI,
save=fpath,
)
@compare()
def test_graph_top_n_edges_incoming(self, adata: AnnData, fpath: str):
cr.pl.graph(
adata,
"T_fwd",
ixs=range(10),
edge_use_curved=False,
top_n_edges=(2, True, "incoming"),
edge_weight_scale=100,
dpi=DPI,
save=fpath,
)
@compare()
def test_graph_top_n_edges_outgoing(self, adata: AnnData, fpath: str):
cr.pl.graph(
adata,
"T_fwd",
ixs=range(10),
edge_use_curved=False,
top_n_edges=(2, False, "outgoing"),
edge_weight_scale=100,
dpi=DPI,
save=fpath,
)
@compare()
def test_graph_edge_normalize(self, adata: AnnData, fpath: str):
cr.pl.graph(
adata,
"T_fwd",
ixs=range(10),
edge_use_curved=False,
edge_normalize=True,
dpi=DPI,
save=fpath,
)
@compare()
def test_graph_edge_reductions(self, adata: AnnData, fpath: str):
cr.pl.graph(
adata,
"T_fwd",
ixs=range(10),
edge_use_curved=False,
edge_reductions=np.max,
dpi=DPI,
save=fpath,
)
@compare()
def test_graph_edge_reductions_restriction_incoming(
self, adata: AnnData, fpath: str
):
cr.pl.graph(
adata,
"T_fwd",
ixs=range(10),
keys="incoming",
edge_use_curved=False,
edge_reductions_restrict_to_ixs=range(20, 40),
dpi=DPI,
save=fpath,
)
@compare()
def test_graph_edge_reductions_restriction_outgoing(
self, adata: AnnData, fpath: str
):
cr.pl.graph(
adata,
"T_fwd",
ixs=range(10),
keys="outgoing",
edge_use_curved=False,
edge_reductions_restrict_to_ixs=range(20, 40),
dpi=DPI,
save=fpath,
)
@compare()
def test_graph_categorical_key(self, adata: AnnData, fpath: str):
cr.pl.graph(
adata,
"T_fwd",
ixs=range(10),
edge_use_curved=False,
keys="clusters",
keylocs="obs",
dpi=DPI,
save=fpath,
)
@compare()
def test_graph_filter_edges(self, adata: AnnData, fpath: str):
cr.pl.graph(
adata,
"T_fwd",
ixs=range(10),
filter_edges=(0.25, 0.5),
edge_use_curved=False,
dpi=DPI,
save=fpath,
)
@compare()
def test_graph_dict_layout(self, adata: AnnData, fpath: str):
cr.pl.graph(
adata,
"T_fwd",
ixs=range(10),
layout={i: (i, i) for i in range(10)},
edge_use_curved=False,
dpi=DPI,
save=fpath,
)
@compare()
def test_graph_networkx_layout(self, adata: AnnData, fpath: str):
import networkx as nx
cr.pl.graph(
adata,
"T_fwd",
ixs=range(10),
layout=nx.layout.kamada_kawai_layout,
edge_use_curved=False,
dpi=DPI,
save=fpath,
)
@compare()
def test_graph_precomputed_layour_pca(self, adata: AnnData, fpath: str):
cr.pl.graph(
adata,
"T_fwd",
ixs=range(10),
layout="pca",
edge_use_curved=False,
dpi=DPI,
save=fpath,
)
class TestCFLARE:
@compare(kind="cflare")
def test_mc_spectrum(self, mc: CFLARE, fpath: str):
mc.plot_spectrum(dpi=DPI, save=fpath)
@compare(kind="cflare")
def test_mc_complex_spectrum(self, mc: CFLARE, fpath: str):
mc.plot_spectrum(real_only=False, dpi=DPI, save=fpath)
@compare(kind="cflare")
def test_mc_real_spectrum(self, mc: CFLARE, fpath: str):
mc.plot_spectrum(real_only=True, dpi=DPI, save=fpath)
@compare(kind="cflare")
def test_mc_real_spectrum_hide_xticks(self, mc: CFLARE, fpath: str):
mc.plot_spectrum(real_only=True, show_all_xticks=False, dpi=DPI, save=fpath)
@compare(kind="cflare")
def test_mc_real_spectrum_hide_eigengap(self, mc: CFLARE, fpath: str):
mc.plot_spectrum(real_only=True, show_eigengap=False, dpi=DPI, save=fpath)
@compare(kind="cflare")
def test_mc_spectrum_title(self, mc: CFLARE, fpath: str):
mc.plot_spectrum(title="foobar", real_only=False, dpi=DPI, save=fpath)
@compare(kind="cflare")
def test_mc_marker(self, mc: CFLARE, fpath: str):
mc.plot_spectrum(dpi=DPI, marker="X", save=fpath)
@compare(kind="cflare")
def test_mc_kwargs_linewidths(self, mc: CFLARE, fpath: str):
mc.plot_spectrum(dpi=DPI, linewidths=20, save=fpath)
@compare(kind="cflare")
def test_mc_spectrum_evals(self, mc: CFLARE, fpath: str):
mc.plot_spectrum(2, real_only=True, dpi=DPI, save=fpath)
@compare(kind="cflare")
def test_mc_spectrum_evals_complex(self, mc: CFLARE, fpath: str):
mc.plot_spectrum(2, real_only=False, dpi=DPI, save=fpath)
@compare(kind="cflare")
def test_scvelo_final_states(self, mc: CFLARE, fpath: str):
mc.plot_terminal_states(dpi=DPI, save=fpath)
@compare(kind="cflare")
def test_scvelo_final_states_clusters(self, mc: CFLARE, fpath: str):
mc.plot_terminal_states(color="clusters", dpi=DPI, save=fpath)
@compare(kind="cflare")
def test_scvelo_lin_probs(self, mc: CFLARE, fpath: str):
mc.plot_absorption_probabilities(dpi=DPI, save=fpath)
@compare(kind="cflare")
def test_scvelo_lin_probs_clusters(self, mc: CFLARE, fpath: str):
mc.plot_absorption_probabilities(color="clusters", dpi=DPI, save=fpath)
@compare(kind="cflare")
def test_scvelo_lin_probs_cmap(self, mc: CFLARE, fpath: str):
mc.plot_absorption_probabilities(cmap=cm.inferno, dpi=DPI, save=fpath)
@compare(kind="cflare")
def test_scvelo_lin_probs_lineages(self, mc: CFLARE, fpath: str):
mc.plot_absorption_probabilities(states=["0"], dpi=DPI, save=fpath)
@compare(kind="cflare")
def test_scvelo_lin_probs_time(self, mc: CFLARE, fpath: str):
mc.plot_absorption_probabilities(mode="time", dpi=DPI, save=fpath)
class TestGPCCA:
@compare(kind="gpcca")
def test_gpcca_complex_spectrum(self, mc: GPCCA, fpath: str):
mc.plot_spectrum(real_only=False, dpi=DPI, save=fpath)
@compare(kind="gpcca")
def test_gpcca_real_spectrum(self, mc: GPCCA, fpath: str):
mc.plot_spectrum(real_only=True, dpi=DPI, save=fpath)
@compare(kind="gpcca")
def test_gpcca_real_spectrum_hide_eigengap(self, mc: GPCCA, fpath: str):
mc.plot_spectrum(real_only=True, show_eigengap=False, dpi=DPI, save=fpath)
@compare(kind="gpcca")
def test_gpcca_spectrum_title(self, mc: GPCCA, fpath: str):
mc.plot_spectrum(title="foobar", real_only=True, dpi=DPI, save=fpath)
@compare(kind="gpcca")
def test_gpcca_spectrum_evals(self, mc: CFLARE, fpath: str):
mc.plot_spectrum(2, real_only=True, dpi=DPI, save=fpath)
@compare(kind="gpcca")
def test_gpcca_spectrum_evals_complex(self, mc: CFLARE, fpath: str):
mc.plot_spectrum(2, real_only=False, dpi=DPI, save=fpath)
@compare(kind="gpcca")
def test_gpcca_schur_matrix(self, mc: GPCCA, fpath: str):
mc.plot_schur_matrix(dpi=DPI, save=fpath)
@compare(kind="gpcca")
def test_gpcca_schur_matrix_title(self, mc: GPCCA, fpath: str):
mc.plot_schur_matrix(title="foobar", dpi=DPI, save=fpath)
@compare(kind="gpcca")
def test_gpcca_schur_matrix_cmap(self, mc: GPCCA, fpath: str):
mc.plot_schur_matrix(cmap=cm.inferno, dpi=DPI, save=fpath)
@compare(kind="gpcca")
def test_gpcca_coarse_T(self, mc: GPCCA, fpath: str):
mc.plot_coarse_T(
show_initial_dist=False, show_stationary_dist=False, dpi=DPI, save=fpath
)
@compare(kind="gpcca")
def test_gpcca_coarse_T_stat_dist(self, mc: GPCCA, fpath: str):
mc.plot_coarse_T(
show_initial_dist=False, show_stationary_dist=True, dpi=DPI, save=fpath
)
@compare(kind="gpcca")
def test_gpcca_coarse_T_init_dist(self, mc: GPCCA, fpath: str):
mc.plot_coarse_T(
show_initial_dist=True, show_stationary_dist=False, dpi=DPI, save=fpath
)
@compare(kind="gpcca")
def test_gpcca_coarse_T_stat_init_dist(self, mc: GPCCA, fpath: str):
mc.plot_coarse_T(
show_initial_dist=True, show_stationary_dist=True, dpi=DPI, save=fpath
)
@compare(kind="gpcca")
def test_gpcca_coarse_T_no_cbar(self, mc: GPCCA, fpath: str):
mc.plot_coarse_T(show_cbar=False, dpi=DPI, save=fpath)
@compare(kind="gpcca")
def test_gpcca_coarse_T_no_annot(self, mc: GPCCA, fpath: str):
mc.plot_coarse_T(annotate=False, dpi=DPI, save=fpath)
@compare(kind="gpcca")
def test_gpcca_coarse_T_cmap(self, mc: GPCCA, fpath: str):
mc.plot_coarse_T(cmap=cm.inferno, dpi=DPI, save=fpath)
@compare(kind="gpcca")
def test_gpcca_coarse_T_xtick_rot(self, mc: GPCCA, fpath: str):
mc.plot_coarse_T(xtick_rotation=0, dpi=DPI, save=fpath)
@compare(kind="gpcca")
def test_scvelo_gpcca_meta_states(self, mc: GPCCA, fpath: str):
mc.plot_macrostates(dpi=DPI, save=fpath)
@compare(kind="gpcca")
def test_scvelo_gpcca_meta_states_lineages(self, mc: GPCCA, fpath: str):
mc.plot_macrostates(states=["0"], dpi=DPI, save=fpath)
@compare(kind="gpcca")
def test_scvelo_gpcca_meta_states_discrete(self, mc: GPCCA, fpath: str):
mc.plot_macrostates(discrete=True, dpi=DPI, save=fpath)
@compare(kind="gpcca")
def test_scvelo_gpcca_meta_states_cluster_key(self, mc: GPCCA, fpath: str):
mc.plot_macrostates(color="clusters", dpi=DPI, save=fpath)
@compare(kind="gpcca")
def test_scvelo_gpcca_meta_states_no_same_plot(self, mc: GPCCA, fpath: str):
mc.plot_macrostates(same_plot=False, dpi=DPI, save=fpath)
@compare(kind="gpcca")
def test_scvelo_gpcca_meta_states_cmap(self, mc: GPCCA, fpath: str):
mc.plot_macrostates(cmap=cm.inferno, same_plot=False, dpi=DPI, save=fpath)
@compare(kind="gpcca")
def test_scvelo_gpcca_meta_states_title(self, mc: GPCCA, fpath: str):
mc.plot_macrostates(title="foobar", dpi=DPI, save=fpath)
@compare(kind="gpcca")
def test_scvelo_gpcca_meta_states_time(self, mc: GPCCA, fpath: str):
mc.plot_macrostates(mode="time", dpi=DPI, save=fpath)
@compare(kind="gpcca")
def test_scvelo_gpcca_final_states(self, mc: GPCCA, fpath: str):
mc.plot_terminal_states(dpi=DPI, save=fpath)
@compare(kind="gpcca")
def test_scvelo_gpcca_final_states_lineages(self, mc: GPCCA, fpath: str):
mc.plot_terminal_states(states=["0"], dpi=DPI, save=fpath)
@compare(kind="gpcca")
def test_scvelo_gpcca_final_states_discrete(self, mc: GPCCA, fpath: str):
mc.plot_terminal_states(discrete=True, dpi=DPI, save=fpath)
@compare(kind="gpcca")
def test_scvelo_gpcca_final_states_cluster_key(self, mc: GPCCA, fpath: str):
mc.plot_terminal_states(color="clusters", dpi=DPI, save=fpath)
@compare(kind="gpcca")
def test_scvelo_gpcca_final_states_no_same_plot(self, mc: GPCCA, fpath: str):
mc.plot_terminal_states(same_plot=False, dpi=DPI, save=fpath)
@compare(kind="gpcca")
def test_scvelo_gpcca_final_states_cmap(self, mc: GPCCA, fpath: str):
mc.plot_terminal_states(cmap=cm.inferno, same_plot=False, dpi=DPI, save=fpath)
@compare(kind="gpcca")
def test_scvelo_gpcca_final_states_title(self, mc: GPCCA, fpath: str):
mc.plot_terminal_states(title="foobar", dpi=DPI, save=fpath)
@compare(kind="gpcca")
def test_scvelo_gpcca_final_states_time(self, mc: GPCCA, fpath: str):
mc.plot_terminal_states(mode="time", dpi=DPI, save=fpath)
@compare(kind="gpcca")
def test_scvelo_gpcca_abs_probs_disc_same(self, mc: GPCCA, fpath: str):
mc.plot_absorption_probabilities(
color="clusters", discrete=True, same_plot=True, dpi=DPI, save=fpath
)
@compare(kind="gpcca")
def test_scvelo_gpcca_abs_probs_disc_not_same(self, mc: GPCCA, fpath: str):
mc.plot_absorption_probabilities(
color="clusters", discrete=True, same_plot=False, dpi=DPI, save=fpath
)
@compare(kind="gpcca")
def test_scvelo_gpcca_abs_probs_cont_same_no_clusters(self, mc: GPCCA, fpath: str):
mc.plot_absorption_probabilities(
discrete=False, same_plot=True, dpi=DPI, save=fpath
)
@compare(kind="gpcca")
def test_scvelo_gpcca_abs_probs_cont_same_clusters(self, mc: GPCCA, fpath: str):
mc.plot_absorption_probabilities(
color="clusters", discrete=False, same_plot=True, dpi=DPI, save=fpath
)
@compare(kind="gpcca")
def test_scvelo_gpcca_abs_probs_cont_not_same(self, mc: GPCCA, fpath: str):
mc.plot_absorption_probabilities(
color="clusters", discrete=False, same_plot=False, dpi=DPI, save=fpath
)
@compare(kind="gpcca")
def test_scvelo_transition_matrix_projection(self, mc: GPCCA, fpath: str):
mc.kernel.compute_projection(basis="umap")
scv.pl.velocity_embedding(
mc.kernel.adata,
vkey="T_fwd",
basis="umap",
arrow_length=6,
arrow_size=6,
dpi=DPI,
save=fpath,
)
class TestLineages:
@compare()
def test_scvelo_lineages(self, adata: AnnData, fpath: str):
cr.pl.lineages(adata, dpi=DPI, save=fpath)
@compare()
def test_scvelo_lineages_subset(self, adata: AnnData, fpath: str):
cr.pl.lineages(adata, lineages=["1"], dpi=DPI, save=fpath)
@compare()
def test_scvelo_lineages_time(self, adata: AnnData, fpath: str):
cr.pl.lineages(adata, mode="time", dpi=DPI, save=fpath)
@compare()
def test_scvelo_lineages_cmap(self, adata: AnnData, fpath: str):
cr.pl.lineages(adata, cmap=cm.inferno, dpi=DPI, save=fpath)
@compare()
def test_scvelo_lineages_subset(self, adata: AnnData, fpath: str):
cr.pl.lineages(adata, color="clusters", dpi=DPI, save=fpath)
class TestHighLvlStates:
@compare()
def test_scvelo_terminal_states_disc(self, adata: AnnData, fpath: str):
cr.pl.terminal_states(adata, discrete=True, dpi=DPI, save=fpath)
@compare(kind="bwd")
def test_scvelo_initial_states_disc(self, adata: AnnData, fpath: str):
cr.pl.initial_states(adata, discrete=True, dpi=DPI, save=fpath)
# only matters when kind='adata' was computed using GPCCA
@compare()
def test_scvelo_terminal_states_cont(self, adata: AnnData, fpath: str):
cr.pl.terminal_states(adata, discrete=False, dpi=DPI, save=fpath)
@compare()
def test_scvelo_terminal_disc_same_subset(self, adata: AnnData, fpath: str):
cr.pl.terminal_states(
adata, discrete=True, same_plot=True, states="0", dpi=DPI, save=fpath
)
@compare()
def test_scvelo_terminal_disc_not_same_subset(self, adata: AnnData, fpath: str):
cr.pl.terminal_states(
adata, discrete=True, same_plot=False, states="0", dpi=DPI, save=fpath
)
@compare()
def test_scvelo_terminal_cont_same_subset(self, adata: AnnData, fpath: str):
cr.pl.terminal_states(
adata, discrete=False, same_plot=True, states="0", dpi=DPI, save=fpath
)
@compare()
def test_scvelo_terminal_cont_not_same_subset(self, adata: AnnData, fpath: str):
cr.pl.terminal_states(
adata, discrete=False, same_plot=False, states="0", dpi=DPI, save=fpath
)
@compare()
def test_scvelo_terminal_diff_plot(self, adata: AnnData, fpath: str):
cr.pl.terminal_states(adata, same_plot=False, dpi=DPI, save=fpath)
@compare()
def test_scvelo_terminal_diff_plot_titles(self, adata: AnnData, fpath: str):
cr.pl.terminal_states(
adata, same_plot=False, title=["foo", "bar"] * 10, dpi=DPI, save=fpath
)
@compare()
def test_scvelo_terminal_cluster_key_discrete(self, adata: AnnData, fpath: str):
cr.pl.terminal_states(
adata, discrete=True, cluster_key="clusters", dpi=DPI, save=fpath
)
@compare()
def test_scvelo_terminal_time_mode(self, adata: AnnData, fpath: str):
# only works in continuous mode
cr.pl.terminal_states(
adata,
discrete=False,
mode="time",
dpi=DPI,
save=fpath,
)
@compare()
def test_scvelo_terminal_time_mode_subset(self, adata: AnnData, fpath: str):
# only works in continuous mode
cr.pl.terminal_states(
adata,
states="0",
discrete=False,
mode="time",
dpi=DPI,
save=fpath,
)
@compare()
def test_scvelo_terminal_time_mode_clusters(self, adata: AnnData, fpath: str):
# only works in continuous mode
cr.pl.terminal_states(
adata,
discrete=False,
cluster_key="clusters",
mode="time",
dpi=DPI,
save=fpath,
)
class TestLineage:
def test_pie(self, lineage: cr.tl.Lineage):
with pytest.raises(ValueError):
lineage[:, 0].plot_pie(dpi=DPI)
@compare(kind="lineage")
def test_pie(self, lineage: cr.tl.Lineage, fpath: str):
lineage.plot_pie(np.mean, dpi=DPI, save=fpath)
@compare(kind="lineage")
def test_pie_reduction(self, lineage: cr.tl.Lineage, fpath: str):
lineage.plot_pie(np.var, dpi=DPI, save=fpath)
@compare(kind="lineage")
def test_pie_title(self, lineage: cr.tl.Lineage, fpath: str):
lineage.plot_pie(np.mean, title="FOOBAR", dpi=DPI, save=fpath)
@compare(kind="lineage")
def test_pie_t(self, lineage: cr.tl.Lineage, fpath: str):
lineage.T.plot_pie(np.mean, dpi=DPI, save=fpath)
@compare(kind="lineage")
def test_pie_autopct_none(self, lineage: cr.tl.Lineage, fpath: str):
lineage.T.plot_pie(np.mean, dpi=DPI, save=fpath, autopct=None)
@compare(kind="lineage")
def test_pie_legend_loc(self, lineage: cr.tl.Lineage, fpath: str):
lineage.plot_pie(np.mean, dpi=DPI, save=fpath, legend_loc="best")
@compare(kind="lineage")
def test_pie_legend_loc_one(self, lineage: cr.tl.Lineage, fpath: str):
lineage.plot_pie(np.mean, dpi=DPI, save=fpath, legend_loc=None)
@compare(kind="lineage")
def test_pie_legend_kwargs(self, lineage: cr.tl.Lineage, fpath: str):
lineage.plot_pie(
np.mean,
dpi=DPI,
save=fpath,
legend_loc="best",
legend_kwargs={"fontsize": 20},
)
class TestLineageDrivers:
@compare()
def test_drivers_n_genes(self, adata: AnnData, fpath: str):
cr.pl.lineage_drivers(adata, "0", n_genes=5, dpi=DPI, save=fpath)
@compare(kind="bwd")
def test_drivers_backward(self, adata: AnnData, fpath: str):
cr.pl.lineage_drivers(adata, "0", backward=True, ncols=2, dpi=DPI, save=fpath)
@compare()
def test_drivers_cmap(self, adata: AnnData, fpath: str):
cr.pl.lineage_drivers(adata, "0", cmap="inferno", dpi=DPI, save=fpath)
@compare()
def test_drivers_title_fmt(self, adata: AnnData, fpath: str):
cr.pl.lineage_drivers(
adata,
"0",
cmap="inferno",
title_fmt="{gene} qval={qval} corr={corr}",
dpi=DPI,
save=fpath,
)
class TestModel:
@compare()
def test_model_default(self, adata: AnnData, fpath: str):
model = create_model(adata)
model.prepare(adata.var_names[0], "1")
model.fit().predict()
model.confidence_interval()
model.plot(save=fpath, dpi=DPI)
@compare(kind="bwd")
def test_model_default_bwd(self, adata: AnnData, fpath: str):
model = create_model(adata)
model.prepare(adata.var_names[0], "0", backward=True)
model.fit().predict()
model.confidence_interval()
model.plot(save=fpath, dpi=DPI)
@compare()
def test_model_obs_data_key(self, adata: AnnData, fpath: str):
model = create_model(adata)
gene = adata.X[:, 0]
adata.obs["foo"] = gene.A if issparse(gene) else gene
model.prepare("foo", "1", data_key="obs")
model.fit().predict()
model.confidence_interval()
model.plot(save=fpath, dpi=DPI)
@compare()
def test_model_no_lineage(self, adata: AnnData, fpath: str):
model = create_model(adata)
model.prepare(adata.var_names[0], None)
model.fit().predict()
model.confidence_interval()
model.plot(save=fpath, dpi=DPI)
@compare()
def test_model_no_lineage_show_lin_probs(self, adata: AnnData, fpath: str):
model = create_model(adata)
model.prepare(adata.var_names[0], None)
model.fit().predict()
model.plot(save=fpath, dpi=DPI, lineage_probability=True)
@compare()
def test_model_no_legend(self, adata: AnnData, fpath: str):
model = create_model(adata)
model.prepare(adata.var_names[0], "1")
model.fit().predict()
model.confidence_interval()
model.plot(save=fpath, dpi=DPI, loc=None)
# TODO: parametrize (hide cells, ci)
@compare()
def test_model_show_lin_prob_cells_ci(self, adata: AnnData, fpath: str):
model = create_model(adata)
model.prepare(adata.var_names[0], "1")
model.fit().predict()
model.confidence_interval()
model.plot(
save=fpath,
dpi=DPI,
hide_cells=False,
conf_int=True,
lineage_probability=True,
)
@compare()
def test_model_show_lin_prob_cells_lineage_ci(self, adata: AnnData, fpath: str):
model = create_model(adata)
model.prepare(adata.var_names[0], "1")
model.fit().predict()
model.confidence_interval()
model.plot(
save=fpath,
dpi=DPI,
hide_cells=True,
conf_int=True,
lineage_probability=True,
lineage_probability_conf_int=True,
)
@compare()
def test_model_1_lineage(self, adata: AnnData, fpath: str):
adata.obsm[Key.obsm.abs_probs(False)] = Lineage(
np.ones((adata.n_obs, 1)), names=["foo"]
)
model = create_model(adata)
model = model.prepare(adata.var_names[0], "foo", n_test_points=100).fit()
model.fit().predict()
model.confidence_interval()
model.plot(save=fpath, dpi=DPI, conf_int=True)
@gamr_skip
class TestGAMR:
@compare(kind="gamr")
def test_gamr_default(self, model: GAMR, fpath: str):
model.prepare(model.adata.var_names[0], "1")
model.fit().predict()
model.plot(
save=fpath,
dpi=DPI,
)
@compare(kind="gamr")
def test_gamr_ci_50(self, model: GAMR, fpath: str):
model.prepare(model.adata.var_names[0], "1")
model.fit().predict(level=0.5)
model.plot(
conf_int=True,
save=fpath,
dpi=DPI,
)
@compare(kind="gamr")
def test_gamr_no_ci(self, model: GAMR, fpath: str):
model.prepare(model.adata.var_names[0], "1")
model.fit().predict(level=None)
model.plot(
conf_int=False,
save=fpath,
dpi=DPI,
)
@compare(kind="gamr")
def test_gamr_no_cbar(self, model: GAMR, fpath: str):
model.prepare(model.adata.var_names[0], "1")
model.fit().predict(level=0.95)
model.plot(
cbar=False,
save=fpath,
dpi=DPI,
)
@compare(kind="gamr")
def test_gamr_lineage_prob(self, model: GAMR, fpath: str):
model.prepare(model.adata.var_names[0], "1")
model.fit().predict(level=0.95)
model.plot(
lineage_probability=True,
lineage_probability_conf_int=True,
save=fpath,
dpi=DPI,
)
@compare(kind="gamr")
def test_trends_gam_ci_100(self, model: GAMR, fpath: str):
cr.pl.gene_trends(
model.adata,
model,
GENES[:3],
conf_int=1,
backward=False,
data_key="Ms",
dpi=DPI,
save=fpath,
)
@compare(kind="gamr")
def test_trends_gam_ci_20(self, model: GAMR, fpath: str):
cr.pl.gene_trends(
model.adata,
model,
GENES[:3],
conf_int=0.2,
backward=False,
data_key="Ms",
dpi=DPI,
save=fpath,
)
class TestComposition:
@compare()
def test_composition(self, adata: AnnData, fpath: str):
cr.pl._utils.composition(adata, "clusters", dpi=DPI, save=fpath)
@compare()
def test_composition_kwargs_autopct(self, adata: AnnData, fpath: str):
cr.pl._utils.composition(
adata, "clusters", dpi=DPI, save=fpath, autopct="%1.0f%%"
)
class TestFittedModel:
@compare()
def test_fitted_empty_model(self, _adata: AnnData, fpath: str):
np.random.seed(42)
fm = cr.ul.models.FittedModel(np.arange(100), np.random.normal(size=100))
fm.plot(dpi=DPI, save=fpath)
@compare()
def test_fitted_model_conf_int(self, _adata: AnnData, fpath: str):
np.random.seed(43)
y_test = np.random.normal(size=100)
fm = cr.ul.models.FittedModel(
np.arange(100), y_test, conf_int=np.c_[y_test - 1, y_test + 1]
)
fm.plot(conf_int=True, dpi=DPI, save=fpath)
@compare()
def test_fitted_model_conf_int_no_conf_int_computed(
self, _adata: AnnData, fpath: str
):
np.random.seed(44)
fm = cr.ul.models.FittedModel(
np.arange(100),
np.random.normal(size=100),
)
fm.plot(conf_int=True, dpi=DPI, save=fpath)
@compare()
def test_fitted_model_cells_with_weights(self, _adata: AnnData, fpath: str):
np.random.seed(45)
fm = cr.ul.models.FittedModel(
np.arange(100),
np.random.normal(size=100),
x_all=np.random.normal(size=200),
y_all=np.random.normal(size=200),
)
fm.plot(hide_cells=False, dpi=DPI, save=fpath)
@compare()
def test_fitted_model_weights(self, _adata: AnnData, fpath: str):
np.random.seed(46)
fm = cr.ul.models.FittedModel(
np.arange(100),
np.random.normal(size=100),
x_all=np.random.normal(size=200),
y_all=np.random.normal(size=200),
w_all=np.random.normal(size=200),
)
fm.plot(hide_cells=False, dpi=DPI, save=fpath)
@compare()
def test_fitted_ignore_plot_smoothed_lineage(self, _adata: AnnData, fpath: str):
np.random.seed(47)
fm = cr.ul.models.FittedModel(
np.arange(100),
np.random.normal(size=100),
x_all=np.random.normal(size=200),
y_all=np.random.normal(size=200),
w_all=np.random.normal(size=200),
)
fm.plot(
lineage_probability=True,
lineage_probability_conf_int=True,
dpi=DPI,
save=fpath,
)
@compare()
def test_fitted_gene_trends(self, adata: AnnData, fpath: str):
np.random.seed(48)
fm1 = cr.ul.models.FittedModel(
np.arange(100),
np.random.normal(size=100),
x_all=np.random.normal(size=200),
y_all=np.random.normal(size=200),
w_all=np.random.normal(size=200),
)
fm2 = cr.ul.models.FittedModel(
np.arange(100),
np.random.normal(size=100),
x_all=np.random.normal(size=200),
y_all=np.random.normal(size=200),
w_all=np.random.normal(size=200),
)
cr.pl.gene_trends(
adata,
{GENES[0]: fm1, GENES[1]: fm2},
GENES[:2],
data_key="Ms",
dpi=DPI,
save=fpath,
)
@compare(tol=250)
def test_fitted_cluster_fates(self, adata: AnnData, fpath: str):
np.random.seed(49)
model = cr.ul.models.FittedModel(
np.arange(100),
np.random.normal(size=100),
)
cr.pl.cluster_lineage(
adata,
model,
GENES[:10],
"1",
n_points=100,
time_key="latent_time",
random_state=49,
dpi=DPI,
save=fpath,
)
@compare(dirname="fitted_heatmap")
def test_fitted_heatmap(self, adata: AnnData, fpath: str):
np.random.seed(49)
fm = cr.ul.models.FittedModel(
np.arange(100),
np.random.normal(size=100),
)
cr.pl.heatmap(
adata,
fm,
GENES[:10],
mode="lineages",
time_key="latent_time",
dpi=DPI,
save=fpath,
)
class TestCircularProjection:
def test_proj_too_few_lineages(self, adata_gpcca_fwd):
adata, _ = adata_gpcca_fwd
lineages = adata.obsm[Key.obsm.abs_probs(False)].names[:2]
with pytest.raises(ValueError, match=r"Expected at least `3` lineages"):
cr.pl.circular_projection(
adata, keys=["clusters", "clusters"], lineages=lineages
)
@compare()
def test_proj_duplicate_keys(self, adata: AnnData, fpath: str):
cr.pl.circular_projection(
adata, keys=["clusters", "clusters"], dpi=DPI, save=fpath
)
key = "X_fate_simplex_fwd"
assert key in adata.obsm
assert isinstance(adata.obsm[key], np.ndarray)
assert adata.obsm[key].shape[1] == 2
@compare()
def test_proj_key_added(self, adata: AnnData, fpath: str):
key = "foo"
cr.pl.circular_projection(
adata, keys=adata.var_names[0], key_added=key, dpi=DPI, save=fpath
)
assert key in adata.obsm
assert isinstance(adata.obsm[key], np.ndarray)
assert adata.obsm[key].shape[1] == 2
@compare()
def test_proj_hide_edges(self, adata: AnnData, fpath: str):
cr.pl.circular_projection(
adata, keys="dpt_pseudotime", show_edges=False, dpi=DPI, save=fpath
)
@compare()
def test_proj_dont_normalize_by_mean(self, adata: AnnData, fpath: str):
cr.pl.circular_projection(
adata, keys="clusters", normalize_by_mean=False, dpi=DPI, save=fpath
)
@compare()
def test_proj_use_raw(self, adata: AnnData, fpath: str):
cr.pl.circular_projection(
adata, keys=adata.raw.var_names[0], use_raw=True, dpi=DPI, save=fpath
)
@compare()
def test_proj_ncols(self, adata: AnnData, fpath: str):
cr.pl.circular_projection(
adata, keys=adata.var_names[:2], ncols=1, dpi=DPI, save=fpath
)
@compare()
def test_proj_labelrot(self, adata: AnnData, fpath: str):
cr.pl.circular_projection(
adata, keys="clusters", label_rot="default", dpi=DPI, save=fpath
)
@compare()
def test_proj_labeldistance(self, adata: AnnData, fpath: str):
cr.pl.circular_projection(
adata, keys="clusters", label_distance=1.5, dpi=DPI, save=fpath
)
@compare()
def test_proj_text_kwargs(self, adata: AnnData, fpath: str):
cr.pl.circular_projection(
adata, keys="clusters", text_kwargs={"size": 20}, dpi=DPI, save=fpath
)
@compare()
def test_proj_default_ordering(self, adata: AnnData, fpath: str):
cr.pl.circular_projection(
adata, keys="clusters", lineage_order="default", dpi=DPI, save=fpath
)
@compare()
def test_proj_extra_keys(self, adata: AnnData, fpath: str):
cr.pl.circular_projection(
adata, keys=["kl_divergence", "entropy"], dpi=DPI, save=fpath
)
apk = Key.obsm.abs_probs(False)
assert f"{apk}_kl_divergence" in adata.obs
assert f"{apk}_entropy" in adata.obs
@compare()
def test_proj_scvelo_kwargs(self, adata: AnnData, fpath: str):
cr.pl.circular_projection(
adata, keys="clusters", legend_loc="upper right", dpi=DPI, save=fpath
)
@compare()
def test_proj_no_cbar(self, adata: AnnData, fpath: str):
cr.pl.circular_projection(
adata, keys=adata.var_names[0], colorbar=False, dpi=DPI, save=fpath
)
class TestPlotRandomWalk:
@compare(kind="gpcca")
def test_kernel_random_walk_params(self, mc: GPCCA, fpath: str):
mc.kernel.plot_random_walks(
n_sims=100,
max_iter=100,
seed=42,
start_ixs={"clusters": "OL"},
dpi=DPI,
save=fpath,
)
@compare(kind="gpcca")
def test_kernel_random_walk_start_ixs_range(self, mc: GPCCA, fpath: str):
mc.kernel.plot_random_walks(
n_sims=10,
max_iter=100,
seed=42,
start_ixs={"dpt_pseudotime": [0, 0]},
color="dpt_pseudotime",
dpi=DPI,
save=fpath,
)
@compare(kind="gpcca")
def test_kernel_random_walk_basis(self, mc: GPCCA, fpath: str):
mc.kernel.plot_random_walks(
n_sims=10, max_iter=100, seed=42, basis="pca", dpi=DPI, save=fpath
)
@compare(kind="gpcca")
def test_kernel_random_walk_cmap(self, mc: GPCCA, fpath: str):
mc.kernel.plot_random_walks(
n_sims=10, max_iter=100, seed=42, cmap="viridis", dpi=DPI, save=fpath
)
@compare(kind="gpcca")
def test_kernel_random_walk_line_width(self, mc: GPCCA, fpath: str):
mc.kernel.plot_random_walks(
n_sims=10, max_iter=100, seed=42, linewidth=2, dpi=DPI, save=fpath
)
@compare(kind="gpcca")
def test_kernel_random_walk_line_alpha(self, mc: GPCCA, fpath: str):
mc.kernel.plot_random_walks(
n_sims=10, max_iter=100, seed=42, linealpha=1, dpi=DPI, save=fpath
)
@compare(kind="gpcca")
def test_kernel_random_walk_kwargs(self, mc: GPCCA, fpath: str):
mc.kernel.plot_random_walks(
n_sims=10, max_iter=100, seed=42, color="none", dpi=DPI, save=fpath
)
@compare(kind="gpcca")
def test_kernel_random_walk_ixs_legend_loc(self, mc: GPCCA, fpath: str):
mc.kernel.plot_random_walks(
n_sims=10,
max_iter=100,
seed=42,
ixs_legend_loc="top right out",
legend_loc="upper left",
dpi=DPI,
save=fpath,
)
class TestPlotSingleFlow:
@compare(kind="gpcca")
def test_flow_source_clusters(self, mc: GPCCA, fpath: str):
mc.kernel.plot_single_flow(
"Neuroblast",
"clusters",
"age(days)",
clusters=["OPC", "Endothelial", "OL"],
dpi=DPI,
save=fpath,
)
@compare(kind="gpcca")
def test_flow_clusters_subset(self, mc: GPCCA, fpath: str):
mc.kernel.plot_single_flow(
"Astrocytes",
"clusters",
"age(days)",
clusters=["OPC", "Endothelial", "OL"],
dpi=DPI,
save=fpath,
)
@compare(kind="gpcca")
def test_flow_min_flow_remove_empty_clusters(self, mc: GPCCA, fpath: str):
mc.kernel.plot_single_flow(
"Astrocytes",
"clusters",
"age(days)",
min_flow=0.2,
remove_empty_clusters=True,
dpi=DPI,
save=fpath,
)
@compare(kind="gpcca")
def test_flow_min_flow_keep_empty_clusters(self, mc: GPCCA, fpath: str):
mc.kernel.plot_single_flow(
"Astrocytes",
"clusters",
"age(days)",
min_flow=0.2,
remove_empty_clusters=False,
dpi=DPI,
save=fpath,
)
@compare(kind="gpcca")
def test_flow_cluster_ascending(self, mc: GPCCA, fpath: str):
mc.kernel.plot_single_flow(
"Astrocytes", "clusters", "age(days)", ascending=True, dpi=DPI, save=fpath
)
@compare(kind="gpcca")
def test_flow_cluster_descending(self, mc: GPCCA, fpath: str):
mc.kernel.plot_single_flow(
"Astrocytes", "clusters", "age(days)", ascending=False, dpi=DPI, save=fpath
)
@compare(kind="gpcca")
def test_flow_explicit_cluster_order(self, mc: GPCCA, fpath: str):
mc.kernel.plot_single_flow(
"Astrocytes",
"clusters",
"age(days)",
ascending=None,
clusters=["OPC", "OL"],
dpi=DPI,
save=fpath,
)
@compare(kind="gpcca")
def test_flow_legend_loc(self, mc: GPCCA, fpath: str):
mc.kernel.plot_single_flow(
"Astrocytes",
"clusters",
"age(days)",
legend_loc="upper left out",
dpi=DPI,
save=fpath,
)
@compare(kind="gpcca")
def test_flow_alpha(self, mc: GPCCA, fpath: str):
mc.kernel.plot_single_flow(
"Astrocytes", "clusters", "age(days)", alpha=0.3, dpi=DPI, save=fpath
)
@compare(kind="gpcca")
def test_flow_no_xticks(self, mc: GPCCA, fpath: str):
mc.kernel.plot_single_flow(
"Astrocytes",
"clusters",
"age(days)",
xticks_step_size=None,
dpi=DPI,
save=fpath,
)
@compare(kind="gpcca")
def test_flow_time_categories_too_close(self, mc: GPCCA, fpath: str):
mc.adata.obs["day"] = (
mc.adata.obs["age(days)"]
.cat.rename_categories(
{
"12": 0.1,
"35": 0.291,
}
)
.values
)
mc.kernel.plot_single_flow("Astrocytes", "clusters", "day", dpi=DPI, save=fpath)
@compare(kind="gpcca")
def test_flow_return_ax(self, mc: GPCCA, fpath: str):
ax = mc.kernel.plot_single_flow(
"Astrocytes", "clusters", "age(days)", show=False, dpi=DPI, save=fpath
)
assert isinstance(ax, plt.Axes)
class TestPlotDriverCorrelation:
@compare(kind="gpcca")
def test_driver_corr(self, mc: GPCCA, fpath: str):
mc.plot_lineage_drivers_correlation(
"1", "2", dpi=DPI, save=fpath, title="bar", size=100
)
@compare(kind="gpcca")
def test_driver_corr_color(self, mc: GPCCA, fpath: str):
mc.plot_lineage_drivers_correlation(
"0", "1", dpi=DPI, save=fpath, color="2_corr"
)
@compare(kind="gpcca")
def test_driver_corr_gene_sets(self, mc: GPCCA, fpath: str):
mc.plot_lineage_drivers_correlation(
"0", "1", dpi=DPI, save=fpath, gene_sets={"0": mc.adata.var_names[:3]}
)
@compare(kind="gpcca")
def test_driver_corr_gene_sets_colors(self, mc: GPCCA, fpath: str):
mc.plot_lineage_drivers_correlation(
"0",
"1",
dpi=DPI,
save=fpath,
gene_sets={"0": mc.adata.var_names[:3], "1": [mc.adata.var_names[4]]},
gene_sets_colors=["red", "black"],
)
@compare(kind="gpcca")
def test_driver_corr_legend_loc(self, mc: GPCCA, fpath: str):
mc.plot_lineage_drivers_correlation(
"0",
"1",
dpi=DPI,
save=fpath,
gene_sets={"0": mc.adata.var_names[:3], "1": [mc.adata.var_names[4]]},
legend_loc="lower center out",
)
@compare(kind="gpcca")
def test_driver_corr_use_raw(self, mc: GPCCA, fpath: str):
mc.compute_lineage_drivers(cluster_key="clusters", use_raw=True)
mc.plot_lineage_drivers_correlation(
"0", "1", dpi=DPI, save=fpath, use_raw=True, color="1_qval"
)
@compare(kind="gpcca")
def test_driver_corr_cmap(self, mc: GPCCA, fpath: str):
mc.plot_lineage_drivers_correlation(
"0", "1", dpi=DPI, save=fpath, color="1_qval", cmap="inferno"
)
@compare(kind="gpcca")
def test_driver_corr_fontsize(self, mc: GPCCA, fpath: str):
mc.plot_lineage_drivers_correlation(
"0",
"1",
dpi=DPI,
save=fpath,
gene_sets={"foo": mc.adata.var_names[4:6]},
fontsize=20,
)
@compare(kind="gpcca")
def test_driver_corr_adjust_text(self, mc: GPCCA, fpath: str):
mc.plot_lineage_drivers_correlation(
"0",
"1",
dpi=DPI,
save=fpath,
gene_sets={"bar": mc.adata.var_names[:3]},
adjust_text=True,
)
@compare(kind="gpcca")
def test_driver_corr_return_ax(self, mc: GPCCA, fpath: str):
ax = mc.plot_lineage_drivers_correlation(
"2", "0", dpi=DPI, save=fpath, show=False
)
assert isinstance(ax, plt.Axes)
class TestLogOdds:
@compare(tol=250)
def test_log_odds(self, adata: AnnData, fpath: str):
cr.pl.log_odds(
adata,
"0",
"1",
"age(days)",
dpi=DPI,
save=fpath,
figsize=(4, 3),
size=10,
seed=42,
)
@compare(kind="bwd", tol=250)
def test_log_odds_bwd(self, adata: AnnData, fpath: str):
cr.pl.log_odds(
adata,
"0",
"1",
"age(days)",
dpi=DPI,
save=fpath,
backward=True,
figsize=(4, 3),
size=10,
seed=42,
)
@compare()
def test_log_odds_rest(self, adata: AnnData, fpath: str):
cr.pl.log_odds(
adata,
"2",
None,
"age(days)",
dpi=DPI,
save=fpath,
figsize=(4, 3),
size=10,
seed=42,
)
@compare()
def test_log_odds_continuous_keys(self, adata: AnnData, fpath: str):
cr.pl.log_odds(
adata,
"0",
"1",
"age(days)",
dpi=DPI,
save=fpath,
keys=adata.var_names[:3],
figsize=(4, 3),
size=4,
)
@compare()
def test_log_odds_categorical_keys(self, adata: AnnData, fpath: str):
cr.pl.log_odds(
adata,
"0",
"1",
"age(days)",
dpi=DPI,
save=fpath,
keys=["clusters", "clusters_enlarged"],
figsize=(4, 3),
size=10,
seed=42,
)
@compare()
def test_log_odds_threshold(self, adata: AnnData, fpath: str):
cr.pl.log_odds(
adata,
"0",
"1",
"age(days)",
dpi=DPI,
save=fpath,
keys=adata.var_names[:3],
threshold=0.5,
figsize=(4, 3),
size=10,
seed=42,
)
@compare()
def test_log_odds_multiple_threshold(self, adata: AnnData, fpath: str):
cr.pl.log_odds(
adata,
"0",
"1",
"age(days)",
dpi=DPI,
save=fpath,
keys=adata.var_names[:3],
threshold=[0.7, 0.2, 0.3],
figsize=(4, 3),
size=10,
seed=42,
)
@compare()
def test_log_odds_threshold_color(self, adata: AnnData, fpath: str):
cr.pl.log_odds(
adata,
"0",
"1",
"age(days)",
dpi=DPI,
save=fpath,
keys=adata.var_names[:3],
threshold=0.5,
threshold_color="blue",
figsize=(4, 3),
size=10,
seed=42,
)
@compare()
def test_log_odds_layer(self, adata: AnnData, fpath: str):
cr.pl.log_odds(
adata,
"0",
"1",
"age(days)",
dpi=DPI,
save=fpath,
keys=adata.var_names[3:6],
layer="Ms",
figsize=(4, 3),
size=10,
seed=42,
)
@compare()
def test_log_odds_use_raw(self, adata: AnnData, fpath: str):
cr.pl.log_odds(
adata,
"0",
"1",
"age(days)",
dpi=DPI,
save=fpath,
keys=adata.raw.var_names[3:6],
use_raw=True,
figsize=(4, 3),
size=10,
seed=42,
)
@compare()
def test_log_odds_size(self, adata: AnnData, fpath: str):
cr.pl.log_odds(
adata,
"0",
"1",
"age(days)",
dpi=DPI,
save=fpath,
keys="clusters",
size=20,
figsize=(4, 3),
)
@compare()
def test_log_odds_cmap(self, adata: AnnData, fpath: str):
cr.pl.log_odds(
adata,
"0",
"1",
"age(days)",
dpi=DPI,
save=fpath,
keys=adata.var_names[:2],
size=10,
cmap="inferno",
figsize=(4, 3),
)
@compare()
def test_log_odds_alpha(self, adata: AnnData, fpath: str):
cr.pl.log_odds(
adata,
"0",
"1",
"age(days)",
dpi=DPI,
save=fpath,
keys="clusters",
alpha=0.5,
figsize=(4, 3),
size=10,
seed=42,
)
@compare()
def test_log_odds_ncols(self, adata: AnnData, fpath: str):
cr.pl.log_odds(
adata,
"0",
"1",
"age(days)",
dpi=DPI,
save=fpath,
keys=["clusters", adata.var_names[-1]],
ncols=1,
figsize=(3, 4),
size=10,
seed=42,
)
@compare()
def test_log_odds_fontsize(self, adata: AnnData, fpath: str):
cr.pl.log_odds(
adata,
"0",
"1",
"age(days)",
dpi=DPI,
save=fpath,
keys="clusters",
fontsize=25,
figsize=(3, 4),
size=10,
seed=42,
)
@compare()
def test_log_odds_xticks_steps_size(self, adata: AnnData, fpath: str):
cr.pl.log_odds(
adata,
"0",
"1",
"age(days)",
dpi=DPI,
save=fpath,
keys="clusters",
xticks_step_size=None,
figsize=(3, 4),
size=10,
seed=42,
)
@compare()
def test_log_odds_legend_loc(self, adata: AnnData, fpath: str):
cr.pl.log_odds(
adata,
"0",
"1",
"age(days)",
dpi=DPI,
save=fpath,
keys=["clusters", adata.var_names[-1]],
legend_loc="upper right out",
figsize=(4, 3),
size=10,
seed=42,
)
@compare(tol=250)
def test_log_odds_jitter(self, adata: AnnData, fpath: str):
cr.pl.log_odds(
adata,
"0",
"1",
"age(days)",
dpi=DPI,
save=fpath,
figsize=(4, 3),
size=10,
seed=42,
jitter=1,
)
@compare()
def test_log_odds_kwargs_return_ax(self, adata: AnnData, fpath: str):
ax = cr.pl.log_odds(
adata,
"1",
"2",
"age(days)",
keys="clusters",
dpi=DPI,
save=fpath,
show=False,
edgecolor="red",
figsize=(4, 3),
size=4,
)
assert isinstance(ax, plt.Axes)
@compare()
def test_log_odds_kwargs_return_axes(self, adata: AnnData, fpath: str):
axes = cr.pl.log_odds(
adata,
"1",
"2",
"age(days)",
keys=adata.var_names[:3],
dpi=DPI,
save=fpath,
ncols=2,
show=False,
figsize=(4, 3),
size=4,
)
assert isinstance(axes, np.ndarray)
assert axes.shape == (3,)
assert np.all([isinstance(ax, plt.Axes) for ax in axes])
@compare()
def test_log_odds_kwargs(self, adata: AnnData, fpath: str):
cr.pl.log_odds(
adata,
"1",
"2",
"age(days)",
dpi=DPI,
save=fpath,
linewidth=5,
edgecolor="red",
figsize=(4, 3),
size=4,
)
class TestMacrostateComposition:
@compare(kind="gpcca")
def test_msc_default(self, mc: GPCCA, fpath: str):
mc.plot_macrostate_composition("clusters", dpi=DPI, save=fpath)
@compare(kind="gpcca")
def test_msc_width(self, mc: GPCCA, fpath: str):
mc.plot_macrostate_composition("clusters", dpi=DPI, save=fpath, width=0.2)
@compare(kind="gpcca")
def test_msc_title(self, mc: GPCCA, fpath: str):
mc.plot_macrostate_composition("clusters", dpi=DPI, save=fpath, title="foobar")
@compare(kind="gpcca")
def test_msc_labelrot(self, mc: GPCCA, fpath: str):
mc.plot_macrostate_composition("clusters", dpi=DPI, save=fpath, labelrot=0)
@compare(kind="gpcca")
def test_msc_legend_loc(self, mc: GPCCA, fpath: str):
mc.plot_macrostate_composition(
"clusters_enlarged", dpi=DPI, save=fpath, legend_loc="upper left out"
)
class TestProjectionEmbedding:
@compare()
def test_scvelo_connectivity_kernel_emb_stream(self, adata: AnnData, fpath: str):
ck = ConnectivityKernel(adata)
ck.compute_transition_matrix()
ck.compute_projection()
scv.pl.velocity_embedding_stream(adata, vkey="T_fwd", dpi=DPI, save=fpath)
@compare()
def test_scvelo_pseudotime_kernel_hard_threshold_emb_stream(
self, adata: AnnData, fpath: str
):
ptk = PseudotimeKernel(adata)
ptk.compute_transition_matrix(threshold_scheme="hard", frac_to_keep=0.3)
ptk.compute_projection()
scv.pl.velocity_embedding_stream(adata, vkey="T_fwd", dpi=DPI, save=fpath)
@compare()
def test_scvelo_pseudotime_kernel_soft_threshold_emb_stream(
self, adata: AnnData, fpath: str
):
ptk = PseudotimeKernel(adata)
ptk.compute_transition_matrix(threshold_scheme="soft", frac_to_keep=0.3)
ptk.compute_projection()
scv.pl.velocity_embedding_stream(adata, vkey="T_fwd", dpi=DPI, save=fpath)
@compare()
def test_scvelo_velocity_kernel_emb_stream(self, adata: AnnData, fpath: str):
vk = VelocityKernel(adata)
vk.compute_transition_matrix()
vk.compute_projection()
scv.pl.velocity_embedding_stream(adata, vkey="T_fwd", dpi=DPI, save=fpath)
| 29.081489 | 116 | 0.544968 | 12,993 | 111,702 | 4.466328 | 0.047025 | 0.041495 | 0.051869 | 0.077803 | 0.86633 | 0.844583 | 0.814892 | 0.79237 | 0.744188 | 0.682463 | 0 | 0.014388 | 0.337335 | 111,702 | 3,840 | 117 | 29.089063 | 0.769592 | 0.005076 | 0 | 0.663217 | 0 | 0.000591 | 0.051997 | 0.003951 | 0 | 0 | 0 | 0.00026 | 0.020402 | 1 | 0.105855 | false | 0 | 0.007688 | 0 | 0.123891 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6 |
0f89ea520796c83160597e4b348525ed3d09942c | 226 | py | Python | mobile/exceptions/bad_request_api_exception.py | invinst/CPDB | c2d8ae8888b13d956cc1068742f18d45736d4121 | [
"Apache-2.0"
] | 16 | 2016-05-20T09:03:32.000Z | 2020-09-13T14:23:06.000Z | mobile/exceptions/bad_request_api_exception.py | invinst/CPDB | c2d8ae8888b13d956cc1068742f18d45736d4121 | [
"Apache-2.0"
] | 2 | 2016-05-24T01:44:14.000Z | 2016-06-17T22:19:45.000Z | mobile/exceptions/bad_request_api_exception.py | invinst/CPDB | c2d8ae8888b13d956cc1068742f18d45736d4121 | [
"Apache-2.0"
] | 2 | 2016-10-10T16:14:19.000Z | 2020-10-26T00:17:02.000Z | from rest_framework.exceptions import APIException
from rest_framework.status import HTTP_400_BAD_REQUEST
class BadRequestApiException(APIException):
status_code = HTTP_400_BAD_REQUEST
default_detail = 'Bad request'
| 28.25 | 54 | 0.840708 | 28 | 226 | 6.428571 | 0.571429 | 0.166667 | 0.188889 | 0.188889 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.030151 | 0.119469 | 226 | 7 | 55 | 32.285714 | 0.874372 | 0 | 0 | 0 | 0 | 0 | 0.048673 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.4 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 6 |
7e37615761b5e55b76a2cf288de705028fe0f395 | 78 | py | Python | ooobuild/star/__init__.py | Amourspirit/ooo_uno_tmpl | 64e0c86fd68f24794acc22d63d8d32ae05dd12b8 | [
"Apache-2.0"
] | null | null | null | ooobuild/star/__init__.py | Amourspirit/ooo_uno_tmpl | 64e0c86fd68f24794acc22d63d8d32ae05dd12b8 | [
"Apache-2.0"
] | null | null | null | ooobuild/star/__init__.py | Amourspirit/ooo_uno_tmpl | 64e0c86fd68f24794acc22d63d8d32ae05dd12b8 | [
"Apache-2.0"
] | null | null | null | from typing import TYPE_CHECKING
if not TYPE_CHECKING:
raise ImportError
| 15.6 | 32 | 0.807692 | 11 | 78 | 5.545455 | 0.818182 | 0.393443 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.179487 | 78 | 4 | 33 | 19.5 | 0.953125 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.666667 | 0 | 0.666667 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 6 |
7e68309003f4de16b97eadbb53c9aa78808c23b4 | 10,538 | py | Python | lvreuse/analysis/combined/cost_breakdown_sweep.py | mvernacc/lvreuse | e2ac6aca334b49b0d4f5f881861cb42ce86dd130 | [
"MIT"
] | 7 | 2019-10-01T04:21:23.000Z | 2022-03-22T15:20:38.000Z | lvreuse/analysis/combined/cost_breakdown_sweep.py | mvernacc/lvreuse | e2ac6aca334b49b0d4f5f881861cb42ce86dd130 | [
"MIT"
] | null | null | null | lvreuse/analysis/combined/cost_breakdown_sweep.py | mvernacc/lvreuse | e2ac6aca334b49b0d4f5f881861cb42ce86dd130 | [
"MIT"
] | 6 | 2019-10-01T04:21:24.000Z | 2021-02-15T17:07:10.000Z | import os.path
from matplotlib import pyplot as plt
import matplotlib.ticker
import numpy as np
from lvreuse.analysis.combined import strategy_models
from lvreuse.analysis.cost.strategy_cost_models import wyr_conversion
from lvreuse.data.missions import LEO, LEO_smallsat
from num_reuse_sweep import get_mode_values
def main():
fontsize = 20
fontsize_axes = 24
fontsize_ticks = 24
strat = strategy_models.PropulsiveDownrange
strat_instance = strat(strategy_models.kero_GG_boost_tech, strategy_models.kero_GG_upper_tech, LEO)
modes = get_mode_values(strat_instance.uncertainties)
###
num_reuses = np.arange(1, 101)
s1_e1_prod_cost_per_flight = np.zeros(len(num_reuses))
s2_e2_prod_cost_per_flight = np.zeros(len(num_reuses))
veh_int_checkout = np.zeros(len(num_reuses))
ops_cost_per_flight = np.zeros(len(num_reuses))
prod_cost_per_flight = np.zeros(len(num_reuses))
cpf = np.zeros(len(num_reuses))
props_cost = np.zeros(len(num_reuses))
refurb_cost = np.zeros(len(num_reuses))
for i in range(len(num_reuses)):
modes['num_reuses_s1'] = num_reuses[i]
modes['num_reuses_e1'] = num_reuses[i]
results = strat_instance.evaluate(**modes)
prod_cost_per_flight[i] = results[2]
s1_e1_prod_cost_per_flight[i] = results[7]
s2_e2_prod_cost_per_flight[i] = results[8]
veh_int_checkout[i] = results[9]
ops_cost_per_flight[i] = results[3]
props_cost[i] = results[10]
refurb_cost[i] = results[11]
cpf[i] = results[4]
print('min cpf: ', min(cpf))
print('min use num: ', np.argmin(cpf))
labels = ['Stage 1 Production', 'Stage 2 Production', 'Vehicle Integration and Checkout',
'Operations', 'Propellants', 'Refurbishment']
plt.figure(figsize=(10.5, 9.5))
ax = plt.subplot(1, 1, 1)
plt.stackplot(num_reuses, s1_e1_prod_cost_per_flight*wyr_conversion, s2_e2_prod_cost_per_flight*wyr_conversion,
veh_int_checkout*wyr_conversion, ops_cost_per_flight*wyr_conversion - props_cost*wyr_conversion -
refurb_cost*wyr_conversion, props_cost*wyr_conversion, refurb_cost*wyr_conversion, labels=labels)
plt.xlabel('Number of 1st stage uses', fontsize=fontsize)
plt.xticks(fontsize=fontsize)
plt.ylabel('Cost [Million US Dollars in 2018]', fontsize=fontsize_axes)
plt.title('Cost per flight breakdown vs. vehicle life \n LEO mission, 10.0 Mg payload \n stage 1: kerosene gas generator tech., \nstage 2: kerosene gas generator tech', fontsize=fontsize)
plt.yticks(fontsize=fontsize)
ax.set_xscale('log')
ax.set_ylim(0, 60)
ax.tick_params(axis='both', labelsize=fontsize_ticks)
handles, labels = ax.get_legend_handles_labels()
ax.legend(handles[::-1], labels[::-1], fontsize=fontsize)
plt.xlim(1e0, 1e2)
# make x-axis not use exponential notation (exp. not. is de default for a log axis).
ax.get_xaxis().set_major_formatter(matplotlib.ticker.FormatStrFormatter('%.0f'))
ax.get_xaxis().set_minor_formatter(matplotlib.ticker.NullFormatter())
ax1 = ax.twinx()
ax1.set_ylabel('Cost [WYr]', fontsize=fontsize_axes)
ax1.set_ylim(0, 60/wyr_conversion)
ax1.tick_params(axis='y', labelsize=fontsize_ticks)
ax1.grid(False)
plt.tight_layout()
plt.savefig(os.path.join('plots', 'cpf_stackplot_reuses_sweep.png'))
###
modes = get_mode_values(strat_instance.uncertainties)
launch_rate = np.array([3, 5, 10, 20, 40])
cpf = np.zeros((len(launch_rate),len(num_reuses)))
plt.figure(figsize=(10.5, 10.5))
ax = plt.subplot(1, 1, 1)
for j in range(len(launch_rate)):
for i in range(len(num_reuses)):
modes['num_reuses_s1'] = num_reuses[i]
modes['num_reuses_e1'] = num_reuses[i]
modes['launch_rate'] = launch_rate[j]
results = strat_instance.evaluate(**modes)
cpf[j, i] = results[4]
plt.semilogx(num_reuses, cpf[j, :]*wyr_conversion)
plt.title('Cost per flight vs. vehicle life \n LEO mission, 10.0 Mg payload \n stage 1: kerosene gas generator tech., \nstage 2: kerosene gas generator tech', fontsize=fontsize)
plt.xlabel('Number of 1st stage uses', fontsize=fontsize)
#plt.xticks(fontsize=fontsize)
plt.ylabel('Cost per flight [Million US Dollars in 2018]', fontsize=fontsize)
labels = [str(i) for i in launch_rate]
# plt.legend(labels=labels, title='Launch rate', fontsize=fontsize*0.85)
plt.xlim(1e0, 1e2)
plt.ylim(0, 75)
ax.tick_params(axis='both', labelsize=0.8*fontsize)
ax.grid(True, which='major')
ax.grid(True, which='minor', color=[0.9]*3)
# make x-axis not use exponential notation (exp. not. is de default for a log axis).
ax.get_xaxis().set_major_formatter(matplotlib.ticker.FormatStrFormatter('%.0f'))
ax.get_xaxis().set_minor_formatter(matplotlib.ticker.NullFormatter())
ax1 = ax.twinx()
ax1.set_ylabel('Cost per flight [WYr]', fontsize=fontsize)
ax1.set_ylim(0, 75/wyr_conversion)
ax1.tick_params(axis='y', labelsize=0.8*fontsize)
ax1.grid(False)
plt.savefig(os.path.join('plots', 'cpf_reuses_sweep_vary_launch_rate.png'))
###
modes = get_mode_values(strat_instance.uncertainties)
launch_rate = np.arange(1, 31)
s1_e1_prod_cost_per_flight = np.zeros(len(launch_rate))
s2_e2_prod_cost_per_flight = np.zeros(len(launch_rate))
veh_int_checkout = np.zeros(len(launch_rate))
ops_cost_per_flight = np.zeros(len(launch_rate))
prod_cost_per_flight = np.zeros(len(launch_rate))
cpf = np.zeros(len(launch_rate))
props_cost = np.zeros(len(launch_rate))
refurb_cost = np.zeros(len(launch_rate))
for i in range(len(launch_rate)):
modes['launch_rate'] = launch_rate[i]
results = strat_instance.evaluate(**modes)
prod_cost_per_flight[i] = results[2]
s1_e1_prod_cost_per_flight[i] = results[7]
s2_e2_prod_cost_per_flight[i] = results[8]
veh_int_checkout[i] = results[9]
ops_cost_per_flight[i] = results[3]
cpf[i] = results[4]
props_cost[i] = results[10]
refurb_cost[i] = results[11]
labels = ['Stage 1 Production', 'Stage 2 Production', 'Vehicle Integration and Checkout',
'Operations', 'Propellants', 'Refurbishment']
plt.figure(figsize=(10.5, 10.5))
ax = plt.subplot(1, 1, 1)
plt.stackplot(launch_rate, s1_e1_prod_cost_per_flight*wyr_conversion, s2_e2_prod_cost_per_flight*wyr_conversion,
veh_int_checkout*wyr_conversion, ops_cost_per_flight*wyr_conversion - props_cost*wyr_conversion -
refurb_cost*wyr_conversion, props_cost*wyr_conversion, refurb_cost*wyr_conversion, labels=labels)
plt.xlabel('Annual launch rate', fontsize=fontsize)
plt.ylabel('Cost [Million US Dollars in 2018]', fontsize=fontsize)
plt.title('Cost per flight breakdown vs. launch rate \n LEO mission, 10.0 Mg payload \n stage 1: kerosene gas generator tech., \nstage 2: kerosene gas generator tech', fontsize=fontsize)
ax.set_xscale('log')
ax.tick_params(axis='both',labelsize=fontsize)
ax.set_ylim(0, 75)
handles, labels = ax.get_legend_handles_labels()
ax.legend(handles[::-1], labels[::-1], fontsize=fontsize*0.85)
plt.xlim(1, 30)
ax1 = ax.twinx()
ax1.set_ylabel('Cost [WYr]', fontsize=fontsize)
ax1.set_ylim(0, 75/wyr_conversion)
ax1.tick_params(axis='y', labelsize=0.8*fontsize)
ax1.grid(False)
plt.savefig(os.path.join('plots', 'cpf_stackplot_launch_rate_sweep.png'))
### small sat
strat_instance = strat(strategy_models.kero_GG_boost_tech, strategy_models.kero_GG_upper_tech, LEO_smallsat)
modes = get_mode_values(strat_instance.uncertainties)
num_reuses = np.arange(1, 101)
s1_e1_prod_cost_per_flight = np.zeros(len(num_reuses))
s2_e2_prod_cost_per_flight = np.zeros(len(num_reuses))
veh_int_checkout = np.zeros(len(num_reuses))
ops_cost_per_flight = np.zeros(len(num_reuses))
prod_cost_per_flight = np.zeros(len(num_reuses))
cpf = np.zeros(len(num_reuses))
props_cost = np.zeros(len(num_reuses))
refurb_cost = np.zeros(len(num_reuses))
for i in range(len(num_reuses)):
modes['num_reuses_s1'] = num_reuses[i]
modes['num_reuses_e1'] = num_reuses[i]
results = strat_instance.evaluate(**modes)
prod_cost_per_flight[i] = results[2]
s1_e1_prod_cost_per_flight[i] = results[7]
s2_e2_prod_cost_per_flight[i] = results[8]
veh_int_checkout[i] = results[9]
ops_cost_per_flight[i] = results[3]
props_cost[i] = results[10]
refurb_cost[i] = results[11]
cpf[i] = results[4]
print('min cpf: ', min(cpf))
print('min use num: ', np.argmin(cpf))
labels = ['Stage 1 Production', 'Stage 2 Production', 'Vehicle Integration and Checkout',
'Operations', 'Propellants', 'Refurbishment']
plt.figure(figsize=(10.5, 11))
ax = plt.subplot(1, 1, 1)
plt.stackplot(num_reuses, s1_e1_prod_cost_per_flight*wyr_conversion, s2_e2_prod_cost_per_flight*wyr_conversion,
veh_int_checkout*wyr_conversion, ops_cost_per_flight*wyr_conversion - props_cost*wyr_conversion -
refurb_cost*wyr_conversion, props_cost*wyr_conversion, refurb_cost*wyr_conversion, labels=labels)
plt.xlabel('Number of 1st stage uses', fontsize=fontsize)
plt.ylabel('Cost [Million US Dollars in 2018]', fontsize=fontsize_axes)
plt.title('Cost per flight breakdown vs. vehicle life \n LEO mission, 100 kg payload \n stage 1: kerosene gas generator tech., \nstage 2: kerosene gas generator tech', fontsize=fontsize)
ax.set_xscale('log')
ax.set_ylim(0, 12)
ax.tick_params(axis='both', labelsize=fontsize_ticks)
handles, labels = ax.get_legend_handles_labels()
ax.legend(handles[::-1], labels[::-1], fontsize=fontsize)
plt.xlim(1e0, 1e2)
# make x-axis not use exponential notation (exp. not. is de default for a log axis).
ax.get_xaxis().set_major_formatter(matplotlib.ticker.FormatStrFormatter('%.0f'))
ax.get_xaxis().set_minor_formatter(matplotlib.ticker.NullFormatter())
ax1 = ax.twinx()
ax1.set_ylabel('Cost [WYr]', fontsize=fontsize_axes)
ax1.set_ylim(0, 12/wyr_conversion)
ax1.tick_params(axis='y', labelsize=fontsize_ticks)
ax1.grid(False)
plt.tight_layout()
plt.savefig(os.path.join('plots', 'cpf_stackplot_reuses_sweep_small_sat.png'))
plt.show()
if __name__ == '__main__':
main() | 43.726141 | 191 | 0.699089 | 1,563 | 10,538 | 4.458093 | 0.122201 | 0.039179 | 0.072761 | 0.058553 | 0.889638 | 0.869259 | 0.844862 | 0.829363 | 0.817595 | 0.798651 | 0 | 0.029982 | 0.177073 | 10,538 | 241 | 192 | 43.726141 | 0.773524 | 0.034067 | 0 | 0.65445 | 0 | 0.020942 | 0.153808 | 0.013974 | 0 | 0 | 0 | 0 | 0 | 1 | 0.005236 | false | 0 | 0.041885 | 0 | 0.04712 | 0.020942 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6 |
7e97590fb6d55ce185187bd95d2e17ccf5c439f1 | 13,521 | py | Python | test/test_pyrg.py | Nausx/pyrg3 | cd133779d4120cd57f49325cc3f05b2466b167f7 | [
"BSD-3-Clause"
] | null | null | null | test/test_pyrg.py | Nausx/pyrg3 | cd133779d4120cd57f49325cc3f05b2466b167f7 | [
"BSD-3-Clause"
] | null | null | null | test/test_pyrg.py | Nausx/pyrg3 | cd133779d4120cd57f49325cc3f05b2466b167f7 | [
"BSD-3-Clause"
] | null | null | null | import unittest
import configparser
import sys
import os
from tempfile import NamedTemporaryFile
sys.path.insert(0, os.path.abspath("pyrg"))
import pyrg
class ColorFunctionTest(unittest.TestCase):
def test_coloring_method(self):
line = "get_gg (__main__.TestTest)"
self.assertEqual("[36mget_gg (__main__.TestTest)[0m",
pyrg.coloring_method(line))
def test_okroute(self):
input_strings = """..
----------------------------------------------------------------------
Ran 2 tests in 0.000s
OK
"""
result_strings = """[32m.[0m[32m.[0m
----------------------------------------------------------------------
Ran 2 tests in 0.000s
[32mOK[0m"""
ret = pyrg.parse_unittest_result(input_strings.splitlines(1))
self.assertEqual(ret, result_strings)
def test_okroute_verbose(self):
input_strings = """test_dummy1 (__main__.TestDummy) ... ok
----------------------------------------------------------------------
Ran 1 tests in 0.000s
OK
"""
result_strings = """test_dummy1 (__main__.TestDummy) ... [32mok[0m
----------------------------------------------------------------------
Ran 1 tests in 0.000s
[32mOK[0m"""
ret = pyrg.parse_unittest_result_verbose(input_strings.splitlines(1))
self.assertEqual(ret, result_strings)
def test_failroute(self):
input_strings = """.F
======================================================================
FAIL: test_dummy_fail (__main__.TestDummy)
----------------------------------------------------------------------
Traceback (most recent call last):
File "test/test_pyrg_ng.py", line 140, in test_dummy_fail
self.assertEqual(1, 2)
AssertionError: 1 != 2
----------------------------------------------------------------------
Ran 2 tests in 0.000s
FAILED (failures=1)
"""
result_strings = """[32m.[0m[31mF[0m
======================================================================
[31mFAIL[0m: [36mtest_dummy_fail (__main__.TestDummy)[0m
----------------------------------------------------------------------
Traceback (most recent call last):
File "test/test_pyrg_ng.py", line 140, in test_dummy_fail
self.assertEqual(1, 2)
AssertionError: 1 != 2
----------------------------------------------------------------------
Ran 2 tests in 0.000s
[31mFAILED[0m ([31mfailures[0m=[31m1[0m)"""
ret = pyrg.parse_unittest_result(input_strings.splitlines(1))
self.assertEqual(ret, result_strings)
def test_errorroute(self):
input_strings = """.E
======================================================================
ERROR: test_dummy_error (__main__.TestDummy)
----------------------------------------------------------------------
Traceback (most recent call last):
File "test/test_pyrg_ng.py", line 143, in test_dummy_error
self.assertEqual(1, a)
NameError: global name 'a' is not defined
----------------------------------------------------------------------
Ran 2 tests in 0.000s
FAILED (errors=1)
"""
result_strings = """[32m.[0m[1;33mE[0m
======================================================================
[1;33mERROR[0m: [36mtest_dummy_error (__main__.TestDummy)[0m
----------------------------------------------------------------------
Traceback (most recent call last):
File "test/test_pyrg_ng.py", line 143, in test_dummy_error
self.assertEqual(1, a)
NameError: global name 'a' is not defined
----------------------------------------------------------------------
Ran 2 tests in 0.000s
[31mFAILED[0m ([1;33merrors[0m=[1;33m1[0m)"""
ret = pyrg.parse_unittest_result(input_strings.splitlines(1))
self.assertEqual(ret, result_strings)
def test_errorfailroute(self):
input_strings = """.EF
======================================================================
ERROR: test_dummy_error (__main__.TestDummy)
----------------------------------------------------------------------
Traceback (most recent call last):
File "test/test_pyrg_ng.py", line 143, in test_dummy_error
self.assertEqual(1, a)
NameError: global name 'a' is not defined
======================================================================
FAIL: test_dummy_fail (__main__.TestDummy)
----------------------------------------------------------------------
Traceback (most recent call last):
File "test/test_pyrg_ng.py", line 140, in test_dummy_fail
self.assertEqual(1, 2)
AssertionError: 1 != 2
----------------------------------------------------------------------
Ran 3 tests in 0.000s
FAILED (failures=1, errors=1)
"""
result_strings = """[32m.[0m[1;33mE[0m[31mF[0m
======================================================================
[1;33mERROR[0m: [36mtest_dummy_error (__main__.TestDummy)[0m
----------------------------------------------------------------------
Traceback (most recent call last):
File "test/test_pyrg_ng.py", line 143, in test_dummy_error
self.assertEqual(1, a)
NameError: global name 'a' is not defined
======================================================================
[31mFAIL[0m: [36mtest_dummy_fail (__main__.TestDummy)[0m
----------------------------------------------------------------------
Traceback (most recent call last):
File "test/test_pyrg_ng.py", line 140, in test_dummy_fail
self.assertEqual(1, 2)
AssertionError: 1 != 2
----------------------------------------------------------------------
Ran 3 tests in 0.000s
[31mFAILED[0m ([31mfailures[0m=[31m1[0m, """\
"""[1;33merrors[0m=[1;33m1[0m)"""
ret = pyrg.parse_unittest_result(input_strings.splitlines(1))
self.assertEqual(ret, result_strings)
class TestColor(unittest.TestCase):
def setUp(self):
self.test_color_define = ['black', 'gray', 'red', 'pink', 'darkred',
'green', 'yellowgreen', 'darkgreen', 'brown',
'yellow', 'gold', 'blue', 'lightblue', 'darkblue',
'magenta', 'lightmagenta', 'darkmagenta',
'cyan', 'lightcyan', 'darkcyan', 'silver',
'white', 'darksilver']
None
def test_colormap_key_nonkey(self):
colorname = self.id().split('_')[-1]
self.assertEqual(False, colorname in pyrg.COLOR_MAP)
def test_colormap_key_black(self):
colorname = self.id().split('_')[-1]
self.assertEqual(True, colorname in pyrg.COLOR_MAP)
def test_colormap_key_gray(self):
colorname = self.id().split('_')[-1]
self.assertEqual(True, colorname in pyrg.COLOR_MAP)
def test_colormap_key_red(self):
colorname = self.id().split('_')[-1]
self.assertEqual(True, colorname in pyrg.COLOR_MAP)
def test_colormap_key_pink(self):
colorname = self.id().split('_')[-1]
self.assertEqual(True, colorname in pyrg.COLOR_MAP)
def test_colormap_key_darkred(self):
colorname = self.id().split('_')[-1]
self.assertEqual(True, colorname in pyrg.COLOR_MAP)
def test_colormap_key_green(self):
colorname = self.id().split('_')[-1]
self.assertEqual(True, colorname in pyrg.COLOR_MAP)
def test_colormap_key_yellowgreen(self):
colorname = self.id().split('_')[-1]
self.assertEqual(True, colorname in pyrg.COLOR_MAP)
def test_colormap_key_darkgreen(self):
colorname = self.id().split('_')[-1]
self.assertEqual(True, colorname in pyrg.COLOR_MAP)
def test_colormap_key_brown(self):
colorname = self.id().split('_')[-1]
self.assertEqual(True, colorname in pyrg.COLOR_MAP)
def test_colormap_key_yellow(self):
colorname = self.id().split('_')[-1]
self.assertEqual(True, colorname in pyrg.COLOR_MAP)
def test_colormap_key_gold(self):
colorname = self.id().split('_')[-1]
self.assertEqual(True, colorname in pyrg.COLOR_MAP)
def test_colormap_key_blue(self):
colorname = self.id().split('_')[-1]
self.assertEqual(True, colorname in pyrg.COLOR_MAP)
def test_colormap_key_lightblue(self):
colorname = self.id().split('_')[-1]
self.assertEqual(True, colorname in pyrg.COLOR_MAP)
def test_colormap_key_darkblue(self):
colorname = self.id().split('_')[-1]
self.assertEqual(True, colorname in pyrg.COLOR_MAP)
def test_colormap_key_magenta(self):
colorname = self.id().split('_')[-1]
self.assertEqual(True, colorname in pyrg.COLOR_MAP)
def test_colormap_key_lightmagenta(self):
colorname = self.id().split('_')[-1]
self.assertEqual(True, colorname in pyrg.COLOR_MAP)
def test_colormap_key_darkmagenta(self):
colorname = self.id().split('_')[-1]
self.assertEqual(True, colorname in pyrg.COLOR_MAP)
def test_colormap_key_cyan(self):
colorname = self.id().split('_')[-1]
self.assertEqual(True, colorname in pyrg.COLOR_MAP)
def test_colormap_key_lightcyan(self):
colorname = self.id().split('_')[-1]
self.assertEqual(True, colorname in pyrg.COLOR_MAP)
def test_colormap_key_darkcyan(self):
colorname = self.id().split('_')[-1]
self.assertEqual(True, colorname in pyrg.COLOR_MAP)
def test_colormap_key_silver(self):
colorname = self.id().split('_')[-1]
self.assertEqual(True, colorname in pyrg.COLOR_MAP)
def test_colormap_key_white(self):
colorname = self.id().split('_')[-1]
self.assertEqual(True, colorname in pyrg.COLOR_MAP)
def test_colormap_key_darksilver(self):
colorname = self.id().split('_')[-1]
self.assertEqual(True, colorname in pyrg.COLOR_MAP)
class TestConfig(unittest.TestCase):
def test_notexist_file(self):
color_set = pyrg.set_configuration("/home/hogehoge/.pyrgrc")
self.assertEqual(pyrg.PRINT_COLOR_SET_DEFAULT, color_set)
def test_check_id(self):
default_color_id = id(pyrg.PRINT_COLOR_SET_DEFAULT)
setting_color_id = id(pyrg.PRINT_COLOR_SET)
get_color_id = id(pyrg.set_configuration(""))
self.assertNotEqual(default_color_id, setting_color_id)
self.assertNotEqual(default_color_id, get_color_id)
self.assertNotEqual(setting_color_id, get_color_id)
def test_config(self):
config_example = """
[color]
ok = yellowgreen
error = red
fail = blue
function = pink
"""
temp = NamedTemporaryFile()
temp.file.write(config_example.encode())
temp.file.flush()
color_set = pyrg.set_configuration(temp.name)
self.assertEqual('yellowgreen', color_set['ok'])
self.assertEqual('red', color_set['error'])
self.assertEqual('blue', color_set['fail'])
self.assertEqual('pink', color_set['function'])
temp.close()
def test_config_inval_colorkey(self):
config_example = """
[color]
ok = white
fail = red
error = jihogeredd
function = pink
"""
temp = NamedTemporaryFile()
temp.file.write(config_example.encode())
temp.file.flush()
color_set = pyrg.set_configuration(temp.name)
self.assertEqual('white', color_set['ok'])
self.assertEqual('yellow', color_set['error'])
self.assertEqual('red', color_set['fail'])
self.assertEqual('pink', color_set['function'])
temp.close()
def test_config_empty(self):
config_example = """
[color]
ok =
error =
fail =
function =
"""
temp = NamedTemporaryFile()
temp.file.write(config_example)
temp.file.flush()
color_set = pyrg.set_configuration(temp.name)
self.assertEqual(pyrg.PRINT_COLOR_SET_DEFAULT, color_set)
temp.close()
def test_config_colorkey_notexist_all(self):
config_example = """
[color]
ok =
error =
hoge =
fail =
function =
"""
temp = NamedTemporaryFile()
temp.file.write(config_example.encode())
temp.file.flush()
color_set = pyrg.set_configuration(temp.name)
self.assertEqual(pyrg.PRINT_COLOR_SET_DEFAULT, color_set)
temp.close()
def test_config_keyword_notexist_2(self):
config_example = """
[color]
ok =
fail =
function =
"""
temp = NamedTemporaryFile()
temp.file.write(config_example.encode())
temp.file.flush()
color_set = pyrg.set_configuration(temp.name)
self.assertEqual(pyrg.PRINT_COLOR_SET_DEFAULT, color_set)
temp.close()
def test_config_keyword_notexist_4(self):
config_example = """
[color]
function =
"""
temp = NamedTemporaryFile()
temp.file.write(config_example.encode())
temp.file.flush()
color_set = pyrg.set_configuration(temp.name)
self.assertEqual(pyrg.PRINT_COLOR_SET_DEFAULT, color_set)
temp.close()
def test_config_keyword_notexist_all(self):
config_example = """
[color]
"""
temp = NamedTemporaryFile()
temp.file.write(config_example.encode())
temp.file.flush()
color_set = pyrg.set_configuration(temp.name)
self.assertEqual(pyrg.PRINT_COLOR_SET_DEFAULT, color_set)
temp.close()
def test_config_empty(self):
config_example = ""
temp = NamedTemporaryFile()
temp.file.write(config_example.encode())
temp.file.flush()
self.assertRaises(configparser.NoSectionError,
pyrg.set_configuration, temp.name)
temp.close()
if __name__ == '__main__':
unittest.main()
| 33.972362 | 79 | 0.569337 | 1,555 | 13,521 | 4.742765 | 0.101608 | 0.105763 | 0.062915 | 0.058576 | 0.833356 | 0.780339 | 0.768271 | 0.746034 | 0.737627 | 0.711593 | 0 | 0.021694 | 0.181791 | 13,521 | 397 | 80 | 34.057935 | 0.639158 | 0 | 0 | 0.685015 | 0 | 0 | 0.357757 | 0.17302 | 0 | 0 | 0 | 0 | 0.183486 | 1 | 0.125382 | false | 0 | 0.018349 | 0 | 0.152905 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6 |
7eb596f4b3ad3c7ef5fb61a109ac5ff34abec183 | 127 | py | Python | zones/helpers/__init__.py | jgrss/zones | cb6495ab18e49111f31f7c2951d3b1d4abe2bab4 | [
"MIT"
] | 1 | 2021-03-27T03:01:58.000Z | 2021-03-27T03:01:58.000Z | zones/helpers/__init__.py | Geospatial-Data-Science/zones | 87004580a3fe6a8e463582816988163669987f94 | [
"MIT"
] | 1 | 2020-01-08T01:21:19.000Z | 2020-01-16T00:21:42.000Z | zones/helpers/__init__.py | Geospatial-Data-Science/zones | 87004580a3fe6a8e463582816988163669987f94 | [
"MIT"
] | 3 | 2019-11-12T17:25:24.000Z | 2022-03-08T08:30:28.000Z | from ._dictionary import create_dictionary, merge_dictionary_keys
__all__ = ['create_dictionary', 'merge_dictionary_keys']
| 31.75 | 66 | 0.818898 | 14 | 127 | 6.642857 | 0.5 | 0.344086 | 0.451613 | 0.666667 | 0.752688 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.102362 | 127 | 3 | 67 | 42.333333 | 0.815789 | 0 | 0 | 0 | 0 | 0 | 0.306452 | 0.169355 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 6 |
0e19c9dcd1228f96f6e579c6f94c905e01de202b | 24 | py | Python | haversine/__init__.py | ajepe/haversine | 7129baea7a27c740e5e1a73001a6c5350d329f9c | [
"MIT"
] | 2 | 2019-06-01T19:46:22.000Z | 2019-06-03T15:54:15.000Z | haversine/__init__.py | ajepe/haversine | 7129baea7a27c740e5e1a73001a6c5350d329f9c | [
"MIT"
] | null | null | null | haversine/__init__.py | ajepe/haversine | 7129baea7a27c740e5e1a73001a6c5350d329f9c | [
"MIT"
] | null | null | null | from . import haversine
| 12 | 23 | 0.791667 | 3 | 24 | 6.333333 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.166667 | 24 | 1 | 24 | 24 | 0.95 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 6 |
0e30f706e4f3afa270cf41bad30b08ac230508bd | 29 | py | Python | cogs/calendar/__init__.py | Banzai99/ASTUSbot | ce9565a41e4b06bcd72d44d557aaf84c53cd8fad | [
"MIT"
] | 4 | 2020-06-28T02:30:55.000Z | 2021-03-22T10:44:26.000Z | cogs/calendar/__init__.py | Banzai99/ASTUSbot | ce9565a41e4b06bcd72d44d557aaf84c53cd8fad | [
"MIT"
] | 23 | 2020-06-28T01:24:56.000Z | 2021-09-22T14:13:30.000Z | cogs/calendar/__init__.py | Banzai99/ASTUSbot | ce9565a41e4b06bcd72d44d557aaf84c53cd8fad | [
"MIT"
] | 3 | 2020-11-09T12:55:27.000Z | 2020-12-03T12:00:39.000Z | from .cog import CogCalendar
| 14.5 | 28 | 0.827586 | 4 | 29 | 6 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.137931 | 29 | 1 | 29 | 29 | 0.96 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 6 |
0e47f93e70f0a9a4f92412a1b265f0bf1ecffa70 | 107 | py | Python | DegreesOfClimateChange/__init__.py | toddschultz/DegreesOfClimateChange | dee74dab8c12013a2ff826302156c7c178d536ba | [
"MIT"
] | null | null | null | DegreesOfClimateChange/__init__.py | toddschultz/DegreesOfClimateChange | dee74dab8c12013a2ff826302156c7c178d536ba | [
"MIT"
] | 24 | 2018-04-18T01:25:30.000Z | 2018-06-12T04:18:38.000Z | DegreesOfClimateChange/__init__.py | toddschultz/DegreesOfClimateChange | dee74dab8c12013a2ff826302156c7c178d536ba | [
"MIT"
] | null | null | null | from __future__ import absolute_import, division, print_function
#from .version import __version__ # noqa
| 35.666667 | 64 | 0.831776 | 13 | 107 | 6.076923 | 0.692308 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.121495 | 107 | 2 | 65 | 53.5 | 0.840426 | 0.364486 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 1 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 1 | 0 | 6 |
0e7ea862ad7178ae60275cb79ac32e13428ac41c | 83 | py | Python | oceanmonkey/utils/url.py | chipscoco/OceanMonkey | bffd0c9cd3fca7822466f721c2c5308a96a33d1d | [
"Apache-2.0"
] | 5 | 2022-01-03T15:04:41.000Z | 2022-01-27T02:42:31.000Z | oceanmonkey/utils/url.py | tantongxue1/OceanMonkey | 95f250a63ac692ddf2c67a6eb8f9bffb9243939c | [
"Apache-2.0"
] | null | null | null | oceanmonkey/utils/url.py | tantongxue1/OceanMonkey | 95f250a63ac692ddf2c67a6eb8f9bffb9243939c | [
"Apache-2.0"
] | 3 | 2022-01-03T15:04:44.000Z | 2022-01-09T08:42:29.000Z | from urllib.parse import urlparse
def domain(url):
return urlparse(url).netloc | 20.75 | 33 | 0.771084 | 12 | 83 | 5.333333 | 0.833333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.144578 | 83 | 4 | 34 | 20.75 | 0.901408 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.333333 | false | 0 | 0.333333 | 0.333333 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 6 |
0e95a758fd6308cf6ec7bcec82429f7544e80bc2 | 4,593 | py | Python | tests/integration/test_defxmlschema.py | gramm/xsdata | 082c780757c6d76a5c31a6757276ef6912901ed2 | [
"MIT"
] | null | null | null | tests/integration/test_defxmlschema.py | gramm/xsdata | 082c780757c6d76a5c31a6757276ef6912901ed2 | [
"MIT"
] | null | null | null | tests/integration/test_defxmlschema.py | gramm/xsdata | 082c780757c6d76a5c31a6757276ef6912901ed2 | [
"MIT"
] | null | null | null | import os
from pathlib import Path
from click.testing import CliRunner
from tests import root
from tests.conftest import validate_bindings
from xsdata.cli import cli
from xsdata.utils.testing import load_class
os.chdir(root)
def test_definitive_xml_schema_chapter_01():
schema = Path("tests/fixtures/defxmlschema/chapter01.xsd")
package = "tests.fixtures.defxmlschema"
runner = CliRunner()
result = runner.invoke(cli, [str(schema), "--package", package])
if result.exception:
raise result.exception
clazz = load_class(result.output, "Product")
validate_bindings(schema, clazz)
def test_definitive_xml_schema_chapter_03():
schema = Path("tests/fixtures/defxmlschema/chapter03.xsd")
package = "tests.fixtures.defxmlschema"
runner = CliRunner()
result = runner.invoke(cli, [str(schema), "--package", package])
if result.exception:
raise result.exception
clazz = load_class(result.output, "Envelope")
validate_bindings(schema, clazz)
def test_definitive_xml_schema_chapter_04():
schema = Path("tests/fixtures/defxmlschema/chapter04.xsd")
package = "tests.fixtures.defxmlschema"
runner = CliRunner()
result = runner.invoke(cli, [str(schema), "--package", package])
if result.exception:
raise result.exception
clazz = load_class(result.output, "Order")
validate_bindings(schema, clazz)
def test_definitive_xml_schema_chapter_05():
schema = Path("tests/fixtures/defxmlschema/chapter05.xsd")
package = "tests.fixtures.defxmlschema"
runner = CliRunner()
result = runner.invoke(cli, [str(schema), "--package", package])
if result.exception:
raise result.exception
clazz = load_class(result.output, "Order")
validate_bindings(schema, clazz)
def test_definitive_xml_schema_chapter_08():
schema = Path("tests/fixtures/defxmlschema/chapter08.xsd")
package = "tests.fixtures.defxmlschema"
runner = CliRunner()
result = runner.invoke(cli, [str(schema), "--package", package])
if result.exception:
raise result.exception
clazz = load_class(result.output, "Sizes")
validate_bindings(schema, clazz)
def test_definitive_xml_schema_chapter_10():
schema = Path("tests/fixtures/defxmlschema/chapter10.xsd")
package = "tests.fixtures.defxmlschema"
runner = CliRunner()
result = runner.invoke(cli, [str(schema), "--package", package])
if result.exception:
raise result.exception
clazz = load_class(result.output, "Sizes")
validate_bindings(schema, clazz)
def test_definitive_xml_schema_chapter_12():
schema = Path("tests/fixtures/defxmlschema/chapter12.xsd")
package = "tests.fixtures.defxmlschema"
runner = CliRunner()
result = runner.invoke(
cli, [str(schema), "--package", package, "--compound-fields"]
)
if result.exception:
raise result.exception
clazz = load_class(result.output, "Items")
validate_bindings(schema, clazz)
def test_definitive_xml_schema_chapter_13():
schema = Path("tests/fixtures/defxmlschema/chapter13.xsd")
package = "tests.fixtures.defxmlschema"
runner = CliRunner()
result = runner.invoke(cli, [str(schema), "--package", package])
if result.exception:
raise result.exception
clazz = load_class(result.output, "Items")
validate_bindings(schema, clazz)
def test_definitive_xml_schema_chapter_15():
schema = Path("tests/fixtures/defxmlschema/chapter15.xsd")
package = "tests.fixtures.defxmlschema"
runner = CliRunner()
result = runner.invoke(cli, [str(schema), "--package", package])
if result.exception:
raise result.exception
clazz = load_class(result.output, "Shirt")
validate_bindings(schema, clazz)
def test_definitive_xml_schema_chapter_16():
schema = Path("tests/fixtures/defxmlschema/chapter16.xsd")
package = "tests.fixtures.defxmlschema"
runner = CliRunner()
result = runner.invoke(cli, [str(schema), "--package", package])
if result.exception:
raise result.exception
clazz = load_class(result.output, "Items")
validate_bindings(schema, clazz)
def test_definitive_xml_schema_chapter_17():
schema = Path("tests/fixtures/defxmlschema/chapter17.xsd")
package = "tests.fixtures.defxmlschema"
runner = CliRunner()
result = runner.invoke(
cli, [str(schema), "--package", package, "--compound-fields"]
)
if result.exception:
raise result.exception
clazz = load_class(result.output, "Order")
validate_bindings(schema, clazz)
| 28.886792 | 69 | 0.707163 | 524 | 4,593 | 6.04771 | 0.129771 | 0.090249 | 0.173556 | 0.069423 | 0.896182 | 0.774692 | 0.764279 | 0.764279 | 0.764279 | 0.764279 | 0 | 0.011591 | 0.173525 | 4,593 | 158 | 70 | 29.06962 | 0.823235 | 0 | 0 | 0.684685 | 0 | 0 | 0.204877 | 0.162857 | 0 | 0 | 0 | 0 | 0 | 1 | 0.099099 | false | 0 | 0.063063 | 0 | 0.162162 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6 |
7ede244e4a60708c3ba10e06b8718fbe7e4cd5b7 | 2,779 | py | Python | project.py | mretolaza/software-renderer | b0d1d4e6cc0fb055b1df951604d7923eee36f3ab | [
"Apache-2.0"
] | null | null | null | project.py | mretolaza/software-renderer | b0d1d4e6cc0fb055b1df951604d7923eee36f3ab | [
"Apache-2.0"
] | null | null | null | project.py | mretolaza/software-renderer | b0d1d4e6cc0fb055b1df951604d7923eee36f3ab | [
"Apache-2.0"
] | null | null | null | from srLibs import Bitmap
from textureLoader import textureLoader
from utils import vertex3
GL = Bitmap('render.bmp')
def setUpRenderer():
GL.glInit()
GL.glCreateWindow(1920, 1080)
GL.glViewPort(0, 0, 1920, 1080)
GL.glClear(1, 1, 1)
GL.glColor(1, 1, 1)
def medShot():
obj = 'deer/deer.obj'
translate = (1.5, 0.05, -0.2)
scale = (0.15, 0.18, 0.1)
rotate = (0, 0, 0)
intensity = 1
texture = textureLoader('deer/deer.bmp')
print('Renderizando: ' + obj + '\ntranslación: ' + str(translate) + '\nescala: ' + str(scale))
print('Por favor espere un momento...')
setUpRenderer()
GL.glLookAt(
vertex3(5, 1, 0),
vertex3(0, 0, 0),
vertex3(0, 1, 0)
)
GL.glLoadObj(obj, translate, scale, rotate, intensity, texture)
GL.glFinish()
print('Puede verlo en la carpeta como: \'render.bmp\'')
def dutchAngle():
obj = 'deer/deer.obj'
translate = (0, 0, 0)
scale = (0.08, 0.16, 0.1)
rotate = (0, 0, 0)
intensity = 1
texture = textureLoader('deer/deer.bmp')
print('Renderizando: ' + obj + '\ntranslación: ' + str(translate) + '\nescala: ' + str(scale))
print('Por favor espere un momento...')
setUpRenderer()
GL.glLookAt(
vertex3(5, 1, 0),
vertex3(0, 0, 0),
vertex3(0, 1, 0.13)
)
GL.glLoadObj(obj, translate, scale, rotate, intensity, texture)
GL.glFinish()
print('Puede verlo en la carpeta: \'render.bmp\'')
def lowShot():
obj = 'deer/deer.obj'
translate = (0, 0, 0)
scale = (0.1, 0.15, 0.1)
rotate = (0, 0, 0)
intensity = 1
texture = textureLoader('deer/deer.bmp')
print('Renderizando: ' + obj + '\ntranslación: ' + str(translate) + '\nescala: ' + str(scale))
print('Por favor espere un momento...')
setUpRenderer()
GL.glLookAt(
vertex3(10, -6.5, 5),
vertex3(0, -0.2, 0),
vertex3(0, 1, 0)
)
GL.glLoadObj(obj, translate, scale, rotate, intensity, texture)
GL.glFinish()
print('Puede verlo en la carpeta: \'render.bmp\'')
def highShot():
obj = 'deer/deer.obj'
translate = (0, 0, 0)
scale = (0.1, 0.15, 0.1)
rotate = (0, 0, 0)
intensity = 1
texture = textureLoader('deer/deer.bmp')
print('Renderizando: ' + obj + '\ntranslación: ' + str(translate) + '\nescala: ' + str(scale))
print('Por favor espere un momento...')
setUpRenderer()
GL.glLookAt(
vertex3(10, 25, 28),
vertex3(0, -0.2, 0),
vertex3(0, 1, 0)
)
GL.glLoadObj(obj, translate, scale, rotate, intensity, texture)
GL.glFinish()
print('Puede verlo en la carpeta: \'render.bmp\'')
#medShot()
#dutchAngle()
lowShot()
#highShot()
| 26.980583 | 104 | 0.56783 | 356 | 2,779 | 4.432584 | 0.176966 | 0.026616 | 0.01711 | 0.035488 | 0.806084 | 0.791508 | 0.791508 | 0.791508 | 0.791508 | 0.791508 | 0 | 0.07045 | 0.264484 | 2,779 | 102 | 105 | 27.245098 | 0.701566 | 0.011155 | 0 | 0.686747 | 0 | 0 | 0.1949 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.060241 | false | 0 | 0.036145 | 0 | 0.096386 | 0.144578 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6 |
7d3668bc20cc41c77a492037b38636ea05eaf9d5 | 16,861 | py | Python | idl2py/jd/date_conv.py | RapidLzj/idl2py | 193051cd8d01db0d125b8975713b885ad521a992 | [
"MIT"
] | null | null | null | idl2py/jd/date_conv.py | RapidLzj/idl2py | 193051cd8d01db0d125b8975713b885ad521a992 | [
"MIT"
] | null | null | null | idl2py/jd/date_conv.py | RapidLzj/idl2py | 193051cd8d01db0d125b8975713b885ad521a992 | [
"MIT"
] | null | null | null | """
By Dr Jie Zheng -Q, NAOC
v1 2019-04-27
"""
import numpy as np
from..util import *
def date_conv():
pass
#function date_conv,date,type, BAD_DATE = bad_date
#;+
#; NAME:
#; DATE_CONV
#; PURPOSE:
#; Procedure to perform conversion of dates to one of three possible formats.
#;
#; EXPLANATION:
#; The following date formats are allowed
#;
#; format 1: real*8 scalar encoded as:
#; year*1000 + day + hour/24. + min/24./60 + sec/24./60/60
#; where day is the day of year (1 to 366)
#; format 2: Vector encoded as:
#; date[0] = year (eg. 2005)
#; date[1] = day of year (1 to 366)
#; date[2] = hour
#; date[3] = minute
#; date[4] = second
#; To indicate a date only, set a negative hour.
#; format 3: string (ascii text) encoded as
#; DD-MON-YEAR HH:MM:SS.SS
#; (eg. 14-JUL-2005 15:25:44.23)
#; OR
#; YYYY-MM-DD HH:MM:SS.SS (ISO standard)
#; (eg. 1987-07-14 15:25:44.23 or 1987-07-14T15:25:44.23)
#;
#; OR
#; DD/MM/YY (pre-2000 option for FITS DATE keywords)
#; Time of day segment is optional in all of these.
#;
#; format 4: three element vector giving spacecraft time words
#; from a Hubble Space Telescope (HST) telemetry packet. Based on
#; total number of secs since midnight, JAN. 1, 1979
#;
#; format 5: Julian day. As this is also a scalar, like format 1,
#; the distinction between the two on input is made based on their
#; value. Numbers > 2300000 are interpreted as Julian days.
#;
#; CALLING SEQUENCE
#; results = DATE_CONV( DATE, TYPE )
#;
#; INPUTS:
#; DATE - input date in one of the possible formats. Must be scalar.
#; TYPE - type of output format desired. If not supplied then
#; format 3 (real*8 scalar) is used.
#; valid values:
#; 'REAL' - format 1
#; 'VECTOR' - format 2
#; 'STRING' - format 3
#; 'FITS' - YYYY-MM-DDTHH:MM:SS.SS'
#; 'JULIAN' - Julian date
#; 'MODIFIED' - Modified Julian date (JD-2400000.5)
#; TYPE can be abbreviated to the single character strings 'R',
#; 'V', 'S', 'F', 'J', and 'M'.
#; Nobody wants to convert TO spacecraft time (I hope!)
#; OUTPUTS:
#; The converted date is returned as the function value.
#; Output is -1 if date is unrecognisable.
#;
#; If the time of day is omitted from the input, it will also
#; be omitted from any output string (format STRING or FITS).
#; Note that date-only strings are allowed by the FITS standard.
#; For other output formats any missing time of day is set to
#; 00:00:00.0
#;
#; KEYWORD OUTPUTS
#;
#; BAD_DATE set to 1B if date is unrecognisable
#;
#; EXAMPLES:
#; IDL> print,date_conv('2006-03-13 19:58:00.00'),f='(f15.5)'
#; 2006072.83194
#; IDL> print,date_conv( 2006072.8319444d,'F')
#; 2006-03-13T19:58:00.00
#; IDL> print,date_conv( 2006072.8319444d,'V')
#; 2006.00 72.0000 19.0000 57.0000 59.9962
#; IDL> print,date_conv( 2006072.8319444d,'J'), f='(f15.5)'
#; 2453808.33194
#;
#;
#; HISTORY:
#; version 1 D. Lindler July, 1987
#; adapted for IDL version 2 J. Isensee May, 1990
#; Made year 2000 compliant; allow ISO format input jls/acc Oct 1998
#; DJL/ACC Jan 1998, Modified to work with dates such as 6-JAN-1996 where
#; day of month has only one digit.
#; DJL, Nov. 2000, Added input/output format YYYY-MM-DDTHH:MM:SS.SS
#; Replace spaces with '0' in output FITS format W.Landsman April 2006
#; Added Julian date capabilities on input and output. M.Perrin, July 2007
#; Removed spurious /WARN keyword to MESSAGE W.L. Feb 2012
#; ...and another /WARN; added BAD_DATE, drop spurious time-of-day
#; output from strings. J. P. Leahy July 2013
#; changed all /CONTINUE warning messages to /INFO: can be suppressed
#; by setting !QUIET = 1. J. P. Leahy July 2013
#;-
#;-------------------------------------------------------------
#;
#compile_opt idl2
#; data declaration
#;
#days = [0,31,28,31,30,31,30,31,31,30,31,30,31]
#months = [' ','JAN','FEB','MAR','APR','MAY','JUN','JUL','AUG','SEP','OCT',$
# 'NOV','DEC']
#;
#; set default type if not supplied
#;
#if N_params() lt 2 then type = 'REAL'
#;
#; Determine type of input supplied
#;
#s = size(date) & ndim = s[0] & datatype = s[ndim+1]
#if ndim gt 0 then begin ;vector?
# if ndim gt 1 then goto,notvalid
# if (s[1] ne 5) && (s[1] ne 3) then goto,notvalid
# if (s[1] eq 5) then form = 2 else form = 4
# end else begin ;scalar input
# if datatype eq 0 then goto,notvalid
# if datatype eq 7 then form = 3 $ ;string
# else form = 1 ;numeric scalar
#end
#;
#; -----------------------------------
#;
#;*** convert input to year,day,hour,minute,second
#;
#; -----------------------------------
#case form of
#
# 1: begin ;real scalar
# ; The 'real' input format may be interpreted EITHER
# ; a) if < 2300000
# ; as the traditional 'real*8 encoded' format used by date_conv
# ; b) if > 2300000
# ; as a Julian Day Number
# idate = long(date)
# year = long(idate/1000)
#
# if year lt 2300 then begin
#
# ; if year is only 2 digits, assume 1900
# if year lt 100 then begin
# message,/INF, $
# 'Warning: Year specified is only 2 digits, assuming 19xx'
# year=1900+year
# idate=1900000+idate
# date=1900000.+date
# end
# day = idate - year*1000
# fdate = date-idate
# fdate = fdate*24.
# hour = fix(fdate)
# fdate = (fdate-hour)*60.0
# minute = fix(fdate)
# sec = float((fdate-minute)*60.0)
#
# endif else begin
# daycnv, date, year, mn, mndy, hr
# ; convert from month/day to day of year
# ; how many days PRECEED the start of each month?
# YDAYS = [0,31,59,90,120,151,181,212,243,273,304,334,366]
# LEAP = (((YeaR MOD 4) EQ 0) AND ((YeaR MOD 100) NE 0)) OR $
# ((YeaR MOD 400) EQ 0)
# IF LEAP THEN YDAYS[2:*] = YDAYS[2:*] + 1
# day = ydays[mn-1]+mndy
#
# hour = fix(hr)
# fmin = (hr-hour)*60
# minute = fix(fmin)
# sec = float((fmin-minute)*60)
# endelse
# end
#
# 2: begin ;vector
# year = fix(date[0])
#;
#; if year is only 2 digits, assume 1900
#;
# if year lt 100 then begin
# message,/INF, $
# 'Warning: Year specified is only 2 digits, assuming 19xx'
# year=1900+year
# end
#;
# day = fix(date[1])
# hour = fix(date[2])
# minute = fix(date[3])
# sec = float(date[4])
# end
#
# 3: begin ;string
# temp = date
#;
#; check for old type of date, DD-MMM-YYYY
#;
# test = STRPOS(temp,'-')
# if test ge 0 && test le 2 then begin
# day_of_month = fix(gettok(temp,'-'))
# month_name = gettok(temp,'-')
# year = fix(gettok(temp,' '))
#;
#; determine month number from month name
#;
# month_name = strupcase(month_name)
# for mon = 1,12 do begin
# if month_name eq months[mon] then goto,found
# end
# message,/INFORMATIONAL, 'Invalid month name specified'
# goto, notvalid
#;
#; check for new type of date, ISO: YYYY-MM-DD
#;
# end else if strpos(temp,'-') eq 4 then begin
# year = fix(gettok(temp,'-'))
# month_name = gettok(temp,'-')
# mon= FIX(month_name)
# day_of_month=gettok(temp,' ')
# if strlen(temp) eq 0 then begin
# dtmp=gettok(day_of_month,'T')
# temp=day_of_month
# day_of_month=dtmp
# end
# day_of_month=fix(day_of_month)
#;
#; check for DD/MM/YY
#;
# end else if STRPOS(temp,'/') eq 2 then begin
# day_of_month = FIX(gettok(temp,'/'))
# mon = FIX(gettok(temp,'/'))
# year = 1900 + FIX(STRMID(temp,0,2))
# end else goto, notvalid
#
# found:
# hour = gettok(temp,':')
# hour = hour NE '' ? FIX(hour) : -1
# minute = fix(gettok(temp,':'))
# sec = float(strtrim(strmid(temp,0,5)))
#
# IF (mon LT 1 || mon GT 12) THEN BEGIN
# MESSAGE, /INFORMATIONAL, 'Invalid month specified'
# goto, notvalid
# ENDIF
#;
#; if year is only 2 digits, assume 1900
#;
# if year lt 100 then begin
# message,/INFORMATIONAL, $
# 'Warning: Year specified is only 2 digits, assuming 19xx'
# year=1900+year
# end
#;
#;
#; convert to day of year from month/day_of_month
#;
#; correction for leap years
#;
#; if (fix(year) mod 4) eq 0 then days(2) = 29 ;add one to february
# lpyr = ((year mod 4) eq 0) and ((year mod 100) ne 0) $
# or ((year mod 400) eq 0)
# if lpyr eq 1 then days[2] = 29 ; if leap year, add day to Feb.
#;
#;
#; compute day of year
#;
# day = fix(total(days[0:mon-1])+day_of_month)
# end
#
# 4 : begin ;spacecraft time
# SC = DOUBLE(date)
# SC = SC + (SC LT 0.0)*65536. ;Get rid of neg. numbers
#;
#; Determine total number of secs since midnight, JAN. 1, 1979
#;
# SECS = SC[2]/64 + SC[1]*1024 + SC[0]*1024*65536.
# SECS = SECS/8192.0D0 ;Convert from spacecraft units
#;
#; Determine number of years
#;
# MINS = SECS/60.
# HOURS = MINS/60.
# TOTDAYS = HOURS/24.
# YEARS = TOTDAYS/365.
# YEARS = FIX(YEARS)
#;
#; Compute number of leap years past
#;
# LEAPYEARS = (YEARS+2)/4
#;
#; Compute day of year
#;
# DAY = FIX(TOTDAYS-YEARS*365.-LEAPYEARS)
#;
#; Correct for case of being right at end of leapyear
#;
# IF DAY LT 0 THEN BEGIN
# DAY = DAY+366
# LEAPYEARS = LEAPYEARS-1
# YEARS = YEARS-1
# END
#;
#; COMPUTE HOUR OF DAY
#;
# TOTDAYS = YEARS*365.+DAY+LEAPYEARS
# HOUR = FIX(HOURS - 24*TOTDAYS)
# TOTHOURS = TOTDAYS*24+HOUR
#;
#; COMPUTE MINUTE
#;
# MINUTE = FIX(MINS-TOTHOURS*60)
# TOTMIN = TOTHOURS*60+MINUTE
#;
#; COMPUTE SEC
#;
# SEC = SECS-TOTMIN*60
#;
#; COMPUTE ACTUAL YEAR
#;
# YEAR = YEARS+79
#;
#; if year is only 2 digits, assume 1900
#;
# if year lt 100 then begin
# message, /INF, $
# 'Warning: Year specified is only 2 digits, assuming 19xx'
# year=1900+year
# end
#;
#;
#; START DAY AT ONE AND NOT ZERO
#;
# DAY++
# END
#ENDCASE
#;
#; correction for leap years
#;
# if form ne 3 then begin ;Was it already done?
# lpyr = ((year mod 4) eq 0) && ((year mod 100) ne 0) $
# || ((year mod 400) eq 0)
# if lpyr eq 1 then days[2] = 29 ; if leap year, add day to Feb.
# end
#;
#; check for valid day
#;
# if (day lt 1) || (day gt total(days)) then begin
# message, /INFORMATIONAL, $
# 'ERROR -- There are only ' + strtrim(fix(total(days)),2) + $
# ' days in year '+strtrim(year,2)
# goto, notvalid
# endif
#;
#; find month which day occurs
#;
# day_of_month = day
# month_num = 1
# while day_of_month gt days[month_num] do begin
# day_of_month = day_of_month - days[month_num]
# month_num = month_num+1
# end
#; ---------------------------------------
#;
#; ***** Now convert to output format
#;
#; ---------------------------------------
#;
#; is type a string
#;
#s = size(type)
#if (s[0] ne 0) or (s[1] ne 7) then $
# message,'ERROR - Output type specification must be a string'
#;
#outcode = STRMID(STRUPCASE(type),0,1)
#IF (outcode EQ 'S' || outcode EQ 'F') && hour GE 0 THEN BEGIN
# xsec = strmid(string(sec+100,'(f6.2)'),1,5)
# if xsec EQ '60.00' then begin
# minute = minute+1
# xsec = '00.00'
# endif
# xminute = string(minute,'(i2.2)')
# if xminute EQ '60' then begin
# hour = hour+1
# xminute = '00'
# endif
# tod = string(hour,'(i2.2)') + ':' +xminute + ':'+ xsec
#ENDIF
#
#case outcode of
#
# 'V' : begin ;vector output
# out = fltarr(5)
# out[0] = year
# out[1] = day
# out[2] = hour > 0
# out[3] = minute
# out[4] = sec
# end
#
# 'R' : begin ;floating point scalar
#; if year gt 1900 then year = year-1900
# out = sec/24.0d0/60./60. + minute/24.0d0/60. $
# + (hour > 0)/24.0d0 + day + year*1000d0
# end
#
# 'S' : begin ;string output
#
# month_name = months[month_num]
#;
#; encode into ascii_date
#;
# out = string(day_of_month,'(i2)') +'-'+ month_name +'-' + $
# string(year,'(i4)')
#
# ; Omit time of day from output string if not specified on input
# IF hour GE 0 THEN out += ' '+tod
# end
# 'F' : begin
# out = string(year,'(i4)')+'-'+string(month_num,'(I2.2)') $
# + '-' + string(day_of_month,'(i2.2)')
# IF hour GE 0 THEN out += 'T' + tod
# end
#
# 'J' : begin ; Julian Date
# ydn2md, year, day, mn, dy
# juldate, [year, mn, dy, hour, minute, sec], rjd
# out = rjd+2400000 ; convert from reduced to regular JD
# end
# 'M' : begin ; Modified Julian Date = JD - 2400000.5
# ydn2md, year, day, mn, dy
# juldate, [year, mn, dy, hour, minute, sec], rjd
# out = rjd-0.5 ; convert from reduced to modified JD
# end
#
# else: begin ;invalid type specified
# print,'DATE_CONV-- Invalid output type specified'
# print,' It must be ''REAL'', ''STRING'', ''VECTOR'', ''JULIAN'', ''MODIFIED'', or ''FITS''.'
# return,-1
# end
#endcase
#
#bad_date = 0B
#return,out
#;
#; invalid input date error section
#;
#NOTVALID:
#bad_date = 1B
#message, 'Invalid input date specified', /INFORMATIONAL
#return, -1
#end
| 36.338362 | 111 | 0.451397 | 1,958 | 16,861 | 3.853422 | 0.222165 | 0.015242 | 0.022531 | 0.013784 | 0.206759 | 0.183168 | 0.126176 | 0.119417 | 0.119417 | 0.100596 | 0 | 0.078359 | 0.418718 | 16,861 | 463 | 112 | 36.416847 | 0.69146 | 0.888797 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | true | 0.25 | 0.5 | 0 | 0.75 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 0 | 1 | 0 | 0 | 6 |
adfdb4ef56b0ad384fa37e3bbbb45ad3bcfd961b | 44 | py | Python | pypeit/par/__init__.py | rcooke-ast/PYPIT | 0cb9c4cb422736b855065a35aefc2bdba6d51dd0 | [
"BSD-3-Clause"
] | null | null | null | pypeit/par/__init__.py | rcooke-ast/PYPIT | 0cb9c4cb422736b855065a35aefc2bdba6d51dd0 | [
"BSD-3-Clause"
] | null | null | null | pypeit/par/__init__.py | rcooke-ast/PYPIT | 0cb9c4cb422736b855065a35aefc2bdba6d51dd0 | [
"BSD-3-Clause"
] | null | null | null |
from pypeit.par.pypeitpar import PypeItPar
| 14.666667 | 42 | 0.840909 | 6 | 44 | 6.166667 | 0.833333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.113636 | 44 | 2 | 43 | 22 | 0.948718 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 6 |
bc3bee6e41f1c99baf04aee1ba52be0dc3d60022 | 127 | py | Python | semester3/oop/lab3/parser/funcs/__init__.py | no1sebomb/University-Labs | 1da5e7486f0b8a6119c077945aba8c89cdfc2e50 | [
"WTFPL"
] | null | null | null | semester3/oop/lab3/parser/funcs/__init__.py | no1sebomb/University-Labs | 1da5e7486f0b8a6119c077945aba8c89cdfc2e50 | [
"WTFPL"
] | null | null | null | semester3/oop/lab3/parser/funcs/__init__.py | no1sebomb/University-Labs | 1da5e7486f0b8a6119c077945aba8c89cdfc2e50 | [
"WTFPL"
] | 1 | 2020-11-01T23:54:52.000Z | 2020-11-01T23:54:52.000Z | # coding=utf-8
from .login import init
from .search import search_article, search_brand
from .currency import search_currency
| 21.166667 | 48 | 0.818898 | 19 | 127 | 5.315789 | 0.578947 | 0.237624 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.009009 | 0.125984 | 127 | 5 | 49 | 25.4 | 0.900901 | 0.094488 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 6 |
70b156adee68fba175e7903973567756ce1a53dc | 67 | py | Python | homura/vision/__init__.py | nick1392/homura | 26545ee62d5181fda526b8401f441b4ef92edc03 | [
"Apache-2.0"
] | 2 | 2019-10-20T05:40:15.000Z | 2019-10-31T17:25:57.000Z | homura/vision/__init__.py | thanhkaist/homura | bd668f24cf76e4a5e138c07a30fee025b001d127 | [
"Apache-2.0"
] | null | null | null | homura/vision/__init__.py | thanhkaist/homura | bd668f24cf76e4a5e138c07a30fee025b001d127 | [
"Apache-2.0"
] | null | null | null | from .data import *
from .models import *
from .transforms import * | 22.333333 | 25 | 0.746269 | 9 | 67 | 5.555556 | 0.555556 | 0.4 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.164179 | 67 | 3 | 25 | 22.333333 | 0.892857 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 6 |
70e9257c6d2ea272bcdafe15994783e752cd2efb | 113 | py | Python | py/elg2017b/simulate/__init__.py | gdhungana/elg2017b | 084c9195d43132558d77585e1a05376e342490f6 | [
"MIT"
] | null | null | null | py/elg2017b/simulate/__init__.py | gdhungana/elg2017b | 084c9195d43132558d77585e1a05376e342490f6 | [
"MIT"
] | null | null | null | py/elg2017b/simulate/__init__.py | gdhungana/elg2017b | 084c9195d43132558d77585e1a05376e342490f6 | [
"MIT"
] | null | null | null | """
elg2017b
=========
"""
from __future__ import absolute_import, division, print_function, unicode_literals
| 12.555556 | 82 | 0.716814 | 11 | 113 | 6.727273 | 0.909091 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.040404 | 0.123894 | 113 | 8 | 83 | 14.125 | 0.707071 | 0.159292 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 1 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 1 | 0 | 6 |
cb18a2a563ed753baac5727809e7a59923b90c05 | 57 | py | Python | config.py | Meghnalove/Telegram-bot-Google-Drive | 116de799632899643a7a3128505bba16441ed93c | [
"MIT"
] | null | null | null | config.py | Meghnalove/Telegram-bot-Google-Drive | 116de799632899643a7a3128505bba16441ed93c | [
"MIT"
] | null | null | null | config.py | Meghnalove/Telegram-bot-Google-Drive | 116de799632899643a7a3128505bba16441ed93c | [
"MIT"
] | null | null | null | TOKEN = "1795611796:AAG6cMQapsxInhZlZG7ohJaaPzveHgXgfgI"
| 28.5 | 56 | 0.877193 | 3 | 57 | 16.666667 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.222222 | 0.052632 | 57 | 1 | 57 | 57 | 0.703704 | 0 | 0 | 0 | 0 | 0 | 0.807018 | 0.807018 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6 |
cb300c0e92b14e8dbdff22fab28a9519174efe2b | 5,240 | py | Python | tests/test_models/test_forward/test_mot_forward.py | LJoson/mmtracking | af471f07d2d2e5b30862c39f4d576a0a0fb81e69 | [
"Apache-2.0"
] | null | null | null | tests/test_models/test_forward/test_mot_forward.py | LJoson/mmtracking | af471f07d2d2e5b30862c39f4d576a0a0fb81e69 | [
"Apache-2.0"
] | null | null | null | tests/test_models/test_forward/test_mot_forward.py | LJoson/mmtracking | af471f07d2d2e5b30862c39f4d576a0a0fb81e69 | [
"Apache-2.0"
] | null | null | null | # Copyright (c) OpenMMLab. All rights reserved.
import copy
from collections import defaultdict
import pytest
import torch
from mmtrack.datasets.pipelines.processing import MatchInstances
from .utils import _demo_mm_inputs, _get_config_module
@pytest.mark.parametrize(
'cfg_file',
[
'mot/qdtrack/qdtrack_faster-rcnn_r50_fpn_4e_mot17-private-half.py',
'mot/qdtrack/qdtrack_faster-rcnn_r50_fpn_4e_crowdhuman_mot17-private-half.py' # noqa
])
def test_mot_forward_train(cfg_file):
config = _get_config_module(cfg_file)
model = copy.deepcopy(config.model)
from mmtrack.models import build_model
qdtrack = build_model(model)
# Test forward train with a non-empty truth batch
input_shape = (1, 3, 256, 256)
mm_inputs = _demo_mm_inputs(
input_shape, num_items=[10], num_classes=2, with_track=True)
imgs = mm_inputs.pop('imgs')
img_metas = mm_inputs.pop('img_metas')
gt_bboxes = mm_inputs['gt_bboxes']
gt_labels = mm_inputs['gt_labels']
gt_instance_ids = mm_inputs['gt_instance_ids']
gt_masks = mm_inputs['gt_masks']
ref_input_shape = (1, 3, 256, 256)
ref_mm_inputs = _demo_mm_inputs(
ref_input_shape, num_items=[10], num_classes=2, with_track=True)
ref_img = ref_mm_inputs.pop('imgs')
ref_img_metas = ref_mm_inputs.pop('img_metas')
ref_gt_bboxes = ref_mm_inputs['gt_bboxes']
ref_gt_labels = ref_mm_inputs['gt_labels']
ref_gt_masks = ref_mm_inputs['gt_masks']
ref_gt_instance_ids = ref_mm_inputs['gt_instance_ids']
match_tool = MatchInstances()
gt_match_indices, _ = match_tool._match_gts(gt_instance_ids[0],
ref_gt_instance_ids[0])
gt_match_indices = [torch.tensor(gt_match_indices)]
losses = qdtrack.forward(
img=imgs,
img_metas=img_metas,
gt_bboxes=gt_bboxes,
gt_labels=gt_labels,
gt_masks=gt_masks,
gt_match_indices=gt_match_indices,
ref_img=ref_img,
ref_img_metas=ref_img_metas,
ref_gt_bboxes=ref_gt_bboxes,
ref_gt_labels=ref_gt_labels,
ref_gt_masks=ref_gt_masks,
return_loss=True)
assert isinstance(losses, dict)
loss, _ = qdtrack._parse_losses(losses)
loss.requires_grad_(True)
assert float(loss.item()) > 0
loss.backward()
# Test forward train with an empty truth batch
mm_inputs = _demo_mm_inputs(
input_shape, num_items=[0], num_classes=2, with_track=True)
imgs = mm_inputs.pop('imgs')
img_metas = mm_inputs.pop('img_metas')
gt_bboxes = mm_inputs['gt_bboxes']
gt_labels = mm_inputs['gt_labels']
gt_instance_ids = mm_inputs['gt_instance_ids']
gt_masks = mm_inputs['gt_masks']
ref_mm_inputs = _demo_mm_inputs(
ref_input_shape, num_items=[0], num_classes=2, with_track=True)
ref_img = ref_mm_inputs.pop('imgs')
ref_img_metas = ref_mm_inputs.pop('img_metas')
ref_gt_bboxes = ref_mm_inputs['gt_bboxes']
ref_gt_labels = ref_mm_inputs['gt_labels']
ref_gt_masks = ref_mm_inputs['gt_masks']
ref_gt_instance_ids = ref_mm_inputs['gt_instance_ids']
gt_match_indices, _ = match_tool._match_gts(gt_instance_ids[0],
ref_gt_instance_ids[0])
gt_match_indices = [torch.tensor(gt_match_indices)]
losses = qdtrack.forward(
img=imgs,
img_metas=img_metas,
gt_bboxes=gt_bboxes,
gt_labels=gt_labels,
gt_masks=gt_masks,
gt_match_indices=gt_match_indices,
ref_img=ref_img,
ref_img_metas=ref_img_metas,
ref_gt_bboxes=ref_gt_bboxes,
ref_gt_labels=ref_gt_labels,
ref_gt_masks=ref_gt_masks,
return_loss=True)
assert isinstance(losses, dict)
loss, _ = qdtrack._parse_losses(losses)
loss.requires_grad_(True)
assert float(loss.item()) > 0
loss.backward()
@pytest.mark.parametrize(
'cfg_file',
[
'mot/qdtrack/qdtrack_faster-rcnn_r50_fpn_4e_mot17-private-half.py',
'mot/qdtrack/qdtrack_faster-rcnn_r50_fpn_4e_crowdhuman_mot17-private-half.py', # noqa
'mot/tracktor/tracktor_faster-rcnn_r50_fpn_4e_mot17-private.py',
'mot/deepsort/deepsort_faster-rcnn_fpn_4e_mot17-private-half.py',
'mot/bytetrack/bytetrack_yolox_x_crowdhuman_mot17-private-half.py'
])
def test_mot_simple_test(cfg_file):
config = _get_config_module(cfg_file)
model = copy.deepcopy(config.model)
from mmtrack.models import build_model
mot = build_model(model)
mot.eval()
input_shape = (1, 3, 256, 256)
mm_inputs = _demo_mm_inputs(input_shape, num_items=[10], with_track=True)
imgs = mm_inputs.pop('imgs')
img_metas = mm_inputs.pop('img_metas')
with torch.no_grad():
imgs = torch.cat([imgs, imgs.clone()], dim=0)
img_list = [g[None, :] for g in imgs]
img2_metas = copy.deepcopy(img_metas)
img2_metas[0]['frame_id'] = 1
img_metas.extend(img2_metas)
results = defaultdict(list)
for one_img, one_meta in zip(img_list, img_metas):
result = mot.forward([one_img], [[one_meta]], return_loss=False)
for k, v in result.items():
results[k].append(v)
| 36.137931 | 94 | 0.686641 | 767 | 5,240 | 4.263364 | 0.16558 | 0.09052 | 0.04893 | 0.031804 | 0.775535 | 0.766972 | 0.761468 | 0.744343 | 0.744343 | 0.738226 | 0 | 0.018872 | 0.21126 | 5,240 | 144 | 95 | 36.388889 | 0.77232 | 0.028244 | 0 | 0.709677 | 0 | 0 | 0.141172 | 0.091427 | 0 | 0 | 0 | 0 | 0.032258 | 1 | 0.016129 | false | 0 | 0.064516 | 0 | 0.080645 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6 |
cb4da02d68dbaa1c1c3ddbf4a52b3302f3c6e17f | 95 | py | Python | mobilestereonet/__init__.py | ibaiGorordo/ONNX-MobileStereoNet | 5ae8ec5ad633f7ec2caab9399744cff3940232a4 | [
"MIT"
] | 15 | 2021-11-27T15:59:42.000Z | 2022-03-28T08:08:14.000Z | mobilestereonet/__init__.py | ibaiGorordo/TFLite-MobileStereoNet | c140cced4c821c5b91e194bdc5a41ab0f16e1c8b | [
"MIT"
] | 2 | 2021-11-29T04:26:56.000Z | 2021-12-24T09:51:30.000Z | mobilestereonet/__init__.py | ibaiGorordo/TFLite-MobileStereoNet | c140cced4c821c5b91e194bdc5a41ab0f16e1c8b | [
"MIT"
] | 2 | 2021-11-28T19:02:12.000Z | 2022-03-02T08:07:38.000Z | from mobilestereonet.mobilestereonet import MobileStereoNet
from mobilestereonet.utils import * | 47.5 | 59 | 0.894737 | 9 | 95 | 9.444444 | 0.444444 | 0.447059 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.073684 | 95 | 2 | 60 | 47.5 | 0.965909 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 6 |
38040e4400edee51aadc5b3a95bb4a413f24f049 | 21,130 | py | Python | Law-and-Order-Jeopardy-NE.py | athenian-ct-projects/Law-and-Order-Day | a8b034d3b6a7644b442e7cf4e012bba4ba227f34 | [
"Apache-2.0"
] | null | null | null | Law-and-Order-Jeopardy-NE.py | athenian-ct-projects/Law-and-Order-Day | a8b034d3b6a7644b442e7cf4e012bba4ba227f34 | [
"Apache-2.0"
] | null | null | null | Law-and-Order-Jeopardy-NE.py | athenian-ct-projects/Law-and-Order-Day | a8b034d3b6a7644b442e7cf4e012bba4ba227f34 | [
"Apache-2.0"
] | null | null | null | #Note to Participants
print ("Hello! Welcome to the Law & Order Focus Day Jeopardy Game!")
print ("There are three categories in this game: Trial Terms, Supreme Court and Other Facts and five levels in each")
print ("Draw on the board a chart with six rows and three coloums")
print ("Write in the three categories into the first row")
print ("Write 100 in the second")
print ("Write 200 in the third")
print ("Write 300 in the fourth")
print ("Write 400 in the fifth")
print ("Write 500 in the sixth")
print ("Be sure to follow the instructions and in your responses remember spelling and capitilization")
print ("Erase the corresponding box when a question is answered")
print ("Seperate yourselves into three teams")
v = input("Ready?")
#for loop counts to 4
if v == ("yes"):
x=0
for x in range (1,4,1):
print (x)
print("Let's test your knowledge!")
#def of function contains questions and input of answers
def jeopardy(team1_win, team2_win, team3_win):
x = input("Choose Your Category: Trial Terms, Supreme Court or Other Facts ")
if x == ("Trial Terms") or x == ("trial terms"):
y = input("Choose Your Level (100, 200, 300, 400, 500)")
if y== ("100"):
print ("Capital Offense")
c= input ("What is ")
my_list= ["A crime punishable by death","a crime punishable by death", "crime punishable by death"]
if c in my_list:
print ("You Get 100 Points!")
s= (input("What Team Are You?"))
if s in my_list1:
team1_win= team1_win + 100
print ("Team 1: "+ str(team1_win))
elif s in my_list2:
team2_win= team2_win + 100
print ("Team 2: "+ str(team2_win))
elif s in my_list3:
team3_win= team3_win + 100
print ("Team 3: "+ str(team3_win))
else:
print ("You Lose 100 Points!")
print (my_list)
s= (input("What Team Are You?"))
if s in my_list1:
team1_win= team1_win - 100
print ("Team 1: "+ str(team1_win))
elif s in my_list2:
team2_win= team2_win - 100
print ("Team 2: "+ str(team2_win))
elif s in my_list3:
team3_win= team3_win - 100
print ("Team 2: "+ str(team2_win))
if y== ("200"):
print ("Cross Examine")
c= input ("What is ")
my_list= ["Questioning of a witness by the attorney for the other side", "questioning of a witness by the opposing counsel", "questioning of a witness"]
if c in my_list:
print ("You Get 200 Points!")
s= (input("What Team Are You?"))
if s in my_list1:
team1_win= team1_win + 200
print ("team 1: "+ str(team1_win))
elif s in my_list2:
team2_win= team2_win + 200
print ("team 2: "+ str(team2_win))
elif s in my_list3:
team3_win= team3_win + 200
print ("team 3: "+ str(team3_win))
else:
print ("you lose 200 points!")
print (my_list)
s= (input("what team are you?"))
if s in my_list1:
team1_win= team1_win - 200
print ("team 1: "+ str(team1_win))
elif s in my_list2:
team2_win= team2_win - 200
print ("team 2: "+ str(team2_win))
elif s in my_list3:
team3_win= team3_win - 200
print ("team 3: "+ str(team2_win))
if y== ("300"):
print ("A written statement confirmed by oath or affirmation, for use as evidence in court.")
c= input ("What is ")
my_list= ["Affidavit", "affidavit"]
if c in my_list:
print ("you get 300 points!")
s= (input("what team are you?"))
if s in my_list1:
team1_win= team1_win + 300
print ("team 1: "+ str(team1_win))
elif s in my_list2:
team2_win= team2_win + 300
print ("team 2: "+ str(team2_win))
elif s in my_list3:
team3_win= team3_win + 300
print ("team 3: "+ str(team3_win))
else:
print ("you lose 300 points!")
print (my_list)
s= (input("what team are you?"))
if s in my_list1:
team1_win= team1_win - 300
print ("team 1: "+ str(team1_win))
elif s in my_list2:
team2_win= team2_win - 300
print ("team 2: "+ str(team2_win))
elif s in my_list3:
team3_win= team3_win - 300
print ("team 3: "+ str(team2_win))
if y== ("400"):
print ("a person who brings a case against another in a court of law")
c= input ("What is ")
my_list= ["Plaintiff"]
if c in my_list:
print ("you get 400 points!")
s= (input("what team are you?"))
if s in my_list1:
team1_win= team1_win + 400
print ("team 1: "+ str(team1_win))
elif s in my_list2:
team2_win= team2_win + 400
print ("team 2: "+ str(team2_win))
elif s in my_list3:
team3_win= team3_win + 400
print ("team 3: "+ str(team3_win))
else:
print ("you lose 400 points!")
print (my_list)
s= (input("what team are you?"))
if s in my_list1:
team1_win= team1_win - 400
print ("team 1: "+ str(team1_win))
elif s in my_list2:
team2_win= team2_win - 400
print ("team 2: "+ str(team2_win))
elif s in my_list3:
team3_win= team3_win - 400
print ("team 3: "+ str(team2_win))
if y== ("500"):
print ("The process of giving sworn evidence")
c= input ("What is ")
my_list= ["Deposition"]
if c in my_list:
print ("you get 500 points!")
s= (input("what team are you?"))
if s in my_list1:
team1_win= team1_win + 500
print ("team 1: "+ str(team1_win))
elif s in my_list2:
team2_win= team2_win + 500
print ("team 2: "+ str(team2_win))
elif s in my_list3:
team3_win= team3_win + 500
print ("team 3: "+ str(team3_win))
else:
print ("you lose 500 points!")
print (my_list)
s= (input("what team are you?"))
if s in my_list1:
team1_win= team1_win - 500
print ("team 1: "+ str(team1_win))
elif s in my_list2:
team2_win= team2_win - 500
print ("team 2: "+ str(team2_win))
elif s in my_list3:
team3_win= team3_win - 500
print ("team 3: "+ str(team2_win))
if x == ("Supreme Court"):
y = input ("Choose Your Level (100, 200, 300, 400, 500)")
if y== ("100"):
print ("There are ___ judges on the Supreme Court")
c= input ("What is ")
my_list= ["9", "nine", "Nine"]
if c in my_list:
print ("you get 100 points!")
s= (input("what team are you?"))
if s in my_list1:
team1_win= team1_win + 100
print ("team 1: "+ str(team1_win))
elif s in my_list2:
team2_win= team2_win + 100
print ("team 2: "+ str(team2_win))
elif s in my_list3:
team3_win= team3_win + 100
print ("team 3: "+ str(team3_win))
else:
print ("you lose 100 points!")
s= (input("what team are you?"))
print (my_list)
if s in my_list1:
team1_win= team1_win - 100
print ("team 1: "+ str(team1_win))
elif s in my_list2:
team2_win= team2_win - 100
print ("team 2: "+ str(team2_win))
elif s in my_list3:
team3_win= team3_win - 100
print ("team 3: "+ str(team2_win))
if y== ("200"):
print ("The Supreme Court has the responsibility to do: A. Interpret the Constitution B. Elect legislators C. Appoint new justices")
c= input ("What is ")
my_list= ["A", "a"]
if c in my_list:
print ("you get 200 points!")
s= (input("what team are you?"))
if s in my_list1:
team1_win= team1_win + 200
print ("team 1: "+ str(team1_win))
elif s in my_list2:
team2_win= team2_win + 200
print ("team 2: "+ str(team2_win))
elif s in my_list3:
team3_win= team3_win + 200
print ("team 3: "+ str(team3_win))
else:
print ("you lose 200 points!")
print (my_list)
s= (input("what team are you?"))
if s in my_list1:
team1_win= team1_win - 200
print ("team 1: "+ str(team1_win))
elif s in my_list2:
team2_win= team2_win - 200
print ("team 2: "+ str(team2_win))
elif s in my_list3:
team3_win= team3_win - 200
print ("team 3: "+ str(team2_win))
if y== ("300"):
print ("The U.S. Supreme Court can hear appeals from the state supreme courts: Answer True or False")
c= input ("What is ")
my_list= ["True", "true"]
if c in my_list:
print ("you get 300 points!")
s = (input("what team are you?"))
if s in my_list1:
team1_win= team1_win + 300
print ("team 1: "+ str(team1_win))
elif s in my_list2:
team2_win= team2_win + 300
print ("team 2: "+ str(team2_win))
elif s in my_list3:
team3_win= team3_win + 300
print ("team 3: "+ str(team3_win))
else:
print ("you lose 300 points!")
print (my_list)
s= (input("what team are you?"))
if s in my_list1:
team1_win= team1_win - 300
print ("team 1: "+ str(team1_win))
elif s in my_list2:
team2_win= team2_win - 300
print ("team 2: "+ str(team2_win))
elif s in my_list3:
team3_win= team3_win - 300
print ("team 3: "+ str(team3_win))
if y== ("400"):
print ("How many women are currently on the Supreme Court?")
c= input ("What is ")
my_list= ["3", "Three", "three"]
if c in my_list:
print ("you get 400 points!")
s = (input("what team are you?"))
if s in my_list1:
team1_win= team1_win + 400
print ("team 1: "+ str(team1_win))
elif s in my_list2:
team2_win= team2_win + 400
print ("team 2: "+ str(team2_win))
elif s in my_list3:
team3_win= team3_win + 400
print ("team 3: "+ str(team3_win))
else:
print ("you lose 400 points!")
print (my_list)
s = (input("what team are you?"))
if s in my_list1:
team1_win= team1_win - 400
print ("team 1: "+ str(team1_win))
elif s in my_list2:
team2_win= team2_win - 400
print ("team 2: "+ str(team2_win))
elif s in my_list3:
team3_win= team3_win - 400
print ("team 3: "+ str(team3_win))
if y== ("500"):
print ("Name someone currently on the Supreme Court (Remember to Capitilize Names)")
c= input ("What is ")
my_list= ["Brett Kavanaugh", "Kavanaugh", "Neil Gorsuch", "Gorsuch", "Elena Kagan", "Kagan", "Sonia Sotomayor", "Sotomayor", "Samuel Alito", "Alito", "Stephen Breyer", "Breyer", "Ruth Bader Ginsburg", "RBG", "Clarence Thomas", "Thomas", "John Roberts", "Roberts"]
if c in my_list:
print ("you get 500 points!")
s = (input("what team are you?"))
if s in my_list1:
team1_win= team1_win + 500
print ("team 1: "+ str(team1_win))
elif s in my_list2:
team2_win= team2_win + 500
print ("team 2: "+ str(team2_win))
elif s in my_list3:
team3_win= team3_win + 500
print ("team 3: "+ str(team3_win))
else:
print ("you lose 500 points!")
print (my_list)
s = (input("what team are you?"))
if s in my_list1:
team1_win= team1_win - 500
print ("team 1: "+ str(team1_win))
elif s in my_list2:
team2_win= team2_win - 500
print ("team 2: "+ str(team2_win))
elif s in my_list3:
team3_win= team3_win - 500
print ("team 3: "+ str(team3_win))
if x == ("Other Facts"):
y = input ("Choose Your Level (100, 200, 300, 400, 500)")
if y== ("100"):
print ("Which party gets to make the opening and closing statement as well as the calls the first witnesses?")
c= input ("What is ")
my_list= ["Prosecution"]
if c in my_list:
print ("you get 100 points!")
s= (input("what team are you?"))
if s in my_list1:
team1_win= team1_win + 100
print ("team 1: "+ str(team1_win))
elif s in my_list2:
team2_win= team2_win + 100
print ("team 2: "+ str(team2_win))
elif s in my_list3:
team3_win= team3_win + 100
print ("team 3: "+ str(team3_win))
else:
print ("you lose 100 points!")
print (my_list)
s= (input("what team are you?"))
if s in my_list1:
team1_win= team1_win - 100
print ("team 1: "+ str(team1_win))
elif s in my_list2:
team2_win= team2_win - 100
print ("team 2: "+ str(team2_win))
elif s in my_list3:
team3_win= team3_win - 100
print ("team 3: "+ str(team2_win))
if y== ("200"):
print ("What is the highest federal court that makes decisions which are final?")
c= input ("What is ")
my_list= ["The Supreme Court"]
if c in my_list:
print ("you get 200 points!")
s= (input("what team are you?"))
if s in my_list1:
team1_win= team1_win + 200
print ("team 1: "+ str(team1_win))
elif s in my_list2:
team2_win= team2_win + 200
print ("team 2: "+ str(team2_win))
elif s in my_list3:
team3_win= team3_win + 200
print ("team 3: "+ str(team3_win))
else:
print ("you lose 200 points!")
print (my_list)
s= (input("what team are you?"))
if s in my_list1:
team1_win= team1_win - 200
print ("team 1: "+ str(team1_win))
elif s in my_list2:
team2_win= team2_win - 200
print ("team 2: "+ str(team2_win))
elif s in my_list3:
team3_win= team3_win - 200
print ("team 3: "+ str(team2_win))
if y== ("300"):
print ("True or false: A jury is mandatory in a criminal case?")
c= input ("What is ")
my_list= ["True", "true"]
if c in my_list:
print ("you get 300 points!")
s= (input("what team are you?"))
if s in my_list1:
team1_win= team1_win + 300
print ("team 1: "+ str(team1_win))
elif s in my_list2:
team2_win= team2_win + 300
print ("team 2: "+ str(team2_win))
elif s in my_list3:
team3_win= team3_win + 300
print ("team 3: "+ str(team3_win))
else:
print ("you lose 300 points!")
print (my_list)
s= (input("what team are you?"))
if s in my_list1:
team1_win= team1_win - 300
print ("team 1: "+ str(team1_win))
elif s in my_list2:
team2_win= team2_win - 300
print ("team 2: "+ str(team2_win))
elif s in my_list3:
team3_win= team3_win - 300
print ("team 3: "+ str(team3_win))
if y== ("400"):
print ("What is the job of an appeals/appellate court?")
c= input ("What is ")
my_list= ["to review decisions made in lower courts"]
if c in my_list:
print ("you get 400 points!")
s= (input("what team are you?"))
if s in my_list1:
team1_win= team1_win + 400
print ("team 1: "+ str(team1_win))
elif s in my_list2:
team2_win= team2_win + 400
print ("team 2: "+ str(team2_win))
elif s in my_list3:
team3_win= team3_win + 400
print ("team 3: "+ str(team3_win))
else:
print ("you lose 400 points!")
print (my_list)
s= (input("what team are you?"))
if s in my_list1:
team1_win= team1_win - 400
print ("team 1: "+ str(team1_win))
elif s in my_list2:
team2_win= team2_win - 400
print ("team 2: "+ str(team2_win))
elif s in my_list3:
team3_win= team3_win - 400
print ("team 3: "+ str(team3_win))
if y== ("500"):
print ("In an _____ system, the judge plays a more active role")
c= input ("What is ")
my_list= ["Inquisitional"]
if c in my_list:
print ("you get 500 points!")
s= (input("what team are you?"))
if s in my_list1:
team1_win= team1_win + 500
print ("team 1: "+ str(team1_win))
elif s in my_list2:
team2_win= team2_win + 500
print ("team 2: "+ str(team2_win))
elif s in my_list3:
team3_win= team3_win + 500
print ("team 3: "+ str(team3_win))
else:
print ("you lose 500 points!")
print (my_list)
s= (input("what team are you?"))
if s in my_list1:
team1_win= team1_win - 500
print ("team 1: "+ str(team1_win))
elif s in my_list2:
team2_win= team2_win - 500
print ("team 2: "+ str(team2_win))
elif s in my_list3:
team3_win= team3_win - 500
print ("team 3: "+ str(team3_win))
i= input ("play again?") #point system
return(team1_win, team2_win, team3_win, i)
#score
team1_win=0
team2_win=0
team3_win=0
#for deciphering who g
my_list1 = ["team one", "team 1", "1"]
my_list2 = ["team two", "team 2", "2"]
my_list3 = ["team three","team 3", "3"]
i = "yes"
while i == ("yes"):
score = jeopardy (team1_win, team2_win, team3_win)
#print score
team1_win=score[0]
team2_win=score[1]
team3_win=score[2]
i= score[3]
if i != "yes":
print(team1_win, team2_win, team3_win)
#else:
#print (team1_win, team2_win, team3_win)
#call funtion
| 42.860041 | 274 | 0.463843 | 2,628 | 21,130 | 3.563166 | 0.09551 | 0.09056 | 0.048056 | 0.064075 | 0.777552 | 0.7673 | 0.745728 | 0.721273 | 0.715506 | 0.715506 | 0 | 0.080507 | 0.436252 | 21,130 | 492 | 275 | 42.947154 | 0.705591 | 0.009513 | 0 | 0.849372 | 0 | 0.004184 | 0.20914 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.002092 | false | 0 | 0 | 0 | 0.002092 | 0.345188 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6 |
69751ee04b2f8777365e6d5958123166252274a2 | 14,212 | py | Python | utils_BINGO/Json_file_related.py | IMBINGO95/FairMOT | c496e911a89870a9b6988d93f80e680d01ee8afc | [
"MIT"
] | null | null | null | utils_BINGO/Json_file_related.py | IMBINGO95/FairMOT | c496e911a89870a9b6988d93f80e680d01ee8afc | [
"MIT"
] | null | null | null | utils_BINGO/Json_file_related.py | IMBINGO95/FairMOT | c496e911a89870a9b6988d93f80e680d01ee8afc | [
"MIT"
] | null | null | null | import matplotlib.pyplot as plt
import json
import os
import shutil
import numpy as np
import cv2
from tqdm import tqdm
from utils_BINGO.xml_related import *
def expand_bbox(left, right, top, bottom, img_width, img_height,ratio = 0.1, expand_w_min = 10):
'''
以一定的ratio向左右外扩。 不向上向下扩展了。
'''
width = right - left
height = bottom - top
# expand ratio
expand_w_min = max(ratio * width , expand_w_min) # 最小外扩 expand_w_min
new_left = np.clip(left - expand_w_min, 0, img_width)
new_right = np.clip(right + expand_w_min, 0, img_width)
# new_top = np.clip(top - ratio * height, 0, img_height)
# new_bottom = np.clip(bottom + ratio * height, 0, img_height)
return [int(new_left), int(new_right), int(top), int(bottom)]
def get_back_box(keypoints, img_height, img_width, ratio=0.1, expand_w_min=10):
'''这个get box 是用来获取球员的背部区域的'''
xmin = min(keypoints[5 * 3], keypoints[11 * 3])
xmax = max(keypoints[6 * 3], keypoints[12 * 3])
ymin = min(keypoints[5 * 3 + 1], keypoints[6 * 3 + 1])
ymax = max(keypoints[11 * 3 + 1], keypoints[12 * 3 + 1])
return [int(round(xmin)), int(round(xmax))], expand_bbox(xmin, xmax, ymin, ymax, img_width, img_height, ratio ,expand_w_min)
def get_front_box(keypoints, img_height, img_width, ratio=0.1, expand_w_min=10):
'''这个get box 是用来获取球员的正面胸部区域的'''
xmax = max(keypoints[5 * 3], keypoints[11 * 3])
xmin = min(keypoints[6 * 3], keypoints[12 * 3])
ymin = min(keypoints[5 * 3 + 1], keypoints[6 * 3 + 1])
ymax = max(keypoints[11 * 3 + 1], keypoints[12 * 3 + 1])
return [int(round(xmin)), int(round(xmax))], expand_bbox(xmin, xmax, ymin, ymax, img_width, img_height, ratio ,expand_w_min)
def make_dir(dir):
if os.path.isdir(dir):
shutil.rmtree(dir)
os.makedirs(dir)
def filter_outliers(img_dir,dir_save_front, dir_save_True, dir_save_False,json_file,save_rectangle=True,mode='test'):
# 基于骨骼关键节点的信息,通过肩宽和半身长,来筛选符合条件的目标。
print(json_file)
with open(json_file,'r') as f :
data = json.load(f)
data_len = len(data)
count_right_pose = 0
count_final = 0
count_True = 0
count_False = 0
im_names_desc = tqdm(range(data_len), dynamic_ncols=True)
all_aspect_ratios = []
if mode in ['test','train']:
anno_dir_read = os.path.join(img_dir,'..','Annotations')
anno_dir_save = os.path.join(img_dir,'..','Annotations_save')
make_dir(anno_dir_save)
target_transform = AnnotationTransform(['region'])
for i in im_names_desc:
item = data[i]
img_name = item['img_name']
id = img_name.split('.')[0]
img = cv2.imread(os.path.join(img_dir,img_name))
height,width,_ = img.shape
keypoints = item['keypoints']
# 这个判断标准和get_box的标准不一样。
# 用来判断是否背向的
l_x_max = max(keypoints[5 * 3], keypoints[11 * 3])
r_x_min = min(keypoints[6 * 3], keypoints[12 * 3])
t_y_max = max(keypoints[5 * 3 + 1], keypoints[6 * 3 + 1])
b_y_min = min(keypoints[11 * 3 + 1], keypoints[12 * 3 + 1])
if l_x_max < r_x_min and t_y_max < b_y_min:
'初步判断球员是否背向'
[xmin_old, xmax_old], [xmin, xmax, ymin, ymax] = get_back_box(keypoints, height, width, ratio=0.1, expand_w_min=10)
count_right_pose += 1
if height < 130 or width < 60:
continue
count_final += 1
#计算肩宽、胯宽和半身长
Shoulder_width = keypoints[6*3] - keypoints[5*3]
Crotch_width = keypoints[12*3] - keypoints[11*3]
body_length = ymax - ymin
if body_length == 0 :
print(os.path.join(img_dir,img_name))
aspect_ratio = (max(Shoulder_width,Crotch_width)) / (body_length)
all_aspect_ratios.append(aspect_ratio)
if aspect_ratio >= 0.40:
dir_save = dir_save_True
count_True += 1
# 保存Annotations
if mode in ['test','train']:
xml_read_path = os.path.join(anno_dir_read,'{}.xml'.format(id))
width_read, height_read, depth_read, length, number = read_xml(xml_read_path, target_transform)
if width != int(width_read) or height != int(height_read):
raise ValueError("{} is not right".format(type(id)))
else:
# xml_write_path = os.path.join(anno_dir_save, '{}.xml'.format(id))
write_xml(anno_dir_save,width_read,height_read,depth_read,id,length,num=number,
item=[max(xmin,0), max(0,ymin), min(xmax,width), min(ymax,height)])
else:
dir_save = dir_save_False
count_False += 1
if save_rectangle == True:
img_rectangle = img[ymin:ymax, xmin:xmax]
cv2.imwrite(os.path.join(dir_save, img_name), img_rectangle)
else:
# cv2.rectangle(img, (xmin, ymin), (xmax, ymax), color=(255, 0, 0), thickness=1)
cv2.rectangle(img, (xmin_old, ymin), (xmax_old, ymax), color=(255, 0, 0), thickness=1)
cv2.rectangle(img, (xmin, ymin), (xmax, ymax), color=(0, 255, 0), thickness=1)
cv2.imwrite(os.path.join(dir_save, img_name), img)
print('count_right_pose / length = {} / {} = {}'.format(count_right_pose, data_len, count_right_pose / data_len))
print('count_final / length = {} / {} = {}'.format(count_final, data_len, count_final / data_len))
print('count_True / length = {} / {} = {}'.format(count_True, data_len, count_True / data_len))
print('count_False / length = {} / {} = {}'.format(count_False, data_len, count_False / data_len))
his = np.array(all_aspect_ratios)
scale = np.histogram(his, bins=100, range=(0, 1))
num = 'num:{:->8}\n'.format(len(his))
max_score = 'max:{:.4f},'.format(np.max(his))
min_score = 'min:{:.4f}\n'.format(np.min(his))
mean_score = '(r)mean:{:.4f},'.format(np.mean(his))
median_score = '(g)median:{:.4f}'.format(np.median(his))
plt.hist(his, bins=100, range=(0, 1))
'''draw mean and median line in the scores histogram'''
plt.axvline(x=np.mean(his), ymin=np.min(scale[0]), ymax=np.max(scale[0]), linewidth=5, color='r')
plt.axvline(x=np.median(his), ymin=np.min(scale[0]), ymax=np.max(scale[0]), linewidth=5, color='g')
plt.title(mode)
plt.ylabel('count')
plt.xlabel(num + max_score + min_score + mean_score + median_score)
plt.grid(True)
plt.subplots_adjust(hspace=0.5) # set gap between subplot !
plt.tight_layout()
# plt.savefig(os.path.join(dir, title + '_' + file + '.png'))
plt.show()
plt.close()
def filter_outliers_Negative(img_dir,json_file,save_rectangle=True,mode='test',vis=False):
# 基于骨骼关键节点的信息,通过肩宽和半身长,来筛选符合条件的目标。
# 这次筛选的是 正面的球员
print(json_file)
with open(json_file,'r') as f :
data = json.load(f)
data_len = len(data)
count_right_pose = 0
count_final = 0
count_True = 0
count_False = 0
im_names_desc = tqdm(range(data_len), dynamic_ncols=True)
all_aspect_ratios = []
# if mode in ['Negative']:
# # anno_dir_read = os.path.join(img_dir,'..','Annotations')
# anno_dir_save = os.path.join(img_dir,'..','Annotations_save')
# make_dir(anno_dir_save)
# target_transform = AnnotationTransform(['region'])
mode = 'train'
anno_dir_save = os.path.join(img_dir, '..', mode, 'Annotations')
dir_save_True = os.path.join(img_dir, '..', mode, 'JPEGImages')
dir_save_False = os.path.join(img_dir, '..', mode, 'False')
os.makedirs(anno_dir_save,exist_ok=True)
os.makedirs(dir_save_True,exist_ok=True)
os.makedirs(dir_save_False,exist_ok=True)
for i in im_names_desc:
item = data[i]
img_name = item['img_name']
# if img_name == '17_2_A_Player_N_47_4.jpg.jpg':
# print()
if len(img_name.split('.')) > 2:
print(img_name)
continue
id = img_name.split('.')[0]
img = cv2.imread(os.path.join(img_dir,img_name))
if type(img) != np.ndarray:
print(img_name)
continue
height,width,depth = img.shape
keypoints = item['keypoints']
# 这个判断标准和get_box的标准不一样。
# 用来判断是否背向的
l_x_min = min(keypoints[5 * 3], keypoints[11 * 3]) # 左侧最小值
r_x_max = max(keypoints[6 * 3], keypoints[12 * 3]) # 右侧最大值
t_y_max = max(keypoints[5 * 3 + 1], keypoints[6 * 3 + 1])
b_y_min = min(keypoints[11 * 3 + 1], keypoints[12 * 3 + 1])
if l_x_min > r_x_max and t_y_max < b_y_min:
'初步判断球员是否正向'
[xmin_old, xmax_old], [xmin, xmax, ymin, ymax] = get_front_box(keypoints, height, width, ratio=0.1, expand_w_min=10)
count_right_pose += 1
if height < 130 or width < 60:
continue
count_final += 1
#计算肩宽、胯宽和半身长
Shoulder_width = abs(keypoints[6*3] - keypoints[5*3])
Crotch_width = abs(keypoints[12*3] - keypoints[11*3])
body_length = ymax - ymin
if body_length == 0 :
print(os.path.join(img_dir,img_name))
aspect_ratio = (max(Shoulder_width,Crotch_width)) / (body_length)
all_aspect_ratios.append(aspect_ratio)
if aspect_ratio >= 0.40:
dir_save = dir_save_True
count_True += 1
# 保存Annotations
length = 0
number = -1
write_xml(anno_dir_save,width,height,depth,id,length,num=number,
item=[max(xmin,0), max(0,ymin), min(xmax,width), min(ymax,height)])
else:
dir_save = dir_save_False
count_False += 1
if save_rectangle == True:
img_rectangle = img[ymin:ymax, xmin:xmax]
cv2.imwrite(os.path.join(dir_save, '{}.jpg'.format(id)), img_rectangle)
else:
# cv2.rectangle(img, (xmin, ymin), (xmax, ymax), color=(255, 0, 0), thickness=1)
if vis == True:
cv2.rectangle(img, (xmin_old, ymin), (xmax_old, ymax), color=(255, 0, 0), thickness=1)
cv2.rectangle(img, (xmin, ymin), (xmax, ymax), color=(0, 255, 0), thickness=1)
cv2.imwrite(os.path.join(dir_save, img_name), img)
if count_True == 3500:
mode = 'test'
anno_dir_save = os.path.join(img_dir, '..', mode, 'Annotations')
dir_save_True = os.path.join(img_dir, '..', mode, 'JPEGImages')
dir_save_False = os.path.join(img_dir, '..', mode, 'False')
os.makedirs(anno_dir_save, exist_ok=True)
os.makedirs(dir_save_True, exist_ok=True)
os.makedirs(dir_save_False, exist_ok=True)
elif count_True == 4500:
break
print('count_right_pose / length = {} / {} = {}'.format(count_right_pose, data_len, count_right_pose / data_len))
print('count_final / length = {} / {} = {}'.format(count_final, data_len, count_final / data_len))
print('count_True / length = {} / {} = {}'.format(count_True, data_len, count_True / data_len))
print('count_False / length = {} / {} = {}'.format(count_False, data_len, count_False / data_len))
his = np.array(all_aspect_ratios)
scale = np.histogram(his, bins=100, range=(0, 1))
num = 'num:{:->8}\n'.format(len(his))
max_score = 'max:{:.4f},'.format(np.max(his))
min_score = 'min:{:.4f}\n'.format(np.min(his))
mean_score = '(r)mean:{:.4f},'.format(np.mean(his))
median_score = '(g)median:{:.4f}'.format(np.median(his))
plt.hist(his, bins=100, range=(0, 1))
'''draw mean and median line in the scores histogram'''
plt.axvline(x=np.mean(his), ymin=np.min(scale[0]), ymax=np.max(scale[0]), linewidth=5, color='r')
plt.axvline(x=np.median(his), ymin=np.min(scale[0]), ymax=np.max(scale[0]), linewidth=5, color='g')
plt.title(mode)
plt.ylabel('count')
plt.xlabel(num + max_score + min_score + mean_score + median_score)
plt.grid(True)
plt.subplots_adjust(hspace=0.5) # set gap between subplot !
plt.tight_layout()
# plt.savefig(os.path.join(dir, title + '_' + file + '.png'))
plt.show()
plt.close()
def validate_false_pose(list_dir,pose_dir,origin_img_dir,save_dir):
imgs = os.listdir(list_dir)
data_len = len(imgs)
im_names_desc = tqdm(range(data_len), dynamic_ncols=True)
for i in im_names_desc :
img = imgs[i]
img_name = img.split('.')[0]
shutil.copy(os.path.join(list_dir,img),os.path.join(save_dir,'{}_{}.jpg'.format(img_name,'一')))
shutil.copy(os.path.join(pose_dir,img),os.path.join(save_dir,'{}_{}.jpg'.format(img_name,'二')))
shutil.copy(os.path.join(origin_img_dir,img),os.path.join(save_dir,'{}_{}.jpg'.format(img_name,'三')))
def generate_positive_SVHN_annotation():
for game in ['train','test']:
dir = '/datanew/hwb/data/WG_Num/{}'.format(game)
img_dir = '/datanew/hwb/data/WG_Num/{}/JPEGImages'.format(game)
dir_save_front = '/datanew/hwb/data/WG_Num/{}/{}_front_after_sort'.format(game,game)
dir_save_True = '/datanew/hwb/data/WG_Num/{}/{}_True_after_sort'.format(game,game)
dir_save_False = '/datanew/hwb/data/WG_Num/{}/{}_False_after_sort'.format(game,game)
make_dir(dir_save_True)
make_dir(dir_save_False)
file = '{}_vis_keypoints.json'.format(game)
json_file = os.path.join(dir, file)
filter_outliers(img_dir,dir_save_front, dir_save_True, dir_save_False, json_file, save_rectangle = True ,mode=game)
def generate_negative_SVHN_annotation():
for game in ['Negative']:
dir = '/datanew/hwb/data/WG_Num/{}'.format(game)
img_dir = '/datanew/hwb/data/WG_Num/{}/JPEGImages'.format(game)
file = '{}_vis_keypoints.json'.format(game)
json_file = os.path.join(dir, file)
filter_outliers_Negative(img_dir, json_file,save_rectangle = False ,mode=game)
if __name__ == '__main__':
generate_negative_SVHN_annotation()
| 42.297619 | 128 | 0.602871 | 2,028 | 14,212 | 3.985207 | 0.115878 | 0.037243 | 0.03712 | 0.022519 | 0.829993 | 0.79609 | 0.778644 | 0.73608 | 0.727914 | 0.709354 | 0 | 0.027393 | 0.247397 | 14,212 | 335 | 129 | 42.423881 | 0.728216 | 0.078455 | 0 | 0.64898 | 0 | 0 | 0.079196 | 0.02413 | 0 | 0 | 0 | 0 | 0 | 1 | 0.036735 | false | 0 | 0.032653 | 0 | 0.081633 | 0.057143 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6 |
69c28ca2144e0dade2f902dce601a91261a20afb | 1,655 | py | Python | 10/10/failed_attempt.py | juancroldan/tuenti-challenge | 4b0b233f457366dd78e80c011ade138cd162e297 | [
"Unlicense"
] | null | null | null | 10/10/failed_attempt.py | juancroldan/tuenti-challenge | 4b0b233f457366dd78e80c011ade138cd162e297 | [
"Unlicense"
] | null | null | null | 10/10/failed_attempt.py | juancroldan/tuenti-challenge | 4b0b233f457366dd78e80c011ade138cd162e297 | [
"Unlicense"
] | null | null | null | # -*- coding: utf-8 -*-
from paramiko import SSHClient, AutoAddPolicy
emojis = 'ℹ↔↕↖↗↘↙↩↪⊛⌚⌛⌨⏏⏩⏪⏫⏬⏭⏮⏯⏰⏱⏲⏳⏸⏹⏺Ⓜ▪▫▶◀◻◼◽◾☀☁☂☃☄☎☑☔☕☘☝☠☢☣☦☪☮☯☸☹☺♀♂♈♉♊♋♌♍♎♏♐♑♒♓♟♠♣♥♦♨♻♾♿⚒⚓⚔⚕⚖⚗⚙⚛⚜⚠⚡⚪⚫⚰⚱⚽⚾⛄⛅⛈⛎⛏⛑⛓⛔⛩⛪⛰⛱⛲⛳⛴⛵⛷⛸⛹⛺⛽✂✅✈✉✊✋✌✍✏✒✔✖✝✡✨✳✴❄❇❌❎❓❔❕❗❣❤➕➖➗➡➰➿⤴⤵⬅⬆⬇⬛⬜⭐⭕〰〽㊗㊙🀄🃏🅰🅱🅾🅿🆎🆑🆒🆓🆔🆕🆖🆗🆘🆙🆚🇦🇧🇨🇩🇪🇫🇬🇭🇮🇯🇰🇱🇲🇳🇴🇵🇶🇷🇸🇹🇺🇻🇼🇽🇾🇿🈁🈂🈚🈯🈲🈳🈴🈵🈶🈷🈸🈹🈺🉐🉑🌀🌁🌂🌃🌄🌅🌆🌇🌈🌉🌊🌋🌌🌍🌎🌏🌐🌑🌒🌓🌔🌕🌖🌗🌘🌙🌚🌛🌜🌝🌞🌟🌠🌡🌤🌥🌦🌧🌨🌩🌪🌫🌬🌭🌮🌯🌰🌱🌲🌳🌴🌵🌶🌷🌸🌹🌺🌻🌼🌽🌾🌿🍀🍁🍂🍃🍄🍅🍆🍇🍈🍉🍊🍋🍌🍍🍎🍏🍐🍑🍒🍓🍔🍕🍖🍗🍘🍙🍚🍛🍜🍝🍞🍟🍠🍡🍢🍣🍤🍥🍦🍧🍨🍩🍪🍫🍬🍭🍮🍯🍰🍱🍲🍳🍴🍵🍶🍷🍸🍹🍺🍻🍼🍽🍾🍿🎀🎁🎂🎃🎄🎅🎆🎇🎈🎉🎊🎋🎌🎍🎎🎏🎐🎑🎒🎓🎖🎗🎙🎚🎛🎞🎟🎠🎡🎢🎣🎤🎥🎦🎧🎨🎩🎪🎫🎬🎭🎮🎯🎰🎱🎲🎳🎴🎵🎶🎷🎸🎹🎺🎻🎼🎽🎾🎿🏀🏁🏂🏃🏄🏅🏆🏇🏈🏉🏊🏋🏌🏍🏎🏏🏐🏑🏒🏓🏔🏕🏖🏗🏘🏙🏚🏛🏜🏝🏞🏟🏠🏡🏢🏣🏤🏥🏦🏧🏨🏩🏪🏫🏬🏭🏮🏯🏰🏳🏴🏵🏷🏸🏹🏺🐀🐁🐂🐃🐄🐅🐆🐇🐈🐉🐊🐋🐌🐍🐎🐏🐐🐑🐒🐓🐔🐕🐖🐗🐘🐙🐚🐛🐜🐝🐞🐟🐠🐡🐢🐣🐤🐥🐦🐧🐨🐩🐪🐫🐬🐭🐮🐯🐰🐱🐲🐳🐴🐵🐶🐷🐸🐹🐺🐻🐼🐽🐾🐿👀👁👂👃👄👅👆👇👈👉👊👋👌👍👎👏👐👑👒👓👔👕👖👗👘👙👚👛👜👝👞👟👠👡👢👣👤👥👦👧👨👩👪👫👬👭👮👯👰👱👲👳👴👵👶👷👸👹👺👻👼👽👾👿💀💁💂💃💄💅💆💇💈💉💊💋💌💍💎💏💐💑💒💓💔💕💖💗💘💙💚💛💜💝💞💟💠💡💢💣💤💥💦💧💨💩💪💫💬💭💮💯💰💱💲💳💴💵💶💷💸💹💺💻💼💽💾💿📀📁📂📃📄📅📆📇📈📉📊📋📌📍📎📏📐📑📒📓📔📕📖📗📘📙📚📛📜📝📞📟📠📡📢📣📤📥📦📧📨📩📪📫📬📭📮📯📰📱📲📳📴📵📶📷📸📹📺📻📼📽📿🔀🔁🔂🔃🔄🔅🔆🔇🔈🔉🔊🔋🔌🔍🔎🔏🔐🔑🔒🔓🔔🔕🔖🔗🔘🔙🔚🔛🔜🔝🔞🔟🔠🔡🔢🔣🔤🔥🔦🔧🔨🔩🔪🔫🔬🔭🔮🔯🔰🔱🔲🔳🔴🔵🔶🔷🔸🔹🔺🔻🔼🔽🕉🕊🕋🕌🕍🕎🕐🕑🕒🕓🕔🕕🕖🕗🕘🕙🕚🕛🕜🕝🕞🕟🕠🕡🕢🕣🕤🕥🕦🕧🕯🕰🕳🕴🕵🕶🕷🕸🕹🕺🖇🖊🖋🖌🖍🖐🖕🖖🖤🖥🖨🖱🖲🖼🗂🗃🗄🗑🗒🗓🗜🗝🗞🗡🗣🗨🗯🗳🗺🗻🗼🗽🗾🗿😀😁😂😃😄😅😆😇😈😉😊😋😌😍😎😏😐😑😒😓😔😕😖😗😘😙😚😛😜😝😞😟😠😡😢😣😤😥😦😧😨😩😪😫😬😭😮😯😰😱😲😳😴😵😶😷😸😹😺😻😼😽😾😿🙀🙁🙂🙃🙄🙅🙆🙇🙈🙉🙊🙋🙌🙍🙎🙏🚀🚁🚂🚃🚄🚅🚆🚇🚈🚉🚊🚋🚌🚍🚎🚏🚐🚑🚒🚓🚔🚕🚖🚗🚘🚙🚚🚛🚜🚝🚞🚟🚠🚡🚢🚣🚤🚥🚦🚧🚨🚩🚪🚫🚬🚭🚮🚯🚰🚱🚲🚳🚴🚵🚶🚷🚸🚹🚺🚻🚼🚽🚾🚿🛀🛁🛂🛃🛄🛅🛋🛌🛍🛎🛏🛐🛑🛒🛠🛡🛢🛣🛤🛥🛩🛫🛬🛰🛳🛴🛵🛶🛷🛸🛹🤐🤑🤒🤓🤔🤕🤖🤗🤘🤙🤚🤛🤜🤝🤞🤟🤠🤡🤢🤣🤤🤥🤦🤧🤨🤩🤪🤫🤬🤭🤮🤯🤰🤱🤲🤳🤴🤵🤶🤷🤸🤹🤺🤼🤽🤾🥀🥁🥂🥃🥄🥅🥇🥈🥉🥊🥋🥌🥍🥎🥏🥐🥑🥒🥓🥔🥕🥖🥗🥘🥙🥚🥛🥜🥝🥞🥟🥠🥡🥢🥣🥤🥥🥦🥧🥨🥩🥪🥫🥬🥭🥮🥯🥰🥳🥴🥵🥶🥺🥼🥽🥾🥿🦀🦁🦂🦃🦄🦅🦆🦇🦈🦉🦊🦋🦌🦍🦎🦏🦐🦑🦒🦓🦔🦕🦖🦗🦘🦙🦚🦛🦜🦝🦞🦟🦠🦡🦢🦰🦱🦲🦳🦴🦵🦶🦷🦸🦹🧀🧁🧂🧐🧑🧒🧓🧔🧕🧖🧗🧘🧙🧚🧛🧜🧝🧞🧟🧠🧡🧢🧣🧤🧥🧦🧧🧨🧩🧪🧫🧬🧭🧮🧯🧰🧱🧲🧳🧴🧵🧶🧷🧸🧹🧺🧻🧼🧽🧾🧿'
ssh = SSHClient()
ssh.set_missing_host_key_policy(AutoAddPolicy())
ssh.connect('52.49.91.111', port=22000, username='castle', password='castle')
def say(text):
stdin, stdout, stderr = ssh.exec_command(text)
for line in stdout:
print('... ' + line.strip('\n'))
for line in stderr:
print('### ' + line.strip('\n'))
say('🔦')
ssh.close() | 91.944444 | 1,240 | 0.172205 | 68 | 1,655 | 22.205882 | 0.720588 | 0.009272 | 0.011921 | 0.019868 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.009381 | 0.033837 | 1,655 | 18 | 1,241 | 91.944444 | 0.165729 | 0.012689 | 0 | 0 | 0 | 0 | 0.77526 | 0.752603 | 0 | 0 | 0 | 0 | 0 | 1 | 0.076923 | false | 0.076923 | 0.076923 | 0 | 0.153846 | 0.153846 | 0 | 0 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 6 |
3850f8b56d9998f4d93bad69413363a8c20d5bde | 283 | py | Python | flask_squirrel/__init__.py | ClNo/flask-squirrel | af3659a477a4ebf50360643b02b33d2299ad7d0f | [
"MIT"
] | null | null | null | flask_squirrel/__init__.py | ClNo/flask-squirrel | af3659a477a4ebf50360643b02b33d2299ad7d0f | [
"MIT"
] | null | null | null | flask_squirrel/__init__.py | ClNo/flask-squirrel | af3659a477a4ebf50360643b02b33d2299ad7d0f | [
"MIT"
] | null | null | null | from flask_squirrel.table.dbtable import DbTable
from flask_squirrel.table.viewspec import ResourceViewSpec
from flask_squirrel.util.session_auth import LoginTokenApi
from flask_squirrel.util.dirmanager import DirManager
from flask_squirrel.startup.flask_app import main, create_app
| 47.166667 | 61 | 0.886926 | 39 | 283 | 6.230769 | 0.435897 | 0.185185 | 0.349794 | 0.18107 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.074205 | 283 | 5 | 62 | 56.6 | 0.927481 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 6 |
3859c9cef69cd6549abd8f2bb8f28fadb2fd9b80 | 38,002 | py | Python | instances/passenger_demand/pas-20210421-2109-int18e/46.py | LHcau/scheduling-shared-passenger-and-freight-transport-on-a-fixed-infrastructure | bba1e6af5bc8d9deaa2dc3b83f6fe9ddf15d2a11 | [
"BSD-3-Clause"
] | null | null | null | instances/passenger_demand/pas-20210421-2109-int18e/46.py | LHcau/scheduling-shared-passenger-and-freight-transport-on-a-fixed-infrastructure | bba1e6af5bc8d9deaa2dc3b83f6fe9ddf15d2a11 | [
"BSD-3-Clause"
] | null | null | null | instances/passenger_demand/pas-20210421-2109-int18e/46.py | LHcau/scheduling-shared-passenger-and-freight-transport-on-a-fixed-infrastructure | bba1e6af5bc8d9deaa2dc3b83f6fe9ddf15d2a11 | [
"BSD-3-Clause"
] | null | null | null |
"""
PASSENGERS
"""
numPassengers = 4008
passenger_arriving = (
(6, 11, 9, 2, 1, 0, 7, 11, 5, 5, 0, 0), # 0
(8, 16, 9, 0, 4, 0, 6, 10, 9, 7, 2, 0), # 1
(4, 10, 4, 6, 3, 0, 9, 14, 7, 6, 1, 0), # 2
(8, 10, 8, 6, 4, 0, 9, 12, 6, 5, 2, 0), # 3
(5, 7, 6, 5, 3, 0, 7, 5, 6, 4, 2, 0), # 4
(4, 11, 6, 2, 1, 0, 8, 9, 4, 5, 3, 0), # 5
(6, 5, 13, 9, 1, 0, 5, 11, 12, 3, 1, 0), # 6
(2, 10, 11, 7, 3, 0, 11, 10, 6, 9, 3, 0), # 7
(3, 9, 10, 5, 2, 0, 8, 12, 8, 3, 3, 0), # 8
(6, 10, 3, 5, 3, 0, 4, 9, 10, 4, 1, 0), # 9
(4, 11, 9, 7, 6, 0, 12, 8, 9, 8, 6, 0), # 10
(3, 9, 7, 3, 2, 0, 8, 11, 4, 4, 1, 0), # 11
(4, 5, 14, 2, 1, 0, 8, 16, 7, 6, 4, 0), # 12
(9, 13, 15, 2, 1, 0, 2, 9, 6, 7, 4, 0), # 13
(4, 12, 11, 2, 4, 0, 11, 12, 7, 6, 3, 0), # 14
(3, 7, 9, 4, 3, 0, 10, 22, 9, 3, 3, 0), # 15
(3, 8, 7, 6, 2, 0, 7, 9, 9, 3, 4, 0), # 16
(7, 14, 9, 7, 2, 0, 11, 8, 5, 9, 1, 0), # 17
(4, 9, 11, 6, 2, 0, 9, 8, 11, 8, 4, 0), # 18
(7, 17, 7, 4, 5, 0, 9, 14, 4, 3, 3, 0), # 19
(7, 19, 11, 6, 3, 0, 10, 17, 5, 10, 5, 0), # 20
(6, 12, 13, 2, 1, 0, 8, 8, 8, 11, 7, 0), # 21
(5, 13, 9, 3, 7, 0, 5, 12, 6, 9, 2, 0), # 22
(2, 13, 12, 2, 2, 0, 9, 5, 11, 3, 4, 0), # 23
(4, 12, 10, 6, 4, 0, 2, 8, 8, 11, 1, 0), # 24
(3, 20, 14, 8, 3, 0, 9, 13, 8, 3, 4, 0), # 25
(0, 11, 4, 6, 3, 0, 9, 16, 3, 6, 1, 0), # 26
(4, 10, 9, 3, 5, 0, 11, 12, 5, 10, 5, 0), # 27
(1, 15, 9, 6, 0, 0, 5, 6, 2, 9, 4, 0), # 28
(11, 9, 11, 4, 2, 0, 4, 16, 4, 6, 4, 0), # 29
(4, 10, 7, 4, 1, 0, 8, 12, 5, 7, 3, 0), # 30
(6, 11, 10, 4, 3, 0, 4, 10, 8, 8, 2, 0), # 31
(3, 17, 8, 5, 3, 0, 14, 9, 5, 7, 7, 0), # 32
(12, 15, 17, 7, 2, 0, 9, 12, 7, 4, 1, 0), # 33
(9, 17, 8, 1, 2, 0, 10, 10, 7, 6, 2, 0), # 34
(8, 13, 4, 1, 1, 0, 8, 11, 7, 5, 3, 0), # 35
(7, 7, 13, 3, 6, 0, 6, 10, 6, 8, 2, 0), # 36
(3, 16, 9, 8, 0, 0, 6, 7, 9, 6, 3, 0), # 37
(8, 11, 7, 5, 4, 0, 6, 19, 7, 8, 3, 0), # 38
(8, 14, 6, 8, 2, 0, 4, 15, 7, 5, 2, 0), # 39
(3, 13, 6, 7, 1, 0, 5, 16, 8, 2, 3, 0), # 40
(3, 14, 7, 2, 2, 0, 12, 16, 5, 3, 2, 0), # 41
(7, 17, 6, 4, 4, 0, 5, 8, 4, 11, 1, 0), # 42
(11, 10, 13, 2, 3, 0, 5, 13, 8, 5, 4, 0), # 43
(9, 7, 5, 5, 2, 0, 7, 14, 6, 6, 2, 0), # 44
(11, 13, 8, 4, 4, 0, 2, 9, 11, 1, 2, 0), # 45
(4, 17, 8, 9, 1, 0, 12, 10, 8, 8, 0, 0), # 46
(4, 15, 10, 1, 1, 0, 7, 9, 9, 5, 4, 0), # 47
(6, 9, 10, 3, 7, 0, 7, 18, 5, 6, 2, 0), # 48
(2, 15, 15, 5, 4, 0, 6, 12, 6, 6, 2, 0), # 49
(5, 17, 11, 3, 5, 0, 4, 15, 5, 2, 3, 0), # 50
(3, 8, 7, 6, 5, 0, 7, 14, 5, 7, 6, 0), # 51
(2, 10, 7, 4, 5, 0, 9, 8, 8, 6, 3, 0), # 52
(5, 8, 11, 3, 3, 0, 7, 12, 7, 6, 3, 0), # 53
(6, 9, 10, 10, 3, 0, 10, 8, 9, 2, 3, 0), # 54
(1, 13, 8, 3, 5, 0, 8, 10, 5, 7, 4, 0), # 55
(7, 11, 6, 5, 1, 0, 7, 10, 8, 8, 5, 0), # 56
(4, 11, 8, 3, 2, 0, 7, 7, 8, 2, 3, 0), # 57
(4, 10, 14, 4, 0, 0, 8, 12, 6, 7, 2, 0), # 58
(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), # 59
)
station_arriving_intensity = (
(4.769372805092186, 12.233629261363635, 14.389624839331619, 11.405298913043477, 12.857451923076923, 8.562228260869567), # 0
(4.81413961808604, 12.369674877683082, 14.46734796754499, 11.46881589673913, 12.953819711538461, 8.559309850543478), # 1
(4.8583952589991215, 12.503702525252525, 14.54322622107969, 11.530934782608696, 13.048153846153847, 8.556302173913043), # 2
(4.902102161984196, 12.635567578125, 14.617204169344474, 11.591602581521737, 13.14036778846154, 8.553205638586958), # 3
(4.94522276119403, 12.765125410353535, 14.689226381748071, 11.650766304347826, 13.230375, 8.550020652173911), # 4
(4.987719490781387, 12.892231395991162, 14.759237427699228, 11.708372961956522, 13.318088942307691, 8.546747622282608), # 5
(5.029554784899035, 13.01674090909091, 14.827181876606687, 11.764369565217393, 13.403423076923078, 8.54338695652174), # 6
(5.0706910776997365, 13.138509323705808, 14.893004297879177, 11.818703125, 13.486290865384618, 8.5399390625), # 7
(5.1110908033362605, 13.257392013888888, 14.956649260925452, 11.871320652173912, 13.56660576923077, 8.536404347826087), # 8
(5.1507163959613695, 13.373244353693181, 15.018061335154243, 11.922169157608696, 13.644281249999999, 8.532783220108696), # 9
(5.1895302897278315, 13.485921717171717, 15.077185089974291, 11.971195652173915, 13.719230769230771, 8.529076086956522), # 10
(5.227494918788412, 13.595279478377526, 15.133965094794343, 12.018347146739131, 13.791367788461539, 8.525283355978262), # 11
(5.2645727172958745, 13.701173011363636, 15.188345919023137, 12.063570652173912, 13.860605769230768, 8.521405434782608), # 12
(5.3007261194029835, 13.803457690183082, 15.240272132069407, 12.106813179347826, 13.926858173076925, 8.51744273097826), # 13
(5.335917559262511, 13.90198888888889, 15.289688303341899, 12.148021739130433, 13.99003846153846, 8.513395652173912), # 14
(5.370109471027217, 13.996621981534089, 15.336539002249355, 12.187143342391304, 14.050060096153846, 8.509264605978261), # 15
(5.403264288849868, 14.087212342171718, 15.380768798200515, 12.224124999999999, 14.10683653846154, 8.50505), # 16
(5.4353444468832315, 14.173615344854797, 15.422322260604112, 12.258913722826087, 14.16028125, 8.500752241847827), # 17
(5.46631237928007, 14.255686363636363, 15.461143958868895, 12.291456521739132, 14.210307692307696, 8.496371739130435), # 18
(5.496130520193152, 14.333280772569443, 15.4971784624036, 12.321700407608695, 14.256829326923079, 8.491908899456522), # 19
(5.524761303775241, 14.40625394570707, 15.530370340616965, 12.349592391304348, 14.299759615384616, 8.487364130434782), # 20
(5.552167164179106, 14.47446125710227, 15.56066416291774, 12.375079483695652, 14.339012019230768, 8.482737839673913), # 21
(5.578310535557506, 14.537758080808082, 15.588004498714653, 12.398108695652175, 14.374499999999998, 8.47803043478261), # 22
(5.603153852063214, 14.595999790877526, 15.612335917416454, 12.418627038043478, 14.40613701923077, 8.473242323369567), # 23
(5.62665954784899, 14.649041761363636, 15.633602988431875, 12.43658152173913, 14.433836538461538, 8.468373913043479), # 24
(5.648790057067603, 14.696739366319445, 15.651750281169667, 12.451919157608696, 14.457512019230768, 8.463425611413044), # 25
(5.669507813871817, 14.738947979797977, 15.66672236503856, 12.464586956521739, 14.477076923076922, 8.458397826086957), # 26
(5.688775252414398, 14.77552297585227, 15.6784638094473, 12.474531929347828, 14.492444711538463, 8.453290964673915), # 27
(5.7065548068481124, 14.806319728535353, 15.68691918380463, 12.481701086956523, 14.503528846153845, 8.448105434782608), # 28
(5.722808911325724, 14.831193611900254, 15.69203305751928, 12.486041440217392, 14.510242788461538, 8.44284164402174), # 29
(5.7375, 14.85, 15.69375, 12.4875, 14.512500000000001, 8.4375), # 30
(5.751246651214834, 14.865621839488634, 15.692462907608693, 12.487236580882353, 14.511678590425532, 8.430077267616193), # 31
(5.7646965153452685, 14.881037215909092, 15.68863804347826, 12.486451470588234, 14.509231914893617, 8.418644565217393), # 32
(5.777855634590792, 14.896244211647728, 15.682330027173915, 12.485152389705883, 14.50518630319149, 8.403313830584706), # 33
(5.790730051150895, 14.91124090909091, 15.67359347826087, 12.483347058823531, 14.499568085106382, 8.38419700149925), # 34
(5.803325807225064, 14.926025390624996, 15.662483016304348, 12.481043198529411, 14.492403590425532, 8.361406015742128), # 35
(5.815648945012788, 14.940595738636366, 15.649053260869564, 12.478248529411767, 14.48371914893617, 8.335052811094453), # 36
(5.8277055067135555, 14.954950035511365, 15.63335883152174, 12.474970772058823, 14.47354109042553, 8.305249325337332), # 37
(5.839501534526853, 14.969086363636364, 15.615454347826088, 12.471217647058824, 14.461895744680852, 8.272107496251873), # 38
(5.851043070652174, 14.983002805397728, 15.595394429347825, 12.466996875000001, 14.44880944148936, 8.23573926161919), # 39
(5.862336157289003, 14.99669744318182, 15.573233695652176, 12.462316176470589, 14.434308510638296, 8.196256559220389), # 40
(5.873386836636828, 15.010168359374997, 15.549026766304348, 12.457183272058824, 14.418419281914893, 8.153771326836583), # 41
(5.88420115089514, 15.023413636363639, 15.522828260869566, 12.451605882352942, 14.401168085106384, 8.108395502248875), # 42
(5.894785142263428, 15.03643135653409, 15.494692798913043, 12.445591727941178, 14.38258125, 8.060241023238381), # 43
(5.905144852941176, 15.049219602272727, 15.464675, 12.439148529411764, 14.36268510638298, 8.009419827586207), # 44
(5.915286325127877, 15.061776455965909, 15.432829483695656, 12.43228400735294, 14.341505984042554, 7.956043853073464), # 45
(5.925215601023019, 15.074100000000003, 15.39921086956522, 12.425005882352941, 14.319070212765958, 7.90022503748126), # 46
(5.934938722826087, 15.086188316761364, 15.363873777173913, 12.417321874999999, 14.295404122340427, 7.842075318590705), # 47
(5.944461732736574, 15.098039488636365, 15.326872826086957, 12.409239705882353, 14.27053404255319, 7.7817066341829095), # 48
(5.953790672953963, 15.10965159801136, 15.288262635869566, 12.400767095588236, 14.24448630319149, 7.71923092203898), # 49
(5.96293158567775, 15.121022727272724, 15.248097826086958, 12.391911764705883, 14.217287234042553, 7.65476011994003), # 50
(5.971890513107417, 15.132150958806818, 15.206433016304347, 12.38268143382353, 14.188963164893616, 7.588406165667167), # 51
(5.980673497442456, 15.143034375, 15.163322826086954, 12.373083823529411, 14.159540425531915, 7.5202809970015), # 52
(5.989286580882353, 15.153671058238638, 15.118821875, 12.363126654411765, 14.129045345744682, 7.450496551724138), # 53
(5.9977358056266, 15.164059090909088, 15.072984782608694, 12.352817647058824, 14.09750425531915, 7.379164767616192), # 54
(6.00602721387468, 15.174196555397728, 15.02586616847826, 12.342164522058825, 14.064943484042553, 7.306397582458771), # 55
(6.014166847826087, 15.184081534090907, 14.977520652173913, 12.331175, 14.031389361702129, 7.232306934032984), # 56
(6.022160749680308, 15.193712109375003, 14.92800285326087, 12.319856801470587, 13.996868218085105, 7.15700476011994), # 57
(6.030014961636829, 15.203086363636363, 14.877367391304347, 12.308217647058825, 13.961406382978723, 7.0806029985007495), # 58
(0.0, 0.0, 0.0, 0.0, 0.0, 0.0), # 59
)
passenger_arriving_acc = (
(6, 11, 9, 2, 1, 0, 7, 11, 5, 5, 0, 0), # 0
(14, 27, 18, 2, 5, 0, 13, 21, 14, 12, 2, 0), # 1
(18, 37, 22, 8, 8, 0, 22, 35, 21, 18, 3, 0), # 2
(26, 47, 30, 14, 12, 0, 31, 47, 27, 23, 5, 0), # 3
(31, 54, 36, 19, 15, 0, 38, 52, 33, 27, 7, 0), # 4
(35, 65, 42, 21, 16, 0, 46, 61, 37, 32, 10, 0), # 5
(41, 70, 55, 30, 17, 0, 51, 72, 49, 35, 11, 0), # 6
(43, 80, 66, 37, 20, 0, 62, 82, 55, 44, 14, 0), # 7
(46, 89, 76, 42, 22, 0, 70, 94, 63, 47, 17, 0), # 8
(52, 99, 79, 47, 25, 0, 74, 103, 73, 51, 18, 0), # 9
(56, 110, 88, 54, 31, 0, 86, 111, 82, 59, 24, 0), # 10
(59, 119, 95, 57, 33, 0, 94, 122, 86, 63, 25, 0), # 11
(63, 124, 109, 59, 34, 0, 102, 138, 93, 69, 29, 0), # 12
(72, 137, 124, 61, 35, 0, 104, 147, 99, 76, 33, 0), # 13
(76, 149, 135, 63, 39, 0, 115, 159, 106, 82, 36, 0), # 14
(79, 156, 144, 67, 42, 0, 125, 181, 115, 85, 39, 0), # 15
(82, 164, 151, 73, 44, 0, 132, 190, 124, 88, 43, 0), # 16
(89, 178, 160, 80, 46, 0, 143, 198, 129, 97, 44, 0), # 17
(93, 187, 171, 86, 48, 0, 152, 206, 140, 105, 48, 0), # 18
(100, 204, 178, 90, 53, 0, 161, 220, 144, 108, 51, 0), # 19
(107, 223, 189, 96, 56, 0, 171, 237, 149, 118, 56, 0), # 20
(113, 235, 202, 98, 57, 0, 179, 245, 157, 129, 63, 0), # 21
(118, 248, 211, 101, 64, 0, 184, 257, 163, 138, 65, 0), # 22
(120, 261, 223, 103, 66, 0, 193, 262, 174, 141, 69, 0), # 23
(124, 273, 233, 109, 70, 0, 195, 270, 182, 152, 70, 0), # 24
(127, 293, 247, 117, 73, 0, 204, 283, 190, 155, 74, 0), # 25
(127, 304, 251, 123, 76, 0, 213, 299, 193, 161, 75, 0), # 26
(131, 314, 260, 126, 81, 0, 224, 311, 198, 171, 80, 0), # 27
(132, 329, 269, 132, 81, 0, 229, 317, 200, 180, 84, 0), # 28
(143, 338, 280, 136, 83, 0, 233, 333, 204, 186, 88, 0), # 29
(147, 348, 287, 140, 84, 0, 241, 345, 209, 193, 91, 0), # 30
(153, 359, 297, 144, 87, 0, 245, 355, 217, 201, 93, 0), # 31
(156, 376, 305, 149, 90, 0, 259, 364, 222, 208, 100, 0), # 32
(168, 391, 322, 156, 92, 0, 268, 376, 229, 212, 101, 0), # 33
(177, 408, 330, 157, 94, 0, 278, 386, 236, 218, 103, 0), # 34
(185, 421, 334, 158, 95, 0, 286, 397, 243, 223, 106, 0), # 35
(192, 428, 347, 161, 101, 0, 292, 407, 249, 231, 108, 0), # 36
(195, 444, 356, 169, 101, 0, 298, 414, 258, 237, 111, 0), # 37
(203, 455, 363, 174, 105, 0, 304, 433, 265, 245, 114, 0), # 38
(211, 469, 369, 182, 107, 0, 308, 448, 272, 250, 116, 0), # 39
(214, 482, 375, 189, 108, 0, 313, 464, 280, 252, 119, 0), # 40
(217, 496, 382, 191, 110, 0, 325, 480, 285, 255, 121, 0), # 41
(224, 513, 388, 195, 114, 0, 330, 488, 289, 266, 122, 0), # 42
(235, 523, 401, 197, 117, 0, 335, 501, 297, 271, 126, 0), # 43
(244, 530, 406, 202, 119, 0, 342, 515, 303, 277, 128, 0), # 44
(255, 543, 414, 206, 123, 0, 344, 524, 314, 278, 130, 0), # 45
(259, 560, 422, 215, 124, 0, 356, 534, 322, 286, 130, 0), # 46
(263, 575, 432, 216, 125, 0, 363, 543, 331, 291, 134, 0), # 47
(269, 584, 442, 219, 132, 0, 370, 561, 336, 297, 136, 0), # 48
(271, 599, 457, 224, 136, 0, 376, 573, 342, 303, 138, 0), # 49
(276, 616, 468, 227, 141, 0, 380, 588, 347, 305, 141, 0), # 50
(279, 624, 475, 233, 146, 0, 387, 602, 352, 312, 147, 0), # 51
(281, 634, 482, 237, 151, 0, 396, 610, 360, 318, 150, 0), # 52
(286, 642, 493, 240, 154, 0, 403, 622, 367, 324, 153, 0), # 53
(292, 651, 503, 250, 157, 0, 413, 630, 376, 326, 156, 0), # 54
(293, 664, 511, 253, 162, 0, 421, 640, 381, 333, 160, 0), # 55
(300, 675, 517, 258, 163, 0, 428, 650, 389, 341, 165, 0), # 56
(304, 686, 525, 261, 165, 0, 435, 657, 397, 343, 168, 0), # 57
(308, 696, 539, 265, 165, 0, 443, 669, 403, 350, 170, 0), # 58
(308, 696, 539, 265, 165, 0, 443, 669, 403, 350, 170, 0), # 59
)
passenger_arriving_rate = (
(4.769372805092186, 9.786903409090908, 8.63377490359897, 4.56211956521739, 2.5714903846153843, 0.0, 8.562228260869567, 10.285961538461537, 6.843179347826086, 5.755849935732647, 2.446725852272727, 0.0), # 0
(4.81413961808604, 9.895739902146465, 8.680408780526994, 4.587526358695651, 2.5907639423076922, 0.0, 8.559309850543478, 10.363055769230769, 6.881289538043478, 5.786939187017995, 2.4739349755366162, 0.0), # 1
(4.8583952589991215, 10.00296202020202, 8.725935732647814, 4.612373913043478, 2.609630769230769, 0.0, 8.556302173913043, 10.438523076923076, 6.918560869565217, 5.817290488431875, 2.500740505050505, 0.0), # 2
(4.902102161984196, 10.1084540625, 8.770322501606683, 4.636641032608694, 2.628073557692308, 0.0, 8.553205638586958, 10.512294230769232, 6.954961548913042, 5.846881667737789, 2.527113515625, 0.0), # 3
(4.94522276119403, 10.212100328282828, 8.813535829048842, 4.66030652173913, 2.6460749999999997, 0.0, 8.550020652173911, 10.584299999999999, 6.990459782608696, 5.875690552699228, 2.553025082070707, 0.0), # 4
(4.987719490781387, 10.313785116792928, 8.855542456619537, 4.6833491847826085, 2.663617788461538, 0.0, 8.546747622282608, 10.654471153846153, 7.025023777173913, 5.90369497107969, 2.578446279198232, 0.0), # 5
(5.029554784899035, 10.413392727272727, 8.896309125964011, 4.705747826086957, 2.680684615384615, 0.0, 8.54338695652174, 10.72273846153846, 7.058621739130436, 5.930872750642674, 2.603348181818182, 0.0), # 6
(5.0706910776997365, 10.510807458964646, 8.935802578727506, 4.72748125, 2.697258173076923, 0.0, 8.5399390625, 10.789032692307693, 7.0912218750000005, 5.95720171915167, 2.6277018647411614, 0.0), # 7
(5.1110908033362605, 10.60591361111111, 8.97398955655527, 4.7485282608695645, 2.7133211538461537, 0.0, 8.536404347826087, 10.853284615384615, 7.122792391304347, 5.982659704370181, 2.6514784027777774, 0.0), # 8
(5.1507163959613695, 10.698595482954543, 9.010836801092546, 4.768867663043478, 2.7288562499999993, 0.0, 8.532783220108696, 10.915424999999997, 7.153301494565217, 6.007224534061697, 2.6746488707386358, 0.0), # 9
(5.1895302897278315, 10.788737373737373, 9.046311053984574, 4.7884782608695655, 2.743846153846154, 0.0, 8.529076086956522, 10.975384615384616, 7.182717391304348, 6.030874035989716, 2.697184343434343, 0.0), # 10
(5.227494918788412, 10.87622358270202, 9.080379056876605, 4.807338858695652, 2.7582735576923074, 0.0, 8.525283355978262, 11.03309423076923, 7.2110082880434785, 6.053586037917737, 2.719055895675505, 0.0), # 11
(5.2645727172958745, 10.960938409090907, 9.113007551413881, 4.825428260869565, 2.7721211538461534, 0.0, 8.521405434782608, 11.088484615384614, 7.238142391304347, 6.0753383676092545, 2.740234602272727, 0.0), # 12
(5.3007261194029835, 11.042766152146465, 9.144163279241644, 4.8427252717391305, 2.7853716346153847, 0.0, 8.51744273097826, 11.141486538461539, 7.264087907608696, 6.096108852827762, 2.760691538036616, 0.0), # 13
(5.335917559262511, 11.121591111111112, 9.173812982005138, 4.859208695652173, 2.7980076923076918, 0.0, 8.513395652173912, 11.192030769230767, 7.288813043478259, 6.115875321336759, 2.780397777777778, 0.0), # 14
(5.370109471027217, 11.19729758522727, 9.201923401349612, 4.874857336956521, 2.810012019230769, 0.0, 8.509264605978261, 11.240048076923076, 7.312286005434782, 6.134615600899742, 2.7993243963068175, 0.0), # 15
(5.403264288849868, 11.269769873737372, 9.228461278920308, 4.88965, 2.8213673076923076, 0.0, 8.50505, 11.28546923076923, 7.334474999999999, 6.152307519280206, 2.817442468434343, 0.0), # 16
(5.4353444468832315, 11.338892275883836, 9.253393356362468, 4.903565489130434, 2.83205625, 0.0, 8.500752241847827, 11.328225, 7.3553482336956515, 6.168928904241644, 2.834723068970959, 0.0), # 17
(5.46631237928007, 11.40454909090909, 9.276686375321336, 4.916582608695652, 2.842061538461539, 0.0, 8.496371739130435, 11.368246153846156, 7.374873913043479, 6.184457583547558, 2.8511372727272724, 0.0), # 18
(5.496130520193152, 11.466624618055553, 9.298307077442159, 4.928680163043477, 2.8513658653846155, 0.0, 8.491908899456522, 11.405463461538462, 7.393020244565217, 6.198871384961439, 2.866656154513888, 0.0), # 19
(5.524761303775241, 11.525003156565655, 9.318222204370178, 4.939836956521739, 2.859951923076923, 0.0, 8.487364130434782, 11.439807692307692, 7.409755434782609, 6.212148136246785, 2.8812507891414136, 0.0), # 20
(5.552167164179106, 11.579569005681815, 9.336398497750643, 4.95003179347826, 2.8678024038461536, 0.0, 8.482737839673913, 11.471209615384614, 7.425047690217391, 6.224265665167096, 2.894892251420454, 0.0), # 21
(5.578310535557506, 11.630206464646465, 9.352802699228791, 4.95924347826087, 2.8748999999999993, 0.0, 8.47803043478261, 11.499599999999997, 7.438865217391305, 6.235201799485861, 2.907551616161616, 0.0), # 22
(5.603153852063214, 11.67679983270202, 9.367401550449872, 4.967450815217391, 2.8812274038461534, 0.0, 8.473242323369567, 11.524909615384614, 7.451176222826087, 6.244934366966581, 2.919199958175505, 0.0), # 23
(5.62665954784899, 11.719233409090908, 9.380161793059125, 4.974632608695652, 2.8867673076923075, 0.0, 8.468373913043479, 11.54706923076923, 7.461948913043478, 6.25344119537275, 2.929808352272727, 0.0), # 24
(5.648790057067603, 11.757391493055556, 9.391050168701799, 4.980767663043478, 2.8915024038461534, 0.0, 8.463425611413044, 11.566009615384614, 7.471151494565217, 6.260700112467866, 2.939347873263889, 0.0), # 25
(5.669507813871817, 11.79115838383838, 9.400033419023135, 4.985834782608695, 2.8954153846153843, 0.0, 8.458397826086957, 11.581661538461537, 7.478752173913043, 6.266688946015424, 2.947789595959595, 0.0), # 26
(5.688775252414398, 11.820418380681815, 9.40707828566838, 4.989812771739131, 2.8984889423076923, 0.0, 8.453290964673915, 11.593955769230769, 7.484719157608696, 6.271385523778919, 2.9551045951704538, 0.0), # 27
(5.7065548068481124, 11.84505578282828, 9.412151510282778, 4.992680434782609, 2.9007057692307687, 0.0, 8.448105434782608, 11.602823076923075, 7.489020652173913, 6.274767673521851, 2.96126394570707, 0.0), # 28
(5.722808911325724, 11.864954889520202, 9.415219834511568, 4.994416576086956, 2.902048557692307, 0.0, 8.44284164402174, 11.608194230769229, 7.491624864130435, 6.276813223007712, 2.9662387223800506, 0.0), # 29
(5.7375, 11.879999999999999, 9.41625, 4.995, 2.9025, 0.0, 8.4375, 11.61, 7.4925, 6.277499999999999, 2.9699999999999998, 0.0), # 30
(5.751246651214834, 11.892497471590906, 9.415477744565216, 4.994894632352941, 2.9023357180851064, 0.0, 8.430077267616193, 11.609342872340426, 7.492341948529411, 6.276985163043476, 2.9731243678977264, 0.0), # 31
(5.7646965153452685, 11.904829772727274, 9.413182826086956, 4.994580588235293, 2.901846382978723, 0.0, 8.418644565217393, 11.607385531914892, 7.49187088235294, 6.275455217391303, 2.9762074431818184, 0.0), # 32
(5.777855634590792, 11.916995369318181, 9.40939801630435, 4.994060955882353, 2.9010372606382977, 0.0, 8.403313830584706, 11.60414904255319, 7.491091433823529, 6.272932010869566, 2.9792488423295453, 0.0), # 33
(5.790730051150895, 11.928992727272727, 9.40415608695652, 4.993338823529412, 2.899913617021276, 0.0, 8.38419700149925, 11.599654468085104, 7.490008235294118, 6.269437391304347, 2.9822481818181816, 0.0), # 34
(5.803325807225064, 11.940820312499996, 9.39748980978261, 4.9924172794117645, 2.898480718085106, 0.0, 8.361406015742128, 11.593922872340425, 7.488625919117647, 6.264993206521739, 2.985205078124999, 0.0), # 35
(5.815648945012788, 11.952476590909091, 9.389431956521738, 4.9912994117647065, 2.896743829787234, 0.0, 8.335052811094453, 11.586975319148936, 7.486949117647059, 6.259621304347825, 2.988119147727273, 0.0), # 36
(5.8277055067135555, 11.96396002840909, 9.380015298913044, 4.989988308823529, 2.8947082180851056, 0.0, 8.305249325337332, 11.578832872340422, 7.484982463235293, 6.253343532608695, 2.9909900071022726, 0.0), # 37
(5.839501534526853, 11.97526909090909, 9.369272608695653, 4.988487058823529, 2.89237914893617, 0.0, 8.272107496251873, 11.56951659574468, 7.4827305882352935, 6.246181739130434, 2.9938172727272727, 0.0), # 38
(5.851043070652174, 11.986402244318182, 9.357236657608695, 4.98679875, 2.8897618882978717, 0.0, 8.23573926161919, 11.559047553191487, 7.480198125, 6.23815777173913, 2.9966005610795454, 0.0), # 39
(5.862336157289003, 11.997357954545455, 9.343940217391305, 4.984926470588235, 2.886861702127659, 0.0, 8.196256559220389, 11.547446808510635, 7.477389705882353, 6.22929347826087, 2.999339488636364, 0.0), # 40
(5.873386836636828, 12.008134687499997, 9.329416059782607, 4.982873308823529, 2.8836838563829783, 0.0, 8.153771326836583, 11.534735425531913, 7.474309963235294, 6.219610706521738, 3.002033671874999, 0.0), # 41
(5.88420115089514, 12.01873090909091, 9.31369695652174, 4.980642352941176, 2.880233617021277, 0.0, 8.108395502248875, 11.520934468085107, 7.4709635294117644, 6.209131304347826, 3.0046827272727277, 0.0), # 42
(5.894785142263428, 12.02914508522727, 9.296815679347825, 4.978236691176471, 2.8765162499999994, 0.0, 8.060241023238381, 11.506064999999998, 7.467355036764706, 6.1978771195652165, 3.0072862713068176, 0.0), # 43
(5.905144852941176, 12.03937568181818, 9.278805, 4.975659411764705, 2.8725370212765955, 0.0, 8.009419827586207, 11.490148085106382, 7.4634891176470575, 6.1858699999999995, 3.009843920454545, 0.0), # 44
(5.915286325127877, 12.049421164772726, 9.259697690217394, 4.972913602941176, 2.8683011968085106, 0.0, 7.956043853073464, 11.473204787234042, 7.459370404411764, 6.1731317934782615, 3.0123552911931815, 0.0), # 45
(5.925215601023019, 12.059280000000001, 9.239526521739132, 4.970002352941176, 2.8638140425531913, 0.0, 7.90022503748126, 11.455256170212765, 7.455003529411765, 6.159684347826087, 3.0148200000000003, 0.0), # 46
(5.934938722826087, 12.06895065340909, 9.218324266304347, 4.966928749999999, 2.859080824468085, 0.0, 7.842075318590705, 11.43632329787234, 7.450393124999999, 6.145549510869564, 3.0172376633522724, 0.0), # 47
(5.944461732736574, 12.07843159090909, 9.196123695652174, 4.9636958823529405, 2.854106808510638, 0.0, 7.7817066341829095, 11.416427234042551, 7.445543823529412, 6.130749130434782, 3.0196078977272727, 0.0), # 48
(5.953790672953963, 12.087721278409088, 9.17295758152174, 4.960306838235294, 2.8488972606382976, 0.0, 7.71923092203898, 11.39558904255319, 7.4404602573529415, 6.115305054347826, 3.021930319602272, 0.0), # 49
(5.96293158567775, 12.096818181818177, 9.148858695652175, 4.956764705882353, 2.8434574468085105, 0.0, 7.65476011994003, 11.373829787234042, 7.43514705882353, 6.099239130434783, 3.0242045454545443, 0.0), # 50
(5.971890513107417, 12.105720767045453, 9.123859809782608, 4.953072573529411, 2.837792632978723, 0.0, 7.588406165667167, 11.351170531914892, 7.429608860294118, 6.082573206521738, 3.026430191761363, 0.0), # 51
(5.980673497442456, 12.114427499999998, 9.097993695652173, 4.949233529411764, 2.8319080851063827, 0.0, 7.5202809970015, 11.32763234042553, 7.4238502941176465, 6.065329130434781, 3.0286068749999995, 0.0), # 52
(5.989286580882353, 12.122936846590909, 9.071293125, 4.945250661764706, 2.8258090691489364, 0.0, 7.450496551724138, 11.303236276595745, 7.417875992647058, 6.04752875, 3.030734211647727, 0.0), # 53
(5.9977358056266, 12.13124727272727, 9.043790869565216, 4.941127058823529, 2.8195008510638297, 0.0, 7.379164767616192, 11.278003404255319, 7.411690588235294, 6.0291939130434775, 3.0328118181818176, 0.0), # 54
(6.00602721387468, 12.139357244318182, 9.015519701086955, 4.93686580882353, 2.8129886968085103, 0.0, 7.306397582458771, 11.251954787234041, 7.405298713235295, 6.010346467391304, 3.0348393110795455, 0.0), # 55
(6.014166847826087, 12.147265227272724, 8.986512391304348, 4.9324699999999995, 2.8062778723404254, 0.0, 7.232306934032984, 11.225111489361701, 7.398705, 5.991008260869565, 3.036816306818181, 0.0), # 56
(6.022160749680308, 12.154969687500001, 8.95680171195652, 4.927942720588234, 2.7993736436170207, 0.0, 7.15700476011994, 11.197494574468083, 7.391914080882352, 5.9712011413043475, 3.0387424218750003, 0.0), # 57
(6.030014961636829, 12.16246909090909, 8.926420434782608, 4.923287058823529, 2.792281276595744, 0.0, 7.0806029985007495, 11.169125106382976, 7.384930588235295, 5.950946956521738, 3.0406172727272724, 0.0), # 58
(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0), # 59
)
passenger_allighting_rate = (
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 0
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 1
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 2
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 3
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 4
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 5
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 6
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 7
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 8
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 9
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 10
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 11
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 12
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 13
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 14
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 15
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 16
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 17
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 18
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 19
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 20
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 21
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 22
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 23
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 24
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 25
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 26
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 27
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 28
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 29
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 30
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 31
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 32
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 33
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 34
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 35
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 36
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 37
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 38
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 39
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 40
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 41
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 42
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 43
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 44
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 45
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 46
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 47
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 48
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 49
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 50
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 51
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 52
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 53
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 54
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 55
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 56
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 57
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 58
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 59
)
"""
parameters for reproducibiliy. More information: https://numpy.org/doc/stable/reference/random/parallel.html
"""
#initial entropy
entropy = 258194110137029475889902652135037600173
#index for seed sequence child
child_seed_index = (
1, # 0
45, # 1
)
| 113.438806 | 213 | 0.729909 | 5,147 | 38,002 | 5.387022 | 0.238003 | 0.31161 | 0.246691 | 0.467414 | 0.327767 | 0.326613 | 0.326613 | 0.326613 | 0.326613 | 0.326613 | 0 | 0.819637 | 0.118783 | 38,002 | 334 | 214 | 113.778443 | 0.008331 | 0.031867 | 0 | 0.202532 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.015823 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6 |
38a64b83886170174ec731ae22711357bdba13d4 | 11,596 | py | Python | hypercane/actions/score.py | ato/hypercane | 290ef402006ee8f8d98090e31da52819e26145a0 | [
"MIT"
] | 2 | 2020-06-11T18:42:02.000Z | 2020-10-06T21:17:15.000Z | hypercane/actions/score.py | ato/hypercane | 290ef402006ee8f8d98090e31da52819e26145a0 | [
"MIT"
] | 55 | 2020-06-01T00:23:00.000Z | 2022-02-21T20:52:29.000Z | hypercane/actions/score.py | ato/hypercane | 290ef402006ee8f8d98090e31da52819e26145a0 | [
"MIT"
] | 3 | 2021-02-07T05:36:24.000Z | 2021-12-17T05:45:14.000Z | import logging
module_logger = logging.getLogger("hypercane.actions.score")
def score_by_top_entities_and_bm25(args):
from hypercane.utils import get_web_session, save_resource_data
from hypercane.identify import discover_resource_data_by_input_type, \
discover_mementos_by_input_type
from hypercane.score.bm25 import bm25_by_entites
# TODO: make this configurable
default_entity_types = ['PERSON', 'NORP', 'FAC', 'ORG', 'GPE', 'LOC', 'PRODUCT', 'EVENT', 'WORK_OF_ART', 'LAW']
output_type = 'mementos'
session = get_web_session(cache_storage=args.cache_storage)
module_logger.info("Beginning the scoring by BM25")
urimdata = discover_resource_data_by_input_type(
args.input_type, output_type, args.input_arguments, args.crawl_depth,
session, discover_mementos_by_input_type
)
urimdata = bm25_by_entites(
urimdata, session, args.cache_storage, args.k, default_entity_types
)
save_resource_data(args.output_filename, urimdata, 'mementos', list(urimdata.keys()))
module_logger.info("Finished scoring by BM25, output is at {}".format(args.output_filename))
def bm25_ranking(args):
from hypercane.utils import get_web_session, save_resource_data
from hypercane.identify import discover_resource_data_by_input_type, \
discover_mementos_by_input_type
from hypercane.score.bm25 import rank_by_bm25
output_type = 'mementos'
session = get_web_session(cache_storage=args.cache_storage)
module_logger.info("Beginning the scoring by BM25")
urimdata = discover_resource_data_by_input_type(
args.input_type, output_type, args.input_arguments, args.crawl_depth,
session, discover_mementos_by_input_type
)
urimdata = rank_by_bm25(
urimdata, session, args.query, args.cache_storage
)
save_resource_data(args.output_filename, urimdata, 'mementos', list(urimdata.keys()))
module_logger.info("Finished scoring by BM25, output is at {}".format(args.output_filename))
def dsa1_scoring(args):
from hypercane.utils import get_web_session, save_resource_data
from hypercane.identify import discover_resource_data_by_input_type, \
discover_mementos_by_input_type
from hypercane.score.dsa1_score import rank_by_dsa1_score
output_type = 'mementos'
session = get_web_session(cache_storage=args.cache_storage)
module_logger.info("Beginning the scoring by DSA1 scoring equation")
if args.input_type == "mementos":
urimdata = discover_resource_data_by_input_type(
args.input_type, output_type, args.input_arguments, args.crawl_depth,
session, discover_mementos_by_input_type
)
else:
# TODO: derive URI-Ms from input type
raise NotImplementedError("Input type of {} not yet supported for scoring".format(
args.input_type))
urimdata = rank_by_dsa1_score(
urimdata, session,
memento_damage_url=args.memento_damage_url,
damage_weight=float(args.damage_weight),
category_weight=float(args.category_weight),
path_depth_weight=float(args.path_depth_weight)
)
save_resource_data(args.output_filename, urimdata, 'mementos', list(urimdata.keys()))
module_logger.info("Finished ranking by DSA1 scoring equation, output is at {}".format(args.output_filename))
def dsa2_scoring(args):
from hypercane.utils import get_web_session, save_resource_data
from hypercane.identify import discover_resource_data_by_input_type, \
discover_mementos_by_input_type
from hypercane.score.dsa2_score import score_by_dsa2_score
output_type = 'mementos'
session = get_web_session(cache_storage=args.cache_storage)
module_logger.info("Beginning the scoring by DSA2 scoring equation")
if args.input_type == "mementos":
urimdata = discover_resource_data_by_input_type(
args.input_type, output_type, args.input_arguments, args.crawl_depth,
session, discover_mementos_by_input_type
)
else:
# TODO: derive URI-Ms from input type
raise NotImplementedError("Input type of {} not yet supported for scoring".format(
args.input_type))
urimdata = score_by_dsa2_score(
urimdata, args.cache_storage,
card_weight=float(args.card_weight),
size_weight=float(args.size_weight),
image_count_weight=float(args.image_count_weight)
)
save_resource_data(args.output_filename, urimdata, 'mementos', list(urimdata.keys()))
module_logger.info("Finished ranking by DSA2 scoring equation, output is at {}".format(args.output_filename))
def image_count_scoring(args):
from hypercane.utils import get_web_session, save_resource_data
from hypercane.identify import discover_resource_data_by_input_type, \
discover_mementos_by_input_type
from hypercane.score.image_count import score_by_image_count
output_type = 'mementos'
session = get_web_session(cache_storage=args.cache_storage)
module_logger.info("Beginning the scoring by image count")
if args.input_type == "mementos":
urimdata = discover_resource_data_by_input_type(
args.input_type, output_type, args.input_arguments, args.crawl_depth,
session, discover_mementos_by_input_type
)
else:
# TODO: derive URI-Ms from input type
raise NotImplementedError("Input type of {} not yet supported for scoring".format(
args.input_type))
module_logger.info("using session {}".format(session))
module_logger.info("using cache storage: {}".format(args.cache_storage))
urimdata = score_by_image_count(
urimdata, session
)
save_resource_data(args.output_filename, urimdata, 'mementos', list(urimdata.keys()))
module_logger.info("Finished scoring by image count, output is at {}".format(args.output_filename))
def simple_card_scoring(args):
from hypercane.utils import get_web_session, save_resource_data
from hypercane.identify import discover_resource_data_by_input_type, \
discover_mementos_by_input_type
from hypercane.score.card_score import compute_simple_card_scores
output_type = 'mementos'
session = get_web_session(cache_storage=args.cache_storage)
module_logger.info("Beginning the scoring by image count")
urimdata = discover_resource_data_by_input_type(
args.input_type, output_type, args.input_arguments, args.crawl_depth,
session, discover_mementos_by_input_type
)
module_logger.info("using session {}".format(session))
module_logger.info("using cache storage: {}".format(args.cache_storage))
urimdata = compute_simple_card_scores(urimdata, session)
save_resource_data(args.output_filename, urimdata, 'mementos', list(urimdata.keys()))
module_logger.info("Finished scoring by card-score, output is at {}".format(args.output_filename))
def path_depth_scoring(args):
from hypercane.utils import get_web_session, save_resource_data
from hypercane.identify import discover_resource_data_by_input_type, \
discover_mementos_by_input_type
from hypercane.score.dsa1_score import score_by_path_depth
output_type = 'mementos'
session = get_web_session(cache_storage=args.cache_storage)
module_logger.info("Beginning the scoring by DSA1 scoring equation")
urimdata = discover_resource_data_by_input_type(
args.input_type, output_type, args.input_arguments, args.crawl_depth,
session, discover_mementos_by_input_type
)
urimdata = score_by_path_depth(
urimdata, session
)
save_resource_data(args.output_filename, urimdata, 'mementos', list(urimdata.keys()))
module_logger.info("Finished ranking by path depth, output is at {}".format(args.output_filename))
def category_scoring(args):
from hypercane.utils import get_web_session, save_resource_data
from hypercane.identify import discover_resource_data_by_input_type, \
discover_mementos_by_input_type
from hypercane.score.dsa1_score import score_by_category
output_type = 'mementos'
session = get_web_session(cache_storage=args.cache_storage)
module_logger.info("Beginning the scoring by URL category equation")
urimdata = discover_resource_data_by_input_type(
args.input_type, output_type, args.input_arguments, args.crawl_depth,
session, discover_mementos_by_input_type
)
urimdata = score_by_category(
urimdata, session
)
save_resource_data(args.output_filename, urimdata, 'mementos', list(urimdata.keys()))
module_logger.info("Finished scoring by URL category, output is at {}".format(args.output_filename))
def score_by_distance_from_centroid(args):
from hypercane.utils import get_web_session, save_resource_data
from hypercane.identify import discover_resource_data_by_input_type, \
discover_mementos_by_input_type
from hypercane.score.distance_from_centroid import compute_distance_from_centroid
# TODO: an ignore outliers option to run DBSCAN instead of kmeans
output_type = 'mementos'
session = get_web_session(cache_storage=args.cache_storage)
module_logger.info("Beginning the scoring by distance from centroid category equation")
urimdata = discover_resource_data_by_input_type(
args.input_type, output_type, args.input_arguments, args.crawl_depth,
session, discover_mementos_by_input_type
)
urimdata = compute_distance_from_centroid(urimdata, args.cache_storage, more_similar=args.more_similar)
save_resource_data(args.output_filename, urimdata, 'mementos', list(urimdata.keys()))
module_logger.info("Finished scoring by cluster distance, output is at {}".format(args.output_filename))
def score_by_size(args):
from hypercane.utils import get_web_session, save_resource_data
from hypercane.identify import discover_resource_data_by_input_type, \
discover_mementos_by_input_type
from hypercane.score.document_size import compute_boilerplate_free_character_size, \
compute_character_size
output_type = 'mementos'
session = get_web_session(cache_storage=args.cache_storage)
module_logger.info("Beginning the scoring by mementy by size with feature {}".format(args.feature))
urimdata = discover_resource_data_by_input_type(
args.input_type, output_type, args.input_arguments, args.crawl_depth,
session, discover_mementos_by_input_type
)
if args.feature == 'bytes':
urimdata = compute_character_size(urimdata, args.cache_storage, bytes=True)
elif args.feature == 'characters':
urimdata = compute_character_size(urimdata, args.cache_storage, bytes=False)
elif args.feature == 'boilerplate-free-characters':
urimdata = compute_boilerplate_free_character_size(urimdata, args.cache_storage, unit='characters')
elif args.feature == 'words':
urimdata = compute_boilerplate_free_character_size(urimdata, args.cache_storage, unit='words')
elif args.feature == 'sentences':
urimdata = compute_boilerplate_free_character_size(urimdata, args.cache_storage, unit='sentences')
else:
raise NotImplementedError("Feature '{}' not yet implemented with this score".format(args.feature))
save_resource_data(args.output_filename, urimdata, 'mementos', list(urimdata.keys()))
module_logger.info("Finished scoring by size with feature {}, output is at {}".format(args.feature, args.output_filename))
| 35.353659 | 126 | 0.749914 | 1,499 | 11,596 | 5.454303 | 0.086057 | 0.068249 | 0.053816 | 0.053816 | 0.81727 | 0.808219 | 0.808219 | 0.808219 | 0.794643 | 0.7807 | 0 | 0.004056 | 0.170749 | 11,596 | 327 | 127 | 35.461774 | 0.846194 | 0.017247 | 0 | 0.584158 | 0 | 0 | 0.134592 | 0.00439 | 0 | 0 | 0 | 0.003058 | 0 | 1 | 0.049505 | false | 0 | 0.153465 | 0 | 0.20297 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6 |
38bc59f1c5845ce7195e366a3cd0c6be524a9cee | 84 | py | Python | tests/test_int_op_int.py | mary3000/rubymine-is2018 | 674b6ea4cb0d050c39425f206cbe1b338c5f0190 | [
"Apache-2.0"
] | null | null | null | tests/test_int_op_int.py | mary3000/rubymine-is2018 | 674b6ea4cb0d050c39425f206cbe1b338c5f0190 | [
"Apache-2.0"
] | null | null | null | tests/test_int_op_int.py | mary3000/rubymine-is2018 | 674b6ea4cb0d050c39425f206cbe1b338c5f0190 | [
"Apache-2.0"
] | null | null | null | if 5 == 5:
pass
if 3 < 10:
pass
if 5 > -1:
pass
if 3 == 2:
pass
| 6.461538 | 10 | 0.392857 | 16 | 84 | 2.0625 | 0.4375 | 0.545455 | 0.424242 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.204545 | 0.47619 | 84 | 12 | 11 | 7 | 0.545455 | 0 | 0 | 0.5 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0.5 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 6 |
38d11a2eaa75baa4bbd579c56ffb92e1aed22565 | 81 | py | Python | tests/testapp/circular_import_new/models.py | dwx9/test | a74e38369de40b9e5f481f6ac9dda6d5eb161da0 | [
"BSD-3-Clause"
] | 1 | 2021-02-11T10:01:11.000Z | 2021-02-11T10:01:11.000Z | tests/testapp/circular_import_new/models.py | bmihelac/django-shop | 1bf58d013c8cb14090a8d0278878e279699c84aa | [
"BSD-3-Clause"
] | null | null | null | tests/testapp/circular_import_new/models.py | bmihelac/django-shop | 1bf58d013c8cb14090a8d0278878e279699c84aa | [
"BSD-3-Clause"
] | 1 | 2020-11-08T17:56:45.000Z | 2020-11-08T17:56:45.000Z | from shop.models_bases import BaseProduct
class MyProduct(BaseProduct):
pass
| 20.25 | 41 | 0.814815 | 10 | 81 | 6.5 | 0.9 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.135802 | 81 | 3 | 42 | 27 | 0.928571 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0.333333 | 0.333333 | 0 | 0.666667 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 1 | 0 | 0 | 6 |
2a1b554fbd4659db0f48d40d077657b8b3336e9f | 4,240 | py | Python | parchments/test/test_period.py | idlelosthobo/parchment | 99cebb8bed439c04be3e7e4f6869a4e3f85f6047 | [
"MIT"
] | null | null | null | parchments/test/test_period.py | idlelosthobo/parchment | 99cebb8bed439c04be3e7e4f6869a4e3f85f6047 | [
"MIT"
] | 4 | 2021-02-16T15:35:39.000Z | 2021-04-09T19:19:35.000Z | parchments/test/test_period.py | idlelosthobo/parchments | 99cebb8bed439c04be3e7e4f6869a4e3f85f6047 | [
"MIT"
] | null | null | null | import unittest
import parchments
import datetime
import calendar
TEST_INDEX = (
('goats', 'int', 0),
('price', 'dollar', 2),
('value', 'percentage', 4),
('names', 'string', 0),
('animal', 'bool', 0),
)
PERIOD_DATA = [
200,
3000.00,
0.7500,
'goaty mc goaterson',
True,
]
OTHER_PERIOD_DATA = [
300,
4000.00,
0.5500,
'douglas bahhhhh',
True,
]
MORE_PERIOD_DATA = [
100,
2000.00,
0.6500,
'waaaaaaaaah sheep licker',
False,
]
class TestPeriod(unittest.TestCase):
def test_previous_period_year_iteration(self):
period_test_grid = parchments.Grid(TEST_INDEX, period_iteration='year')
period_test_grid.add_period(datetime.datetime(2020, 4, 1), PERIOD_DATA)
self.assertTrue(period_test_grid.period_index[0].previous_period.key == '20190101')
def test_next_period_year_iteration(self):
period_test_grid = parchments.Grid(TEST_INDEX, period_iteration='year')
period_test_grid.add_period(datetime.datetime(2020, 4, 1), PERIOD_DATA)
self.assertTrue(period_test_grid.period_index[0].next_period.key == '20210101')
def test_previous_period_month_iteration(self):
period_test_grid = parchments.Grid(TEST_INDEX, period_iteration='month')
period_test_grid.add_period(datetime.datetime(2020, 4, 1), PERIOD_DATA)
self.assertTrue(period_test_grid.period_index[0].previous_period.key == '20200301')
def test_previous_period_year_roll_over_month_iteration(self):
period_test_grid = parchments.Grid(TEST_INDEX, period_iteration='month')
period_test_grid.add_period(datetime.datetime(2020, 1, 1), PERIOD_DATA)
self.assertTrue(period_test_grid.period_index[0].previous_period.key == '20191201')
def test_next_period_month_iteration(self):
period_test_grid = parchments.Grid(TEST_INDEX, period_iteration='month')
period_test_grid.add_period(datetime.datetime(2020, 4, 1), PERIOD_DATA)
self.assertTrue(period_test_grid.period_index[0].next_period.key == '20200501')
def test_next_period_year_roll_over_month_iteration(self):
period_test_grid = parchments.Grid(TEST_INDEX, period_iteration='month')
period_test_grid.add_period(datetime.datetime(2020, 12, 1), PERIOD_DATA)
self.assertTrue(period_test_grid.period_index[0].next_period.key == '20210101')
def test_previous_period_day_iteration(self):
period_test_grid = parchments.Grid(TEST_INDEX, period_iteration='day')
period_test_grid.add_period(datetime.datetime(2020, 4, 10), PERIOD_DATA)
self.assertTrue(period_test_grid.period_index[0].previous_period.key == '20200409')
def test_previous_period_month_roll_over_day_iteration(self):
period_test_grid = parchments.Grid(TEST_INDEX, period_iteration='day')
period_test_grid.add_period(datetime.datetime(2020, 4, 1), PERIOD_DATA)
self.assertTrue(period_test_grid.period_index[0].previous_period.key == '20200331')
def test_previous_period_year_roll_over_day_iteration(self):
period_test_grid = parchments.Grid(TEST_INDEX, period_iteration='day')
period_test_grid.add_period(datetime.datetime(2020, 1, 1), PERIOD_DATA)
self.assertTrue(period_test_grid.period_index[0].previous_period.key == '20191231')
def test_next_period_day_iteration(self):
period_test_grid = parchments.Grid(TEST_INDEX, period_iteration='day')
period_test_grid.add_period(datetime.datetime(2020, 4, 10), PERIOD_DATA)
self.assertTrue(period_test_grid.period_index[0].next_period.key == '20200411')
def test_next_period_month_roll_over_day_iteration(self):
period_test_grid = parchments.Grid(TEST_INDEX, period_iteration='day')
period_test_grid.add_period(datetime.datetime(2020, 4, 30), PERIOD_DATA)
self.assertTrue(period_test_grid.period_index[0].next_period.key == '20200501')
def test_next_period_year_roll_over_day_iteration(self):
period_test_grid = parchments.Grid(TEST_INDEX, period_iteration='day')
period_test_grid.add_period(datetime.datetime(2020, 12, 31), PERIOD_DATA)
self.assertTrue(period_test_grid.period_index[0].next_period.key == '20210101')
| 41.980198 | 91 | 0.734906 | 573 | 4,240 | 5.061082 | 0.132635 | 0.124138 | 0.173793 | 0.095172 | 0.87069 | 0.848966 | 0.848966 | 0.838621 | 0.838621 | 0.837241 | 0 | 0.064939 | 0.153774 | 4,240 | 100 | 92 | 42.4 | 0.743311 | 0 | 0 | 0.345679 | 0 | 0 | 0.05992 | 0 | 0 | 0 | 0 | 0 | 0.148148 | 1 | 0.148148 | false | 0 | 0.049383 | 0 | 0.209877 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6 |
2a2151fc4e863868950b3057555bbfc5cb7a3c66 | 104 | py | Python | Backend/views.py | abahernest/ElectionResultsChecker | 4cf75b3f7fb735a8695e1e6505f3891750f2e527 | [
"Apache-2.0"
] | 1 | 2020-07-11T02:18:36.000Z | 2020-07-11T02:18:36.000Z | Backend/views.py | abahernest/ElectionResultsChecker | 4cf75b3f7fb735a8695e1e6505f3891750f2e527 | [
"Apache-2.0"
] | 5 | 2021-03-30T13:52:33.000Z | 2021-09-22T19:13:56.000Z | Backend/views.py | abahernest/ElectionResultsChecker | 4cf75b3f7fb735a8695e1e6505f3891750f2e527 | [
"Apache-2.0"
] | null | null | null | from django.shortcuts import render
def HomeViews (request):
return render(request,'index.html')
| 14.857143 | 39 | 0.75 | 13 | 104 | 6 | 0.846154 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.153846 | 104 | 6 | 40 | 17.333333 | 0.886364 | 0 | 0 | 0 | 0 | 0 | 0.097087 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.333333 | false | 0 | 0.333333 | 0.333333 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 6 |
2a7018436bee71dd4512d637973ffde8739d644d | 32 | py | Python | module/gui/__init__.py | Appnet1337/OSINT-SAN | 8379c31eac598d0aff9d15ba74645800aa1352f4 | [
"BSD-2-Clause"
] | 313 | 2020-12-30T10:18:45.000Z | 2022-03-23T21:11:05.000Z | module/gui/__init__.py | ttt888ttt/OSINT-SAN | 6be6f859a3c689f1ab62807a171ee78a2dcc17af | [
"BSD-2-Clause"
] | 18 | 2020-12-18T18:19:09.000Z | 2022-03-30T11:44:57.000Z | module/gui/__init__.py | ttt888ttt/OSINT-SAN | 6be6f859a3c689f1ab62807a171ee78a2dcc17af | [
"BSD-2-Clause"
] | 65 | 2021-01-16T13:42:04.000Z | 2022-03-25T12:50:27.000Z | from .gui import main as run_gui | 32 | 32 | 0.8125 | 7 | 32 | 3.571429 | 0.857143 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.15625 | 32 | 1 | 32 | 32 | 0.925926 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 6 |
aa4f4f775b7b88df56c9149fb64726c4707ab501 | 120 | py | Python | resources/mgltools_x86_64Linux2_1.5.6/MGLToolsPckgs/opengltk/OpenGL/GL.py | J-E-J-S/aaRS-Pipeline | 43f59f28ab06e4b16328c3bc405cdddc6e69ac44 | [
"MIT"
] | 8 | 2021-12-14T21:30:01.000Z | 2022-02-14T11:30:03.000Z | resources/mgltools_x86_64Linux2_1.5.6/MGLToolsPckgs/opengltk/OpenGL/GL.py | J-E-J-S/aaRS-Pipeline | 43f59f28ab06e4b16328c3bc405cdddc6e69ac44 | [
"MIT"
] | null | null | null | resources/mgltools_x86_64Linux2_1.5.6/MGLToolsPckgs/opengltk/OpenGL/GL.py | J-E-J-S/aaRS-Pipeline | 43f59f28ab06e4b16328c3bc405cdddc6e69ac44 | [
"MIT"
] | null | null | null | #
# copyright_notice
#
"""GL module
"""
from opengltk.extent._gllib import *
from opengltk.wrapper.gl_wrapper import *
| 13.333333 | 41 | 0.741667 | 15 | 120 | 5.733333 | 0.666667 | 0.27907 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.133333 | 120 | 8 | 42 | 15 | 0.826923 | 0.225 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 6 |
aa88928bb93b50ba721ac333726d1b04d836641d | 78 | py | Python | slurmlint/__init__.py | appeltel/slurmlint | f135d5ff3af2932c387e899d3e8f4f307e0aebba | [
"MIT"
] | 1 | 2021-09-01T20:35:15.000Z | 2021-09-01T20:35:15.000Z | slurmlint/__init__.py | appeltel/slurmlint | f135d5ff3af2932c387e899d3e8f4f307e0aebba | [
"MIT"
] | null | null | null | slurmlint/__init__.py | appeltel/slurmlint | f135d5ff3af2932c387e899d3e8f4f307e0aebba | [
"MIT"
] | null | null | null | from slurmlint.linter import lint
from slurmlint.hosts import expand_hostlist
| 26 | 43 | 0.871795 | 11 | 78 | 6.090909 | 0.727273 | 0.38806 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.102564 | 78 | 2 | 44 | 39 | 0.957143 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 6 |
aa909019a67a442afcb9ad97c1c19301995dd73f | 33 | py | Python | src/boykovKolmogorov.py | anishLearnsToCode/image-segmentation | 988a82592b6dc4496d73e21d9c0b44aa128d76f7 | [
"MIT"
] | 1 | 2020-08-31T08:30:28.000Z | 2020-08-31T08:30:28.000Z | src/boykovKolmogorov.py | anishLearnsToCode/image-segmentation | 988a82592b6dc4496d73e21d9c0b44aa128d76f7 | [
"MIT"
] | null | null | null | src/boykovKolmogorov.py | anishLearnsToCode/image-segmentation | 988a82592b6dc4496d73e21d9c0b44aa128d76f7 | [
"MIT"
] | 1 | 2020-11-01T00:45:46.000Z | 2020-11-01T00:45:46.000Z | def boykovKolmogorov():
pass
| 11 | 23 | 0.69697 | 3 | 33 | 7.666667 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.212121 | 33 | 2 | 24 | 16.5 | 0.884615 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.5 | true | 0.5 | 0 | 0 | 0.5 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 6 |
aa9ce94ca90bdf240da2ecbd79c8f6408336d631 | 32 | py | Python | mk_2/app/src/interfaz/__init__.py | josemanuel179/practica3IA | d5a947fd9523100497e7bfb026c75c0792ba1149 | [
"Apache-2.0"
] | null | null | null | mk_2/app/src/interfaz/__init__.py | josemanuel179/practica3IA | d5a947fd9523100497e7bfb026c75c0792ba1149 | [
"Apache-2.0"
] | null | null | null | mk_2/app/src/interfaz/__init__.py | josemanuel179/practica3IA | d5a947fd9523100497e7bfb026c75c0792ba1149 | [
"Apache-2.0"
] | 1 | 2020-12-14T20:24:06.000Z | 2020-12-14T20:24:06.000Z | from .interfaz import Interfaz
| 10.666667 | 30 | 0.8125 | 4 | 32 | 6.5 | 0.75 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.15625 | 32 | 2 | 31 | 16 | 0.962963 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 6 |
aaaac9f5bb7651bd14e3980ef5c945ebccdffeb2 | 868 | py | Python | Graphers/GraphFuncs.py | SirCraftinator/Stock-Trading-Bot | 66156a3bac719d94bf9e917ebca9c127fed04994 | [
"MIT"
] | 1 | 2021-06-14T03:57:29.000Z | 2021-06-14T03:57:29.000Z | Graphers/GraphFuncs.py | SirCraftinator/Stock-Trading-Bot | 66156a3bac719d94bf9e917ebca9c127fed04994 | [
"MIT"
] | null | null | null | Graphers/GraphFuncs.py | SirCraftinator/Stock-Trading-Bot | 66156a3bac719d94bf9e917ebca9c127fed04994 | [
"MIT"
] | null | null | null | def average(lst):
total = 0
for l in lst:
total += l
return total/len(lst)
def CleanList(lst):
lst2 = []
for item in lst:
if item in lst2:
lst2.append(item)
lst = lst2
def isSupport(df,i,layers,stat):
lst = []
stat = df[stat]
'''
for x in range(1,layers+1):
lst.append(stat[i-(x-1)] < stat[i-x])
lst.append(stat[i+(x-1)] < stat[i+x])
'''
#'''
for x in range(1,layers+1):
lst.append(stat[i] < stat[i-x])
lst.append(stat[i] < stat[i+x])
#'''
return sum(lst) == layers*2
def isResistance(df,i,layers,stat):
lst = []
stat = df[stat]
'''
for x in range(1,layers+1):
lst.append(stat[i-(x-1)] > stat[i-x])
lst.append(stat[i+(x-1)] > stat[i+x])
'''
#'''
for x in range(1,layers+1):
lst.append(stat[i] > stat[i-x])
lst.append(stat[i] > stat[i+x])
#'''
return sum(lst) == layers*2
| 20.186047 | 41 | 0.548387 | 154 | 868 | 3.090909 | 0.168831 | 0.168067 | 0.151261 | 0.235294 | 0.701681 | 0.701681 | 0.701681 | 0.701681 | 0.701681 | 0.701681 | 0 | 0.028443 | 0.230415 | 868 | 42 | 42 | 20.666667 | 0.684132 | 0.013825 | 0 | 0.32 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.16 | false | 0 | 0 | 0 | 0.28 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6 |
2af36a8e8f34f681f712c84ee7650c50fdc3f6a0 | 109 | py | Python | segmentation_models_pytorch/utils/__init__.py | Olimon660/segmentation_models.pytorch | 28f9d56cc5bb61b33432b6fd038d13161da9ea6b | [
"MIT"
] | null | null | null | segmentation_models_pytorch/utils/__init__.py | Olimon660/segmentation_models.pytorch | 28f9d56cc5bb61b33432b6fd038d13161da9ea6b | [
"MIT"
] | null | null | null | segmentation_models_pytorch/utils/__init__.py | Olimon660/segmentation_models.pytorch | 28f9d56cc5bb61b33432b6fd038d13161da9ea6b | [
"MIT"
] | null | null | null | from . import train
from . import losses
from . import metrics
from . import adamw
from . import lr_scheduler | 21.8 | 26 | 0.779817 | 16 | 109 | 5.25 | 0.5 | 0.595238 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.174312 | 109 | 5 | 26 | 21.8 | 0.933333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 6 |
63054d6d7289ac097b286cfb24ae7ea89afedbe6 | 103 | py | Python | terrafirma/planner/views.py | AlexandraAlter/django-terrafirma | afce5946f173aded2b4bfea78cf1b1034ec32272 | [
"MIT"
] | null | null | null | terrafirma/planner/views.py | AlexandraAlter/django-terrafirma | afce5946f173aded2b4bfea78cf1b1034ec32272 | [
"MIT"
] | null | null | null | terrafirma/planner/views.py | AlexandraAlter/django-terrafirma | afce5946f173aded2b4bfea78cf1b1034ec32272 | [
"MIT"
] | null | null | null | from django.shortcuts import render
from django import views
class PlannerView(views.View):
pass
| 14.714286 | 35 | 0.786408 | 14 | 103 | 5.785714 | 0.714286 | 0.246914 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.165049 | 103 | 6 | 36 | 17.166667 | 0.94186 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0.25 | 0.5 | 0 | 0.75 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 6 |
2d7acdf0f1261cd7ff03aa6b54cd7ca927203df5 | 111 | py | Python | crawlers/__init__.py | veken1199/CityLibraries | f1097c7b081acdd74f35c7aa04e2fed2ecb16e85 | [
"MIT"
] | null | null | null | crawlers/__init__.py | veken1199/CityLibraries | f1097c7b081acdd74f35c7aa04e2fed2ecb16e85 | [
"MIT"
] | 8 | 2019-02-13T03:42:19.000Z | 2022-02-17T19:18:49.000Z | crawlers/__init__.py | veken1199/CityLibraries | f1097c7b081acdd74f35c7aa04e2fed2ecb16e85 | [
"MIT"
] | null | null | null | from crawlers.MTL import concordia_crawler, udm_crawler, uqam_crawler
from crawlers.crawler_registery import *
| 37 | 69 | 0.864865 | 15 | 111 | 6.133333 | 0.6 | 0.26087 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.09009 | 111 | 2 | 70 | 55.5 | 0.910891 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 6 |
2dd88760d8a6697f9bb538e09ffda88a6e25412f | 16,093 | py | Python | chan/solid.py | danielliulihua/chan | fbb64f975c98888e4b55e7f32db0f10100a33845 | [
"MIT"
] | null | null | null | chan/solid.py | danielliulihua/chan | fbb64f975c98888e4b55e7f32db0f10100a33845 | [
"MIT"
] | null | null | null | chan/solid.py | danielliulihua/chan | fbb64f975c98888e4b55e7f32db0f10100a33845 | [
"MIT"
] | null | null | null | # coding: utf-8
import pandas as pd
import traceback
from .ta import macd
from .analyze import is_bei_chi, KlineAnalyze, down_zs_number, up_zs_number
def __in_tolerance(base_price, latest_price, tolerance=0.03):
"""判断 latest_price 是否在 base_price 的容差范围内"""
if (1 - tolerance) * base_price <= latest_price <= (1 + tolerance) * base_price:
return True
else:
return False
def __get_sub_xds(ka, ka1):
"""根据上级别线段标记获取本级别最后一个走势的线段"""
xds_l = [x for x in ka.xd if x['dt'] <= ka1.xd[-1]['dt']]
xds_r = [x for x in ka.xd if x['dt'] > ka1.xd[-1]['dt']]
if not xds_r:
xds = [xds_l[-1]]
return xds
if xds_r[0]['fx_mark'] != ka1.xd[-1]['fx_mark'] and len(xds_l) > 0:
xds = [xds_l[-1]] + xds_r
else:
xds = xds_r
return xds
def is_macd_cross(ka, direction="up"):
"""判断macd的向上金叉、向下死叉"""
df = pd.DataFrame(ka.kline)
df = macd(df)
if (direction == "up" and df.iloc[-1]['diff'] > df.iloc[-1]['dea']) \
or (direction == "down" and df.iloc[-1]['diff'] < df.iloc[-1]['dea']):
return True
return False
def is_first_buy(ka, ka1, ka2=None, tolerance=0.03):
"""确定某一级别一买
注意:如果本级别上一级别的 ka 不存在,默认返回 False !!!
:param ka: KlineAnalyze
本级别
:param ka1: KlineAnalyze
上级别
:param ka2: KlineAnalyze
下级别,默认为 None
:param tolerance: float
相对于基准价格的操作容差,默认为 0.03,表示在基准价格附近上下3个点的波动范围内都是允许操作的
:return:
"""
if len(ka.xd) < 6 or not ka1.xd or ka1.xd[-1]['fx_mark'] == 'g':
return False, None
if ka1.xd[-1]['xd'] == ka1.bi[-1]['bi']:
ka1.xd.pop(-1)
else:
return False, None
b = False
detail = {
"标的代码": ka.symbol,
"操作提示": "一买",
"出现时间": "",
"基准价格": 0,
"其他信息": ""
}
# 趋势至少有5段;底背驰一定要创新低
xds = __get_sub_xds(ka, ka1)
if len(xds) >= 6 and xds[-1]['fx_mark'] == 'd' \
and ka1.bi[-1]['fx_mark'] == 'd' and xds[-1]['xd'] < xds[-3]['xd']:
zs1 = [xds[-2]['dt'], xds[-1]['dt']]
zs2 = [xds[-4]['dt'], xds[-3]['dt']]
base_price = xds[-1]['xd']
if is_bei_chi(ka, zs1, zs2, direction='down', mode='xd') \
and __in_tolerance(base_price, ka.latest_price, tolerance):
detail["出现时间"] = xds[-1]['dt']
detail["基准价格"] = base_price
b = True
if isinstance(ka2, KlineAnalyze) and (ka2.xd[-1]['fx_mark'] == 'g' or ka2.bi[-1]['fx_mark'] == 'g'):
b = False
return b, detail
def is_first_sell(ka, ka1, ka2=None, tolerance=0.03):
"""确定某一级别一卖
注意:如果本级别上一级别的 ka 不存在,默认返回 False !!!
:param ka: KlineAnalyze
本级别
:param ka1: KlineAnalyze
上级别
:param ka2: KlineAnalyze
下级别,默认为 None
:param tolerance: float
相对于基准价格的操作容差,默认为 0.03,表示在基准价格附近上下3个点的波动范围内都是允许操作的
:return:
"""
if len(ka.xd) < 6 or not ka1.xd or ka1.xd[-1]['fx_mark'] == 'd':
return False, None
if ka1.xd[-1]['xd'] == ka1.bi[-1]['bi']:
ka1.xd.pop(-1)
else:
return False, None
b = False
detail = {
"标的代码": ka.symbol,
"操作提示": "一卖",
"出现时间": "",
"基准价格": 0,
"其他信息": ""
}
# 趋势至少有5段;顶背驰一定要创新高
xds = __get_sub_xds(ka, ka1)
if len(xds) >= 6 and xds[-1]['fx_mark'] == 'g' \
and ka1.bi[-1]['fx_mark'] == 'g' and xds[-1]['xd'] > xds[-3]['xd']:
zs1 = [xds[-2]['dt'], xds[-1]['dt']]
zs2 = [xds[-4]['dt'], xds[-3]['dt']]
base_price = xds[-1]['xd']
if is_bei_chi(ka, zs1, zs2, direction='up', mode='xd') \
and __in_tolerance(base_price, ka.latest_price, tolerance):
detail["出现时间"] = xds[-1]['dt']
detail["基准价格"] = base_price
b = True
if isinstance(ka2, KlineAnalyze) and (ka2.xd[-1]['fx_mark'] == 'd' or ka2.bi[-1]['fx_mark'] == 'd'):
b = False
return b, detail
def is_second_buy(ka, ka1, ka2=None, tolerance=0.03):
"""确定某一级别二买,包括类二买
注意:如果本级别上一级别的 ka 不存在,默认返回 False !!!
:param ka: KlineAnalyze
本级别
:param ka1: KlineAnalyze
上级别
:param ka2: KlineAnalyze
下级别,默认为 None
:param tolerance: float
相对于基准价格的操作容差,默认为 0.03,表示在基准价格附近上下3个点的波动范围内都是允许操作的
:return:
"""
if len(ka.xd) < 6 or not ka1.xd or ka1.xd[-1]['fx_mark'] == 'g':
return False, None
b = False
detail = {
"标的代码": ka.symbol,
"操作提示": "二买",
"出现时间": "",
"基准价格": 0,
"其他信息": ""
}
xds = __get_sub_xds(ka, ka1)
base_price = xds[-1]['xd']
# 次级别向下走势不创新低,就认为是类二买,其中第一个是真正的二买;
# 如果一个向上走势内部已经有5段次级别走势,则认为该走势随后不再有二买机会
if 3 <= len(xds) <= 4 and xds[-1]['fx_mark'] == 'd' \
and ka1.bi[-1]['fx_mark'] == 'd' and xds[-1]['xd'] > xds[-3]['xd'] \
and __in_tolerance(base_price, ka.latest_price, tolerance):
detail["出现时间"] = xds[-1]['dt']
detail["基准价格"] = base_price
b = True
if isinstance(ka2, KlineAnalyze) and (ka2.xd[-1]['fx_mark'] == 'g' or ka2.bi[-1]['fx_mark'] == 'g'):
b = False
return b, detail
def is_second_sell(ka, ka1, ka2=None, tolerance=0.03):
"""确定某一级别二卖,包括类二卖
注意:如果本级别上一级别的 ka 不存在,默认返回 False !!!
:param ka: KlineAnalyze
本级别
:param ka1: KlineAnalyze
上级别
:param ka2: KlineAnalyze
下级别,默认为 None
:param tolerance: float
相对于基准价格的操作容差,默认为 0.03,表示在基准价格附近上下3个点的波动范围内都是允许操作的
:return:
"""
if len(ka.xd) < 6 or not ka1.xd or ka1.xd[-1]['fx_mark'] == 'd':
return False, None
b = False
detail = {
"标的代码": ka.symbol,
"操作提示": "二卖",
"出现时间": "",
"基准价格": 0,
"其他信息": ""
}
xds = __get_sub_xds(ka, ka1)
base_price = xds[-1]['xd']
if 3 <= len(xds) <= 4 and xds[-1]['fx_mark'] == 'g' and ka1.bi[-1]['fx_mark'] == 'g' \
and xds[-1]['xd'] < xds[-3]['xd'] \
and __in_tolerance(base_price, ka.latest_price, tolerance):
detail["出现时间"] = xds[-1]['dt']
detail["基准价格"] = base_price
b = True
if isinstance(ka2, KlineAnalyze) and (ka2.xd[-1]['fx_mark'] == 'd' or ka2.bi[-1]['fx_mark'] == 'd'):
b = False
return b, detail
def is_third_buy(ka, ka1=None, ka2=None, tolerance=0.03, max_num=4):
"""确定某一级别三买
第三类买点: 一个第三类买点,至少需要有5段次级别的走势,前三段构成中枢,第四段离开中枢,第5段不跌回中枢。
:param ka: KlineAnalyze
本级别
:param ka1: KlineAnalyze
上级别,默认为 None
:param ka2: KlineAnalyze
下级别,默认为 None
:param tolerance: float
相对于基准价格的操作容差,默认为 0.03,表示在基准价格附近上下3个点的波动范围内都是允许操作的
:param max_num: int
前面的最大中枢数量
:return:
"""
if len(ka.xd) < 6 or ka.xd[-1]['fx_mark'] == 'g':
return False, None
uz = up_zs_number(ka)
zs_g = min([x['xd'] for x in ka.xd[-6:-1] if x['fx_mark'] == "g"])
zs_d = max([x['xd'] for x in ka.xd[-6:-1] if x['fx_mark'] == "d"])
if zs_d > zs_g or uz >= max_num:
return False, None
b = False
detail = {
"标的代码": ka.symbol,
"操作提示": "三买",
"出现时间": "",
"基准价格": 0,
"其他信息": "向上中枢数量为%i" % uz
}
last_xd = ka.xd[-1]
base_price = last_xd['xd']
if last_xd['xd'] > zs_g and __in_tolerance(base_price, ka.latest_price, tolerance):
detail['出现时间'] = last_xd['dt']
detail["基准价格"] = base_price
b = True
if isinstance(ka1, KlineAnalyze) and ka1.bi[-1]['fx_mark'] == 'g':
b = False
if isinstance(ka2, KlineAnalyze) and ka2.xd[-1]['fx_mark'] == 'g':
b = False
return b, detail
def is_third_sell(ka, ka1=None, ka2=None, tolerance=0.03, max_num=4):
"""确定某一级别三卖
第三类卖点: 一个第三类卖点,至少需要有5段次级别的走势,前三段构成中枢,第四段离开中枢,第5段不升破中枢的低点。
:param ka: KlineAnalyze
本级别
:param ka1: KlineAnalyze
上级别,默认为 None
:param ka2: KlineAnalyze
下级别,默认为 None
:param tolerance: float
相对于基准价格的操作容差,默认为 0.03,表示在基准价格附近上下3个点的波动范围内都是允许操作的
:param max_num: int
前面的最大中枢数量
:return:
"""
if not isinstance(ka, KlineAnalyze) or len(ka.xd) < 6 or ka.xd[-1]['fx_mark'] == 'd':
return False, None
dz = down_zs_number(ka)
zs_g = min([x['xd'] for x in ka.xd[-6:-1] if x['fx_mark'] == "g"])
zs_d = max([x['xd'] for x in ka.xd[-6:-1] if x['fx_mark'] == "d"])
if zs_d > zs_g or dz >= max_num:
return False, None
b = False
detail = {
"标的代码": ka.symbol,
"操作提示": "三卖",
"出现时间": "",
"基准价格": 0,
"其他信息": "向下中枢数量为%i" % dz
}
last_xd = ka.xd[-1]
base_price = last_xd['xd']
if last_xd['xd'] < zs_d and __in_tolerance(base_price, ka.latest_price, tolerance):
detail['出现时间'] = last_xd['dt']
detail["基准价格"] = base_price
b = True
if isinstance(ka1, KlineAnalyze) and ka1.bi[-1]['fx_mark'] == 'd':
b = False
if isinstance(ka2, KlineAnalyze) and ka2.xd[-1]['fx_mark'] == 'd':
b = False
return b, detail
def is_xd_buy(ka, ka1=None, ka2=None, tolerance=0.03):
"""同级别分解买点,我称之为线买,即线段买点
:param ka: KlineAnalyze
本级别
:param ka1: KlineAnalyze
上级别,默认为 None
:param ka2: KlineAnalyze
下级别,默认为 None
:param tolerance: float
相对于基准价格的操作容差,默认为 0.03,表示在基准价格附近上下3个点的波动范围内都是允许操作的
:return:
"""
if not isinstance(ka, KlineAnalyze) or len(ka.xd) < 4 or ka.xd[-1]['fx_mark'] == 'g':
return False, None
b = False
detail = {
"标的代码": ka.symbol,
"操作提示": "线买",
"出现时间": "",
"基准价格": 0,
"其他信息": ""
}
last_xd = ka.xd[-1]
base_price = last_xd['xd']
zs1 = [ka.xd[-2]['dt'], ka.xd[-1]['dt']]
zs2 = [ka.xd[-4]['dt'], ka.xd[-3]['dt']]
# 线买的两种情况:1)向下线段不创新低;2)向下线段新低背驰
if (last_xd['xd'] >= ka.xd[-3]['xd'] or
(last_xd['xd'] < ka.xd[-3]['xd'] and is_bei_chi(ka, zs1, zs2, direction='down', mode='xd'))) \
and __in_tolerance(base_price, ka.latest_price, tolerance):
detail['出现时间'] = last_xd['dt']
detail["基准价格"] = base_price
b = True
if isinstance(ka1, KlineAnalyze) and ka1.bi[-1]['fx_mark'] == 'g':
b = False
if isinstance(ka2, KlineAnalyze) and ka2.xd[-1]['fx_mark'] == 'g':
b = False
return b, detail
def is_xd_sell(ka, ka1=None, ka2=None, tolerance=0.03):
"""同级别分解卖点,我称之为线卖,即线段卖点
:param ka: KlineAnalyze
本级别
:param ka1: KlineAnalyze
上级别,默认为 None
:param ka2: KlineAnalyze
下级别,默认为 None
:param tolerance: float
相对于基准价格的操作容差,默认为 0.03,表示在基准价格附近上下3个点的波动范围内都是允许操作的
:return:
"""
if not isinstance(ka, KlineAnalyze) or len(ka.xd) < 4 or ka.xd[-1]['fx_mark'] == 'd':
return False, None
b = False
detail = {
"标的代码": ka.symbol,
"操作提示": "线卖",
"出现时间": "",
"基准价格": 0,
"其他信息": ""
}
last_xd = ka.xd[-1]
base_price = last_xd['xd']
zs1 = [ka.xd[-2]['dt'], ka.xd[-1]['dt']]
zs2 = [ka.xd[-4]['dt'], ka.xd[-3]['dt']]
# 线卖的两种情况:1)向上线段不创新高;2)向上线段新高背驰
if (last_xd['xd'] <= ka.xd[-3]['xd']
or (last_xd['xd'] > ka.xd[-3]['xd'] and is_bei_chi(ka, zs1, zs2, direction='up', mode='xd'))) \
and __in_tolerance(base_price, ka.latest_price, tolerance):
detail['出现时间'] = last_xd['dt']
detail["基准价格"] = base_price
b = True
if isinstance(ka1, KlineAnalyze) and ka1.bi[-1]['fx_mark'] == 'd':
b = False
if isinstance(ka2, KlineAnalyze) and ka2.xd[-1]['fx_mark'] == 'd':
b = False
return b, detail
class SolidAnalyze(object):
"""多级别(日线、30分钟、5分钟、1分钟)K线联合分析
这只是一个样例,展示如何结合多个K线级别进行买卖点分析。
你可以根据自己对缠论的理解,利用 KlineAnalyze 的分析结果在多个级别之间进行联合分析,找出符合自己要求的买卖点。
"""
def __init__(self, klines):
"""
:param klines: dict
key 为K线级别名称;value 为对应的K线数据,K线数据基本格式参考 KlineAnalyze
example: {"日线": df, "30分钟": df, "5分钟": df, "1分钟": df,}
"""
self.kas = dict()
self.freqs = list(klines.keys())
for freq, kline in klines.items():
try:
ka = KlineAnalyze(kline)
self.kas[freq] = ka
except:
self.kas[freq] = None
traceback.print_exc()
self.symbol = self.kas['1分钟'].symbol
def _get_ka(self, freq):
"""输入级别,返回该级别 ka,以及上一级别 ka1,下一级别 ka2"""
assert freq in self.freqs, "‘%s’不在级别列表(%s)中" % (freq, "|".join(self.freqs))
if freq == '日线':
ka, ka1, ka2 = self.kas['日线'], None, self.kas['30分钟']
elif freq == '30分钟':
ka, ka1, ka2 = self.kas['30分钟'], self.kas['日线'], self.kas['5分钟']
elif freq == '5分钟':
ka, ka1, ka2 = self.kas['5分钟'], self.kas['30分钟'], self.kas['1分钟']
elif freq == '1分钟':
ka, ka1, ka2 = self.kas['1分钟'], self.kas['5分钟'], None
else:
raise ValueError
return ka, ka1, ka2
def is_first_buy(self, freq, tolerance=0.03):
"""确定某一级别一买,包括由盘整背驰引发的类一买
注意:如果本级别上一级别的 ka 不存在,默认返回 False !!!
:param freq: str
K线级别,如 1分钟;这个级别可以是你定义的任何名称
:param tolerance: float
相对于基准价格的操作容差,默认为 0.03,表示在基准价格附近上下3个点的波动范围内都是允许操作的
:return:
"""
ka, ka1, ka2 = self._get_ka(freq)
assert freq != "日线", "日线级别不能识别一买"
return is_first_buy(ka, ka1, ka2, tolerance)
def is_first_sell(self, freq, tolerance=0.03):
"""确定某一级别一卖,包括由盘整背驰引发的类一卖
注意:如果本级别上一级别的 ka 不存在,默认返回 False !!!
:param freq: str
K线级别,如 1分钟;这个级别可以是你定义的任何名称
:param tolerance: float
相对于基准价格的操作容差,默认为 0.03,表示在基准价格附近上下3个点的波动范围内都是允许操作的
:return:
"""
ka, ka1, ka2 = self._get_ka(freq)
assert freq != "日线", "日线级别不能识别一卖"
return is_first_sell(ka, ka1, ka2, tolerance)
def is_second_buy(self, freq, tolerance=0.03):
"""确定某一级别二买,包括类二买
注意:如果本级别上一级别的 ka 不存在,默认返回 False !!!
:param freq: str
K线级别,如 1分钟;这个级别可以是你定义的任何名称
:param tolerance: float
相对于基准价格的操作容差,默认为 0.03,表示在基准价格附近上下3个点的波动范围内都是允许操作的
:return:
"""
ka, ka1, ka2 = self._get_ka(freq)
assert freq != "日线", "日线级别不能识别二买"
return is_second_buy(ka, ka1, ka2, tolerance)
def is_second_sell(self, freq, tolerance=0.03):
"""确定某一级别二卖,包括类二卖
:param freq: str
K线级别,如 1分钟;这个级别可以是你定义的任何名称
:param tolerance: float
相对于基准价格的操作容差,默认为 0.03,表示在基准价格附近上下3个点的波动范围内都是允许操作的
:return:
"""
ka, ka1, ka2 = self._get_ka(freq)
assert freq != "日线", "日线级别不能识别二卖"
return is_second_sell(ka, ka1, ka2, tolerance)
def is_third_buy(self, freq, tolerance=0.03):
"""确定某一级别三买
:param freq: str
K线级别,如 1分钟;这个级别可以是你定义的任何名称
:param tolerance: float
相对于基准价格的操作容差,默认为 0.03,表示在基准价格附近上下3个点的波动范围内都是允许操作的
:return:
"""
ka, ka1, ka2 = self._get_ka(freq)
return is_third_buy(ka, ka1, ka2, tolerance)
def is_third_sell(self, freq, tolerance=0.03):
"""确定某一级别三卖
:param freq: str
K线级别,如 1分钟;这个级别可以是你定义的任何名称
:param tolerance: float
相对于基准价格的操作容差,默认为 0.03,表示在基准价格附近上下3个点的波动范围内都是允许操作的
:return:
"""
ka, ka1, ka2 = self._get_ka(freq)
return is_third_sell(ka, ka1, ka2, tolerance)
def is_xd_buy(self, freq, tolerance=0.03):
"""同级别分解买点,我称之为线买,即线段买点
:param freq: str
K线级别,如 1分钟;这个级别可以是你定义的任何名称
:param tolerance: float
相对于基准价格的操作容差,默认为 0.03,表示在基准价格附近上下3个点的波动范围内都是允许操作的
:return:
"""
ka, ka1, ka2 = self._get_ka(freq)
return is_xd_buy(ka, ka1, ka2, tolerance)
def is_xd_sell(self, freq, tolerance=0.03):
"""同级别分解卖点,我称之为线卖,即线段卖点
:param freq: str
K线级别,如 1分钟;这个级别可以是你定义的任何名称
:param tolerance: float
相对于基准价格的操作容差,默认为 0.03,表示在基准价格附近上下3个点的波动范围内都是允许操作的
:return:
"""
ka, ka1, ka2 = self._get_ka(freq)
return is_xd_sell(ka, ka1, ka2, tolerance)
| 28.788909 | 107 | 0.546014 | 2,171 | 16,093 | 3.928604 | 0.099954 | 0.026732 | 0.027084 | 0.017939 | 0.820495 | 0.790011 | 0.767265 | 0.732091 | 0.717552 | 0.703717 | 0 | 0.037603 | 0.292736 | 16,093 | 558 | 108 | 28.840502 | 0.711738 | 0.243336 | 0 | 0.607639 | 0 | 0 | 0.074463 | 0 | 0 | 0 | 0 | 0 | 0.017361 | 1 | 0.072917 | false | 0 | 0.013889 | 0 | 0.211806 | 0.003472 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6 |
930cdce0be63684d67144d4dd45435ea67e1b5b8 | 30 | py | Python | transformations/synonym_substitution/__init__.py | ns-moosavi/NL-Augmenter | 1275179e3746e55cc1915f12de00eb140103f981 | [
"MIT"
] | 583 | 2021-06-12T02:30:26.000Z | 2022-03-28T05:57:45.000Z | transformations/synonym_substitution/__init__.py | ns-moosavi/NL-Augmenter | 1275179e3746e55cc1915f12de00eb140103f981 | [
"MIT"
] | 246 | 2021-06-11T15:49:36.000Z | 2022-02-02T12:17:41.000Z | transformations/synonym_substitution/__init__.py | ns-moosavi/NL-Augmenter | 1275179e3746e55cc1915f12de00eb140103f981 | [
"MIT"
] | 189 | 2021-06-15T14:14:15.000Z | 2022-03-15T22:10:46.000Z | from .transformation import *
| 15 | 29 | 0.8 | 3 | 30 | 8 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.133333 | 30 | 1 | 30 | 30 | 0.923077 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 6 |
93263e373eb3a4bc86bbd11b1ff0e10c4c8f4ea4 | 257,303 | py | Python | instances/passenger_demand/pas-20210422-1717-int8e-1/92.py | LHcau/scheduling-shared-passenger-and-freight-transport-on-a-fixed-infrastructure | bba1e6af5bc8d9deaa2dc3b83f6fe9ddf15d2a11 | [
"BSD-3-Clause"
] | null | null | null | instances/passenger_demand/pas-20210422-1717-int8e-1/92.py | LHcau/scheduling-shared-passenger-and-freight-transport-on-a-fixed-infrastructure | bba1e6af5bc8d9deaa2dc3b83f6fe9ddf15d2a11 | [
"BSD-3-Clause"
] | null | null | null | instances/passenger_demand/pas-20210422-1717-int8e-1/92.py | LHcau/scheduling-shared-passenger-and-freight-transport-on-a-fixed-infrastructure | bba1e6af5bc8d9deaa2dc3b83f6fe9ddf15d2a11 | [
"BSD-3-Clause"
] | null | null | null |
"""
PASSENGERS
"""
numPassengers = 15382
passenger_arriving = (
(2, 5, 2, 5, 2, 1, 2, 2, 1, 0, 1, 0, 0, 8, 2, 4, 1, 2, 1, 4, 3, 0, 1, 1, 0, 0), # 0
(5, 7, 2, 9, 1, 2, 2, 2, 2, 0, 3, 3, 0, 3, 6, 3, 2, 1, 2, 0, 2, 0, 3, 0, 0, 0), # 1
(5, 5, 3, 6, 5, 2, 3, 1, 1, 2, 2, 0, 0, 2, 4, 3, 2, 4, 3, 3, 1, 2, 1, 0, 0, 0), # 2
(6, 8, 7, 4, 3, 0, 5, 1, 0, 0, 0, 2, 0, 0, 4, 3, 4, 3, 2, 1, 0, 2, 1, 0, 0, 0), # 3
(3, 4, 3, 4, 2, 1, 0, 2, 2, 0, 1, 0, 0, 6, 4, 6, 3, 2, 5, 2, 1, 3, 0, 1, 0, 0), # 4
(5, 6, 6, 11, 5, 4, 2, 4, 4, 0, 0, 0, 0, 3, 1, 2, 1, 6, 1, 2, 1, 0, 2, 1, 2, 0), # 5
(13, 7, 2, 11, 2, 1, 0, 0, 0, 2, 0, 0, 0, 5, 7, 2, 0, 1, 3, 2, 3, 0, 2, 2, 0, 0), # 6
(4, 4, 3, 4, 8, 0, 1, 4, 3, 1, 0, 1, 0, 4, 6, 6, 3, 2, 1, 2, 2, 0, 1, 0, 0, 0), # 7
(1, 4, 7, 5, 6, 3, 1, 3, 2, 1, 2, 1, 0, 4, 6, 3, 3, 2, 6, 1, 1, 1, 1, 0, 0, 0), # 8
(6, 7, 6, 4, 5, 3, 0, 1, 3, 3, 4, 0, 0, 6, 6, 4, 6, 5, 5, 4, 2, 3, 3, 1, 1, 0), # 9
(10, 7, 6, 2, 3, 4, 2, 3, 1, 3, 2, 0, 0, 4, 4, 5, 4, 6, 6, 2, 2, 1, 1, 1, 0, 0), # 10
(4, 7, 9, 6, 6, 1, 5, 2, 3, 2, 1, 1, 0, 8, 2, 3, 2, 2, 4, 1, 4, 4, 0, 3, 0, 0), # 11
(9, 3, 6, 7, 7, 4, 3, 1, 1, 1, 2, 0, 0, 6, 10, 6, 2, 4, 5, 4, 2, 2, 2, 2, 1, 0), # 12
(1, 6, 6, 10, 4, 3, 3, 0, 3, 1, 1, 1, 0, 7, 6, 5, 2, 4, 5, 7, 2, 2, 1, 2, 3, 0), # 13
(6, 9, 7, 6, 5, 2, 9, 1, 0, 0, 0, 0, 0, 6, 3, 7, 4, 7, 2, 0, 2, 3, 2, 0, 0, 0), # 14
(8, 5, 7, 2, 6, 3, 7, 2, 9, 2, 1, 0, 0, 3, 7, 8, 4, 12, 4, 4, 3, 2, 1, 0, 1, 0), # 15
(6, 4, 9, 7, 4, 2, 1, 2, 2, 2, 0, 1, 0, 6, 9, 1, 2, 5, 9, 1, 2, 5, 7, 3, 1, 0), # 16
(5, 8, 9, 4, 2, 4, 2, 1, 6, 4, 0, 2, 0, 10, 7, 5, 6, 8, 6, 1, 1, 2, 3, 1, 0, 0), # 17
(8, 9, 13, 8, 5, 4, 6, 5, 3, 5, 0, 1, 0, 7, 8, 6, 6, 5, 5, 3, 4, 3, 5, 2, 0, 0), # 18
(5, 9, 7, 4, 5, 3, 2, 4, 3, 4, 1, 0, 0, 9, 6, 2, 6, 2, 3, 1, 2, 4, 2, 1, 2, 0), # 19
(15, 11, 8, 10, 7, 3, 2, 1, 3, 1, 2, 0, 0, 10, 10, 12, 6, 5, 5, 6, 1, 4, 1, 0, 1, 0), # 20
(9, 8, 6, 8, 5, 4, 2, 0, 3, 2, 0, 1, 0, 2, 5, 6, 6, 6, 6, 2, 2, 3, 3, 0, 0, 0), # 21
(6, 8, 4, 6, 8, 0, 2, 3, 2, 1, 1, 1, 0, 7, 4, 3, 2, 9, 4, 2, 0, 6, 0, 1, 1, 0), # 22
(7, 7, 11, 7, 4, 0, 2, 2, 1, 3, 0, 2, 0, 11, 4, 5, 1, 9, 3, 5, 2, 3, 1, 2, 5, 0), # 23
(9, 9, 3, 7, 13, 1, 1, 3, 1, 0, 2, 2, 0, 11, 5, 10, 3, 12, 5, 3, 2, 2, 1, 2, 3, 0), # 24
(11, 6, 2, 9, 4, 6, 1, 1, 4, 1, 1, 1, 0, 14, 12, 4, 6, 9, 3, 6, 1, 1, 2, 3, 0, 0), # 25
(11, 2, 9, 4, 8, 3, 3, 1, 3, 2, 1, 0, 0, 11, 4, 5, 6, 7, 2, 2, 3, 2, 2, 4, 0, 0), # 26
(8, 14, 10, 6, 9, 4, 5, 6, 4, 3, 0, 0, 0, 7, 5, 10, 7, 4, 1, 4, 2, 6, 1, 0, 1, 0), # 27
(7, 8, 7, 10, 0, 6, 4, 7, 2, 2, 2, 0, 0, 4, 9, 7, 5, 6, 6, 7, 1, 3, 2, 1, 1, 0), # 28
(9, 10, 6, 3, 4, 3, 0, 3, 3, 1, 0, 2, 0, 12, 10, 10, 9, 4, 4, 0, 3, 3, 6, 1, 0, 0), # 29
(3, 11, 7, 9, 3, 2, 2, 1, 6, 0, 1, 0, 0, 8, 4, 9, 5, 8, 8, 1, 0, 6, 2, 1, 2, 0), # 30
(6, 11, 5, 8, 7, 7, 3, 3, 4, 1, 0, 0, 0, 12, 8, 8, 3, 1, 5, 3, 2, 0, 2, 4, 0, 0), # 31
(9, 8, 2, 10, 3, 5, 3, 8, 6, 1, 2, 1, 0, 16, 6, 7, 3, 8, 7, 3, 1, 2, 2, 1, 3, 0), # 32
(7, 8, 7, 8, 2, 3, 6, 3, 2, 0, 1, 1, 0, 11, 6, 6, 1, 3, 8, 4, 1, 0, 5, 2, 1, 0), # 33
(9, 11, 7, 13, 9, 2, 0, 2, 8, 1, 0, 0, 0, 12, 13, 4, 6, 6, 1, 2, 3, 2, 0, 2, 1, 0), # 34
(6, 10, 5, 5, 7, 3, 4, 2, 0, 2, 2, 1, 0, 12, 6, 3, 5, 5, 2, 3, 4, 3, 1, 2, 2, 0), # 35
(7, 10, 8, 10, 7, 1, 4, 4, 4, 3, 3, 0, 0, 5, 7, 5, 6, 7, 6, 4, 1, 3, 5, 4, 1, 0), # 36
(7, 4, 6, 5, 6, 1, 3, 2, 2, 1, 0, 0, 0, 5, 6, 7, 4, 9, 1, 4, 3, 4, 5, 1, 2, 0), # 37
(1, 9, 3, 5, 7, 3, 5, 2, 4, 2, 2, 0, 0, 10, 8, 3, 4, 7, 4, 5, 2, 1, 3, 1, 0, 0), # 38
(7, 9, 11, 13, 6, 3, 4, 4, 1, 2, 0, 0, 0, 9, 10, 1, 7, 12, 4, 2, 1, 4, 2, 2, 0, 0), # 39
(10, 8, 11, 7, 12, 1, 2, 2, 2, 2, 4, 1, 0, 7, 9, 6, 4, 6, 7, 2, 2, 2, 1, 0, 1, 0), # 40
(5, 10, 10, 3, 2, 1, 2, 1, 2, 2, 2, 3, 0, 8, 5, 10, 5, 10, 2, 2, 1, 3, 5, 1, 0, 0), # 41
(8, 9, 6, 6, 8, 6, 3, 4, 10, 5, 1, 0, 0, 6, 9, 4, 6, 3, 4, 3, 2, 3, 3, 1, 0, 0), # 42
(9, 9, 5, 3, 9, 5, 5, 5, 3, 3, 1, 1, 0, 11, 9, 14, 3, 4, 7, 2, 1, 1, 3, 1, 3, 0), # 43
(5, 5, 3, 11, 6, 1, 1, 2, 4, 1, 1, 0, 0, 6, 7, 4, 5, 8, 7, 6, 2, 6, 1, 0, 0, 0), # 44
(8, 10, 7, 6, 6, 2, 2, 1, 3, 0, 0, 2, 0, 11, 7, 7, 6, 8, 5, 4, 1, 4, 0, 3, 0, 0), # 45
(7, 11, 6, 5, 11, 2, 1, 1, 2, 1, 2, 0, 0, 7, 7, 5, 3, 14, 5, 4, 1, 4, 0, 1, 1, 0), # 46
(9, 5, 6, 12, 7, 6, 2, 3, 1, 2, 2, 0, 0, 4, 4, 2, 5, 5, 2, 4, 4, 3, 3, 2, 0, 0), # 47
(9, 12, 8, 3, 10, 3, 2, 5, 1, 1, 1, 0, 0, 12, 7, 6, 4, 9, 2, 2, 4, 1, 1, 1, 1, 0), # 48
(13, 7, 3, 9, 2, 4, 2, 6, 6, 1, 0, 2, 0, 9, 8, 6, 9, 12, 6, 3, 1, 2, 4, 2, 0, 0), # 49
(6, 3, 7, 2, 4, 2, 2, 2, 1, 3, 1, 1, 0, 6, 7, 5, 2, 6, 4, 9, 2, 3, 6, 2, 2, 0), # 50
(12, 13, 10, 7, 4, 2, 2, 0, 0, 1, 0, 1, 0, 8, 9, 14, 6, 7, 3, 2, 3, 1, 5, 1, 0, 0), # 51
(8, 7, 4, 8, 6, 4, 6, 1, 3, 0, 0, 0, 0, 12, 4, 4, 1, 11, 2, 1, 2, 3, 3, 1, 0, 0), # 52
(10, 3, 8, 5, 4, 2, 2, 0, 3, 3, 1, 0, 0, 7, 8, 5, 6, 8, 3, 1, 3, 2, 1, 3, 0, 0), # 53
(6, 12, 10, 4, 5, 4, 4, 3, 3, 2, 1, 0, 0, 6, 12, 3, 2, 5, 7, 1, 1, 2, 1, 6, 1, 0), # 54
(9, 5, 8, 1, 3, 3, 1, 5, 1, 1, 3, 0, 0, 7, 5, 9, 6, 5, 1, 2, 3, 2, 5, 2, 0, 0), # 55
(9, 5, 5, 9, 9, 0, 4, 1, 1, 1, 0, 0, 0, 12, 0, 4, 4, 3, 6, 2, 1, 1, 5, 0, 0, 0), # 56
(12, 6, 7, 9, 8, 2, 4, 0, 4, 1, 0, 2, 0, 9, 7, 6, 7, 7, 4, 3, 1, 3, 2, 2, 1, 0), # 57
(5, 4, 4, 8, 8, 3, 0, 1, 3, 1, 1, 0, 0, 5, 8, 11, 5, 8, 5, 1, 2, 5, 4, 2, 0, 0), # 58
(9, 8, 6, 9, 6, 3, 2, 0, 4, 0, 0, 1, 0, 9, 7, 6, 3, 6, 6, 2, 0, 2, 2, 1, 0, 0), # 59
(7, 6, 6, 3, 2, 7, 5, 0, 6, 0, 0, 0, 0, 14, 6, 4, 7, 7, 2, 2, 3, 4, 3, 2, 1, 0), # 60
(4, 9, 7, 9, 4, 2, 4, 2, 4, 0, 1, 0, 0, 6, 4, 9, 9, 10, 2, 2, 3, 4, 2, 1, 0, 0), # 61
(8, 11, 12, 11, 4, 3, 4, 5, 2, 3, 2, 1, 0, 11, 9, 5, 6, 5, 3, 2, 3, 2, 4, 2, 1, 0), # 62
(9, 5, 8, 10, 9, 5, 2, 8, 4, 0, 0, 1, 0, 7, 8, 4, 6, 6, 4, 3, 0, 1, 5, 1, 1, 0), # 63
(11, 11, 4, 5, 9, 2, 5, 1, 5, 2, 3, 0, 0, 8, 6, 4, 9, 7, 2, 2, 1, 3, 2, 3, 2, 0), # 64
(8, 5, 6, 6, 7, 1, 4, 5, 2, 0, 0, 0, 0, 6, 7, 6, 3, 6, 4, 6, 2, 1, 2, 3, 0, 0), # 65
(10, 7, 4, 6, 11, 5, 6, 2, 4, 1, 0, 0, 0, 9, 7, 7, 5, 8, 5, 6, 1, 5, 1, 0, 0, 0), # 66
(6, 11, 5, 5, 5, 4, 2, 0, 5, 1, 1, 0, 0, 9, 9, 8, 8, 10, 4, 2, 2, 2, 2, 3, 1, 0), # 67
(6, 6, 9, 6, 9, 5, 4, 0, 2, 2, 1, 0, 0, 7, 4, 9, 7, 7, 3, 2, 2, 6, 3, 1, 0, 0), # 68
(6, 8, 6, 8, 7, 5, 1, 2, 2, 4, 3, 1, 0, 10, 7, 9, 3, 4, 3, 5, 0, 3, 2, 0, 0, 0), # 69
(11, 7, 9, 11, 5, 4, 3, 3, 2, 1, 0, 2, 0, 5, 7, 6, 2, 7, 2, 3, 1, 2, 3, 2, 0, 0), # 70
(11, 3, 8, 6, 6, 3, 5, 1, 1, 0, 2, 2, 0, 8, 2, 4, 7, 8, 3, 5, 2, 4, 1, 0, 3, 0), # 71
(7, 9, 6, 11, 2, 0, 2, 2, 3, 1, 1, 1, 0, 13, 7, 4, 2, 7, 3, 4, 2, 3, 3, 4, 0, 0), # 72
(4, 9, 3, 7, 5, 4, 5, 4, 3, 1, 0, 0, 0, 5, 8, 3, 10, 8, 2, 3, 3, 3, 3, 1, 0, 0), # 73
(12, 11, 7, 6, 1, 4, 2, 3, 3, 2, 0, 0, 0, 7, 5, 4, 2, 9, 5, 0, 1, 1, 3, 2, 0, 0), # 74
(3, 9, 7, 10, 7, 3, 1, 2, 7, 1, 0, 1, 0, 8, 6, 9, 1, 2, 3, 4, 2, 5, 4, 1, 0, 0), # 75
(5, 12, 5, 7, 4, 2, 2, 3, 2, 2, 1, 2, 0, 8, 5, 5, 3, 6, 2, 0, 1, 0, 5, 1, 1, 0), # 76
(8, 3, 4, 5, 7, 2, 2, 3, 8, 1, 2, 0, 0, 4, 7, 8, 4, 8, 3, 3, 3, 2, 0, 3, 0, 0), # 77
(11, 11, 4, 16, 2, 4, 3, 4, 3, 2, 2, 1, 0, 7, 8, 2, 6, 5, 4, 6, 1, 2, 1, 1, 0, 0), # 78
(9, 8, 7, 3, 6, 2, 3, 2, 5, 2, 2, 1, 0, 7, 11, 5, 6, 8, 5, 4, 1, 3, 3, 4, 0, 0), # 79
(8, 2, 6, 8, 5, 3, 3, 2, 2, 6, 3, 0, 0, 9, 6, 5, 4, 5, 5, 6, 3, 2, 3, 2, 0, 0), # 80
(6, 7, 4, 7, 8, 1, 5, 1, 0, 1, 0, 1, 0, 17, 9, 8, 3, 7, 2, 3, 2, 2, 2, 2, 2, 0), # 81
(11, 7, 8, 10, 9, 4, 3, 0, 4, 1, 0, 0, 0, 5, 5, 8, 7, 8, 2, 3, 3, 2, 4, 1, 1, 0), # 82
(5, 3, 5, 5, 7, 4, 3, 1, 1, 1, 3, 0, 0, 5, 6, 5, 7, 3, 3, 3, 3, 1, 2, 1, 0, 0), # 83
(4, 8, 6, 3, 6, 5, 2, 1, 5, 0, 3, 1, 0, 9, 4, 2, 5, 4, 7, 4, 4, 5, 5, 0, 1, 0), # 84
(5, 9, 5, 9, 9, 3, 6, 2, 2, 1, 1, 0, 0, 10, 5, 6, 8, 5, 2, 1, 4, 1, 4, 0, 0, 0), # 85
(2, 5, 10, 9, 3, 3, 2, 1, 1, 3, 0, 1, 0, 11, 3, 4, 2, 4, 5, 2, 3, 3, 2, 0, 1, 0), # 86
(7, 6, 7, 12, 5, 1, 3, 1, 4, 0, 2, 1, 0, 8, 3, 5, 3, 8, 3, 3, 3, 2, 2, 0, 1, 0), # 87
(8, 8, 8, 4, 4, 0, 3, 2, 3, 1, 0, 2, 0, 10, 6, 8, 4, 4, 4, 0, 2, 3, 5, 1, 0, 0), # 88
(11, 5, 3, 9, 6, 0, 2, 3, 3, 0, 0, 1, 0, 2, 3, 5, 1, 2, 4, 3, 3, 2, 1, 2, 0, 0), # 89
(6, 8, 7, 5, 4, 4, 3, 4, 3, 0, 3, 0, 0, 8, 7, 6, 5, 7, 5, 2, 1, 5, 4, 1, 0, 0), # 90
(11, 9, 12, 6, 7, 3, 1, 2, 1, 2, 0, 4, 0, 6, 6, 7, 0, 5, 2, 3, 2, 1, 2, 1, 0, 0), # 91
(9, 6, 7, 9, 9, 4, 0, 1, 4, 0, 5, 0, 0, 11, 6, 8, 4, 7, 5, 2, 3, 4, 3, 0, 0, 0), # 92
(13, 4, 12, 6, 4, 2, 4, 2, 1, 2, 0, 1, 0, 7, 10, 4, 6, 6, 5, 2, 3, 1, 1, 1, 0, 0), # 93
(7, 4, 10, 5, 4, 0, 4, 2, 2, 0, 0, 0, 0, 15, 3, 5, 6, 11, 4, 0, 0, 1, 4, 0, 1, 0), # 94
(11, 4, 5, 6, 7, 1, 1, 4, 3, 5, 0, 0, 0, 7, 9, 1, 3, 12, 1, 3, 2, 2, 3, 2, 1, 0), # 95
(11, 7, 6, 5, 9, 6, 2, 2, 4, 2, 0, 2, 0, 5, 4, 3, 5, 11, 6, 1, 2, 1, 2, 4, 0, 0), # 96
(7, 7, 5, 6, 5, 4, 2, 3, 2, 2, 2, 0, 0, 5, 3, 6, 5, 10, 4, 4, 3, 2, 4, 0, 0, 0), # 97
(7, 5, 8, 6, 2, 4, 6, 2, 7, 3, 0, 2, 0, 5, 6, 7, 3, 5, 5, 4, 1, 2, 1, 2, 1, 0), # 98
(5, 7, 2, 10, 5, 5, 2, 2, 3, 1, 0, 0, 0, 6, 6, 5, 2, 2, 4, 3, 1, 4, 1, 1, 0, 0), # 99
(12, 8, 5, 6, 4, 4, 2, 4, 5, 1, 0, 0, 0, 13, 5, 4, 10, 7, 3, 3, 3, 6, 3, 1, 2, 0), # 100
(6, 10, 5, 9, 7, 1, 4, 2, 3, 2, 3, 0, 0, 6, 3, 8, 3, 10, 6, 2, 2, 0, 2, 0, 0, 0), # 101
(12, 6, 7, 5, 3, 5, 4, 1, 3, 1, 3, 1, 0, 11, 7, 5, 2, 5, 6, 8, 1, 6, 0, 3, 2, 0), # 102
(7, 10, 10, 5, 4, 0, 3, 1, 1, 0, 0, 0, 0, 2, 4, 8, 3, 6, 4, 3, 1, 3, 4, 0, 1, 0), # 103
(6, 11, 9, 3, 5, 2, 4, 3, 1, 1, 0, 1, 0, 8, 6, 3, 9, 2, 4, 2, 1, 6, 0, 0, 0, 0), # 104
(6, 8, 14, 7, 5, 4, 2, 1, 4, 2, 0, 0, 0, 6, 6, 9, 3, 9, 4, 3, 1, 6, 1, 0, 0, 0), # 105
(7, 6, 5, 5, 9, 5, 2, 4, 3, 1, 3, 0, 0, 7, 3, 8, 5, 5, 4, 3, 2, 1, 5, 2, 1, 0), # 106
(8, 4, 5, 6, 3, 3, 3, 4, 7, 0, 0, 0, 0, 8, 5, 5, 4, 7, 4, 4, 2, 4, 2, 1, 1, 0), # 107
(8, 6, 4, 7, 4, 2, 2, 1, 3, 1, 0, 1, 0, 7, 5, 10, 3, 4, 0, 0, 2, 2, 3, 1, 0, 0), # 108
(6, 8, 5, 10, 5, 1, 5, 2, 2, 1, 2, 0, 0, 8, 9, 8, 2, 6, 2, 3, 0, 5, 1, 2, 0, 0), # 109
(14, 1, 11, 9, 5, 4, 2, 2, 2, 4, 0, 1, 0, 10, 9, 2, 1, 7, 2, 2, 2, 3, 2, 1, 1, 0), # 110
(6, 8, 6, 9, 5, 0, 3, 2, 3, 3, 1, 0, 0, 9, 6, 7, 4, 5, 6, 3, 2, 2, 2, 2, 0, 0), # 111
(7, 8, 7, 1, 8, 2, 0, 3, 3, 2, 3, 1, 0, 6, 4, 7, 3, 2, 1, 1, 3, 3, 5, 0, 0, 0), # 112
(6, 6, 7, 5, 2, 3, 2, 2, 3, 0, 3, 3, 0, 7, 10, 8, 3, 4, 1, 4, 0, 6, 2, 1, 0, 0), # 113
(12, 2, 5, 6, 5, 3, 1, 1, 2, 0, 0, 2, 0, 6, 4, 5, 1, 7, 7, 2, 1, 1, 3, 1, 1, 0), # 114
(8, 7, 8, 3, 3, 0, 2, 1, 2, 1, 0, 0, 0, 6, 8, 6, 4, 5, 5, 4, 3, 2, 1, 1, 2, 0), # 115
(10, 5, 3, 7, 9, 2, 3, 4, 2, 0, 1, 0, 0, 4, 9, 2, 4, 5, 1, 0, 1, 2, 3, 1, 0, 0), # 116
(9, 1, 5, 5, 5, 3, 2, 1, 6, 1, 1, 1, 0, 4, 3, 7, 2, 5, 1, 0, 1, 1, 0, 0, 0, 0), # 117
(5, 8, 10, 8, 6, 2, 1, 0, 2, 1, 2, 0, 0, 2, 9, 6, 5, 2, 4, 1, 1, 3, 1, 2, 0, 0), # 118
(5, 3, 5, 7, 6, 2, 2, 0, 6, 2, 1, 0, 0, 7, 8, 2, 4, 10, 2, 3, 1, 5, 2, 1, 0, 0), # 119
(3, 6, 2, 12, 1, 3, 1, 1, 1, 0, 1, 1, 0, 9, 7, 6, 7, 4, 3, 2, 2, 3, 2, 1, 0, 0), # 120
(9, 13, 6, 6, 2, 2, 3, 2, 2, 0, 0, 1, 0, 6, 6, 7, 3, 6, 2, 2, 2, 4, 5, 3, 0, 0), # 121
(6, 3, 8, 5, 6, 4, 1, 2, 3, 0, 1, 0, 0, 8, 6, 5, 7, 6, 5, 2, 5, 3, 1, 2, 1, 0), # 122
(5, 7, 8, 3, 3, 3, 5, 3, 2, 1, 2, 0, 0, 6, 12, 5, 3, 8, 3, 0, 0, 0, 3, 3, 0, 0), # 123
(8, 4, 10, 8, 5, 3, 1, 1, 2, 0, 0, 1, 0, 6, 2, 10, 4, 6, 1, 0, 3, 3, 1, 1, 0, 0), # 124
(3, 8, 6, 3, 7, 2, 0, 3, 3, 3, 0, 1, 0, 6, 4, 5, 6, 3, 3, 3, 4, 1, 2, 2, 1, 0), # 125
(5, 4, 3, 4, 4, 2, 2, 1, 3, 1, 0, 0, 0, 10, 3, 4, 3, 6, 3, 3, 0, 2, 3, 0, 2, 0), # 126
(9, 4, 7, 10, 8, 3, 4, 1, 3, 2, 0, 0, 0, 5, 11, 5, 0, 2, 1, 2, 2, 2, 2, 1, 1, 0), # 127
(5, 7, 10, 7, 5, 1, 1, 3, 3, 1, 2, 1, 0, 7, 2, 8, 4, 6, 0, 2, 3, 1, 3, 3, 2, 0), # 128
(5, 2, 8, 6, 8, 0, 3, 3, 0, 2, 1, 2, 0, 7, 5, 3, 1, 1, 3, 2, 2, 2, 1, 3, 0, 0), # 129
(7, 5, 5, 4, 7, 5, 3, 0, 3, 0, 2, 0, 0, 4, 8, 5, 3, 12, 2, 1, 2, 3, 1, 1, 2, 0), # 130
(6, 4, 4, 6, 7, 3, 3, 3, 3, 1, 1, 1, 0, 5, 8, 5, 4, 9, 1, 0, 0, 2, 1, 2, 0, 0), # 131
(9, 5, 9, 5, 5, 6, 4, 1, 1, 2, 0, 1, 0, 6, 3, 4, 4, 3, 3, 2, 1, 0, 1, 3, 0, 0), # 132
(7, 6, 3, 2, 4, 1, 2, 2, 2, 1, 0, 0, 0, 4, 1, 3, 3, 2, 1, 0, 2, 2, 3, 0, 0, 0), # 133
(6, 1, 0, 6, 4, 2, 1, 1, 2, 1, 0, 0, 0, 8, 8, 3, 3, 8, 4, 2, 2, 2, 1, 0, 1, 0), # 134
(3, 3, 10, 3, 8, 3, 2, 2, 4, 3, 2, 0, 0, 7, 6, 3, 2, 8, 3, 2, 2, 2, 4, 1, 0, 0), # 135
(5, 5, 7, 5, 4, 4, 1, 1, 5, 0, 1, 1, 0, 8, 8, 4, 0, 8, 1, 3, 1, 0, 1, 1, 0, 0), # 136
(7, 11, 5, 1, 1, 5, 2, 3, 1, 0, 0, 2, 0, 7, 3, 4, 4, 5, 2, 3, 3, 3, 3, 3, 0, 0), # 137
(8, 6, 8, 4, 1, 3, 5, 1, 3, 0, 0, 0, 0, 10, 7, 4, 3, 8, 4, 4, 4, 2, 2, 0, 1, 0), # 138
(10, 5, 5, 8, 5, 2, 1, 2, 1, 2, 1, 0, 0, 8, 12, 7, 2, 7, 5, 0, 3, 2, 1, 3, 1, 0), # 139
(2, 7, 4, 4, 4, 5, 3, 2, 4, 1, 0, 0, 0, 7, 9, 3, 4, 9, 7, 4, 0, 2, 2, 0, 0, 0), # 140
(4, 5, 5, 2, 3, 1, 2, 2, 3, 0, 0, 0, 0, 10, 3, 3, 3, 3, 1, 1, 1, 2, 3, 3, 0, 0), # 141
(7, 1, 7, 6, 8, 1, 1, 4, 2, 0, 0, 1, 0, 2, 6, 10, 7, 5, 3, 2, 0, 2, 5, 0, 0, 0), # 142
(9, 6, 6, 5, 4, 3, 4, 4, 4, 2, 4, 0, 0, 11, 5, 2, 6, 3, 4, 1, 3, 3, 0, 1, 0, 0), # 143
(6, 3, 6, 8, 6, 4, 3, 1, 3, 1, 0, 0, 0, 6, 1, 4, 6, 8, 2, 2, 0, 5, 3, 0, 0, 0), # 144
(8, 1, 9, 10, 7, 6, 1, 2, 0, 2, 0, 1, 0, 11, 1, 4, 2, 11, 3, 2, 0, 1, 0, 0, 0, 0), # 145
(4, 5, 7, 10, 4, 1, 2, 0, 1, 0, 1, 0, 0, 13, 6, 4, 3, 3, 6, 0, 2, 4, 0, 2, 0, 0), # 146
(4, 5, 2, 9, 5, 2, 2, 0, 6, 0, 2, 0, 0, 4, 9, 5, 7, 4, 1, 4, 2, 1, 1, 2, 0, 0), # 147
(6, 8, 7, 2, 4, 4, 2, 1, 1, 0, 0, 1, 0, 8, 7, 5, 4, 10, 3, 2, 2, 2, 2, 0, 1, 0), # 148
(5, 2, 8, 5, 2, 2, 4, 1, 1, 0, 1, 1, 0, 5, 2, 2, 2, 4, 3, 3, 2, 0, 3, 2, 1, 0), # 149
(10, 2, 5, 5, 5, 1, 3, 1, 3, 1, 0, 1, 0, 3, 5, 1, 7, 9, 2, 3, 5, 2, 2, 0, 0, 0), # 150
(3, 6, 1, 2, 4, 2, 3, 2, 1, 1, 1, 0, 0, 5, 8, 3, 3, 8, 1, 1, 1, 3, 3, 1, 0, 0), # 151
(4, 3, 5, 10, 7, 2, 5, 2, 1, 1, 1, 0, 0, 8, 9, 4, 4, 9, 1, 4, 2, 3, 1, 1, 0, 0), # 152
(7, 8, 2, 5, 9, 5, 0, 3, 5, 0, 2, 0, 0, 3, 4, 7, 7, 3, 3, 1, 3, 4, 1, 1, 0, 0), # 153
(7, 3, 4, 5, 3, 2, 0, 2, 1, 0, 0, 0, 0, 6, 2, 3, 0, 2, 2, 2, 1, 4, 1, 0, 0, 0), # 154
(6, 2, 9, 2, 7, 1, 2, 0, 2, 2, 1, 0, 0, 13, 4, 7, 3, 10, 4, 0, 0, 5, 3, 0, 1, 0), # 155
(5, 8, 8, 6, 4, 5, 1, 2, 3, 0, 1, 0, 0, 3, 6, 4, 4, 7, 2, 0, 1, 3, 0, 1, 0, 0), # 156
(5, 4, 9, 9, 3, 1, 2, 3, 1, 1, 1, 0, 0, 8, 5, 2, 1, 7, 2, 2, 2, 1, 1, 2, 0, 0), # 157
(3, 2, 4, 6, 5, 2, 0, 5, 0, 2, 1, 0, 0, 7, 7, 3, 5, 2, 3, 4, 2, 2, 3, 0, 1, 0), # 158
(5, 2, 8, 3, 3, 1, 1, 3, 4, 1, 2, 0, 0, 4, 3, 4, 1, 2, 1, 0, 2, 0, 3, 2, 2, 0), # 159
(5, 7, 3, 6, 8, 6, 3, 1, 3, 1, 1, 0, 0, 6, 7, 1, 4, 6, 2, 3, 4, 4, 2, 1, 0, 0), # 160
(5, 1, 4, 3, 7, 3, 1, 0, 4, 1, 1, 0, 0, 7, 4, 0, 1, 8, 3, 0, 4, 2, 1, 0, 1, 0), # 161
(7, 7, 2, 3, 3, 2, 0, 3, 3, 1, 0, 0, 0, 9, 8, 0, 4, 4, 1, 0, 4, 1, 0, 1, 0, 0), # 162
(9, 4, 8, 5, 3, 1, 1, 2, 3, 2, 1, 0, 0, 9, 2, 7, 3, 11, 3, 3, 3, 0, 3, 1, 0, 0), # 163
(2, 5, 6, 6, 8, 2, 1, 0, 7, 1, 2, 0, 0, 7, 10, 8, 1, 5, 5, 1, 1, 1, 2, 0, 1, 0), # 164
(1, 8, 6, 2, 5, 1, 2, 0, 5, 0, 0, 2, 0, 9, 2, 5, 2, 7, 3, 1, 3, 1, 1, 0, 1, 0), # 165
(5, 2, 7, 6, 8, 0, 1, 2, 1, 1, 1, 0, 0, 2, 5, 3, 5, 11, 5, 2, 1, 3, 3, 3, 0, 0), # 166
(4, 5, 5, 1, 2, 2, 2, 2, 2, 0, 1, 2, 0, 8, 5, 5, 3, 3, 4, 2, 0, 3, 1, 0, 0, 0), # 167
(5, 9, 5, 3, 3, 2, 0, 0, 2, 0, 1, 0, 0, 3, 5, 5, 1, 2, 4, 0, 1, 4, 2, 0, 0, 0), # 168
(8, 4, 6, 4, 2, 2, 2, 1, 0, 0, 1, 0, 0, 9, 2, 4, 7, 2, 0, 2, 2, 2, 2, 2, 0, 0), # 169
(3, 1, 4, 9, 6, 2, 0, 1, 1, 0, 1, 0, 0, 5, 4, 5, 3, 1, 3, 1, 2, 1, 1, 2, 0, 0), # 170
(4, 1, 2, 5, 6, 0, 1, 2, 0, 0, 1, 0, 0, 9, 4, 5, 5, 1, 4, 0, 3, 1, 1, 1, 0, 0), # 171
(4, 3, 4, 4, 1, 2, 0, 1, 1, 0, 2, 0, 0, 5, 4, 4, 1, 5, 1, 1, 1, 1, 1, 3, 0, 0), # 172
(8, 5, 5, 1, 2, 3, 0, 1, 1, 0, 0, 0, 0, 3, 4, 3, 3, 2, 0, 0, 1, 1, 2, 2, 0, 0), # 173
(4, 1, 3, 3, 4, 0, 0, 1, 5, 1, 1, 0, 0, 5, 5, 0, 1, 5, 3, 3, 0, 2, 3, 0, 0, 0), # 174
(1, 3, 3, 5, 2, 3, 1, 1, 4, 0, 0, 1, 0, 3, 2, 5, 1, 4, 0, 1, 2, 2, 1, 0, 0, 0), # 175
(6, 3, 4, 2, 2, 1, 1, 3, 2, 0, 0, 0, 0, 4, 4, 4, 2, 0, 2, 1, 0, 0, 0, 0, 0, 0), # 176
(4, 1, 3, 1, 5, 2, 1, 1, 0, 0, 1, 0, 0, 7, 2, 4, 3, 2, 2, 0, 0, 1, 3, 1, 0, 0), # 177
(3, 5, 4, 2, 2, 2, 0, 0, 3, 0, 1, 0, 0, 2, 1, 5, 0, 4, 0, 0, 1, 2, 0, 0, 0, 0), # 178
(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), # 179
)
station_arriving_intensity = (
(4.0166924626974145, 4.420230847754533, 4.169026583690005, 4.971734219090746, 4.4437484860876895, 2.5109239456298713, 3.3168284922991322, 3.7225409383835384, 4.872079249734406, 3.166412012417896, 3.3642121311084825, 3.918332062644939, 4.067104170062691), # 0
(4.283461721615979, 4.712048555315807, 4.444277273064122, 5.3001154026212935, 4.737992269979389, 2.6767868672340445, 3.535575153010955, 3.9676109783245668, 5.1937962610663275, 3.37518455382172, 3.5864769087649053, 4.176973328651484, 4.3358333179518835), # 1
(4.549378407183785, 5.0027081367127835, 4.718433828437931, 5.627190163731836, 5.0311703789997955, 2.841988091609956, 3.7534548063685635, 4.211700198323536, 5.514229445502039, 3.583131020016437, 3.8078585190210505, 4.434586121642444, 4.603491862567752), # 2
(4.81340623451725, 5.291056401549158, 4.9904086954558835, 5.951661126025659, 5.322129340801522, 3.0058724980680904, 3.9696029133183646, 4.453840925995606, 5.832108128736874, 3.7894261587409446, 4.027478729461906, 4.690148547944369, 4.869018245003381), # 3
(5.074508918732786, 5.57594015942862, 5.259114319762429, 6.272230913106056, 5.609715683037194, 3.1677849659189343, 4.183154934806767, 4.6930654889559325, 6.146161636466166, 3.993244717734143, 4.24445930767246, 4.942638713883811, 5.131350906351854), # 4
(5.331650174946809, 5.856206219954871, 5.523463147002015, 6.587602148576315, 5.892775933359424, 3.3270703744729717, 4.393246331780179, 4.928406214819674, 6.455119294385248, 4.193761444734931, 4.457922021237706, 5.191034725787318, 5.389428287706262), # 5
(5.583793718275733, 6.130701392731601, 5.782367622819093, 6.896477456039722, 6.170156619420835, 3.4830736030406912, 4.59901256518501, 5.158895431201991, 6.757710428189452, 4.390151087482207, 4.666988637742626, 5.434314689981447, 5.642188830159686), # 6
(5.829903263835975, 6.398272487362505, 6.034740192858108, 7.19755945909957, 6.440704268874043, 3.6351395309325767, 4.799589095967668, 5.383565465718042, 7.052664363574116, 4.58158839371487, 4.870780924772215, 5.671456712792743, 5.888570974805216), # 7
(6.068942526743948, 6.65776631345128, 6.279493302763517, 7.489550781359142, 6.703265409371669, 3.782613037459112, 4.994111385074558, 5.60144864598298, 7.338710426234565, 4.76724811117182, 5.068420649911457, 5.901438900547762, 6.127513162735934), # 8
(6.299875222116068, 6.908029680601619, 6.515539398179763, 7.771154046421735, 6.956686568566328, 3.924839001930787, 5.181714893452096, 5.811577299611971, 7.6145779418661395, 4.946304987591954, 5.259029580745342, 6.123239359573051, 6.35795383504493), # 9
(6.5216650650687455, 7.147909398417212, 6.7417909247512995, 8.04107187789063, 7.199814274110641, 4.061162303658086, 5.361535082046684, 6.012983754220169, 7.878996236164172, 5.117933770714171, 5.441729484858859, 6.335836196195162, 6.578831432825289), # 10
(6.7332757707184046, 7.3762522765017655, 6.957160328122573, 8.298006899369119, 7.431495053657227, 4.190927821951495, 5.532707411804733, 6.204700337422732, 8.130694634823994, 5.281309208277375, 5.615642129836999, 6.538207516740648, 6.78908439717009), # 11
(6.93367105418145, 7.591905124458958, 7.160560053938032, 8.54066173446049, 7.650575434858702, 4.313480436121496, 5.694367343672649, 6.385759376834817, 8.368402463540944, 5.435606048020458, 5.7798892832647475, 6.729331427536055, 6.987651169172428), # 12
(7.121814630574301, 7.793714751892496, 7.3509025478421295, 8.767739006768036, 7.855901945367681, 4.428165025478579, 5.845650338596845, 6.555193200071585, 8.590849048010346, 5.579999037682324, 5.933592712727095, 6.908186034907937, 7.173470189925388), # 13
(7.296670215013373, 7.980527968406071, 7.527100255479318, 8.977941339895034, 8.046321112836791, 4.5343264693332275, 5.9856918575237295, 6.7120341347481975, 8.796763713927538, 5.713662925001867, 6.0758741858090275, 7.073749445182848, 7.345479900522051), # 14
(7.457201522615084, 8.151191583603374, 7.688065622494034, 9.169971357444789, 8.220679464918646, 4.63130964699593, 6.1136273613997005, 6.855314508479805, 8.984875786987855, 5.835772457717993, 6.2058554700955355, 7.224999764687337, 7.502618742055505), # 15
(7.602372268495841, 8.304552407088106, 7.83271109453074, 9.342531683020573, 8.377823529265866, 4.718459437777168, 6.228592311171181, 6.984066648881569, 9.153914592886629, 5.945502383569597, 6.32265833317161, 7.360915099747952, 7.643825155618837), # 16
(7.73114616777206, 8.439457248463958, 7.959949117233882, 9.49432494022569, 8.516599833531071, 4.795120720987429, 6.329722167784569, 7.097322883568655, 9.302609457319187, 6.042027450295574, 6.425404542622239, 7.480473556691244, 7.768037582305133), # 17
(7.842486935560164, 8.55475291733462, 8.068692136247904, 9.624053752663423, 8.635854905366871, 4.860638375937203, 6.416152392186281, 7.194115540156209, 9.429689705980877, 6.1245224056348295, 6.513215866032407, 7.582653241843772, 7.874194463207477), # 18
(7.935358286976559, 8.649286223303795, 8.157852597217262, 9.730420743937053, 8.734435272425893, 4.914357281936967, 6.4870184453227155, 7.273476946259397, 9.533884664567024, 6.192161997326263, 6.585214070987103, 7.666432261532077, 7.961234239418957), # 19
(8.008723937137665, 8.72190397597517, 8.226342945786403, 9.812128537649883, 8.811187462360754, 4.955622318297215, 6.54145578814029, 7.334439429493374, 9.61392365877296, 6.2441209731087675, 6.64052092507132, 7.730788722082713, 8.02809535203266), # 20
(8.061547601159893, 8.771452984952447, 8.273075627599775, 9.86787975740519, 8.864958002824071, 4.983778364328429, 6.578599881585408, 7.376035317473299, 9.668536014294018, 6.279574080721244, 6.678258195870048, 7.774700729822235, 8.073716242141662), # 21
(8.092792994159664, 8.796780059839316, 8.296963088301828, 9.89637702680627, 8.89459342146846, 4.998170299341094, 6.59758618660448, 7.397296937814332, 9.696451056825532, 6.297696067902594, 6.697547650968272, 7.797146391077192, 8.097035350839063), # 22
(8.104314690674112, 8.799778875171468, 8.299938545953362, 9.899944650205763, 8.902185644826078, 5.0, 6.599843201807471, 7.399595061728395, 9.699940987654323, 6.299833818015546, 6.699966429729392, 7.799918061271147, 8.1), # 23
(8.112809930427323, 8.79802962962963, 8.299451851851853, 9.899505555555557, 8.906486090891882, 5.0, 6.598603050108934, 7.3964, 9.699473333333334, 6.29852049382716, 6.699699663299665, 7.799269135802469, 8.1), # 24
(8.121125784169264, 8.794581618655693, 8.29849108367627, 9.898636831275722, 8.910691956475603, 5.0, 6.596159122085048, 7.390123456790125, 9.69854938271605, 6.295935070873343, 6.69917071954109, 7.797988111568358, 8.1), # 25
(8.129261615238427, 8.789487517146778, 8.297069410150893, 9.897348353909464, 8.914803094736884, 5.0, 6.592549374646977, 7.380883950617285, 9.69718098765432, 6.29212056698674, 6.698384387080684, 7.7960925468678575, 8.1), # 26
(8.13721678697331, 8.7828, 8.2952, 9.89565, 8.918819358835371, 5.0, 6.587811764705883, 7.3688, 9.69538, 6.28712, 6.697345454545455, 7.793600000000001, 8.1), # 27
(8.1449906627124, 8.774571742112483, 8.292896021947874, 9.893551646090536, 8.922740601930721, 5.0, 6.581984249172921, 7.353990123456791, 9.693158271604938, 6.2809763877457705, 6.696058710562415, 7.790528029263832, 8.1), # 28
(8.1525826057942, 8.764855418381345, 8.290170644718794, 9.89106316872428, 8.926566677182576, 5.0, 6.575104784959253, 7.3365728395061724, 9.690527654320988, 6.273732748056699, 6.6945289437585735, 7.78689419295839, 8.1), # 29
(8.159991979557198, 8.753703703703705, 8.287037037037036, 9.888194444444444, 8.930297437750589, 5.0, 6.567211328976035, 7.316666666666666, 9.6875, 6.265432098765433, 6.692760942760943, 7.782716049382715, 8.1), # 30
(8.167218147339886, 8.741169272976682, 8.283508367626887, 9.88495534979424, 8.933932736794407, 5.0, 6.558341838134432, 7.2943901234567905, 9.684087160493828, 6.256117457704619, 6.6907594961965335, 7.778011156835849, 8.1), # 31
(8.174260472480764, 8.727304801097395, 8.27959780521262, 9.881355761316874, 8.937472427473677, 5.0, 6.548534269345599, 7.269861728395063, 9.680300987654322, 6.245831842706905, 6.688529392692356, 7.772797073616828, 8.1), # 32
(8.181118318318317, 8.712162962962962, 8.27531851851852, 9.877405555555555, 8.94091636294805, 5.0, 6.537826579520697, 7.243200000000001, 9.676153333333334, 6.234618271604939, 6.6860754208754205, 7.7670913580246905, 8.1), # 33
(8.187791048191048, 8.695796433470507, 8.270683676268861, 9.873114609053498, 8.944264396377173, 5.0, 6.526256725570888, 7.214523456790123, 9.671656049382719, 6.222519762231368, 6.68340236937274, 7.760911568358482, 8.1), # 34
(8.194278025437447, 8.678257887517146, 8.26570644718793, 9.868492798353909, 8.947516380920696, 5.0, 6.513862664407327, 7.183950617283951, 9.666820987654322, 6.209579332418839, 6.680515026811323, 7.754275262917239, 8.1), # 35
(8.200578613396004, 8.6596, 8.2604, 9.86355, 8.950672169738269, 5.0, 6.500682352941176, 7.151600000000001, 9.66166, 6.1958400000000005, 6.677418181818182, 7.747200000000001, 8.1), # 36
(8.20669217540522, 8.639875445816186, 8.254777503429356, 9.85829609053498, 8.953731615989538, 5.0, 6.486753748083595, 7.11759012345679, 9.656184938271606, 6.1813447828075, 6.674116623020328, 7.739703337905808, 8.1), # 37
(8.212618074803581, 8.619136899862827, 8.248852126200275, 9.85274094650206, 8.956694572834152, 5.0, 6.4721148067457435, 7.0820395061728405, 9.650407654320988, 6.166136698673983, 6.670615139044769, 7.7318028349337, 8.1), # 38
(8.218355674929589, 8.597437037037038, 8.242637037037039, 9.846894444444445, 8.959560893431762, 5.0, 6.456803485838781, 7.045066666666667, 9.644340000000001, 6.150258765432099, 6.666918518518519, 7.723516049382716, 8.1), # 39
(8.22390433912173, 8.574828532235939, 8.236145404663922, 9.84076646090535, 8.962330430942016, 5.0, 6.440857742273865, 7.006790123456792, 9.637993827160495, 6.133754000914496, 6.663031550068587, 7.714860539551899, 8.1), # 40
(8.229263430718502, 8.551364060356653, 8.229390397805213, 9.834366872427985, 8.965003038524562, 5.0, 6.424315532962156, 6.967328395061729, 9.631380987654321, 6.116665422953818, 6.658959022321986, 7.705853863740284, 8.1), # 41
(8.2344323130584, 8.527096296296298, 8.222385185185187, 9.827705555555557, 8.967578569339047, 5.0, 6.4072148148148145, 6.9268, 9.624513333333335, 6.0990360493827165, 6.654705723905725, 7.696513580246914, 8.1), # 42
(8.239410349479915, 8.50207791495199, 8.215142935528121, 9.820792386831277, 8.970056876545122, 5.0, 6.389593544743001, 6.8853234567901245, 9.617402716049384, 6.080908898033837, 6.650276443446813, 7.6868572473708285, 8.1), # 43
(8.244196903321543, 8.47636159122085, 8.2076768175583, 9.813637242798356, 8.972437813302436, 5.0, 6.371489679657872, 6.843017283950619, 9.610060987654322, 6.062326986739826, 6.645675969572266, 7.676902423411066, 8.1), # 44
(8.248791337921773, 8.450000000000001, 8.200000000000001, 9.80625, 8.974721232770637, 5.0, 6.352941176470589, 6.800000000000001, 9.6025, 6.043333333333334, 6.640909090909091, 7.666666666666666, 8.1), # 45
(8.253193016619106, 8.423045816186557, 8.192125651577504, 9.798640534979425, 8.976906988109373, 5.0, 6.333985992092311, 6.756390123456791, 9.594731604938271, 6.023970955647005, 6.635980596084299, 7.656167535436672, 8.1), # 46
(8.257401302752028, 8.39555171467764, 8.18406694101509, 9.790818724279836, 8.978994932478294, 5.0, 6.3146620834341975, 6.712306172839506, 9.586767654320989, 6.004282871513489, 6.630895273724903, 7.64542258802012, 8.1), # 47
(8.261415559659037, 8.367570370370371, 8.175837037037038, 9.782794444444447, 8.980984919037049, 5.0, 6.295007407407407, 6.667866666666668, 9.57862, 5.984312098765432, 6.625657912457912, 7.634449382716049, 8.1), # 48
(8.26523515067863, 8.339154458161865, 8.167449108367627, 9.774577572016462, 8.982876800945286, 5.0, 6.275059920923102, 6.623190123456791, 9.57030049382716, 5.964101655235483, 6.6202733009103385, 7.623265477823503, 8.1), # 49
(8.268859439149294, 8.310356652949247, 8.15891632373114, 9.766177983539094, 8.984670431362652, 5.0, 6.25485758089244, 6.578395061728395, 9.56182098765432, 5.943694558756287, 6.61474622770919, 7.611888431641519, 8.1), # 50
(8.272287788409528, 8.28122962962963, 8.150251851851852, 9.757605555555557, 8.9863656634488, 5.0, 6.23443834422658, 6.5336, 9.553193333333335, 5.923133827160494, 6.609081481481482, 7.600335802469137, 8.1), # 51
(8.275519561797823, 8.251826063100138, 8.141468861454047, 9.748870164609054, 8.987962350363372, 5.0, 6.213840167836683, 6.488923456790123, 9.54442938271605, 5.90246247828075, 6.603283850854222, 7.588625148605397, 8.1), # 52
(8.278554122652675, 8.222198628257889, 8.132580521262005, 9.739981687242798, 8.989460345266023, 5.0, 6.1931010086339064, 6.444483950617284, 9.535540987654322, 5.881723529949703, 6.597358124454421, 7.576774028349337, 8.1), # 53
(8.281390834312573, 8.192400000000001, 8.1236, 9.73095, 8.990859501316402, 5.0, 6.172258823529412, 6.400399999999999, 9.52654, 5.86096, 6.59130909090909, 7.5648, 8.1), # 54
(8.284029060116017, 8.162482853223594, 8.114540466392318, 9.721784979423868, 8.992159671674152, 5.0, 6.151351569434358, 6.35679012345679, 9.517438271604938, 5.84021490626429, 6.585141538845242, 7.552720621856425, 8.1), # 55
(8.286468163401498, 8.132499862825789, 8.105415089163237, 9.712496502057613, 8.993360709498928, 5.0, 6.130417203259905, 6.313772839506173, 9.508247654320988, 5.819531266575218, 6.578860256889887, 7.54055345221765, 8.1), # 56
(8.288707507507507, 8.102503703703704, 8.096237037037039, 9.703094444444446, 8.994462467950374, 5.0, 6.109493681917211, 6.271466666666668, 9.498980000000001, 5.798952098765433, 6.572470033670034, 7.528316049382716, 8.1), # 57
(8.290746455772544, 8.072547050754459, 8.087019478737998, 9.693588683127572, 8.99546480018814, 5.0, 6.088618962317438, 6.2299901234567905, 9.489647160493828, 5.778520420667582, 6.565975657812697, 7.516025971650663, 8.1), # 58
(8.292584371535098, 8.042682578875171, 8.077775582990398, 9.683989094650206, 8.996367559371876, 5.0, 6.067831001371743, 6.189461728395062, 9.480260987654322, 5.758279250114313, 6.55938191794488, 7.503700777320531, 8.1), # 59
(8.294220618133663, 8.012962962962964, 8.068518518518518, 9.674305555555556, 8.99717059866123, 5.0, 6.0471677559912855, 6.15, 9.470833333333335, 5.738271604938272, 6.552693602693603, 7.491358024691358, 8.1), # 60
(8.295654558906731, 7.983440877914953, 8.05926145404664, 9.664547942386832, 8.997873771215849, 5.0, 6.026667183087227, 6.1117234567901235, 9.461376049382716, 5.718540502972108, 6.545915500685871, 7.4790152720621865, 8.1), # 61
(8.296885557192804, 7.954168998628258, 8.050017558299041, 9.654726131687244, 8.998476930195388, 5.0, 6.006367239570725, 6.074750617283951, 9.451900987654321, 5.699128962048469, 6.539052400548697, 7.4666900777320535, 8.1), # 62
(8.297912976330368, 7.9252, 8.0408, 9.644850000000002, 8.998979928759486, 5.0, 5.986305882352941, 6.039200000000001, 9.44242, 5.68008, 6.532109090909092, 7.4544, 8.1), # 63
(8.298736179657919, 7.896586556927298, 8.0316219478738, 9.634929423868314, 8.999382620067799, 5.0, 5.966521068345034, 6.005190123456791, 9.432944938271605, 5.661436634659351, 6.5250903603940635, 7.442162597165067, 8.1), # 64
(8.29935453051395, 7.86838134430727, 8.02249657064472, 9.624974279835392, 8.999684857279973, 5.0, 5.947050754458163, 5.972839506172839, 9.423487654320988, 5.643241883859168, 6.518000997630629, 7.429995427526291, 8.1), # 65
(8.299767392236957, 7.840637037037038, 8.013437037037038, 9.614994444444445, 8.999886493555659, 5.0, 5.927932897603486, 5.942266666666668, 9.414060000000001, 5.625538765432099, 6.510845791245791, 7.417916049382717, 8.1), # 66
(8.299974128165434, 7.813406310013717, 8.004456515775034, 9.604999794238683, 8.999987382054504, 5.0, 5.909205454692165, 5.913590123456792, 9.404673827160494, 5.608370297210792, 6.5036295298665685, 7.405942021033379, 8.1), # 67
(8.29983329158466, 7.786598911456259, 7.9955247599451305, 9.594913392377887, 8.999902364237876, 4.99990720926688, 5.890812155863717, 5.88667508001829, 9.395270278920897, 5.591696353317733, 6.496228790832301, 7.394024017519794, 8.099900120027435), # 68
(8.298513365539453, 7.75939641577061, 7.98639074074074, 9.584226811594203, 8.99912854030501, 4.999173662551441, 5.872214545077291, 5.860079012345679, 9.385438271604938, 5.575045112563544, 6.487890271132376, 7.38177517868746, 8.099108796296298), # 69
(8.295908630047116, 7.731673967874684, 7.977014746227709, 9.572869699409555, 8.997599451303154, 4.9977290047248895, 5.853328107649096, 5.833561957018748, 9.375122313671698, 5.558335619570188, 6.478519109220864, 7.369138209034247, 8.097545867626888), # 70
(8.292055728514343, 7.703448134873224, 7.967400068587105, 9.560858803005905, 8.995334463003308, 4.995596646852614, 5.8341613276311906, 5.807132693187015, 9.364337768632831, 5.541568287474112, 6.468149896627089, 7.356122349770172, 8.095231910150892), # 71
(8.286991304347827, 7.674735483870967, 7.9575499999999995, 9.548210869565217, 8.99235294117647, 4.992800000000001, 5.81472268907563, 5.7808, 9.353100000000001, 5.524743529411765, 6.456817224880384, 7.342736842105264, 8.0921875), # 72
(8.280752000954257, 7.6455525819726535, 7.947467832647462, 9.534942646269458, 8.988674251593642, 4.989362475232434, 5.795020676034474, 5.754572656607225, 9.341424371284866, 5.507861758519595, 6.444555685510071, 7.328990927249535, 8.0884332133059), # 73
(8.273374461740323, 7.615915996283022, 7.937156858710562, 9.52107088030059, 8.98431776002582, 4.985307483615303, 5.775063772559778, 5.728459442158208, 9.329326245999086, 5.49092338793405, 6.431399870045485, 7.314893846413014, 8.083989626200276), # 74
(8.26489533011272, 7.5858422939068095, 7.92662037037037, 9.50661231884058, 8.97930283224401, 4.980658436213993, 5.754860462703601, 5.7024691358024695, 9.31682098765432, 5.473928830791576, 6.417384370015949, 7.300454840805718, 8.078877314814816), # 75
(8.255351249478142, 7.55534804194876, 7.915861659807956, 9.49158370907139, 8.973648834019205, 4.975438744093889, 5.734419230517997, 5.6766105166895295, 9.303923959762232, 5.4568785002286235, 6.402543776950793, 7.2856831516376666, 8.073116855281206), # 76
(8.244778863243274, 7.524449807513609, 7.904884019204388, 9.476001798174986, 8.967375131122408, 4.9696718183203785, 5.7137485600550235, 5.650892363968908, 9.290650525834478, 5.43977280938164, 6.38691268237935, 7.270588020118885, 8.06672882373114), # 77
(8.233214814814815, 7.493164157706095, 7.893690740740741, 9.459883333333334, 8.96050108932462, 4.963381069958848, 5.69285693536674, 5.625323456790124, 9.277016049382715, 5.422612171387073, 6.370525677830941, 7.255178687459391, 8.059733796296298), # 78
(8.220695747599452, 7.461507659630958, 7.88228511659808, 9.443245061728396, 8.953046074396838, 4.956589910074683, 5.671752840505201, 5.5999125743026985, 9.26303589391861, 5.405396999381371, 6.353417354834898, 7.239464394869204, 8.052152349108367), # 79
(8.207258305003878, 7.429496880392938, 7.870670438957475, 9.426103730542136, 8.945029452110063, 4.949321749733272, 5.650444759522465, 5.574668495656151, 9.248725422953818, 5.388127706500981, 6.335622304920551, 7.223454383558348, 8.04400505829904), # 80
(8.192939130434784, 7.397148387096775, 7.85885, 9.408476086956524, 8.936470588235293, 4.9416, 5.628941176470589, 5.549600000000001, 9.2341, 5.370804705882353, 6.317175119617225, 7.207157894736842, 8.0353125), # 81
(8.177774867298861, 7.364478746847206, 7.8468270919067225, 9.390378878153516, 8.927388848543533, 4.933448071940254, 5.607250575401629, 5.524715866483768, 9.219174988568815, 5.353428410661933, 6.298110390454251, 7.190584169614709, 8.026095250342937), # 82
(8.161802159002804, 7.331504526748971, 7.834605006858711, 9.371828851315083, 8.917803598805778, 4.924889376619419, 5.585381440367643, 5.500024874256973, 9.203965752171925, 5.335999233976169, 6.278462708960955, 7.17374244940197, 8.016373885459535), # 83
(8.145057648953301, 7.29824229390681, 7.822187037037037, 9.35284275362319, 8.907734204793028, 4.915947325102881, 5.563342255420687, 5.475535802469135, 9.188487654320987, 5.3185175889615115, 6.258266666666667, 7.156641975308642, 8.006168981481482), # 84
(8.127577980557048, 7.264708615425461, 7.80957647462277, 9.333437332259797, 8.897200032276286, 4.906645328456029, 5.54114150461282, 5.451257430269777, 9.172756058527662, 5.300983888754405, 6.237556855100715, 7.13929198854475, 7.995501114540467), # 85
(8.10939979722073, 7.230920058409665, 7.796776611796983, 9.313629334406873, 8.886220447026547, 4.897006797744247, 5.518787671996097, 5.4271985368084135, 9.156786328303614, 5.283398546491299, 6.216367865792428, 7.121701730320315, 7.984390860768176), # 86
(8.090559742351045, 7.1968931899641575, 7.7837907407407405, 9.293435507246377, 8.874814814814817, 4.887055144032922, 5.496289241622575, 5.403367901234568, 9.140593827160496, 5.265761975308642, 6.194734290271132, 7.103880441845354, 7.972858796296297), # 87
(8.071094459354686, 7.162644577193681, 7.7706221536351165, 9.27287259796028, 8.863002501412089, 4.876813778387441, 5.473654697544313, 5.37977430269776, 9.124193918609969, 5.248074588342881, 6.172690720066159, 7.085837364329892, 7.960925497256517), # 88
(8.051040591638339, 7.128190787202974, 7.75727414266118, 9.251957353730543, 8.850802872589366, 4.8663061118731905, 5.4508925238133665, 5.356426520347508, 9.107601966163696, 5.230336798730466, 6.150271746706835, 7.067581738983948, 7.948611539780521), # 89
(8.030434782608696, 7.093548387096774, 7.74375, 9.230706521739132, 8.838235294117649, 4.855555555555556, 5.428011204481793, 5.333333333333333, 9.090833333333334, 5.2125490196078434, 6.1275119617224885, 7.049122807017544, 7.9359375000000005), # 90
(8.00931367567245, 7.058733943979822, 7.730053017832647, 9.20913684916801, 8.825319131767932, 4.8445855204999235, 5.405019223601649, 5.3105035208047555, 9.073903383630546, 5.194711664111461, 6.104445956642448, 7.0304698096406995, 7.922923954046638), # 91
(7.9877139142362985, 7.023764024956858, 7.716186488340192, 9.187265083199142, 8.812073751311223, 4.833419417771681, 5.381925065224994, 5.287945861911295, 9.056827480566987, 5.176825145377768, 6.081108322996043, 7.011631988063439, 7.909591478052126), # 92
(7.965672141706924, 6.988655197132617, 7.702153703703704, 9.165107971014494, 8.798518518518518, 4.822080658436214, 5.358737213403881, 5.26566913580247, 9.039620987654322, 5.15888987654321, 6.0575336523126, 6.992618583495776, 7.895960648148147), # 93
(7.943225001491024, 6.953424027611842, 7.6879579561042535, 9.142682259796029, 8.784672799160816, 4.810592653558909, 5.335464152190369, 5.243682121627802, 9.022299268404208, 5.140906270744238, 6.033756536121448, 6.973438837147739, 7.882052040466393), # 94
(7.920409136995288, 6.9180870834992705, 7.673602537722909, 9.120004696725712, 8.770555959009119, 4.798978814205152, 5.312114365636515, 5.221993598536809, 9.004877686328305, 5.122874741117297, 6.009811565951917, 6.954101990229344, 7.867886231138546), # 95
(7.89726119162641, 6.882660931899643, 7.659090740740742, 9.097092028985507, 8.756187363834423, 4.787262551440329, 5.288696337794377, 5.200612345679013, 8.987371604938271, 5.104795700798839, 5.985733333333334, 6.934617283950619, 7.853483796296297), # 96
(7.873817808791078, 6.847162139917697, 7.64442585733882, 9.07396100375738, 8.741586379407732, 4.775467276329827, 5.265218552716011, 5.179547142203933, 8.969796387745772, 5.086669562925308, 5.961556429795026, 6.914993959521576, 7.838865312071332), # 97
(7.850115631895988, 6.811607274658171, 7.629611179698216, 9.050628368223297, 8.726772371500042, 4.763616399939035, 5.241689494453475, 5.158806767261089, 8.952167398262459, 5.068496740633154, 5.937315446866325, 6.895241258152239, 7.824051354595337), # 98
(7.826191304347827, 6.776012903225807, 7.614650000000001, 9.027110869565218, 8.711764705882354, 4.751733333333333, 5.218117647058825, 5.138400000000001, 8.9345, 5.050277647058824, 5.913044976076556, 6.875368421052632, 7.8090625000000005), # 99
(7.80208146955329, 6.740395592725341, 7.59954561042524, 9.00342525496511, 8.696582748325667, 4.739841487578113, 5.194511494584116, 5.118335619570188, 8.916809556470051, 5.032012695338767, 5.888779608955048, 6.855384689432774, 7.79391932441701), # 100
(7.777822770919068, 6.704771910261517, 7.584301303155008, 8.979588271604939, 8.681245864600985, 4.727964273738759, 5.17087952108141, 5.09862240512117, 8.899111431184272, 5.013702298609431, 5.86455393703113, 6.835299304502683, 7.7786424039780515), # 101
(7.753451851851853, 6.669158422939069, 7.56892037037037, 8.955616666666668, 8.665773420479303, 4.7161251028806594, 5.1472302106027605, 5.07926913580247, 8.881420987654321, 4.995346870007263, 5.840402551834131, 6.815121507472385, 7.763252314814816), # 102
(7.729005355758336, 6.633571697862738, 7.5534061042524, 8.93152718733226, 8.650184781731623, 4.704347386069197, 5.123572047200224, 5.060284590763604, 8.86375358939186, 4.976946822668712, 5.816360044893379, 6.794860539551898, 7.747769633058984), # 103
(7.704519926045208, 6.598028302137263, 7.537761796982167, 8.907336580783683, 8.634499314128943, 4.692654534369761, 5.099913514925861, 5.041677549154093, 8.846124599908551, 4.958502569730225, 5.792461007738201, 6.774525641951243, 7.732214934842251), # 104
(7.680032206119162, 6.562544802867383, 7.5219907407407405, 8.883061594202898, 8.618736383442267, 4.681069958847737, 5.076263097831727, 5.023456790123458, 8.82854938271605, 4.940014524328251, 5.768740031897927, 6.754126055880443, 7.716608796296296), # 105
(7.655578839386891, 6.527137767157839, 7.5060962277091905, 8.858718974771874, 8.602915355442589, 4.669617070568511, 5.052629279969876, 5.005631092821217, 8.811043301326016, 4.921483099599236, 5.745231708901884, 6.733671022549515, 7.700971793552812), # 106
(7.631196469255085, 6.491823762113369, 7.490081550068588, 8.83432546967257, 8.587055595900912, 4.65831928059747, 5.0290205453923695, 4.988209236396892, 8.793621719250115, 4.9029087086796315, 5.721970630279402, 6.713169783168484, 7.685324502743484), # 107
(7.606921739130435, 6.456619354838711, 7.473950000000001, 8.809897826086958, 8.571176470588235, 4.647200000000001, 5.0054453781512604, 4.9712000000000005, 8.7763, 4.884291764705883, 5.698991387559809, 6.69263157894737, 7.669687500000001), # 108
(7.582791292419635, 6.421541112438604, 7.4577048696845, 8.785452791196994, 8.55529734527556, 4.636282639841488, 4.98191226229861, 4.954612162780065, 8.759093507087334, 4.865632680814438, 5.676328572272432, 6.67206565109619, 7.654081361454047), # 109
(7.558841772529373, 6.38660560201779, 7.441349451303157, 8.761007112184648, 8.539437585733884, 4.625590611187319, 4.9584296818864715, 4.938454503886603, 8.742017604023777, 4.846931870141747, 5.654016775946601, 6.651481240824971, 7.638526663237312), # 110
(7.535109822866345, 6.351829390681004, 7.424887037037038, 8.736577536231884, 8.523616557734206, 4.615147325102881, 4.935006120966905, 4.922735802469136, 8.725087654320989, 4.828189745824256, 5.632090590111643, 6.630887589343731, 7.623043981481482), # 111
(7.51163208683724, 6.317229045532987, 7.408320919067217, 8.712180810520666, 8.507853627047528, 4.6049761926535595, 4.911650063591967, 4.907464837677184, 8.708319021490626, 4.809406720998413, 5.610584606296888, 6.6102939378624885, 7.607653892318244), # 112
(7.488403378962436, 6.282878895028762, 7.391694262601655, 8.687867105993632, 8.492140544138964, 4.595095815371611, 4.888420770925416, 4.892682055024485, 8.691770249006897, 4.790643789290184, 5.589539124922293, 6.589754349203543, 7.592355120674577), # 113
(7.465184718320052, 6.249117746820429, 7.375236540017295, 8.663831537021869, 8.476314683653062, 4.585483686823921, 4.865614566728464, 4.878569007604096, 8.675695228570449, 4.772252134330226, 5.568995469690558, 6.56952973769038, 7.577020331328028), # 114
(7.441907922403196, 6.215957758946438, 7.358957546165854, 8.640067604145424, 8.460326142310882, 4.576114809999011, 4.84324772015325, 4.865122123422967, 8.660099982935032, 4.754260262390462, 5.548923609141675, 6.549630066047081, 7.561605305328301), # 115
(7.418543898590108, 6.183350625033362, 7.342825751987099, 8.616532920213123, 8.444150821107023, 4.566967101829678, 4.821283854022315, 4.852304250319195, 8.644945071382265, 4.736634686759638, 5.529284745017185, 6.530018557989877, 7.546085807804713), # 116
(7.395063554259018, 6.151248038707777, 7.326809628420789, 8.593185098073794, 8.427764621036088, 4.558018479248712, 4.799686591158202, 4.840078236130868, 8.630191053193762, 4.719341920726503, 5.510040079058626, 6.5106584372350005, 7.53043760388658), # 117
(7.371437796788169, 6.119601693596259, 7.310877646406694, 8.569981750576266, 8.411143443092675, 4.549246859188911, 4.7784195543834524, 4.828406928696078, 8.615798487651148, 4.7023484775798075, 5.49115081300754, 6.49151292749868, 7.51463645870322), # 118
(7.347637533555794, 6.088363283325384, 7.294998276884579, 8.546880490569364, 8.394263188271378, 4.540630158583066, 4.757446366520605, 4.817253175852916, 8.601727934036035, 4.685620870608298, 5.4725781486054625, 6.472545252497148, 7.498658137383946), # 119
(7.323633671940129, 6.057484501521727, 7.27913999079421, 8.523838930901915, 8.377099757566798, 4.532146294363972, 4.736730650392203, 4.806579825439474, 8.587939951630046, 4.669125613100724, 5.454283287593933, 6.453718635946638, 7.482478405058078), # 120
(7.299397119319415, 6.026917041811863, 7.26327125907535, 8.500814684422748, 8.359629051973535, 4.523773183464424, 4.716236028820784, 4.796349725293846, 8.574395099714799, 4.652829218345837, 5.436227431714493, 6.434996301563378, 7.466073026854929), # 121
(7.274898783071883, 5.996612597822369, 7.247360552667769, 8.477765363980685, 8.341826972486187, 4.515488742817215, 4.695926124628894, 4.786525723254119, 8.561053937571911, 4.636698199632382, 5.4183717827086815, 6.416341473063601, 7.4494177679038165), # 122
(7.250109570575775, 5.9665228631798195, 7.231376342511229, 8.454648582424555, 8.323669420099353, 4.50727088935514, 4.675764560639071, 4.7770706671583865, 8.547877024483004, 4.62069907024911, 5.400677542318036, 6.397717374163538, 7.432488393334058), # 123
(7.225000389209324, 5.93659953151079, 7.215287099545496, 8.43142195260319, 8.30513229580763, 4.499097540010991, 4.655714959673856, 4.767947404844741, 8.534824919729692, 4.604798343484769, 5.383105912284096, 6.3790872285794205, 7.4152606682749695), # 124
(7.199542146350767, 5.9067942964418565, 7.199061294710339, 8.408043087365408, 8.286191500605618, 4.490946611717565, 4.635740944555791, 4.759118784151273, 8.521858182593595, 4.588962532628107, 5.3656180943484015, 6.360414260027479, 7.397710357855863), # 125
(7.1737057493783425, 5.877058851599596, 7.182667398945519, 8.384469599560044, 8.266822935487914, 4.482796021407654, 4.615806138107416, 4.750547652916074, 8.508937372356334, 4.573158150967874, 5.348175290252491, 6.341661692223948, 7.379813227206063), # 126
(7.147462105670289, 5.84734489061058, 7.166073883190804, 8.36065910203592, 8.247002501449119, 4.474623686014052, 4.595874163151275, 4.742196858977237, 8.496023048299525, 4.557351711792819, 5.3307387017379035, 6.322792748885053, 7.361545041454879), # 127
(7.120782122604837, 5.817604107101388, 7.14924921838596, 8.336569207641865, 8.226706099483833, 4.466407522469555, 4.575908642509906, 4.73402925017285, 8.483075769704788, 4.5415097283916905, 5.3132695305461795, 6.303770653727031, 7.34288156573163), # 128
(7.093636707560226, 5.787788194698593, 7.132161875470752, 8.312157529226706, 8.20590963058665, 4.458125447706956, 4.555873199005851, 4.726007674341008, 8.47005609585374, 4.5255987140532365, 5.2957289784188575, 6.284558630466109, 7.323798565165631), # 129
(7.065996767914694, 5.757848847028773, 7.1147803253849435, 8.28738167963927, 8.18458899575217, 4.449755378659047, 4.53573145546165, 4.7180949793198, 8.456924586028, 4.509585182066206, 5.278078247097476, 6.2651199028185225, 7.3042718048861985), # 130
(7.037833211046475, 5.727737757718502, 7.097073039068305, 8.262199271728381, 8.162720095974995, 4.441275232258625, 4.515447034699847, 4.71025401294732, 8.443641799509189, 4.493435645719348, 5.260278538323575, 6.2454176945004996, 7.2842770500226495), # 131
(7.009116944333808, 5.697406620394355, 7.079008487460597, 8.23656791834287, 8.140278832249724, 4.432662925438482, 4.49498355954298, 4.7024476230616585, 8.430168295578923, 4.4771166183014115, 5.2422910538386915, 6.225415229228274, 7.263790065704301), # 132
(6.979818875154931, 5.666807128682908, 7.060555141501587, 8.210445232331562, 8.11724110557095, 4.423896375131413, 4.474304652813592, 4.694638657500906, 8.416464633518821, 4.460594613101146, 5.224076995384369, 6.205075730718074, 7.242786617060469), # 133
(6.949909910888076, 5.635890976210739, 7.041681472131043, 8.183788826543283, 8.093582816933274, 4.414953498270212, 4.453373937334223, 4.686789964103155, 8.402491372610504, 4.443836143407299, 5.205597564702143, 6.184362422686133, 7.221242469220467), # 134
(6.919360958911483, 5.604609856604419, 7.022355950288727, 8.156556313826863, 8.069279867331296, 4.405812211787674, 4.432155035927415, 4.678864390706496, 8.388209072135584, 4.426807722508621, 5.186813963533554, 6.163238528848682, 7.199133387313616), # 135
(6.888142926603388, 5.572915463490528, 7.002547046914407, 8.128705307031124, 8.044308157759614, 4.396450432616592, 4.410611571415708, 4.670824785149022, 8.373578291375685, 4.409475863693858, 5.167687393620142, 6.1416672729219535, 7.176435136469229), # 136
(6.856226721342027, 5.540759490495638, 6.982223232947849, 8.100193419004901, 8.018643589212827, 4.386846077689759, 4.388707166621645, 4.662633995268823, 8.358559589612426, 4.391807080251762, 5.1481790567034444, 6.119611878622176, 7.153123481816621), # 137
(6.823583250505639, 5.508093631246327, 6.961352979328814, 8.070978262597011, 7.992262062685535, 4.376977063939971, 4.366405444367763, 4.654254868903992, 8.343113526127425, 4.373767885471078, 5.128250154525002, 6.097035569665582, 7.129174188485113), # 138
(6.790183421472455, 5.4748695793691695, 6.939904756997072, 8.041017450656287, 7.965139479172333, 4.366821308300021, 4.343670027476608, 4.64565025389262, 8.327200660202298, 4.355324792640558, 5.107861888826353, 6.073901569768405, 7.104563021604015), # 139
(6.755998141620719, 5.44103902849074, 6.91784703689239, 8.010268596031556, 7.937251739667824, 4.356356727702703, 4.320464538770717, 4.636782998072797, 8.310781551118666, 4.336444315048949, 5.086975461349035, 6.050173102646873, 7.079265746302652), # 140
(6.720998318328665, 5.406553672237617, 6.895148289954529, 7.978689311571642, 7.908574745166603, 4.345561239080812, 4.296752601072636, 4.6276159492826165, 8.293816758158144, 4.317092965985001, 5.065552073834591, 6.02581339201722, 7.053258127710331), # 141
(6.685154858974525, 5.371365204236373, 6.871776987123257, 7.946237210125377, 7.87908439666327, 4.334412759367142, 4.272497837204901, 4.6181119553601695, 8.276266840602354, 4.2972372587374625, 5.043552928024558, 6.000785661595676, 7.026515930956373), # 142
(6.64843867093654, 5.335425318113585, 6.8477015993383406, 7.91286990454158, 7.848756595152423, 4.322889205494485, 4.247663869990055, 4.608233864143545, 8.258092357732918, 4.276843706595082, 5.020939225660475, 5.975053135098472, 6.999014921170094), # 143
(6.610820661592948, 5.298685707495829, 6.822890597539542, 7.878545007669086, 7.817567241628663, 4.310968494395637, 4.222214322250639, 4.597944523470839, 8.239253868831447, 4.255878822846608, 4.997672168483881, 5.948579036241839, 6.970730863480812), # 144
(6.572271738321982, 5.26109806600968, 6.797312452666631, 7.843220132356716, 7.785492237086586, 4.298628543003392, 4.196112816809195, 4.587206781180141, 8.219711933179564, 4.23430912078079, 4.973712958236316, 5.921326588742011, 6.94163952301784), # 145
(6.5327628085018805, 5.2226140872817135, 6.770935635659374, 7.806852891453301, 7.7525074825207945, 4.285847268250545, 4.169322976488264, 4.575983485109542, 8.199427110058885, 4.212101113686376, 4.949022796659319, 5.893259016315216, 6.911716664910495), # 146
(6.49226477951088, 5.1831854649385045, 6.743728617457528, 7.769400897807664, 7.718588878925882, 4.272602587069886, 4.141808424110385, 4.564237483097132, 8.178359958751033, 4.189221314852117, 4.923562885494429, 5.864339542677689, 6.8809380542880945), # 147
(6.450748558727217, 5.142763892606631, 6.715659869000866, 7.730821764268637, 7.683712327296449, 4.258872416394214, 4.113532782498101, 4.551931622981006, 8.156471038537623, 4.1656362375667575, 4.897294426483186, 5.8345313915456565, 6.8492794562799535), # 148
(6.40818505352913, 5.101301063912665, 6.686697861229155, 7.691073103685042, 7.647853728627097, 4.24463467315632, 4.084459674473953, 4.539028752599253, 8.13372090870027, 4.1413123951190505, 4.870178621367128, 5.803797786635354, 6.81671663601539), # 149
(6.364545171294852, 5.058748672483183, 6.656811065082156, 7.65011252890571, 7.610988983912421, 4.229867274288999, 4.054552722860481, 4.525491719789965, 8.110070128520602, 4.116216300797741, 4.8421766718877945, 5.772101951663011, 6.783225358623717), # 150
(6.31979981940262, 5.015058411944763, 6.625967951499634, 7.607897652779464, 7.573093994147022, 4.214548136725044, 4.023775550480226, 4.511283372391235, 8.085479257280232, 4.090314467891583, 4.813249779786724, 5.739407110344858, 6.748781389234255), # 151
(6.273919905230675, 4.970181975923978, 6.594136991421362, 7.5643860881551355, 7.534144660325495, 4.198655177397251, 3.992091780155732, 4.496366558241153, 8.059908854260776, 4.06357340968932, 4.7833591468054575, 5.705676486397127, 6.713360492976318), # 152
(6.226876336157249, 4.924071058047406, 6.561286655787095, 7.519535447881546, 7.4941168834424445, 4.182166313238413, 3.9594650347095355, 4.48070412517781, 8.03331947874386, 4.035959639479703, 4.752465974685533, 5.670873303536052, 6.676938434979222), # 153
(6.178640019560583, 4.87667735194162, 6.527385415536607, 7.473303344807528, 7.452986564492464, 4.165059461181324, 3.9258589369641825, 4.464258921039298, 8.005671690011093, 4.0074396705514825, 4.72053146516849, 5.63496078547786, 6.639490980372286), # 154
(6.129181862818909, 4.827952551233196, 6.492401741609661, 7.425647391781903, 7.410729604470157, 4.147312538158777, 3.891237109742209, 4.446993793663709, 7.976926047344103, 3.9779800161934036, 4.687516819995866, 5.597902155938786, 6.600993894284821), # 155
(6.078472773310465, 4.7778483495487105, 6.456304104946021, 7.3765252016535, 7.367321904370119, 4.128903461103569, 3.85556317586616, 4.428871590889135, 7.947043110024501, 3.9475471896942183, 4.6533832409092035, 5.559660638635059, 6.561422941846148), # 156
(6.02648365841349, 4.726316440514739, 6.419060976485454, 7.32589438727115, 7.322739365186948, 4.109810146948491, 3.8188007581585754, 4.409855160553666, 7.915983437333911, 3.9161077043426733, 4.618091929650039, 5.52019945728291, 6.520753888185581), # 157
(5.971744757124192, 4.672362496617807, 6.378873563121885, 7.271815665320995, 7.274944884696798, 4.088819581053688, 3.780085376742286, 4.388637561879498, 7.881329673279279, 3.882692733032915, 4.580476602031154, 5.478079651355472, 6.477188687532276), # 158
(5.9058294135827225, 4.610452255679582, 6.32539025472239, 7.203181727030763, 7.212153047825303, 4.058951718405683, 3.734570210708573, 4.357770826211506, 7.829141808977716, 3.8418247952789963, 4.533933548495195, 5.425090018946487, 6.420342117536156), # 159
(5.827897675923448, 4.540077382832571, 6.257536766364711, 7.118862008327088, 7.133136105077437, 4.019473036838147, 3.6817949987070273, 4.316479351621878, 7.757940181782921, 3.792964521490315, 4.477807606887632, 5.360401559110278, 6.349136487114865), # 160
(5.738577643668768, 4.461696694464375, 6.1760375775282474, 7.019658003005382, 7.038714499425691, 3.970861793256251, 3.622145156805501, 4.265280426487824, 7.668663813599214, 3.7365265545367503, 4.412593323679766, 5.284613975126057, 6.264299235855278), # 161
(5.638497416341085, 4.375769006962591, 6.0816171676923965, 6.9063712048610615, 6.929708673842564, 3.9135962445651646, 3.5560061010718473, 4.204691339186562, 7.56225172633091, 3.6729255372881853, 4.338785245342897, 5.198326970273035, 6.166557803344267), # 162
(5.528285093462799, 4.2827531367148195, 5.975000016336562, 6.779803107689547, 6.806939071300551, 3.848154647670058, 3.4837632475739206, 4.1352293780953, 7.439642941882325, 3.6025761126145, 4.2568779183483265, 5.102140247830427, 6.0566396291687035), # 163
(5.408568774556308, 4.183107900108657, 5.856910602940141, 6.640755205286254, 6.6712261347721515, 3.7750152594761035, 3.405802012379573, 4.0574118315912555, 7.301776482157779, 3.525892923385575, 4.167365889167357, 4.996653511077443, 5.935272152915463), # 164
(5.279976559144014, 4.077292113531706, 5.728073406982535, 6.490028991446602, 6.523390307229859, 3.6946563368884693, 3.3225078115566578, 3.971755988051637, 7.149591369061584, 3.4432906124712908, 4.0707437042712895, 4.882466463293296, 5.803182814171416), # 165
(5.143136546748318, 3.9657645933715635, 5.589212907943143, 6.328425959966001, 6.3642520316461715, 3.607556136812327, 3.234266061173029, 3.878779135853662, 6.984026624498059, 3.35518382274153, 3.9675059101314236, 4.760178807757201, 5.661099052523436), # 166
(4.998676836891619, 3.8489841560158298, 5.441053585301364, 6.156747604639875, 6.194631750993584, 3.514192916152847, 3.14146217729654, 3.7789985633745413, 6.80602127037152, 3.2619871970661714, 3.858147053219062, 4.630390247748367, 5.509748307558397), # 167
(4.847225529096317, 3.727409617852103, 5.284319918536599, 5.975795419263637, 6.015349908244594, 3.415044931815199, 3.0444815759950434, 3.672931558991488, 6.616514328586284, 3.1641153783150977, 3.743161680005505, 4.493700486546009, 5.34985801886317), # 168
(4.689410722884812, 3.6014997952679835, 5.119736387128247, 5.786370897632707, 5.827226946371696, 3.310590440704556, 2.9437096733363934, 3.561095411081716, 6.416444821046671, 3.0619830093581895, 3.623044336962055, 4.350709227429338, 5.182155626024628), # 169
(4.525860517779507, 3.47171350465107, 4.948027470555708, 5.589275533542496, 5.631083308347387, 3.2013076997260854, 2.8395318853884426, 3.444007408022438, 6.206751769656991, 2.9560047330653263, 3.498289570560013, 4.202016173677567, 5.007368568629644), # 170
(4.3572030133028, 3.3385095623889605, 4.7699176482983825, 5.385310820788429, 5.427739437144165, 3.087674965784959, 2.7323336282190445, 3.3221848381908665, 5.9883741963215655, 2.846595192306391, 3.3693919272706787, 4.048221028569909, 4.826224286265092), # 171
(4.184066308977092, 3.2023467848692557, 4.586131399835669, 5.175278253165917, 5.218015775734523, 2.970170495786347, 2.6225003178960526, 3.1961449899642167, 5.762251122944709, 2.734169029951264, 3.2368459535653553, 3.889923495385577, 4.639450218517843), # 172
(4.007078504324784, 3.063683988479554, 4.39739320464697, 4.959979324470381, 5.002732767090961, 2.84927254663542, 2.51041737048732, 3.066405151719699, 5.529321571430739, 2.6191408888698255, 3.1011461959153426, 3.72772327740378, 4.44777380497477), # 173
(3.8268676988682753, 2.9229799896074544, 4.204427542211682, 4.740215528497233, 4.782710854185973, 2.725459375237348, 2.3964702020607005, 2.9334826118345285, 5.290524563683971, 2.5019254119319574, 2.9627872007919422, 3.5622200779037345, 4.251922485222747), # 174
(3.6440619921299646, 2.7806936046405557, 4.007958892009206, 4.516788359041894, 4.558770479992055, 2.599209238497303, 2.2810442286840464, 2.797894658685917, 5.046799121608725, 2.3829372420075394, 2.8222635146664556, 3.3940136001646515, 4.052623698848646), # 175
(3.459289483632255, 2.6372836499664585, 3.8087117335189427, 4.29049930989978, 4.331732087481704, 2.4710003933204536, 2.164524866425212, 2.6601585806510792, 4.799084267109314, 2.2625910219664536, 2.680069684010184, 3.2237035474657434, 3.8506048854393393), # 176
(3.273178272897546, 2.493208941972761, 3.607410546220291, 4.062149874866306, 4.102416119627419, 2.3413110966119706, 2.0472975313520503, 2.5207916661072263, 4.548319022090056, 2.1413013946785795, 2.536700255294429, 3.051889623086223, 3.6465934845817), # 177
(3.0863564594482376, 2.348928297047063, 3.404779809592651, 3.832541547736893, 3.871643019401691, 2.210619605277026, 1.929747639532414, 2.3803112034315723, 4.295442408455268, 2.0194830030138, 2.39264977499049, 2.879171530305302, 3.4413169358626017), # 178
(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0), # 179
)
passenger_arriving_acc = (
(2, 5, 2, 5, 2, 1, 2, 2, 1, 0, 1, 0, 0, 8, 2, 4, 1, 2, 1, 4, 3, 0, 1, 1, 0, 0), # 0
(7, 12, 4, 14, 3, 3, 4, 4, 3, 0, 4, 3, 0, 11, 8, 7, 3, 3, 3, 4, 5, 0, 4, 1, 0, 0), # 1
(12, 17, 7, 20, 8, 5, 7, 5, 4, 2, 6, 3, 0, 13, 12, 10, 5, 7, 6, 7, 6, 2, 5, 1, 0, 0), # 2
(18, 25, 14, 24, 11, 5, 12, 6, 4, 2, 6, 5, 0, 13, 16, 13, 9, 10, 8, 8, 6, 4, 6, 1, 0, 0), # 3
(21, 29, 17, 28, 13, 6, 12, 8, 6, 2, 7, 5, 0, 19, 20, 19, 12, 12, 13, 10, 7, 7, 6, 2, 0, 0), # 4
(26, 35, 23, 39, 18, 10, 14, 12, 10, 2, 7, 5, 0, 22, 21, 21, 13, 18, 14, 12, 8, 7, 8, 3, 2, 0), # 5
(39, 42, 25, 50, 20, 11, 14, 12, 10, 4, 7, 5, 0, 27, 28, 23, 13, 19, 17, 14, 11, 7, 10, 5, 2, 0), # 6
(43, 46, 28, 54, 28, 11, 15, 16, 13, 5, 7, 6, 0, 31, 34, 29, 16, 21, 18, 16, 13, 7, 11, 5, 2, 0), # 7
(44, 50, 35, 59, 34, 14, 16, 19, 15, 6, 9, 7, 0, 35, 40, 32, 19, 23, 24, 17, 14, 8, 12, 5, 2, 0), # 8
(50, 57, 41, 63, 39, 17, 16, 20, 18, 9, 13, 7, 0, 41, 46, 36, 25, 28, 29, 21, 16, 11, 15, 6, 3, 0), # 9
(60, 64, 47, 65, 42, 21, 18, 23, 19, 12, 15, 7, 0, 45, 50, 41, 29, 34, 35, 23, 18, 12, 16, 7, 3, 0), # 10
(64, 71, 56, 71, 48, 22, 23, 25, 22, 14, 16, 8, 0, 53, 52, 44, 31, 36, 39, 24, 22, 16, 16, 10, 3, 0), # 11
(73, 74, 62, 78, 55, 26, 26, 26, 23, 15, 18, 8, 0, 59, 62, 50, 33, 40, 44, 28, 24, 18, 18, 12, 4, 0), # 12
(74, 80, 68, 88, 59, 29, 29, 26, 26, 16, 19, 9, 0, 66, 68, 55, 35, 44, 49, 35, 26, 20, 19, 14, 7, 0), # 13
(80, 89, 75, 94, 64, 31, 38, 27, 26, 16, 19, 9, 0, 72, 71, 62, 39, 51, 51, 35, 28, 23, 21, 14, 7, 0), # 14
(88, 94, 82, 96, 70, 34, 45, 29, 35, 18, 20, 9, 0, 75, 78, 70, 43, 63, 55, 39, 31, 25, 22, 14, 8, 0), # 15
(94, 98, 91, 103, 74, 36, 46, 31, 37, 20, 20, 10, 0, 81, 87, 71, 45, 68, 64, 40, 33, 30, 29, 17, 9, 0), # 16
(99, 106, 100, 107, 76, 40, 48, 32, 43, 24, 20, 12, 0, 91, 94, 76, 51, 76, 70, 41, 34, 32, 32, 18, 9, 0), # 17
(107, 115, 113, 115, 81, 44, 54, 37, 46, 29, 20, 13, 0, 98, 102, 82, 57, 81, 75, 44, 38, 35, 37, 20, 9, 0), # 18
(112, 124, 120, 119, 86, 47, 56, 41, 49, 33, 21, 13, 0, 107, 108, 84, 63, 83, 78, 45, 40, 39, 39, 21, 11, 0), # 19
(127, 135, 128, 129, 93, 50, 58, 42, 52, 34, 23, 13, 0, 117, 118, 96, 69, 88, 83, 51, 41, 43, 40, 21, 12, 0), # 20
(136, 143, 134, 137, 98, 54, 60, 42, 55, 36, 23, 14, 0, 119, 123, 102, 75, 94, 89, 53, 43, 46, 43, 21, 12, 0), # 21
(142, 151, 138, 143, 106, 54, 62, 45, 57, 37, 24, 15, 0, 126, 127, 105, 77, 103, 93, 55, 43, 52, 43, 22, 13, 0), # 22
(149, 158, 149, 150, 110, 54, 64, 47, 58, 40, 24, 17, 0, 137, 131, 110, 78, 112, 96, 60, 45, 55, 44, 24, 18, 0), # 23
(158, 167, 152, 157, 123, 55, 65, 50, 59, 40, 26, 19, 0, 148, 136, 120, 81, 124, 101, 63, 47, 57, 45, 26, 21, 0), # 24
(169, 173, 154, 166, 127, 61, 66, 51, 63, 41, 27, 20, 0, 162, 148, 124, 87, 133, 104, 69, 48, 58, 47, 29, 21, 0), # 25
(180, 175, 163, 170, 135, 64, 69, 52, 66, 43, 28, 20, 0, 173, 152, 129, 93, 140, 106, 71, 51, 60, 49, 33, 21, 0), # 26
(188, 189, 173, 176, 144, 68, 74, 58, 70, 46, 28, 20, 0, 180, 157, 139, 100, 144, 107, 75, 53, 66, 50, 33, 22, 0), # 27
(195, 197, 180, 186, 144, 74, 78, 65, 72, 48, 30, 20, 0, 184, 166, 146, 105, 150, 113, 82, 54, 69, 52, 34, 23, 0), # 28
(204, 207, 186, 189, 148, 77, 78, 68, 75, 49, 30, 22, 0, 196, 176, 156, 114, 154, 117, 82, 57, 72, 58, 35, 23, 0), # 29
(207, 218, 193, 198, 151, 79, 80, 69, 81, 49, 31, 22, 0, 204, 180, 165, 119, 162, 125, 83, 57, 78, 60, 36, 25, 0), # 30
(213, 229, 198, 206, 158, 86, 83, 72, 85, 50, 31, 22, 0, 216, 188, 173, 122, 163, 130, 86, 59, 78, 62, 40, 25, 0), # 31
(222, 237, 200, 216, 161, 91, 86, 80, 91, 51, 33, 23, 0, 232, 194, 180, 125, 171, 137, 89, 60, 80, 64, 41, 28, 0), # 32
(229, 245, 207, 224, 163, 94, 92, 83, 93, 51, 34, 24, 0, 243, 200, 186, 126, 174, 145, 93, 61, 80, 69, 43, 29, 0), # 33
(238, 256, 214, 237, 172, 96, 92, 85, 101, 52, 34, 24, 0, 255, 213, 190, 132, 180, 146, 95, 64, 82, 69, 45, 30, 0), # 34
(244, 266, 219, 242, 179, 99, 96, 87, 101, 54, 36, 25, 0, 267, 219, 193, 137, 185, 148, 98, 68, 85, 70, 47, 32, 0), # 35
(251, 276, 227, 252, 186, 100, 100, 91, 105, 57, 39, 25, 0, 272, 226, 198, 143, 192, 154, 102, 69, 88, 75, 51, 33, 0), # 36
(258, 280, 233, 257, 192, 101, 103, 93, 107, 58, 39, 25, 0, 277, 232, 205, 147, 201, 155, 106, 72, 92, 80, 52, 35, 0), # 37
(259, 289, 236, 262, 199, 104, 108, 95, 111, 60, 41, 25, 0, 287, 240, 208, 151, 208, 159, 111, 74, 93, 83, 53, 35, 0), # 38
(266, 298, 247, 275, 205, 107, 112, 99, 112, 62, 41, 25, 0, 296, 250, 209, 158, 220, 163, 113, 75, 97, 85, 55, 35, 0), # 39
(276, 306, 258, 282, 217, 108, 114, 101, 114, 64, 45, 26, 0, 303, 259, 215, 162, 226, 170, 115, 77, 99, 86, 55, 36, 0), # 40
(281, 316, 268, 285, 219, 109, 116, 102, 116, 66, 47, 29, 0, 311, 264, 225, 167, 236, 172, 117, 78, 102, 91, 56, 36, 0), # 41
(289, 325, 274, 291, 227, 115, 119, 106, 126, 71, 48, 29, 0, 317, 273, 229, 173, 239, 176, 120, 80, 105, 94, 57, 36, 0), # 42
(298, 334, 279, 294, 236, 120, 124, 111, 129, 74, 49, 30, 0, 328, 282, 243, 176, 243, 183, 122, 81, 106, 97, 58, 39, 0), # 43
(303, 339, 282, 305, 242, 121, 125, 113, 133, 75, 50, 30, 0, 334, 289, 247, 181, 251, 190, 128, 83, 112, 98, 58, 39, 0), # 44
(311, 349, 289, 311, 248, 123, 127, 114, 136, 75, 50, 32, 0, 345, 296, 254, 187, 259, 195, 132, 84, 116, 98, 61, 39, 0), # 45
(318, 360, 295, 316, 259, 125, 128, 115, 138, 76, 52, 32, 0, 352, 303, 259, 190, 273, 200, 136, 85, 120, 98, 62, 40, 0), # 46
(327, 365, 301, 328, 266, 131, 130, 118, 139, 78, 54, 32, 0, 356, 307, 261, 195, 278, 202, 140, 89, 123, 101, 64, 40, 0), # 47
(336, 377, 309, 331, 276, 134, 132, 123, 140, 79, 55, 32, 0, 368, 314, 267, 199, 287, 204, 142, 93, 124, 102, 65, 41, 0), # 48
(349, 384, 312, 340, 278, 138, 134, 129, 146, 80, 55, 34, 0, 377, 322, 273, 208, 299, 210, 145, 94, 126, 106, 67, 41, 0), # 49
(355, 387, 319, 342, 282, 140, 136, 131, 147, 83, 56, 35, 0, 383, 329, 278, 210, 305, 214, 154, 96, 129, 112, 69, 43, 0), # 50
(367, 400, 329, 349, 286, 142, 138, 131, 147, 84, 56, 36, 0, 391, 338, 292, 216, 312, 217, 156, 99, 130, 117, 70, 43, 0), # 51
(375, 407, 333, 357, 292, 146, 144, 132, 150, 84, 56, 36, 0, 403, 342, 296, 217, 323, 219, 157, 101, 133, 120, 71, 43, 0), # 52
(385, 410, 341, 362, 296, 148, 146, 132, 153, 87, 57, 36, 0, 410, 350, 301, 223, 331, 222, 158, 104, 135, 121, 74, 43, 0), # 53
(391, 422, 351, 366, 301, 152, 150, 135, 156, 89, 58, 36, 0, 416, 362, 304, 225, 336, 229, 159, 105, 137, 122, 80, 44, 0), # 54
(400, 427, 359, 367, 304, 155, 151, 140, 157, 90, 61, 36, 0, 423, 367, 313, 231, 341, 230, 161, 108, 139, 127, 82, 44, 0), # 55
(409, 432, 364, 376, 313, 155, 155, 141, 158, 91, 61, 36, 0, 435, 367, 317, 235, 344, 236, 163, 109, 140, 132, 82, 44, 0), # 56
(421, 438, 371, 385, 321, 157, 159, 141, 162, 92, 61, 38, 0, 444, 374, 323, 242, 351, 240, 166, 110, 143, 134, 84, 45, 0), # 57
(426, 442, 375, 393, 329, 160, 159, 142, 165, 93, 62, 38, 0, 449, 382, 334, 247, 359, 245, 167, 112, 148, 138, 86, 45, 0), # 58
(435, 450, 381, 402, 335, 163, 161, 142, 169, 93, 62, 39, 0, 458, 389, 340, 250, 365, 251, 169, 112, 150, 140, 87, 45, 0), # 59
(442, 456, 387, 405, 337, 170, 166, 142, 175, 93, 62, 39, 0, 472, 395, 344, 257, 372, 253, 171, 115, 154, 143, 89, 46, 0), # 60
(446, 465, 394, 414, 341, 172, 170, 144, 179, 93, 63, 39, 0, 478, 399, 353, 266, 382, 255, 173, 118, 158, 145, 90, 46, 0), # 61
(454, 476, 406, 425, 345, 175, 174, 149, 181, 96, 65, 40, 0, 489, 408, 358, 272, 387, 258, 175, 121, 160, 149, 92, 47, 0), # 62
(463, 481, 414, 435, 354, 180, 176, 157, 185, 96, 65, 41, 0, 496, 416, 362, 278, 393, 262, 178, 121, 161, 154, 93, 48, 0), # 63
(474, 492, 418, 440, 363, 182, 181, 158, 190, 98, 68, 41, 0, 504, 422, 366, 287, 400, 264, 180, 122, 164, 156, 96, 50, 0), # 64
(482, 497, 424, 446, 370, 183, 185, 163, 192, 98, 68, 41, 0, 510, 429, 372, 290, 406, 268, 186, 124, 165, 158, 99, 50, 0), # 65
(492, 504, 428, 452, 381, 188, 191, 165, 196, 99, 68, 41, 0, 519, 436, 379, 295, 414, 273, 192, 125, 170, 159, 99, 50, 0), # 66
(498, 515, 433, 457, 386, 192, 193, 165, 201, 100, 69, 41, 0, 528, 445, 387, 303, 424, 277, 194, 127, 172, 161, 102, 51, 0), # 67
(504, 521, 442, 463, 395, 197, 197, 165, 203, 102, 70, 41, 0, 535, 449, 396, 310, 431, 280, 196, 129, 178, 164, 103, 51, 0), # 68
(510, 529, 448, 471, 402, 202, 198, 167, 205, 106, 73, 42, 0, 545, 456, 405, 313, 435, 283, 201, 129, 181, 166, 103, 51, 0), # 69
(521, 536, 457, 482, 407, 206, 201, 170, 207, 107, 73, 44, 0, 550, 463, 411, 315, 442, 285, 204, 130, 183, 169, 105, 51, 0), # 70
(532, 539, 465, 488, 413, 209, 206, 171, 208, 107, 75, 46, 0, 558, 465, 415, 322, 450, 288, 209, 132, 187, 170, 105, 54, 0), # 71
(539, 548, 471, 499, 415, 209, 208, 173, 211, 108, 76, 47, 0, 571, 472, 419, 324, 457, 291, 213, 134, 190, 173, 109, 54, 0), # 72
(543, 557, 474, 506, 420, 213, 213, 177, 214, 109, 76, 47, 0, 576, 480, 422, 334, 465, 293, 216, 137, 193, 176, 110, 54, 0), # 73
(555, 568, 481, 512, 421, 217, 215, 180, 217, 111, 76, 47, 0, 583, 485, 426, 336, 474, 298, 216, 138, 194, 179, 112, 54, 0), # 74
(558, 577, 488, 522, 428, 220, 216, 182, 224, 112, 76, 48, 0, 591, 491, 435, 337, 476, 301, 220, 140, 199, 183, 113, 54, 0), # 75
(563, 589, 493, 529, 432, 222, 218, 185, 226, 114, 77, 50, 0, 599, 496, 440, 340, 482, 303, 220, 141, 199, 188, 114, 55, 0), # 76
(571, 592, 497, 534, 439, 224, 220, 188, 234, 115, 79, 50, 0, 603, 503, 448, 344, 490, 306, 223, 144, 201, 188, 117, 55, 0), # 77
(582, 603, 501, 550, 441, 228, 223, 192, 237, 117, 81, 51, 0, 610, 511, 450, 350, 495, 310, 229, 145, 203, 189, 118, 55, 0), # 78
(591, 611, 508, 553, 447, 230, 226, 194, 242, 119, 83, 52, 0, 617, 522, 455, 356, 503, 315, 233, 146, 206, 192, 122, 55, 0), # 79
(599, 613, 514, 561, 452, 233, 229, 196, 244, 125, 86, 52, 0, 626, 528, 460, 360, 508, 320, 239, 149, 208, 195, 124, 55, 0), # 80
(605, 620, 518, 568, 460, 234, 234, 197, 244, 126, 86, 53, 0, 643, 537, 468, 363, 515, 322, 242, 151, 210, 197, 126, 57, 0), # 81
(616, 627, 526, 578, 469, 238, 237, 197, 248, 127, 86, 53, 0, 648, 542, 476, 370, 523, 324, 245, 154, 212, 201, 127, 58, 0), # 82
(621, 630, 531, 583, 476, 242, 240, 198, 249, 128, 89, 53, 0, 653, 548, 481, 377, 526, 327, 248, 157, 213, 203, 128, 58, 0), # 83
(625, 638, 537, 586, 482, 247, 242, 199, 254, 128, 92, 54, 0, 662, 552, 483, 382, 530, 334, 252, 161, 218, 208, 128, 59, 0), # 84
(630, 647, 542, 595, 491, 250, 248, 201, 256, 129, 93, 54, 0, 672, 557, 489, 390, 535, 336, 253, 165, 219, 212, 128, 59, 0), # 85
(632, 652, 552, 604, 494, 253, 250, 202, 257, 132, 93, 55, 0, 683, 560, 493, 392, 539, 341, 255, 168, 222, 214, 128, 60, 0), # 86
(639, 658, 559, 616, 499, 254, 253, 203, 261, 132, 95, 56, 0, 691, 563, 498, 395, 547, 344, 258, 171, 224, 216, 128, 61, 0), # 87
(647, 666, 567, 620, 503, 254, 256, 205, 264, 133, 95, 58, 0, 701, 569, 506, 399, 551, 348, 258, 173, 227, 221, 129, 61, 0), # 88
(658, 671, 570, 629, 509, 254, 258, 208, 267, 133, 95, 59, 0, 703, 572, 511, 400, 553, 352, 261, 176, 229, 222, 131, 61, 0), # 89
(664, 679, 577, 634, 513, 258, 261, 212, 270, 133, 98, 59, 0, 711, 579, 517, 405, 560, 357, 263, 177, 234, 226, 132, 61, 0), # 90
(675, 688, 589, 640, 520, 261, 262, 214, 271, 135, 98, 63, 0, 717, 585, 524, 405, 565, 359, 266, 179, 235, 228, 133, 61, 0), # 91
(684, 694, 596, 649, 529, 265, 262, 215, 275, 135, 103, 63, 0, 728, 591, 532, 409, 572, 364, 268, 182, 239, 231, 133, 61, 0), # 92
(697, 698, 608, 655, 533, 267, 266, 217, 276, 137, 103, 64, 0, 735, 601, 536, 415, 578, 369, 270, 185, 240, 232, 134, 61, 0), # 93
(704, 702, 618, 660, 537, 267, 270, 219, 278, 137, 103, 64, 0, 750, 604, 541, 421, 589, 373, 270, 185, 241, 236, 134, 62, 0), # 94
(715, 706, 623, 666, 544, 268, 271, 223, 281, 142, 103, 64, 0, 757, 613, 542, 424, 601, 374, 273, 187, 243, 239, 136, 63, 0), # 95
(726, 713, 629, 671, 553, 274, 273, 225, 285, 144, 103, 66, 0, 762, 617, 545, 429, 612, 380, 274, 189, 244, 241, 140, 63, 0), # 96
(733, 720, 634, 677, 558, 278, 275, 228, 287, 146, 105, 66, 0, 767, 620, 551, 434, 622, 384, 278, 192, 246, 245, 140, 63, 0), # 97
(740, 725, 642, 683, 560, 282, 281, 230, 294, 149, 105, 68, 0, 772, 626, 558, 437, 627, 389, 282, 193, 248, 246, 142, 64, 0), # 98
(745, 732, 644, 693, 565, 287, 283, 232, 297, 150, 105, 68, 0, 778, 632, 563, 439, 629, 393, 285, 194, 252, 247, 143, 64, 0), # 99
(757, 740, 649, 699, 569, 291, 285, 236, 302, 151, 105, 68, 0, 791, 637, 567, 449, 636, 396, 288, 197, 258, 250, 144, 66, 0), # 100
(763, 750, 654, 708, 576, 292, 289, 238, 305, 153, 108, 68, 0, 797, 640, 575, 452, 646, 402, 290, 199, 258, 252, 144, 66, 0), # 101
(775, 756, 661, 713, 579, 297, 293, 239, 308, 154, 111, 69, 0, 808, 647, 580, 454, 651, 408, 298, 200, 264, 252, 147, 68, 0), # 102
(782, 766, 671, 718, 583, 297, 296, 240, 309, 154, 111, 69, 0, 810, 651, 588, 457, 657, 412, 301, 201, 267, 256, 147, 69, 0), # 103
(788, 777, 680, 721, 588, 299, 300, 243, 310, 155, 111, 70, 0, 818, 657, 591, 466, 659, 416, 303, 202, 273, 256, 147, 69, 0), # 104
(794, 785, 694, 728, 593, 303, 302, 244, 314, 157, 111, 70, 0, 824, 663, 600, 469, 668, 420, 306, 203, 279, 257, 147, 69, 0), # 105
(801, 791, 699, 733, 602, 308, 304, 248, 317, 158, 114, 70, 0, 831, 666, 608, 474, 673, 424, 309, 205, 280, 262, 149, 70, 0), # 106
(809, 795, 704, 739, 605, 311, 307, 252, 324, 158, 114, 70, 0, 839, 671, 613, 478, 680, 428, 313, 207, 284, 264, 150, 71, 0), # 107
(817, 801, 708, 746, 609, 313, 309, 253, 327, 159, 114, 71, 0, 846, 676, 623, 481, 684, 428, 313, 209, 286, 267, 151, 71, 0), # 108
(823, 809, 713, 756, 614, 314, 314, 255, 329, 160, 116, 71, 0, 854, 685, 631, 483, 690, 430, 316, 209, 291, 268, 153, 71, 0), # 109
(837, 810, 724, 765, 619, 318, 316, 257, 331, 164, 116, 72, 0, 864, 694, 633, 484, 697, 432, 318, 211, 294, 270, 154, 72, 0), # 110
(843, 818, 730, 774, 624, 318, 319, 259, 334, 167, 117, 72, 0, 873, 700, 640, 488, 702, 438, 321, 213, 296, 272, 156, 72, 0), # 111
(850, 826, 737, 775, 632, 320, 319, 262, 337, 169, 120, 73, 0, 879, 704, 647, 491, 704, 439, 322, 216, 299, 277, 156, 72, 0), # 112
(856, 832, 744, 780, 634, 323, 321, 264, 340, 169, 123, 76, 0, 886, 714, 655, 494, 708, 440, 326, 216, 305, 279, 157, 72, 0), # 113
(868, 834, 749, 786, 639, 326, 322, 265, 342, 169, 123, 78, 0, 892, 718, 660, 495, 715, 447, 328, 217, 306, 282, 158, 73, 0), # 114
(876, 841, 757, 789, 642, 326, 324, 266, 344, 170, 123, 78, 0, 898, 726, 666, 499, 720, 452, 332, 220, 308, 283, 159, 75, 0), # 115
(886, 846, 760, 796, 651, 328, 327, 270, 346, 170, 124, 78, 0, 902, 735, 668, 503, 725, 453, 332, 221, 310, 286, 160, 75, 0), # 116
(895, 847, 765, 801, 656, 331, 329, 271, 352, 171, 125, 79, 0, 906, 738, 675, 505, 730, 454, 332, 222, 311, 286, 160, 75, 0), # 117
(900, 855, 775, 809, 662, 333, 330, 271, 354, 172, 127, 79, 0, 908, 747, 681, 510, 732, 458, 333, 223, 314, 287, 162, 75, 0), # 118
(905, 858, 780, 816, 668, 335, 332, 271, 360, 174, 128, 79, 0, 915, 755, 683, 514, 742, 460, 336, 224, 319, 289, 163, 75, 0), # 119
(908, 864, 782, 828, 669, 338, 333, 272, 361, 174, 129, 80, 0, 924, 762, 689, 521, 746, 463, 338, 226, 322, 291, 164, 75, 0), # 120
(917, 877, 788, 834, 671, 340, 336, 274, 363, 174, 129, 81, 0, 930, 768, 696, 524, 752, 465, 340, 228, 326, 296, 167, 75, 0), # 121
(923, 880, 796, 839, 677, 344, 337, 276, 366, 174, 130, 81, 0, 938, 774, 701, 531, 758, 470, 342, 233, 329, 297, 169, 76, 0), # 122
(928, 887, 804, 842, 680, 347, 342, 279, 368, 175, 132, 81, 0, 944, 786, 706, 534, 766, 473, 342, 233, 329, 300, 172, 76, 0), # 123
(936, 891, 814, 850, 685, 350, 343, 280, 370, 175, 132, 82, 0, 950, 788, 716, 538, 772, 474, 342, 236, 332, 301, 173, 76, 0), # 124
(939, 899, 820, 853, 692, 352, 343, 283, 373, 178, 132, 83, 0, 956, 792, 721, 544, 775, 477, 345, 240, 333, 303, 175, 77, 0), # 125
(944, 903, 823, 857, 696, 354, 345, 284, 376, 179, 132, 83, 0, 966, 795, 725, 547, 781, 480, 348, 240, 335, 306, 175, 79, 0), # 126
(953, 907, 830, 867, 704, 357, 349, 285, 379, 181, 132, 83, 0, 971, 806, 730, 547, 783, 481, 350, 242, 337, 308, 176, 80, 0), # 127
(958, 914, 840, 874, 709, 358, 350, 288, 382, 182, 134, 84, 0, 978, 808, 738, 551, 789, 481, 352, 245, 338, 311, 179, 82, 0), # 128
(963, 916, 848, 880, 717, 358, 353, 291, 382, 184, 135, 86, 0, 985, 813, 741, 552, 790, 484, 354, 247, 340, 312, 182, 82, 0), # 129
(970, 921, 853, 884, 724, 363, 356, 291, 385, 184, 137, 86, 0, 989, 821, 746, 555, 802, 486, 355, 249, 343, 313, 183, 84, 0), # 130
(976, 925, 857, 890, 731, 366, 359, 294, 388, 185, 138, 87, 0, 994, 829, 751, 559, 811, 487, 355, 249, 345, 314, 185, 84, 0), # 131
(985, 930, 866, 895, 736, 372, 363, 295, 389, 187, 138, 88, 0, 1000, 832, 755, 563, 814, 490, 357, 250, 345, 315, 188, 84, 0), # 132
(992, 936, 869, 897, 740, 373, 365, 297, 391, 188, 138, 88, 0, 1004, 833, 758, 566, 816, 491, 357, 252, 347, 318, 188, 84, 0), # 133
(998, 937, 869, 903, 744, 375, 366, 298, 393, 189, 138, 88, 0, 1012, 841, 761, 569, 824, 495, 359, 254, 349, 319, 188, 85, 0), # 134
(1001, 940, 879, 906, 752, 378, 368, 300, 397, 192, 140, 88, 0, 1019, 847, 764, 571, 832, 498, 361, 256, 351, 323, 189, 85, 0), # 135
(1006, 945, 886, 911, 756, 382, 369, 301, 402, 192, 141, 89, 0, 1027, 855, 768, 571, 840, 499, 364, 257, 351, 324, 190, 85, 0), # 136
(1013, 956, 891, 912, 757, 387, 371, 304, 403, 192, 141, 91, 0, 1034, 858, 772, 575, 845, 501, 367, 260, 354, 327, 193, 85, 0), # 137
(1021, 962, 899, 916, 758, 390, 376, 305, 406, 192, 141, 91, 0, 1044, 865, 776, 578, 853, 505, 371, 264, 356, 329, 193, 86, 0), # 138
(1031, 967, 904, 924, 763, 392, 377, 307, 407, 194, 142, 91, 0, 1052, 877, 783, 580, 860, 510, 371, 267, 358, 330, 196, 87, 0), # 139
(1033, 974, 908, 928, 767, 397, 380, 309, 411, 195, 142, 91, 0, 1059, 886, 786, 584, 869, 517, 375, 267, 360, 332, 196, 87, 0), # 140
(1037, 979, 913, 930, 770, 398, 382, 311, 414, 195, 142, 91, 0, 1069, 889, 789, 587, 872, 518, 376, 268, 362, 335, 199, 87, 0), # 141
(1044, 980, 920, 936, 778, 399, 383, 315, 416, 195, 142, 92, 0, 1071, 895, 799, 594, 877, 521, 378, 268, 364, 340, 199, 87, 0), # 142
(1053, 986, 926, 941, 782, 402, 387, 319, 420, 197, 146, 92, 0, 1082, 900, 801, 600, 880, 525, 379, 271, 367, 340, 200, 87, 0), # 143
(1059, 989, 932, 949, 788, 406, 390, 320, 423, 198, 146, 92, 0, 1088, 901, 805, 606, 888, 527, 381, 271, 372, 343, 200, 87, 0), # 144
(1067, 990, 941, 959, 795, 412, 391, 322, 423, 200, 146, 93, 0, 1099, 902, 809, 608, 899, 530, 383, 271, 373, 343, 200, 87, 0), # 145
(1071, 995, 948, 969, 799, 413, 393, 322, 424, 200, 147, 93, 0, 1112, 908, 813, 611, 902, 536, 383, 273, 377, 343, 202, 87, 0), # 146
(1075, 1000, 950, 978, 804, 415, 395, 322, 430, 200, 149, 93, 0, 1116, 917, 818, 618, 906, 537, 387, 275, 378, 344, 204, 87, 0), # 147
(1081, 1008, 957, 980, 808, 419, 397, 323, 431, 200, 149, 94, 0, 1124, 924, 823, 622, 916, 540, 389, 277, 380, 346, 204, 88, 0), # 148
(1086, 1010, 965, 985, 810, 421, 401, 324, 432, 200, 150, 95, 0, 1129, 926, 825, 624, 920, 543, 392, 279, 380, 349, 206, 89, 0), # 149
(1096, 1012, 970, 990, 815, 422, 404, 325, 435, 201, 150, 96, 0, 1132, 931, 826, 631, 929, 545, 395, 284, 382, 351, 206, 89, 0), # 150
(1099, 1018, 971, 992, 819, 424, 407, 327, 436, 202, 151, 96, 0, 1137, 939, 829, 634, 937, 546, 396, 285, 385, 354, 207, 89, 0), # 151
(1103, 1021, 976, 1002, 826, 426, 412, 329, 437, 203, 152, 96, 0, 1145, 948, 833, 638, 946, 547, 400, 287, 388, 355, 208, 89, 0), # 152
(1110, 1029, 978, 1007, 835, 431, 412, 332, 442, 203, 154, 96, 0, 1148, 952, 840, 645, 949, 550, 401, 290, 392, 356, 209, 89, 0), # 153
(1117, 1032, 982, 1012, 838, 433, 412, 334, 443, 203, 154, 96, 0, 1154, 954, 843, 645, 951, 552, 403, 291, 396, 357, 209, 89, 0), # 154
(1123, 1034, 991, 1014, 845, 434, 414, 334, 445, 205, 155, 96, 0, 1167, 958, 850, 648, 961, 556, 403, 291, 401, 360, 209, 90, 0), # 155
(1128, 1042, 999, 1020, 849, 439, 415, 336, 448, 205, 156, 96, 0, 1170, 964, 854, 652, 968, 558, 403, 292, 404, 360, 210, 90, 0), # 156
(1133, 1046, 1008, 1029, 852, 440, 417, 339, 449, 206, 157, 96, 0, 1178, 969, 856, 653, 975, 560, 405, 294, 405, 361, 212, 90, 0), # 157
(1136, 1048, 1012, 1035, 857, 442, 417, 344, 449, 208, 158, 96, 0, 1185, 976, 859, 658, 977, 563, 409, 296, 407, 364, 212, 91, 0), # 158
(1141, 1050, 1020, 1038, 860, 443, 418, 347, 453, 209, 160, 96, 0, 1189, 979, 863, 659, 979, 564, 409, 298, 407, 367, 214, 93, 0), # 159
(1146, 1057, 1023, 1044, 868, 449, 421, 348, 456, 210, 161, 96, 0, 1195, 986, 864, 663, 985, 566, 412, 302, 411, 369, 215, 93, 0), # 160
(1151, 1058, 1027, 1047, 875, 452, 422, 348, 460, 211, 162, 96, 0, 1202, 990, 864, 664, 993, 569, 412, 306, 413, 370, 215, 94, 0), # 161
(1158, 1065, 1029, 1050, 878, 454, 422, 351, 463, 212, 162, 96, 0, 1211, 998, 864, 668, 997, 570, 412, 310, 414, 370, 216, 94, 0), # 162
(1167, 1069, 1037, 1055, 881, 455, 423, 353, 466, 214, 163, 96, 0, 1220, 1000, 871, 671, 1008, 573, 415, 313, 414, 373, 217, 94, 0), # 163
(1169, 1074, 1043, 1061, 889, 457, 424, 353, 473, 215, 165, 96, 0, 1227, 1010, 879, 672, 1013, 578, 416, 314, 415, 375, 217, 95, 0), # 164
(1170, 1082, 1049, 1063, 894, 458, 426, 353, 478, 215, 165, 98, 0, 1236, 1012, 884, 674, 1020, 581, 417, 317, 416, 376, 217, 96, 0), # 165
(1175, 1084, 1056, 1069, 902, 458, 427, 355, 479, 216, 166, 98, 0, 1238, 1017, 887, 679, 1031, 586, 419, 318, 419, 379, 220, 96, 0), # 166
(1179, 1089, 1061, 1070, 904, 460, 429, 357, 481, 216, 167, 100, 0, 1246, 1022, 892, 682, 1034, 590, 421, 318, 422, 380, 220, 96, 0), # 167
(1184, 1098, 1066, 1073, 907, 462, 429, 357, 483, 216, 168, 100, 0, 1249, 1027, 897, 683, 1036, 594, 421, 319, 426, 382, 220, 96, 0), # 168
(1192, 1102, 1072, 1077, 909, 464, 431, 358, 483, 216, 169, 100, 0, 1258, 1029, 901, 690, 1038, 594, 423, 321, 428, 384, 222, 96, 0), # 169
(1195, 1103, 1076, 1086, 915, 466, 431, 359, 484, 216, 170, 100, 0, 1263, 1033, 906, 693, 1039, 597, 424, 323, 429, 385, 224, 96, 0), # 170
(1199, 1104, 1078, 1091, 921, 466, 432, 361, 484, 216, 171, 100, 0, 1272, 1037, 911, 698, 1040, 601, 424, 326, 430, 386, 225, 96, 0), # 171
(1203, 1107, 1082, 1095, 922, 468, 432, 362, 485, 216, 173, 100, 0, 1277, 1041, 915, 699, 1045, 602, 425, 327, 431, 387, 228, 96, 0), # 172
(1211, 1112, 1087, 1096, 924, 471, 432, 363, 486, 216, 173, 100, 0, 1280, 1045, 918, 702, 1047, 602, 425, 328, 432, 389, 230, 96, 0), # 173
(1215, 1113, 1090, 1099, 928, 471, 432, 364, 491, 217, 174, 100, 0, 1285, 1050, 918, 703, 1052, 605, 428, 328, 434, 392, 230, 96, 0), # 174
(1216, 1116, 1093, 1104, 930, 474, 433, 365, 495, 217, 174, 101, 0, 1288, 1052, 923, 704, 1056, 605, 429, 330, 436, 393, 230, 96, 0), # 175
(1222, 1119, 1097, 1106, 932, 475, 434, 368, 497, 217, 174, 101, 0, 1292, 1056, 927, 706, 1056, 607, 430, 330, 436, 393, 230, 96, 0), # 176
(1226, 1120, 1100, 1107, 937, 477, 435, 369, 497, 217, 175, 101, 0, 1299, 1058, 931, 709, 1058, 609, 430, 330, 437, 396, 231, 96, 0), # 177
(1229, 1125, 1104, 1109, 939, 479, 435, 369, 500, 217, 176, 101, 0, 1301, 1059, 936, 709, 1062, 609, 430, 331, 439, 396, 231, 96, 0), # 178
(1229, 1125, 1104, 1109, 939, 479, 435, 369, 500, 217, 176, 101, 0, 1301, 1059, 936, 709, 1062, 609, 430, 331, 439, 396, 231, 96, 0), # 179
)
passenger_arriving_rate = (
(4.0166924626974145, 4.051878277108322, 3.4741888197416713, 3.72880066431806, 2.962498990725126, 1.4647056349507583, 1.6584142461495661, 1.5510587243264744, 1.6240264165781353, 0.7916030031044742, 0.5607020218514138, 0.32652767188707826, 0.0, 4.067104170062691, 3.5918043907578605, 2.803510109257069, 2.374809009313422, 3.2480528331562706, 2.171482214057064, 1.6584142461495661, 1.0462183106791132, 1.481249495362563, 1.2429335547726867, 0.6948377639483343, 0.36835257064621113, 0.0), # 0
(4.283461721615979, 4.319377842372822, 3.703564394220102, 3.97508655196597, 3.1586615133195926, 1.561459005886526, 1.7677875765054776, 1.6531712409685695, 1.7312654203554425, 0.8437961384554302, 0.5977461514608177, 0.34808111072095704, 0.0, 4.3358333179518835, 3.8288922179305267, 2.9887307573040878, 2.53138841536629, 3.462530840710885, 2.3144397373559973, 1.7677875765054776, 1.1153278613475186, 1.5793307566597963, 1.3250288506553236, 0.7407128788440204, 0.39267071294298395, 0.0), # 1
(4.549378407183785, 4.585815791986718, 3.9320281903649423, 4.220392622798877, 3.3541135859998636, 1.6578263867724743, 1.8767274031842818, 1.7548750826348067, 1.838076481834013, 0.8957827550041094, 0.6346430865035085, 0.3695488434702037, 0.0, 4.603491862567752, 4.06503727817224, 3.173215432517542, 2.6873482650123277, 3.676152963668026, 2.4568251156887295, 1.8767274031842818, 1.1841617048374817, 1.6770567929999318, 1.4067975409329592, 0.7864056380729886, 0.41689234472606534, 0.0), # 2
(4.81340623451725, 4.850135034753395, 4.1586739128799035, 4.463745844519244, 3.548086227201014, 1.7534256238730528, 1.9848014566591823, 1.8557670524981693, 1.9440360429122914, 0.9473565396852364, 0.6712464549103178, 0.3908457123286974, 0.0, 4.869018245003381, 4.299302835615671, 3.356232274551589, 2.8420696190557084, 3.8880720858245827, 2.598073873497437, 1.9848014566591823, 1.2524468741950376, 1.774043113600507, 1.487915281506415, 0.8317347825759807, 0.4409213667957632, 0.0), # 3
(5.074508918732786, 5.111278479476234, 4.382595266468691, 4.704173184829542, 3.7398104553581293, 1.8478745634527118, 2.0915774674033836, 1.9554439537316386, 2.048720545488722, 0.998311179433536, 0.7074098846120768, 0.41188655949031766, 0.0, 5.131350906351854, 4.530752154393493, 3.5370494230603833, 2.9949335383006073, 4.097441090977444, 2.737621535224294, 2.0915774674033836, 1.3199104024662227, 1.8699052276790646, 1.5680577282765145, 0.8765190532937384, 0.46466167995238505, 0.0), # 4
(5.331650174946809, 5.368189034958631, 4.602885955835013, 4.940701611432236, 3.9285172889062823, 1.9407910517759004, 2.1966231658900894, 2.0535025895081978, 2.151706431461749, 1.048440361183733, 0.7429870035396177, 0.43258622714894324, 0.0, 5.389428287706262, 4.758448498638375, 3.7149350176980884, 3.145321083551198, 4.303412862923498, 2.8749036253114766, 2.1966231658900894, 1.3862793226970715, 1.9642586444531411, 1.6469005371440792, 0.9205771911670025, 0.48801718499623925, 0.0), # 5
(5.583793718275733, 5.619809610003967, 4.8186396856825775, 5.172358092029792, 4.113437746280557, 2.03179293510707, 2.299506282592505, 2.1495397630008295, 2.2525701427298173, 1.097537771870552, 0.777831439623771, 0.45285955749845397, 0.0, 5.642188830159686, 4.981455132482993, 3.889157198118855, 3.2926133156116553, 4.5051402854596345, 3.0093556682011613, 2.299506282592505, 1.4512806679336214, 2.0567188731402783, 1.724119364009931, 0.9637279371365156, 0.5108917827276335, 0.0), # 6
(5.829903263835975, 5.86508311341563, 5.02895016071509, 5.398169594324678, 4.293802845916028, 2.1204980597106697, 2.399794547983834, 2.2431522773825177, 2.350888121191372, 1.1453970984287176, 0.8117968207953693, 0.47262139273272863, 0.0, 5.888570974805216, 5.198835320060014, 4.058984103976846, 3.436191295286152, 4.701776242382744, 3.1404131883355246, 2.399794547983834, 1.514641471221907, 2.146901422958014, 1.799389864774893, 1.0057900321430182, 0.5331893739468755, 0.0), # 7
(6.068942526743948, 6.102952453997006, 5.232911085636264, 5.617163086019357, 4.468843606247779, 2.2065242718511486, 2.497055692537279, 2.333936935826242, 2.446236808744855, 1.1918120277929551, 0.8447367749852429, 0.49178657504564693, 0.0, 6.127513162735934, 5.409652325502115, 4.223683874926214, 3.5754360833788645, 4.89247361748971, 3.2675117101567386, 2.497055692537279, 1.5760887656079634, 2.2344218031238894, 1.872387695339786, 1.046582217127253, 0.5548138594542734, 0.0), # 8
(6.299875222116068, 6.332360540551483, 5.429616165149803, 5.828365534816301, 4.637791045710885, 2.2894894177929594, 2.590857446726048, 2.421490541504988, 2.538192647288713, 1.2365762468979886, 0.8765049301242238, 0.5102699466310877, 0.0, 6.35795383504493, 5.612969412941963, 4.382524650621119, 3.709728740693965, 5.076385294577426, 3.390086758106983, 2.590857446726048, 1.635349584137828, 2.3188955228554424, 1.9427885116054342, 1.0859232330299606, 0.5756691400501349, 0.0), # 9
(6.5216650650687455, 6.552250281882444, 5.6181591039594165, 6.0308039084179725, 4.799876182740427, 2.3690113438005502, 2.680767541023342, 2.505409897591737, 2.6263320787213904, 1.279483442678543, 0.9069549141431433, 0.5279863496829302, 0.0, 6.578831432825289, 5.807849846512232, 4.534774570715716, 3.838450328035629, 5.252664157442781, 3.5075738566284325, 2.680767541023342, 1.6921509598575357, 2.3999380913702133, 2.010267969472658, 1.1236318207918834, 0.5956591165347678, 0.0), # 10
(6.7332757707184046, 6.761564586793285, 5.797633606768811, 6.223505174526839, 4.954330035771484, 2.444707896138372, 2.7663537059023664, 2.585291807259472, 2.7102315449413314, 1.320327302069344, 0.9359403549728333, 0.5448506263950541, 0.0, 6.78908439717009, 5.993356890345594, 4.679701774864166, 3.9609819062080316, 5.420463089882663, 3.619408530163261, 2.7663537059023664, 1.7462199258131228, 2.477165017885742, 2.07450172484228, 1.1595267213537623, 0.6146876897084805, 0.0), # 11
(6.93367105418145, 6.959246364087378, 5.9671333782816935, 6.405496300845368, 5.100383623239134, 2.516196921070873, 2.8471836718363246, 2.6607330736811736, 2.789467487846981, 1.3589015120051147, 0.9633148805441247, 0.5607776189613379, 0.0, 6.987651169172428, 6.168553808574717, 4.816574402720623, 4.0767045360153435, 5.578934975693962, 3.7250263031536432, 2.8471836718363246, 1.7972835150506232, 2.550191811619567, 2.135165433615123, 1.1934266756563388, 0.63265876037158, 0.0), # 12
(7.121814630574301, 7.144238522568122, 6.125752123201774, 6.575804255076027, 5.237267963578454, 2.5830962648625047, 2.9228251692984224, 2.731330500029827, 2.863616349336782, 1.3949997594205812, 0.9889321187878493, 0.5756821695756614, 0.0, 7.173470189925388, 6.332503865332275, 4.944660593939246, 4.184999278261743, 5.727232698673564, 3.8238627000417584, 2.9228251692984224, 1.8450687606160747, 2.618633981789227, 2.1919347516920094, 1.225150424640355, 0.6494762293243748, 0.0), # 13
(7.296670215013373, 7.315483971038899, 6.272583546232765, 6.733456004921276, 5.3642140752245275, 2.6450237737777162, 2.9928459287618647, 2.7966808894784156, 2.932254571309179, 1.428415731250467, 1.0126456976348381, 0.5894791204319041, 0.0, 7.345479900522051, 6.484270324750944, 5.06322848817419, 4.285247193751401, 5.864509142618358, 3.9153532452697823, 2.9928459287618647, 1.8893026955555114, 2.6821070376122638, 2.244485334973759, 1.254516709246553, 0.6650439973671727, 0.0), # 14
(7.457201522615084, 7.471925618303093, 6.406721352078362, 6.877478518083592, 5.480452976612431, 2.701597294080959, 3.0568136806998503, 2.8563810451999188, 2.9949585956626184, 1.4589431144294984, 1.0343092450159228, 0.6020833137239449, 0.0, 7.502618742055505, 6.622916450963392, 5.171546225079613, 4.376829343288494, 5.989917191325237, 3.9989334632798865, 3.0568136806998503, 1.9297123529149707, 2.7402264883062153, 2.2924928393611976, 1.2813442704156726, 0.6792659653002813, 0.0), # 15
(7.602372268495841, 7.612506373164098, 6.527259245442284, 7.006898762265429, 5.585215686177244, 2.7524346720366815, 3.1142961555855906, 2.9100277703673205, 3.0513048642955427, 1.4863755958923994, 1.0537763888619351, 0.6134095916456628, 0.0, 7.643825155618837, 6.747505508102289, 5.268881944309675, 4.459126787677198, 6.102609728591085, 4.074038878514249, 3.1142961555855906, 1.9660247657404866, 2.792607843088622, 2.3356329207551436, 1.3054518490884568, 0.692046033924009, 0.0), # 16
(7.73114616777206, 7.736169144425294, 6.6332909310282355, 7.120743705169268, 5.677733222354047, 2.7971537539093334, 3.1648610838922844, 2.9572178681536063, 3.1008698191063955, 1.510506862573894, 1.0709007571037066, 0.6233727963909371, 0.0, 7.768037582305133, 6.857100760300307, 5.354503785518533, 4.531520587721681, 6.201739638212791, 4.140105015415049, 3.1648610838922844, 1.9979669670780953, 2.8388666111770235, 2.373581235056423, 1.3266581862056472, 0.7032881040386633, 0.0), # 17
(7.842486935560164, 7.841856840890068, 6.723910113539921, 7.218040314497568, 5.757236603577914, 2.8353723859633684, 3.2080761960931405, 2.9975481417317535, 3.1432299019936254, 1.5311306014087078, 1.085535977672068, 0.6318877701536477, 0.0, 7.874194463207477, 6.950765471690124, 5.427679888360339, 4.593391804226123, 6.286459803987251, 4.196567398424455, 3.2080761960931405, 2.0252659899738346, 2.878618301788957, 2.406013438165856, 1.344782022707984, 0.7128960764445517, 0.0), # 18
(7.935358286976559, 7.928512371361812, 6.798210497681052, 7.29781555795279, 5.822956848283928, 2.866708414463231, 3.2435092226613578, 3.030615394274749, 3.1779615548556746, 1.5480404993315662, 1.0975356784978507, 0.6388693551276732, 0.0, 7.961234239418957, 7.027562906404404, 5.4876783924892525, 4.644121497994697, 6.355923109711349, 4.242861551984649, 3.2435092226613578, 2.0476488674737365, 2.911478424141964, 2.4326051859842637, 1.3596420995362106, 0.720773851941983, 0.0), # 19
(8.008723937137665, 7.995078644643906, 6.855285788155336, 7.359096403237412, 5.874124974907169, 2.8907796856733756, 3.270727894070145, 3.0560164289555725, 3.2046412195909864, 1.5610302432771923, 1.106753487511887, 0.6442323935068929, 0.0, 8.02809535203266, 7.08655632857582, 5.533767437559434, 4.683090729831576, 6.409282439181973, 4.278423000537802, 3.270727894070145, 2.0648426326238396, 2.9370624874535847, 2.4530321344124713, 1.3710571576310673, 0.7268253313312643, 0.0), # 20
(8.061547601159893, 8.040498569539743, 6.89422968966648, 7.400909818053892, 5.909972001882714, 2.90720404585825, 3.289299940792704, 3.0733480489472083, 3.222845338098006, 1.5698935201803115, 1.113043032645008, 0.6478917274851863, 0.0, 8.073716242141662, 7.1268090023370485, 5.56521516322504, 4.709680560540933, 6.445690676196012, 4.302687268526092, 3.289299940792704, 2.0765743184701786, 2.954986000941357, 2.466969939351298, 1.378845937933296, 0.730954415412704, 0.0), # 21
(8.092792994159664, 8.063715054852706, 6.91413590691819, 7.422282770104703, 5.92972894764564, 2.915599341282305, 3.29879309330224, 3.0822070574226386, 3.2321503522751773, 1.574424016975649, 1.1162579418280456, 0.6497621992564327, 0.0, 8.097035350839063, 7.147384191820759, 5.581289709140227, 4.723272050926946, 6.464300704550355, 4.315089880391694, 3.29879309330224, 2.0825709580587892, 2.96486447382282, 2.474094256701568, 1.3828271813836381, 0.7330650049866098, 0.0), # 22
(8.104314690674112, 8.066463968907179, 6.916615454961135, 7.424958487654322, 5.9347904298840515, 2.916666666666667, 3.2999216009037355, 3.0831646090534983, 3.2333136625514407, 1.574958454503887, 1.1166610716215655, 0.6499931717725956, 0.0, 8.1, 7.149924889498552, 5.583305358107827, 4.72487536351166, 6.466627325102881, 4.316430452674898, 3.2999216009037355, 2.0833333333333335, 2.9673952149420257, 2.474986162551441, 1.3833230909922272, 0.7333149062642891, 0.0), # 23
(8.112809930427323, 8.06486049382716, 6.916209876543211, 7.4246291666666675, 5.937657393927921, 2.916666666666667, 3.299301525054467, 3.0818333333333334, 3.2331577777777776, 1.5746301234567905, 1.1166166105499442, 0.6499390946502058, 0.0, 8.1, 7.149330041152263, 5.583083052749721, 4.72389037037037, 6.466315555555555, 4.314566666666667, 3.299301525054467, 2.0833333333333335, 2.9688286969639606, 2.4748763888888896, 1.3832419753086422, 0.7331691358024692, 0.0), # 24
(8.121125784169264, 8.06169981710105, 6.915409236396892, 7.423977623456791, 5.940461304317068, 2.916666666666667, 3.298079561042524, 3.0792181069958855, 3.2328497942386836, 1.5739837677183361, 1.1165284532568485, 0.6498323426306966, 0.0, 8.1, 7.148155768937661, 5.5826422662842425, 4.7219513031550076, 6.465699588477367, 4.31090534979424, 3.298079561042524, 2.0833333333333335, 2.970230652158534, 2.474659207818931, 1.3830818472793784, 0.7328818015546411, 0.0), # 25
(8.129261615238427, 8.057030224051212, 6.914224508459078, 7.423011265432098, 5.943202063157923, 2.916666666666667, 3.2962746873234887, 3.0753683127572025, 3.23239366255144, 1.5730301417466854, 1.1163973978467807, 0.6496743789056548, 0.0, 8.1, 7.146418167962202, 5.581986989233903, 4.719090425240055, 6.46478732510288, 4.305515637860084, 3.2962746873234887, 2.0833333333333335, 2.9716010315789614, 2.4743370884773666, 1.3828449016918156, 0.732457293095565, 0.0), # 26
(8.13721678697331, 8.0509, 6.9126666666666665, 7.4217375, 5.945879572556914, 2.916666666666667, 3.2939058823529415, 3.0703333333333336, 3.231793333333333, 1.5717800000000004, 1.1162242424242426, 0.6494666666666669, 0.0, 8.1, 7.144133333333334, 5.581121212121213, 4.715339999999999, 6.463586666666666, 4.298466666666667, 3.2939058823529415, 2.0833333333333335, 2.972939786278457, 2.4739125000000004, 1.3825333333333334, 0.7319000000000001, 0.0), # 27
(8.1449906627124, 8.043357430269776, 6.910746684956561, 7.420163734567902, 5.948493734620481, 2.916666666666667, 3.2909921245864604, 3.06416255144033, 3.231052757201646, 1.570244096936443, 1.116009785093736, 0.6492106691053194, 0.0, 8.1, 7.141317360158513, 5.580048925468679, 4.710732290809328, 6.462105514403292, 4.289827572016462, 3.2909921245864604, 2.0833333333333335, 2.9742468673102405, 2.4733879115226345, 1.3821493369913125, 0.731214311842707, 0.0), # 28
(8.1525826057942, 8.0344508001829, 6.908475537265661, 7.41829737654321, 5.951044451455051, 2.916666666666667, 3.2875523924796264, 3.0569053497942384, 3.2301758847736624, 1.5684331870141752, 1.1157548239597623, 0.6489078494131992, 0.0, 8.1, 7.13798634354519, 5.578774119798812, 4.705299561042525, 6.460351769547325, 4.279667489711934, 3.2875523924796264, 2.0833333333333335, 2.9755222257275253, 2.4727657921810704, 1.3816951074531325, 0.7304046181984455, 0.0), # 29
(8.159991979557198, 8.02422839506173, 6.905864197530864, 7.416145833333333, 5.953531625167059, 2.916666666666667, 3.2836056644880176, 3.048611111111111, 3.2291666666666665, 1.5663580246913587, 1.115460157126824, 0.648559670781893, 0.0, 8.1, 7.134156378600823, 5.57730078563412, 4.699074074074074, 6.458333333333333, 4.268055555555556, 3.2836056644880176, 2.0833333333333335, 2.9767658125835297, 2.4720486111111115, 1.3811728395061729, 0.7294753086419755, 0.0), # 30
(8.167218147339886, 8.012738500228625, 6.902923639689073, 7.41371651234568, 5.955955157862938, 2.916666666666667, 3.279170919067216, 3.039329218106996, 3.2280290534979423, 1.5640293644261551, 1.1151265826994223, 0.6481675964029875, 0.0, 8.1, 7.129843560432862, 5.575632913497111, 4.692088093278464, 6.456058106995885, 4.2550609053497945, 3.279170919067216, 2.0833333333333335, 2.977977578931469, 2.4712388374485603, 1.3805847279378145, 0.7284307727480569, 0.0), # 31
(8.174260472480764, 8.000029401005945, 6.899664837677183, 7.411016820987655, 5.958314951649118, 2.916666666666667, 3.2742671346727996, 3.029109053497943, 3.226766995884774, 1.5614579606767267, 1.1147548987820595, 0.6477330894680691, 0.0, 8.1, 7.125063984148759, 5.573774493910297, 4.684373882030179, 6.453533991769548, 4.24075267489712, 3.2742671346727996, 2.0833333333333335, 2.979157475824559, 2.470338940329219, 1.3799329675354366, 0.7272754000914496, 0.0), # 32
(8.181118318318317, 7.986149382716048, 6.896098765432099, 7.408054166666666, 5.960610908632033, 2.916666666666667, 3.2689132897603486, 3.0180000000000002, 3.2253844444444444, 1.5586545679012351, 1.114345903479237, 0.6472576131687243, 0.0, 8.1, 7.119833744855966, 5.571729517396184, 4.6759637037037045, 6.450768888888889, 4.225200000000001, 3.2689132897603486, 2.0833333333333335, 2.9803054543160163, 2.469351388888889, 1.37921975308642, 0.7260135802469135, 0.0), # 33
(8.187791048191048, 7.971146730681298, 6.892236396890718, 7.404835956790124, 5.962842930918115, 2.916666666666667, 3.263128362785444, 3.006051440329218, 3.2238853497942395, 1.5556299405578424, 1.1139003948954567, 0.6467426306965403, 0.0, 8.1, 7.114168937661942, 5.569501974477284, 4.666889821673526, 6.447770699588479, 4.208472016460905, 3.263128362785444, 2.0833333333333335, 2.9814214654590576, 2.468278652263375, 1.3784472793781437, 0.724649702789209, 0.0), # 34
(8.194278025437447, 7.95506973022405, 6.888088705989941, 7.401369598765432, 5.965010920613797, 2.916666666666667, 3.2569313322036635, 2.9933127572016467, 3.2222736625514408, 1.5523948331047102, 1.1134191711352206, 0.6461896052431033, 0.0, 8.1, 7.108085657674136, 5.5670958556761025, 4.657184499314129, 6.4445473251028815, 4.1906378600823055, 3.2569313322036635, 2.0833333333333335, 2.9825054603068986, 2.4671231995884777, 1.3776177411979884, 0.7231881572930956, 0.0), # 35
(8.200578613396004, 7.937966666666665, 6.8836666666666675, 7.3976625, 5.967114779825512, 2.916666666666667, 3.250341176470588, 2.979833333333334, 3.220553333333333, 1.5489600000000006, 1.1129030303030305, 0.6456000000000002, 0.0, 8.1, 7.101600000000001, 5.564515151515152, 4.64688, 6.441106666666666, 4.1717666666666675, 3.250341176470588, 2.0833333333333335, 2.983557389912756, 2.4658875000000005, 1.3767333333333336, 0.7216333333333333, 0.0), # 36
(8.20669217540522, 7.919885825331503, 6.8789812528577965, 7.393722067901235, 5.969154410659692, 2.916666666666667, 3.2433768740417976, 2.9656625514403294, 3.218728312757202, 1.5453361957018754, 1.1123527705033882, 0.6449752781588174, 0.0, 8.1, 7.09472805974699, 5.561763852516941, 4.636008587105625, 6.437456625514404, 4.1519275720164615, 3.2433768740417976, 2.0833333333333335, 2.984577205329846, 2.4645740226337454, 1.3757962505715595, 0.7199896204846822, 0.0), # 37
(8.212618074803581, 7.9008754915409245, 6.874043438500229, 7.389555709876545, 5.971129715222768, 2.916666666666667, 3.2360574033728717, 2.9508497942386835, 3.2168025514403293, 1.5415341746684963, 1.111769189840795, 0.6443169029111417, 0.0, 8.1, 7.087485932022558, 5.558845949203975, 4.624602524005487, 6.433605102880659, 4.131189711934157, 3.2360574033728717, 2.0833333333333335, 2.985564857611384, 2.4631852366255154, 1.3748086877000458, 0.7182614083219023, 0.0), # 38
(8.218355674929589, 7.880983950617284, 6.868864197530866, 7.3851708333333335, 5.973040595621175, 2.916666666666667, 3.2284017429193903, 2.9354444444444447, 3.21478, 1.5375646913580252, 1.1111530864197532, 0.6436263374485597, 0.0, 8.1, 7.079889711934156, 5.555765432098766, 4.612694074074074, 6.42956, 4.109622222222223, 3.2284017429193903, 2.0833333333333335, 2.9865202978105874, 2.4617236111111116, 1.3737728395061732, 0.7164530864197532, 0.0), # 39
(8.22390433912173, 7.860259487882944, 6.863454503886603, 7.380574845679012, 5.974886953961343, 2.916666666666667, 3.2204288711369324, 2.9194958847736636, 3.212664609053498, 1.5334385002286244, 1.1105052583447648, 0.6429050449626583, 0.0, 8.1, 7.071955494589241, 5.552526291723823, 4.600315500685872, 6.425329218106996, 4.087294238683129, 3.2204288711369324, 2.0833333333333335, 2.9874434769806717, 2.460191615226338, 1.3726909007773205, 0.714569044352995, 0.0), # 40
(8.229263430718502, 7.838750388660264, 6.857825331504345, 7.375775154320989, 5.976668692349708, 2.916666666666667, 3.212157766481078, 2.903053497942387, 3.210460329218107, 1.529166355738455, 1.1098265037203312, 0.6421544886450238, 0.0, 8.1, 7.06369937509526, 5.549132518601655, 4.587499067215363, 6.420920658436214, 4.0642748971193425, 3.212157766481078, 2.0833333333333335, 2.988334346174854, 2.4585917181069967, 1.371565066300869, 0.7126136716963878, 0.0), # 41
(8.2344323130584, 7.816504938271606, 6.85198765432099, 7.370779166666668, 5.978385712892697, 2.916666666666667, 3.2036074074074072, 2.886166666666667, 3.2081711111111115, 1.5247590123456796, 1.1091176206509543, 0.641376131687243, 0.0, 8.1, 7.0551374485596705, 5.5455881032547705, 4.574277037037037, 6.416342222222223, 4.040633333333334, 3.2036074074074072, 2.0833333333333335, 2.9891928564463486, 2.4569263888888897, 1.370397530864198, 0.7105913580246915, 0.0), # 42
(8.239410349479915, 7.7935714220393235, 6.845952446273435, 7.3655942901234575, 5.980037917696748, 2.916666666666667, 3.1947967723715003, 2.868884773662552, 3.2058009053497942, 1.5202272245084596, 1.1083794072411357, 0.6405714372809025, 0.0, 8.1, 7.046285810089926, 5.541897036205678, 4.5606816735253775, 6.4116018106995885, 4.016438683127573, 3.1947967723715003, 2.0833333333333335, 2.990018958848374, 2.4551980967078197, 1.369190489254687, 0.7085064929126659, 0.0), # 43
(8.244196903321543, 7.769998125285779, 6.839730681298583, 7.360227932098766, 5.981625208868291, 2.916666666666667, 3.185744839828936, 2.8512572016460913, 3.2033536625514403, 1.515581746684957, 1.1076126615953779, 0.639741868617589, 0.0, 8.1, 7.037160554793477, 5.538063307976889, 4.54674524005487, 6.4067073251028805, 3.9917600823045283, 3.185744839828936, 2.0833333333333335, 2.9908126044341454, 2.4534093106995893, 1.3679461362597167, 0.7063634659350709, 0.0), # 44
(8.248791337921773, 7.745833333333334, 6.833333333333335, 7.354687500000001, 5.983147488513758, 2.916666666666667, 3.1764705882352944, 2.833333333333334, 3.2008333333333328, 1.510833333333334, 1.106818181818182, 0.638888888888889, 0.0, 8.1, 7.027777777777777, 5.534090909090909, 4.532500000000001, 6.4016666666666655, 3.9666666666666672, 3.1764705882352944, 2.0833333333333335, 2.991573744256879, 2.4515625000000005, 1.366666666666667, 0.7041666666666668, 0.0), # 45
(8.253193016619106, 7.721125331504343, 6.8267713763145865, 7.348980401234568, 5.984604658739582, 2.916666666666667, 3.1669929960461554, 2.81516255144033, 3.198243868312757, 1.5059927389117518, 1.10599676601405, 0.6380139612863894, 0.0, 8.1, 7.018153574150282, 5.5299838300702495, 4.517978216735254, 6.396487736625514, 3.941227572016462, 3.1669929960461554, 2.0833333333333335, 2.992302329369791, 2.4496601337448567, 1.3653542752629175, 0.7019204846822131, 0.0), # 46
(8.257401302752028, 7.695922405121171, 6.8200557841792415, 7.3431140432098765, 5.985996621652196, 2.916666666666667, 3.1573310417170988, 2.7967942386831277, 3.195589218106996, 1.5010707178783727, 1.105149212287484, 0.6371185490016767, 0.0, 8.1, 7.008304039018443, 5.525746061437419, 4.503212153635117, 6.391178436213992, 3.915511934156379, 3.1573310417170988, 2.0833333333333335, 2.992998310826098, 2.4477046810699594, 1.3640111568358484, 0.6996293095564702, 0.0), # 47
(8.261415559659037, 7.670272839506174, 6.8131975308641985, 7.3370958333333345, 5.987323279358032, 2.916666666666667, 3.1475037037037037, 2.7782777777777783, 3.1928733333333335, 1.4960780246913583, 1.1042763187429856, 0.6362041152263375, 0.0, 8.1, 6.998245267489711, 5.521381593714927, 4.488234074074074, 6.385746666666667, 3.88958888888889, 3.1475037037037037, 2.0833333333333335, 2.993661639679016, 2.445698611111112, 1.3626395061728398, 0.6972975308641977, 0.0), # 48
(8.26523515067863, 7.644224919981709, 6.806207590306356, 7.330933179012346, 5.9885845339635235, 2.916666666666667, 3.137529960461551, 2.7596625514403295, 3.190100164609053, 1.491025413808871, 1.1033788834850566, 0.6352721231519587, 0.0, 8.1, 6.987993354671545, 5.5168944174252825, 4.473076241426613, 6.380200329218106, 3.8635275720164617, 3.137529960461551, 2.0833333333333335, 2.9942922669817618, 2.443644393004116, 1.3612415180612714, 0.6949295381801555, 0.0), # 49
(8.268859439149294, 7.617826931870143, 6.799096936442616, 7.324633487654321, 5.989780287575101, 2.916666666666667, 3.12742879044622, 2.7409979423868314, 3.1872736625514397, 1.485923639689072, 1.1024577046181985, 0.6343240359701267, 0.0, 8.1, 6.977564395671393, 5.512288523090993, 4.457770919067215, 6.3745473251028795, 3.8373971193415644, 3.12742879044622, 2.0833333333333335, 2.9948901437875506, 2.441544495884774, 1.3598193872885234, 0.692529721079104, 0.0), # 50
(8.272287788409528, 7.591127160493827, 6.791876543209877, 7.318204166666668, 5.9909104422991994, 2.916666666666667, 3.11721917211329, 2.7223333333333333, 3.184397777777778, 1.4807834567901237, 1.1015135802469138, 0.6333613168724281, 0.0, 8.1, 6.966974485596708, 5.507567901234569, 4.44235037037037, 6.368795555555556, 3.811266666666667, 3.11721917211329, 2.0833333333333335, 2.9954552211495997, 2.4394013888888897, 1.3583753086419754, 0.6901024691358025, 0.0), # 51
(8.275519561797823, 7.564173891175126, 6.78455738454504, 7.311652623456791, 5.991974900242248, 2.916666666666667, 3.1069200839183413, 2.7037181069958844, 3.18147646090535, 1.4756156195701877, 1.1005473084757038, 0.6323854290504498, 0.0, 8.1, 6.956239719554947, 5.502736542378519, 4.4268468587105625, 6.3629529218107, 3.7852053497942384, 3.1069200839183413, 2.0833333333333335, 2.995987450121124, 2.437217541152264, 1.356911476909008, 0.6876521719250116, 0.0), # 52
(8.278554122652675, 7.537015409236398, 6.777150434385004, 7.304986265432099, 5.992973563510682, 2.916666666666667, 3.0965505043169532, 2.6852016460905355, 3.1785136625514405, 1.470430882487426, 1.0995596874090703, 0.6313978356957782, 0.0, 8.1, 6.945376192653559, 5.4977984370453505, 4.411292647462277, 6.357027325102881, 3.7592823045267494, 3.0965505043169532, 2.0833333333333335, 2.996486781755341, 2.4349954218107, 1.355430086877001, 0.6851832190214908, 0.0), # 53
(8.281390834312573, 7.5097000000000005, 6.769666666666667, 7.2982125, 5.993906334210934, 2.916666666666667, 3.086129411764706, 2.6668333333333334, 3.1755133333333334, 1.4652400000000003, 1.098551515151515, 0.6304000000000001, 0.0, 8.1, 6.9344, 5.492757575757575, 4.395720000000001, 6.351026666666667, 3.7335666666666665, 3.086129411764706, 2.0833333333333335, 2.996953167105467, 2.4327375000000004, 1.3539333333333334, 0.6827000000000002, 0.0), # 54
(8.284029060116017, 7.482275948788294, 6.762117055326932, 7.291338734567901, 5.994773114449434, 2.916666666666667, 3.075675784717179, 2.6486625514403292, 3.1724794238683125, 1.4600537265660727, 1.0975235898075406, 0.6293933851547021, 0.0, 8.1, 6.923327236701723, 5.487617949037702, 4.380161179698217, 6.344958847736625, 3.708127572016461, 3.075675784717179, 2.0833333333333335, 2.997386557224717, 2.4304462448559674, 1.3524234110653865, 0.6802069044352995, 0.0), # 55
(8.286468163401498, 7.454791540923639, 6.754512574302698, 7.28437237654321, 5.995573806332619, 2.916666666666667, 3.0652086016299527, 2.6307386831275723, 3.169415884773662, 1.4548828166438048, 1.0964767094816479, 0.6283794543514709, 0.0, 8.1, 6.912173997866179, 5.482383547408239, 4.364648449931414, 6.338831769547324, 3.6830341563786013, 3.0652086016299527, 2.0833333333333335, 2.9977869031663094, 2.4281241255144037, 1.3509025148605398, 0.6777083219021491, 0.0), # 56
(8.288707507507507, 7.427295061728395, 6.746864197530866, 7.277320833333334, 5.996308311966915, 2.916666666666667, 3.0547468409586056, 2.613111111111112, 3.166326666666667, 1.4497380246913585, 1.0954116722783391, 0.627359670781893, 0.0, 8.1, 6.900956378600823, 5.477058361391695, 4.349214074074075, 6.332653333333334, 3.6583555555555565, 3.0547468409586056, 2.0833333333333335, 2.9981541559834577, 2.425773611111112, 1.3493728395061733, 0.6752086419753087, 0.0), # 57
(8.290746455772544, 7.39983479652492, 6.739182898948332, 7.270191512345679, 5.99697653345876, 2.916666666666667, 3.044309481158719, 2.595829218106996, 3.163215720164609, 1.4446301051668957, 1.0943292763021162, 0.6263354976375554, 0.0, 8.1, 6.889690474013108, 5.471646381510581, 4.333890315500686, 6.326431440329218, 3.6341609053497947, 3.044309481158719, 2.0833333333333335, 2.99848826672938, 2.4233971707818935, 1.3478365797896665, 0.6727122542295383, 0.0), # 58
(8.292584371535098, 7.372459030635573, 6.731479652491998, 7.262991820987654, 5.9975783729145835, 2.916666666666667, 3.0339155006858713, 2.578942386831276, 3.160086995884774, 1.4395698125285785, 1.0932303196574802, 0.6253083981100444, 0.0, 8.1, 6.878392379210486, 5.4661515982874, 4.318709437585735, 6.320173991769548, 3.6105193415637866, 3.0339155006858713, 2.0833333333333335, 2.9987891864572918, 2.420997273662552, 1.3462959304984, 0.6702235482395976, 0.0), # 59
(8.294220618133663, 7.345216049382717, 6.723765432098765, 7.255729166666667, 5.998113732440819, 2.916666666666667, 3.0235838779956428, 2.5625000000000004, 3.156944444444445, 1.4345679012345682, 1.092115600448934, 0.6242798353909466, 0.0, 8.1, 6.867078189300411, 5.460578002244669, 4.303703703703704, 6.31388888888889, 3.5875000000000004, 3.0235838779956428, 2.0833333333333335, 2.9990568662204096, 2.4185763888888894, 1.3447530864197532, 0.6677469135802471, 0.0), # 60
(8.295654558906731, 7.3181541380887065, 6.716051211705533, 7.248410956790124, 5.998582514143899, 2.916666666666667, 3.0133335915436135, 2.5465514403292184, 3.1537920164609052, 1.4296351257430273, 1.0909859167809788, 0.623251272671849, 0.0, 8.1, 6.855763999390337, 5.454929583904893, 4.2889053772290815, 6.3075840329218105, 3.5651720164609055, 3.0133335915436135, 2.0833333333333335, 2.9992912570719494, 2.4161369855967085, 1.3432102423411068, 0.6652867398262462, 0.0), # 61
(8.296885557192804, 7.291321582075903, 6.708347965249201, 7.241044598765433, 5.998984620130258, 2.916666666666667, 3.0031836197853625, 2.5311460905349796, 3.1506336625514404, 1.4247822405121175, 1.0898420667581163, 0.6222241731443379, 0.0, 8.1, 6.844465904587715, 5.449210333790581, 4.274346721536352, 6.301267325102881, 3.5436045267489718, 3.0031836197853625, 2.0833333333333335, 2.999492310065129, 2.4136815329218115, 1.3416695930498403, 0.6628474165523549, 0.0), # 62
(8.297912976330368, 7.264766666666667, 6.700666666666668, 7.233637500000001, 5.999319952506323, 2.916666666666667, 2.9931529411764703, 2.5163333333333338, 3.147473333333333, 1.4200200000000003, 1.0886848484848488, 0.6212000000000001, 0.0, 8.1, 6.8332, 5.443424242424244, 4.26006, 6.294946666666666, 3.5228666666666677, 2.9931529411764703, 2.0833333333333335, 2.9996599762531617, 2.411212500000001, 1.3401333333333336, 0.6604333333333334, 0.0), # 63
(8.298736179657919, 7.2385376771833565, 6.693018289894834, 7.226197067901236, 5.999588413378532, 2.916666666666667, 2.983260534172517, 2.5021625514403296, 3.1443149794238683, 1.415359158664838, 1.0875150600656773, 0.6201802164304223, 0.0, 8.1, 6.821982380734645, 5.437575300328387, 4.246077475994513, 6.288629958847737, 3.5030275720164616, 2.983260534172517, 2.0833333333333335, 2.999794206689266, 2.408732355967079, 1.3386036579789669, 0.6580488797439416, 0.0), # 64
(8.29935453051395, 7.212682898948331, 6.685413808870599, 7.218730709876544, 5.999789904853316, 2.916666666666667, 2.9735253772290813, 2.4886831275720165, 3.1411625514403294, 1.4108104709647922, 1.0863334996051048, 0.619166285627191, 0.0, 8.1, 6.8108291418991, 5.431667498025524, 4.232431412894376, 6.282325102880659, 3.484156378600823, 2.9735253772290813, 2.0833333333333335, 2.999894952426658, 2.4062435699588485, 1.33708276177412, 0.6556984453589393, 0.0), # 65
(8.299767392236957, 7.187250617283952, 6.677864197530865, 7.211245833333334, 5.999924329037105, 2.916666666666667, 2.963966448801743, 2.475944444444445, 3.13802, 1.406384691358025, 1.085140965207632, 0.6181596707818932, 0.0, 8.1, 6.799756378600824, 5.425704826038159, 4.2191540740740745, 6.27604, 3.466322222222223, 2.963966448801743, 2.0833333333333335, 2.9999621645185526, 2.4037486111111117, 1.3355728395061732, 0.6533864197530866, 0.0), # 66
(8.299974128165434, 7.162289117512574, 6.670380429812529, 7.203749845679012, 5.999991588036336, 2.916666666666667, 2.9546027273460824, 2.4639958847736634, 3.1348912757201646, 1.4020925743026982, 1.0839382549777616, 0.617161835086115, 0.0, 8.1, 6.788780185947264, 5.419691274888807, 4.206277722908094, 6.269782551440329, 3.4495942386831286, 2.9546027273460824, 2.0833333333333335, 2.999995794018168, 2.401249948559671, 1.3340760859625058, 0.6511171925011432, 0.0), # 67
(8.29983329158466, 7.137715668834903, 6.662937299954276, 7.196185044283415, 5.999934909491917, 2.916612538739013, 2.9454060779318585, 2.452781283340954, 3.131756759640299, 1.3979240883294335, 1.0827047984720504, 0.6161686681266496, 0.0, 8.099900120027435, 6.777855349393144, 5.413523992360251, 4.1937722649883, 6.263513519280598, 3.433893796677336, 2.9454060779318585, 2.0832946705278665, 2.9999674547459585, 2.398728348094472, 1.3325874599908551, 0.648883242621355, 0.0), # 68
(8.298513365539453, 7.112780047789725, 6.655325617283951, 7.188170108695652, 5.999419026870006, 2.916184636488341, 2.9361072725386457, 2.4416995884773662, 3.1284794238683125, 1.3937612781408861, 1.0813150451887295, 0.6151479315572884, 0.0, 8.099108796296298, 6.766627247130171, 5.406575225943647, 4.181283834422658, 6.256958847736625, 3.4183794238683127, 2.9361072725386457, 2.0829890260631005, 2.999709513435003, 2.396056702898551, 1.33106512345679, 0.6466163679808842, 0.0), # 69
(8.295908630047116, 7.087367803885127, 6.647512288523091, 7.179652274557166, 5.998399634202102, 2.9153419194228523, 2.926664053824548, 2.4306508154244786, 3.1250407712238992, 1.3895839048925471, 1.079753184870144, 0.614094850752854, 0.0, 8.097545867626888, 6.755043358281393, 5.3987659243507204, 4.168751714677641, 6.2500815424477985, 3.40291114159427, 2.926664053824548, 2.082387085302037, 2.999199817101051, 2.393217424852389, 1.3295024577046182, 0.6443061639895571, 0.0), # 70
(8.292055728514343, 7.061494123633789, 6.639500057155922, 7.170644102254428, 5.9968896420022055, 2.9140980439973583, 2.9170806638155953, 2.4196386221612562, 3.1214459228776104, 1.3853920718685282, 1.0780249827711816, 0.613010195814181, 0.0, 8.095231910150892, 6.743112153955991, 5.390124913855908, 4.1561762156055835, 6.242891845755221, 3.387494071025759, 2.9170806638155953, 2.081498602855256, 2.9984448210011028, 2.3902147007514767, 1.3279000114311843, 0.6419540112394354, 0.0), # 71
(8.286991304347827, 7.035174193548387, 6.631291666666667, 7.161158152173913, 5.994901960784313, 2.9124666666666674, 2.907361344537815, 2.408666666666667, 3.1177, 1.3811858823529415, 1.0761362041467308, 0.6118947368421054, 0.0, 8.0921875, 6.730842105263158, 5.380681020733653, 4.143557647058824, 6.2354, 3.3721333333333336, 2.907361344537815, 2.080333333333334, 2.9974509803921565, 2.3870527173913048, 1.3262583333333333, 0.6395612903225807, 0.0), # 72
(8.280752000954257, 7.008423200141599, 6.622889860539551, 7.151206984702094, 5.992449501062428, 2.9104614438855867, 2.897510338017237, 2.397738606919677, 3.113808123761622, 1.376965439629899, 1.0740926142516787, 0.6107492439374613, 0.0, 8.0884332133059, 6.7182416833120735, 5.370463071258393, 4.130896318889696, 6.227616247523244, 3.356834049687548, 2.897510338017237, 2.0789010313468475, 2.996224750531214, 2.383735661567365, 1.3245779721079105, 0.6371293818310545, 0.0), # 73
(8.273374461740323, 6.981256329926103, 6.614297382258802, 7.140803160225442, 5.989545173350547, 2.908096032108927, 2.887531886279889, 2.3868581008992535, 3.1097754153330284, 1.3727308469835127, 1.0718999783409144, 0.6095744872010845, 0.0, 8.083989626200276, 6.705319359211929, 5.359499891704571, 4.118192540950537, 6.219550830666057, 3.3416013412589547, 2.887531886279889, 2.0772114515063764, 2.9947725866752735, 2.380267720075148, 1.3228594764517605, 0.6346596663569185, 0.0), # 74
(8.26489533011272, 6.953688769414575, 6.605516975308642, 7.129959239130434, 5.986201888162673, 2.905384087791496, 2.8774302313518003, 2.376028806584362, 3.1056069958847736, 1.3684822076978942, 1.069564061669325, 0.6083712367338099, 0.0, 8.078877314814816, 6.692083604071907, 5.347820308346624, 4.105446623093682, 6.211213991769547, 3.3264403292181073, 2.8774302313518003, 2.0752743484224974, 2.9931009440813363, 2.3766530797101453, 1.3211033950617284, 0.6321535244922342, 0.0), # 75
(8.255351249478142, 6.925735705119696, 6.596551383173297, 7.118687781803542, 5.982432556012803, 2.9023392673881023, 2.8672096152589983, 2.365254381953971, 3.1013079865874102, 1.364219625057156, 1.067090629491799, 0.6071402626364722, 0.0, 8.073116855281206, 6.678542889001194, 5.335453147458995, 4.092658875171468, 6.2026159731748205, 3.311356134735559, 2.8672096152589983, 2.0730994767057873, 2.9912162780064016, 2.372895927267848, 1.3193102766346596, 0.6296123368290635, 0.0), # 76
(8.244778863243274, 6.897412323554141, 6.587403349336991, 7.10700134863124, 5.9782500874149385, 2.8989752273535543, 2.8568742800275118, 2.354538484987045, 3.0968835086114925, 1.3599432023454103, 1.0644854470632252, 0.6058823350099072, 0.0, 8.06672882373114, 6.664705685108978, 5.322427235316125, 4.07982960703623, 6.193767017222985, 3.296353878981863, 2.8568742800275118, 2.0706965909668247, 2.9891250437074692, 2.369000449543747, 1.3174806698673982, 0.6270374839594675, 0.0), # 77
(8.233214814814815, 6.8687338112305865, 6.578075617283951, 7.0949125, 5.97366739288308, 2.895305624142661, 2.84642846768337, 2.343884773662552, 3.092338683127571, 1.3556530428467686, 1.0617542796384905, 0.6045982239549493, 0.0, 8.059733796296298, 6.650580463504441, 5.308771398192452, 4.066959128540305, 6.184677366255142, 3.2814386831275724, 2.84642846768337, 2.0680754458161865, 2.98683369644154, 2.364970833333334, 1.3156151234567903, 0.624430346475508, 0.0), # 78
(8.220695747599452, 6.8397153546617115, 6.5685709304984, 7.082433796296296, 5.968697382931225, 2.891344114210232, 2.8358764202526006, 2.333296905959458, 3.0876786313062032, 1.351349249845343, 1.058902892472483, 0.6032886995724337, 0.0, 8.052152349108367, 6.63617569529677, 5.294514462362415, 4.0540477495360285, 6.1753572626124065, 3.266615668343241, 2.8358764202526006, 2.0652457958644517, 2.9843486914656125, 2.3608112654320994, 1.3137141860996802, 0.6217923049692465, 0.0), # 79
(8.207258305003878, 6.810372140360193, 6.558892032464563, 7.069577797906602, 5.963352968073375, 2.8871043540110755, 2.8252223797612324, 2.3227785398567296, 3.0829084743179394, 1.3470319266252455, 1.055937050820092, 0.6019545319631957, 0.0, 8.04400505829904, 6.621499851595152, 5.2796852541004595, 4.041095779875736, 6.165816948635879, 3.2518899557994216, 2.8252223797612324, 2.0622173957221968, 2.9816764840366874, 2.3565259326355346, 1.3117784064929128, 0.619124740032745, 0.0), # 80
(8.192939130434784, 6.78071935483871, 6.5490416666666675, 7.056357065217393, 5.957647058823529, 2.8826000000000005, 2.8144705882352943, 2.3123333333333336, 3.078033333333333, 1.3427011764705885, 1.0528625199362043, 0.6005964912280702, 0.0, 8.0353125, 6.606561403508772, 5.264312599681022, 4.028103529411765, 6.156066666666666, 3.237266666666667, 2.8144705882352943, 2.059, 2.9788235294117644, 2.3521190217391315, 1.3098083333333335, 0.6164290322580647, 0.0), # 81
(8.177774867298861, 6.750772184609939, 6.539022576588936, 7.042784158615137, 5.951592565695688, 2.877844708631815, 2.8036252877008145, 2.301964944368237, 3.0730583295229383, 1.3383571026654835, 1.0496850650757086, 0.5992153474678925, 0.0, 8.026095250342937, 6.5913688221468165, 5.248425325378542, 4.0150713079964495, 6.146116659045877, 3.2227509221155315, 2.8036252877008145, 2.0556033633084394, 2.975796282847844, 2.3475947195383795, 1.3078045153177873, 0.6137065622372673, 0.0), # 82
(8.161802159002804, 6.720545816186557, 6.528837505715592, 7.028871638486312, 5.945202399203851, 2.8728521363613275, 2.7926907201838214, 2.2916770309404058, 3.067988584057308, 1.3339998084940425, 1.0464104514934927, 0.5978118707834975, 0.0, 8.016373885459535, 6.575930578618472, 5.232052257467463, 4.001999425482127, 6.135977168114616, 3.208347843316568, 2.7926907201838214, 2.052037240258091, 2.9726011996019257, 2.3429572128287712, 1.3057675011431187, 0.6109587105624144, 0.0), # 83
(8.145057648953301, 6.690055436081242, 6.518489197530864, 7.014632065217392, 5.938489469862018, 2.867635939643347, 2.7816711277103434, 2.2814732510288067, 3.0628292181069954, 1.329629397240378, 1.0430444444444447, 0.5963868312757202, 0.0, 8.006168981481482, 6.560255144032922, 5.215222222222223, 3.9888881917211334, 6.125658436213991, 3.194062551440329, 2.7816711277103434, 2.0483113854595336, 2.969244734931009, 2.338210688405798, 1.303697839506173, 0.6081868578255676, 0.0), # 84
(8.127577980557048, 6.659316230806673, 6.507980395518976, 7.000077999194847, 5.931466688184191, 2.862209774932684, 2.77057075230641, 2.2713572626124074, 3.057585352842554, 1.3252459721886014, 1.0395928091834528, 0.5949409990453959, 0.0, 7.995501114540467, 6.544350989499354, 5.197964045917263, 3.9757379165658033, 6.115170705685108, 3.17990016765737, 2.77057075230641, 2.0444355535233454, 2.9657333440920954, 2.3333593330649496, 1.3015960791037953, 0.6053923846187885, 0.0), # 85
(8.10939979722073, 6.6283433868755255, 6.497313843164153, 6.985222000805154, 5.924146964684365, 2.8565872986841443, 2.7593938359980483, 2.2613327236701726, 3.0522621094345377, 1.320849636622825, 1.0360613109654049, 0.5934751441933597, 0.0, 7.984390860768176, 6.528226586126955, 5.180306554827023, 3.9625489098684747, 6.104524218869075, 3.1658658131382413, 2.7593938359980483, 2.040419499060103, 2.9620734823421824, 2.3284073336017186, 1.2994627686328306, 0.6025766715341389, 0.0), # 86
(8.090559742351045, 6.597152090800478, 6.486492283950617, 6.970076630434782, 5.9165432098765445, 2.8507821673525378, 2.7481446208112876, 2.2514032921810703, 3.0468646090534985, 1.3164404938271608, 1.0324557150451887, 0.5919900368204463, 0.0, 7.972858796296297, 6.511890405024908, 5.162278575225944, 3.9493214814814817, 6.093729218106997, 3.1519646090534983, 2.7481446208112876, 2.036272976680384, 2.9582716049382722, 2.3233588768115947, 1.2972984567901236, 0.5997410991636799, 0.0), # 87
(8.071094459354686, 6.565757529094207, 6.475518461362597, 6.95465444847021, 5.908668334274726, 2.8448080373926743, 2.7368273487721564, 2.2415726261240665, 3.0413979728699894, 1.3120186470857205, 1.0287817866776934, 0.5904864470274911, 0.0, 7.960925497256517, 6.495350917302401, 5.143908933388466, 3.9360559412571607, 6.082795945739979, 3.138201676573693, 2.7368273487721564, 2.032005740994767, 2.954334167137363, 2.3182181494900704, 1.2951036922725196, 0.5968870480994735, 0.0), # 88
(8.051040591638339, 6.534174888269392, 6.464395118884317, 6.938968015297907, 5.90053524839291, 2.8386785652593614, 2.7254462619066833, 2.2318443834781285, 3.035867322054565, 1.3075841996826167, 1.025045291117806, 0.5889651449153291, 0.0, 7.948611539780521, 6.478616594068619, 5.125226455589029, 3.9227525990478496, 6.07173464410913, 3.12458213686938, 2.7254462619066833, 2.0276275466138296, 2.950267624196455, 2.312989338432636, 1.2928790237768635, 0.5940158989335812, 0.0), # 89
(8.030434782608696, 6.502419354838709, 6.453125000000001, 6.923029891304349, 5.892156862745098, 2.8324074074074077, 2.7140056022408965, 2.2222222222222223, 3.030277777777778, 1.303137254901961, 1.021251993620415, 0.5874269005847954, 0.0, 7.9359375000000005, 6.461695906432748, 5.106259968102074, 3.9094117647058826, 6.060555555555556, 3.111111111111111, 2.7140056022408965, 2.0231481481481484, 2.946078431372549, 2.3076766304347833, 1.2906250000000001, 0.5911290322580646, 0.0), # 90
(8.00931367567245, 6.470506115314836, 6.441710848193873, 6.906852636876007, 5.883546087845287, 2.826008220291622, 2.7025096118008247, 2.2127098003353147, 3.024634461210182, 1.2986779160278654, 1.0174076594404082, 0.585872484136725, 0.0, 7.922923954046638, 6.444597325503974, 5.0870382972020405, 3.8960337480835956, 6.049268922420364, 3.097793720469441, 2.7025096118008247, 2.0185773002083014, 2.9417730439226437, 2.302284212292003, 1.2883421696387747, 0.5882278286649852, 0.0), # 91
(7.9877139142362985, 6.438450356210453, 6.43015540695016, 6.890448812399356, 5.874715834207482, 2.8194946603668143, 2.690962532612497, 2.203310775796373, 3.018942493522329, 1.2942062863444421, 1.013518053832674, 0.5843026656719533, 0.0, 7.909591478052126, 6.427329322391485, 5.067590269163369, 3.8826188590333257, 6.037884987044658, 3.0846350861149223, 2.690962532612497, 2.0139247574048675, 2.937357917103741, 2.296816270799786, 1.2860310813900322, 0.5853136687464049, 0.0), # 92
(7.965672141706924, 6.406267264038233, 6.418461419753087, 6.873830978260871, 5.865679012345678, 2.8128803840877916, 2.6793686067019404, 2.1940288065843623, 3.013206995884774, 1.2897224691358027, 1.0095889420521, 0.5827182152913147, 0.0, 7.895960648148147, 6.409900368204461, 5.0479447102605, 3.8691674074074074, 6.026413991769548, 3.0716403292181074, 2.6793686067019404, 2.0092002743484225, 2.932839506172839, 2.291276992753624, 1.2836922839506175, 0.5823879330943849, 0.0), # 93
(7.943225001491024, 6.373972025310855, 6.406631630086878, 6.857011694847022, 5.856448532773877, 2.806179047909364, 2.6677320760951844, 2.1848675506782507, 3.007433089468069, 1.2852265676860597, 1.005626089353575, 0.581119903095645, 0.0, 7.882052040466393, 6.392318934052094, 5.028130446767873, 3.855679703058178, 6.014866178936138, 3.058814570949551, 2.6677320760951844, 2.0044136056495456, 2.9282242663869384, 2.2856705649490077, 1.2813263260173757, 0.5794520023009869, 0.0), # 94
(7.920409136995288, 6.341579826540998, 6.394668781435757, 6.840003522544284, 5.847037306006079, 2.799404308286339, 2.6560571828182575, 2.1758306660570037, 3.001625895442768, 1.2807186852793244, 1.0016352609919863, 0.5795084991857787, 0.0, 7.867886231138546, 6.374593491043566, 5.008176304959932, 3.8421560558379726, 6.003251790885536, 3.046162932479805, 2.6560571828182575, 1.9995745059188135, 2.9235186530030397, 2.2800011741814283, 1.2789337562871517, 0.5765072569582727, 0.0), # 95
(7.89726119162641, 6.30910585424134, 6.382575617283951, 6.8228190217391305, 5.8374582425562815, 2.7925698216735255, 2.6443481688971886, 2.1669218106995887, 2.995790534979424, 1.27619892519971, 0.9976222222222224, 0.5778847736625516, 0.0, 7.853483796296297, 6.356732510288067, 4.988111111111112, 3.828596775599129, 5.991581069958848, 3.0336905349794243, 2.6443481688971886, 1.9946927297668038, 2.9187291212781408, 2.2742730072463773, 1.2765151234567904, 0.5735550776583037, 0.0), # 96
(7.873817808791078, 6.276565294924556, 6.370354881115684, 6.805470752818035, 5.827724252938488, 2.7856892445257326, 2.6326092763580053, 2.1581446425849724, 2.9899321292485905, 1.2716673907313272, 0.9935927382991712, 0.576249496626798, 0.0, 7.838865312071332, 6.338744462894778, 4.967963691495855, 3.8150021721939806, 5.979864258497181, 3.0214024996189615, 2.6326092763580053, 1.9897780318040947, 2.913862126469244, 2.2684902509393456, 1.2740709762231368, 0.5705968449931414, 0.0), # 97
(7.850115631895988, 6.243973335103323, 6.35800931641518, 6.787971276167473, 5.817848247666694, 2.7787762332977706, 2.6208447472267373, 2.1495028196921204, 2.9840557994208194, 1.2671241851582886, 0.9895525744777209, 0.5746034381793533, 0.0, 7.824051354595337, 6.320637819972885, 4.947762872388605, 3.801372555474865, 5.968111598841639, 3.0093039475689687, 2.6208447472267373, 1.9848401666412645, 2.908924123833347, 2.2626570920558247, 1.2716018632830361, 0.5676339395548476, 0.0), # 98
(7.826191304347827, 6.211345161290323, 6.3455416666666675, 6.770333152173913, 5.807843137254903, 2.7718444444444446, 2.6090588235294123, 2.1410000000000005, 2.9781666666666666, 1.2625694117647062, 0.9855074960127594, 0.5729473684210528, 0.0, 7.8090625000000005, 6.302421052631579, 4.927537480063797, 3.787708235294118, 5.956333333333333, 2.9974000000000007, 2.6090588235294123, 1.9798888888888888, 2.9039215686274513, 2.256777717391305, 1.2691083333333337, 0.564667741935484, 0.0), # 99
(7.80208146955329, 6.178695959998229, 6.332954675354367, 6.752568941223833, 5.797721832217111, 2.764907534420566, 2.597255747292058, 2.1326398414875785, 2.9722698521566837, 1.258003173834692, 0.9814632681591747, 0.5712820574527312, 0.0, 7.79391932441701, 6.284102631980042, 4.907316340795873, 3.774009521504075, 5.944539704313367, 2.98569577808261, 2.597255747292058, 1.9749339531575472, 2.8988609161085557, 2.250856313741278, 1.2665909350708735, 0.5616996327271119, 0.0), # 100
(7.777822770919068, 6.1460409177397235, 6.320251085962506, 6.734691203703704, 5.787497243067323, 2.757979159680943, 2.585439760540705, 2.124426002133821, 2.9663704770614236, 1.253425574652358, 0.9774256561718551, 0.5696082753752236, 0.0, 7.7786424039780515, 6.265691029127459, 4.887128280859275, 3.760276723957073, 5.932740954122847, 2.9741964029873493, 2.585439760540705, 1.9699851140578162, 2.8937486215336614, 2.244897067901235, 1.2640502171925014, 0.5587309925217931, 0.0), # 101
(7.753451851851853, 6.11339522102748, 6.307433641975309, 6.716712500000001, 5.7771822803195345, 2.7510729766803848, 2.5736151053013803, 2.1163621399176957, 2.9604736625514403, 1.248836717501816, 0.9734004253056887, 0.5679267922893655, 0.0, 7.763252314814816, 6.24719471518302, 4.867002126528443, 3.746510152505447, 5.920947325102881, 2.962906995884774, 2.5736151053013803, 1.965052126200275, 2.8885911401597673, 2.2389041666666674, 1.261486728395062, 0.5557632019115891, 0.0), # 102
(7.729005355758336, 6.080774056374176, 6.294505086877001, 6.698645390499196, 5.766789854487748, 2.7442026418736987, 2.561786023600112, 2.1084519128181682, 2.9545845297972866, 1.2442367056671781, 0.9693933408155633, 0.5662383782959916, 0.0, 7.747769633058984, 6.228622161255906, 4.846966704077817, 3.7327101170015338, 5.909169059594573, 2.951832677945436, 2.561786023600112, 1.960144744195499, 2.883394927243874, 2.2328817968330656, 1.2589010173754003, 0.5527976414885616, 0.0), # 103
(7.704519926045208, 6.048192610292491, 6.281468164151806, 6.680502435587762, 5.756332876085962, 2.7373818117156943, 2.5499567574629305, 2.1006989788142056, 2.948708199969517, 1.2396256424325565, 0.9654101679563669, 0.564543803495937, 0.0, 7.732214934842251, 6.209981838455306, 4.827050839781834, 3.7188769272976687, 5.897416399939034, 2.9409785703398876, 2.5499567574629305, 1.9552727226540672, 2.878166438042981, 2.2268341451959213, 1.2562936328303613, 0.549835691844772, 0.0), # 104
(7.680032206119162, 6.015666069295101, 6.268325617283951, 6.662296195652173, 5.745824255628177, 2.7306241426611804, 2.5381315489158633, 2.0931069958847743, 2.942849794238683, 1.235003631082063, 0.961456671982988, 0.562843837990037, 0.0, 7.716608796296296, 6.1912822178904054, 4.80728335991494, 3.705010893246188, 5.885699588477366, 2.930349794238684, 2.5381315489158633, 1.9504458161865572, 2.8729121278140886, 2.220765398550725, 1.2536651234567902, 0.546878733572282, 0.0), # 105
(7.655578839386891, 5.983209619894685, 6.255080189757659, 6.644039231078905, 5.735276903628392, 2.723943291164965, 2.526314639984938, 2.0856796220088403, 2.9370144337753388, 1.2303707748998092, 0.9575386181503142, 0.5611392518791264, 0.0, 7.700971793552812, 6.172531770670389, 4.787693090751571, 3.691112324699427, 5.8740288675506775, 2.9199514708123764, 2.526314639984938, 1.9456737794035461, 2.867638451814196, 2.214679743692969, 1.2510160379515318, 0.5439281472631533, 0.0), # 106
(7.631196469255085, 5.950838448603921, 6.241734625057157, 6.625744102254428, 5.724703730600607, 2.7173529136818577, 2.5145102726961848, 2.0784205151653716, 2.931207239750038, 1.225727177169908, 0.9536617717132337, 0.5594308152640404, 0.0, 7.685324502743484, 6.153738967904443, 4.768308858566169, 3.6771815315097234, 5.862414479500076, 2.9097887212315205, 2.5145102726961848, 1.9409663669156128, 2.8623518653003037, 2.208581367418143, 1.2483469250114314, 0.5409853135094475, 0.0), # 107
(7.606921739130435, 5.918567741935485, 6.228291666666668, 6.607423369565218, 5.714117647058822, 2.7108666666666674, 2.5027226890756302, 2.0713333333333335, 2.9254333333333333, 1.221072941176471, 0.9498318979266349, 0.5577192982456142, 0.0, 7.669687500000001, 6.134912280701755, 4.749159489633174, 3.6632188235294123, 5.850866666666667, 2.899866666666667, 2.5027226890756302, 1.9363333333333337, 2.857058823529411, 2.20247445652174, 1.2456583333333338, 0.538051612903226, 0.0), # 108
(7.582791292419635, 5.886412686402053, 6.214754058070417, 6.589089593397745, 5.70353156351704, 2.7044982065742014, 2.490956131149305, 2.064421734491694, 2.9196978356957777, 1.2164081702036098, 0.9460547620454054, 0.5560054709246826, 0.0, 7.654081361454047, 6.116060180171507, 4.730273810227027, 3.6492245106108285, 5.839395671391555, 2.8901904282883715, 2.490956131149305, 1.9317844332672867, 2.85176578175852, 2.196363197799249, 1.2429508116140835, 0.5351284260365504, 0.0), # 109
(7.558841772529373, 5.854388468516307, 6.201124542752631, 6.570755334138486, 5.692958390489256, 2.6982611898592697, 2.4792148409432357, 2.0576893766194178, 2.9140058680079255, 1.211732967535437, 0.9423361293244336, 0.554290103402081, 0.0, 7.638526663237312, 6.0971911374228895, 4.711680646622168, 3.63519890260631, 5.828011736015851, 2.880765127267185, 2.4792148409432357, 1.9273294213280499, 2.846479195244628, 2.1902517780461626, 1.2402249085505264, 0.5322171335014826, 0.0), # 110
(7.535109822866345, 5.82251027479092, 6.187405864197532, 6.552433152173913, 5.68241103848947, 2.6921692729766806, 2.4675030604834527, 2.0511399176954734, 2.9083625514403293, 1.2070474364560642, 0.9386817650186072, 0.5525739657786443, 0.0, 7.623043981481482, 6.078313623565086, 4.693408825093036, 3.621142309368192, 5.816725102880659, 2.871595884773663, 2.4675030604834527, 1.9229780521262005, 2.841205519244735, 2.1841443840579715, 1.2374811728395065, 0.5293191158900837, 0.0), # 111
(7.51163208683724, 5.790793291738572, 6.173600765889348, 6.5341356078905, 5.671902418031685, 2.686236112381243, 2.4558250317959835, 2.0447770156988265, 2.9027730071635416, 1.2023516802496035, 0.9350974343828147, 0.5508578281552075, 0.0, 7.607653892318244, 6.059436109707281, 4.675487171914074, 3.6070550407488096, 5.805546014327083, 2.862687821978357, 2.4558250317959835, 1.9187400802723165, 2.8359512090158425, 2.178045202630167, 1.2347201531778695, 0.5264357537944157, 0.0), # 112
(7.488403378962436, 5.759305653776365, 6.159745218834713, 6.515900329495224, 5.661427029425976, 2.6804725589667733, 2.444210385462708, 2.038617522926869, 2.8972567496689656, 1.1976609473225461, 0.9315898541537156, 0.549146195766962, 0.0, 7.592355120674577, 6.0406081534365805, 4.657949270768578, 3.592982841967638, 5.794513499337931, 2.8540645320976163, 2.444210385462708, 1.914623256404838, 2.830713514712988, 2.1719667764984085, 1.2319490437669427, 0.5235732412523969, 0.0), # 113
(7.465184718320052, 5.728357934585393, 6.146030450014413, 6.497873652766401, 5.6508764557687075, 2.674865483980621, 2.432807283364232, 2.0327370865017067, 2.891898409523483, 1.1930630335825567, 0.9281659116150931, 0.5474608114741984, 0.0, 7.577020331328028, 6.022068926216181, 4.640829558075465, 3.5791891007476693, 5.783796819046966, 2.8458319211023895, 2.432807283364232, 1.9106182028433005, 2.8254382278843537, 2.1659578842554676, 1.2292060900028827, 0.5207598122350358, 0.0), # 114
(7.441907922403196, 5.697961279034234, 6.132464621804878, 6.480050703109068, 5.640217428207254, 2.669400305832757, 2.421623860076625, 2.027134218092903, 2.886699994311677, 1.1885650655976157, 0.9248206015236127, 0.5458025055039235, 0.0, 7.561605305328301, 6.003827560543158, 4.6241030076180625, 3.5656951967928463, 5.773399988623354, 2.8379879053300643, 2.421623860076625, 1.9067145041662548, 2.820108714103627, 2.1600169010363564, 1.226492924360976, 0.5179964799122032, 0.0), # 115
(7.418543898590108, 5.668071406280581, 6.119021459989249, 6.462399690159842, 5.629433880738015, 2.664064142733979, 2.4106419270111576, 2.021793437632998, 2.8816483571274216, 1.1841586716899097, 0.9215474575028644, 0.5441682131658231, 0.0, 7.546085807804713, 5.985850344824053, 4.607737287514321, 3.5524760150697285, 5.763296714254843, 2.8305108126861973, 2.4106419270111576, 1.9029029590956992, 2.8147169403690073, 2.154133230053281, 1.22380429199785, 0.5152792187527803, 0.0), # 116
(7.395063554259018, 5.638644035482129, 6.105674690350658, 6.444888823555345, 5.6185097473573915, 2.6588441128950824, 2.399843295579101, 2.0166992650545286, 2.8767303510645874, 1.179835480181626, 0.9183400131764379, 0.5425548697695834, 0.0, 7.53043760388658, 5.968103567465417, 4.591700065882189, 3.5395064405448773, 5.753460702129175, 2.8233789710763397, 2.399843295579101, 1.8991743663536302, 2.8092548736786958, 2.148296274518449, 1.2211349380701317, 0.5126040032256481, 0.0), # 117
(7.371437796788169, 5.60963488579657, 6.092398038672245, 6.427486312932199, 5.607428962061783, 2.6537273345268653, 2.3892097771917262, 2.0118362202900326, 2.871932829217049, 1.175587119394952, 0.9151918021679234, 0.5409594106248901, 0.0, 7.51463645870322, 5.950553516873789, 4.575959010839616, 3.5267613581848556, 5.743865658434098, 2.8165707084060454, 2.3892097771917262, 1.8955195246620464, 2.8037144810308914, 2.142495437644067, 1.218479607734449, 0.5099668077996883, 0.0), # 118
(7.347637533555794, 5.580999676381602, 6.079165230737149, 6.410160367927023, 5.5961754588475845, 2.648700925840122, 2.3787231832603024, 2.0071888232720485, 2.867242644678678, 1.1714052176520746, 0.9120963581009105, 0.5393787710414291, 0.0, 7.498658137383946, 5.933166481455719, 4.560481790504553, 3.5142156529562234, 5.734485289357356, 2.810064352580868, 2.3787231832603024, 1.8919292327429442, 2.7980877294237922, 2.1367201226423416, 1.21583304614743, 0.507363606943782, 0.0), # 119
(7.323633671940129, 5.552694126394916, 6.065949992328509, 6.392879198176436, 5.584733171711198, 2.6437520050456507, 2.3683653251961014, 2.0027415939331146, 2.8626466505433488, 1.1672814032751813, 0.909047214598989, 0.5378098863288866, 0.0, 7.482478405058078, 5.915908749617751, 4.545236072994944, 3.501844209825543, 5.7252933010866975, 2.80383823150636, 2.3683653251961014, 1.8883942893183219, 2.792366585855599, 2.1309597327254792, 1.2131899984657017, 0.5047903751268107, 0.0), # 120
(7.299397119319415, 5.524673954994208, 6.052726049229459, 6.3756110133170605, 5.573086034649023, 2.638867690354248, 2.358118014410392, 1.9984790522057692, 2.858131699904933, 1.1632073045864595, 0.906037905285749, 0.5362496917969483, 0.0, 7.466073026854929, 5.898746609766429, 4.530189526428744, 3.489621913759378, 5.716263399809866, 2.797870673088077, 2.358118014410392, 1.884905493110177, 2.7865430173245116, 2.1252036711056874, 1.2105452098458918, 0.5022430868176554, 0.0), # 121
(7.274898783071883, 5.496894881337171, 6.039467127223141, 6.358324022985514, 5.561217981657458, 2.634035099976709, 2.347963062314447, 1.9943857180225497, 2.8536846458573035, 1.1591745499080957, 0.9030619637847803, 0.5346951227553002, 0.0, 7.4494177679038165, 5.8816463503083005, 4.515309818923901, 3.4775236497242865, 5.707369291714607, 2.7921400052315697, 2.347963062314447, 1.8814536428405064, 2.780608990828729, 2.119441340995172, 1.2078934254446283, 0.49971771648519747, 0.0), # 122
(7.250109570575775, 5.469312624581501, 6.026146952092692, 6.340986436818417, 5.549112946732902, 2.629241352123832, 2.3378822803195356, 1.9904461113159944, 2.8492923414943343, 1.1551747675622777, 0.9001129237196728, 0.5331431145136282, 0.0, 7.432488393334058, 5.864574259649909, 4.500564618598363, 3.4655243026868323, 5.698584682988669, 2.7866245558423923, 2.3378822803195356, 1.8780295372313083, 2.774556473366451, 2.1136621456061393, 1.2052293904185383, 0.49721023859831837, 0.0), # 123
(7.225000389209324, 5.441882903884891, 6.012739249621247, 6.323566464452393, 5.536754863871753, 2.624473565006412, 2.327857479836928, 1.9866447520186423, 2.844941639909897, 1.1511995858711925, 0.897184318714016, 0.5315906023816185, 0.0, 7.4152606682749695, 5.847496626197802, 4.4859215935700805, 3.4535987576135767, 5.689883279819794, 2.781302652826099, 2.327857479836928, 1.87462397500458, 2.7683774319358765, 2.107855488150798, 1.2025478499242495, 0.49471662762589924, 0.0), # 124
(7.199542146350767, 5.414561438405035, 5.99921774559195, 6.306032315524057, 5.524127667070411, 2.619718856835246, 2.3178704722778956, 1.9829661600630304, 2.840619394197865, 1.147240633157027, 0.8942696823914004, 0.5300345216689567, 0.0, 7.397710357855863, 5.8303797383585225, 4.471348411957002, 3.4417218994710805, 5.68123878839573, 2.7761526240882426, 2.3178704722778956, 1.8712277548823186, 2.7620638335352057, 2.1020107718413525, 1.19984354911839, 0.49223285803682143, 0.0), # 125
(7.1737057493783425, 5.387303947299629, 5.985556165787933, 6.288352199670033, 5.511215290325276, 2.614964345821132, 2.307903069053708, 1.9793948553816976, 2.8363124574521112, 1.1432895377419687, 0.8913625483754153, 0.5284718076853291, 0.0, 7.379813227206063, 5.813189884538619, 4.4568127418770755, 3.4298686132259055, 5.6726249149042225, 2.7711527975343766, 2.307903069053708, 1.8678316755865225, 2.755607645162638, 2.0961173998900113, 1.1971112331575866, 0.4897549042999664, 0.0), # 126
(7.147462105670289, 5.360066149726364, 5.9717282359923365, 6.27049432652694, 5.498001667632746, 2.610197150174864, 2.2979370815756375, 1.975915357907182, 2.832007682766508, 1.139337927948205, 0.8884564502896507, 0.5268993957404212, 0.0, 7.361545041454879, 5.795893353144632, 4.442282251448253, 3.4180137838446143, 5.664015365533016, 2.766281501070055, 2.2979370815756375, 1.8644265358391885, 2.749000833816373, 2.0901647755089803, 1.1943456471984675, 0.487278740884215, 0.0), # 127
(7.120782122604837, 5.332803764842939, 5.957707681988301, 6.252426905731399, 5.484470732989221, 2.6054043881072406, 2.287954321254953, 1.9725121875720208, 2.827691923234929, 1.1353774320979229, 0.8855449217576967, 0.5253142211439193, 0.0, 7.34288156573163, 5.778456432583111, 4.427724608788483, 3.4061322962937677, 5.655383846469858, 2.7615170626008294, 2.287954321254953, 1.8610031343623146, 2.7422353664946106, 2.084142301910467, 1.1915415363976603, 0.4848003422584491, 0.0), # 128
(7.093636707560226, 5.305472511807044, 5.9434682295589605, 6.2341181469200295, 5.4706064203911, 2.600573177829058, 2.2779365995029255, 1.9691698643087534, 2.823352031951247, 1.1313996785133094, 0.882621496403143, 0.5237132192055092, 0.0, 7.323798565165631, 5.7608454112606, 4.413107482015715, 3.3941990355399274, 5.646704063902494, 2.756837810032255, 2.2779365995029255, 1.8575522698778983, 2.73530321019555, 2.078039382306677, 1.188693645911792, 0.48231568289154947, 0.0), # 129
(7.065996767914694, 5.2780281097763755, 5.9289836044874535, 6.215536259729452, 5.45639266383478, 2.595690637551111, 2.267865727730825, 1.9658729080499169, 2.818974862009333, 1.1273962955165517, 0.8796797078495794, 0.522093325234877, 0.0, 7.3042718048861985, 5.743026577583645, 4.398398539247896, 3.3821888865496543, 5.637949724018666, 2.7522220712698835, 2.267865727730825, 1.8540647411079363, 2.72819633191739, 2.0718454199098177, 1.1857967208974907, 0.4798207372523978, 0.0), # 130
(7.037833211046475, 5.250426277908626, 5.914227532556921, 6.196649453796286, 5.441813397316663, 2.590743885484198, 2.2577235173499237, 1.9626058387280498, 2.814547266503063, 1.1233589114298372, 0.8767130897205959, 0.5204514745417084, 0.0, 7.2842770500226495, 5.724966219958791, 4.383565448602979, 3.370076734289511, 5.629094533006126, 2.74764817421927, 2.2577235173499237, 1.850531346774427, 2.7209066986583315, 2.0655498179320957, 1.1828455065113843, 0.4773114798098752, 0.0), # 131
(7.009116944333808, 5.222622735361492, 5.8991737395504975, 6.1774259387571515, 5.4268525548331485, 2.5857200398391145, 2.24749177977149, 1.959353176275691, 2.8100560985263074, 1.119279154575353, 0.8737151756397821, 0.5187846024356896, 0.0, 7.263790065704301, 5.706630626792584, 4.36857587819891, 3.3578374637260584, 5.620112197052615, 2.7430944467859675, 2.24749177977149, 1.8469428855993675, 2.7134262774165743, 2.0591419795857178, 1.1798347479100997, 0.474783885032863, 0.0), # 132
(6.979818875154931, 5.194573201292665, 5.883795951251323, 6.1578339242486715, 5.411494070380632, 2.5806062188266576, 2.237152326406796, 1.9560994406253773, 2.80548821117294, 1.1151486532752868, 0.8706794992307283, 0.5170896442265063, 0.0, 7.242786617060469, 5.687986086491568, 4.353397496153641, 3.3454459598258595, 5.61097642234588, 2.7385392168755285, 2.237152326406796, 1.8432901563047555, 2.705747035190316, 2.052611308082891, 1.1767591902502648, 0.4722339273902424, 0.0), # 133
(6.949909910888076, 5.166233394859844, 5.868067893442536, 6.137841619907462, 5.395721877955516, 2.575389540657624, 2.2266869686671114, 1.9528291517096479, 2.8008304575368346, 1.1109590358518249, 0.8675995941170239, 0.5153635352238445, 0.0, 7.221242469220467, 5.668998887462289, 4.3379979705851195, 3.3328771075554737, 5.601660915073669, 2.7339608123935073, 2.2266869686671114, 1.8395639576125886, 2.697860938977758, 2.0459472066358213, 1.1736135786885074, 0.46965758135089497, 0.0), # 134
(6.919360958911483, 5.137559035220717, 5.851963291907273, 6.117417235370148, 5.379519911554198, 2.57005712354281, 2.2160775179637073, 1.9495268294610402, 2.796069690711861, 1.1067019306271555, 0.8644689939222592, 0.5136032107373902, 0.0, 7.199133387313616, 5.649635318111292, 4.322344969611295, 3.320105791881466, 5.592139381423722, 2.7293375612454565, 2.2160775179637073, 1.835755088244864, 2.689759955777099, 2.0391390784567163, 1.1703926583814546, 0.4670508213837017, 0.0), # 135
(6.888142926603388, 5.108505841532984, 5.835455872428673, 6.096528980273343, 5.362872105173076, 2.564596085693012, 2.205305785707854, 1.9461769938120925, 2.7911927637918947, 1.1023689659234648, 0.8612812322700237, 0.5118056060768296, 0.0, 7.176435136469229, 5.629861666845124, 4.306406161350118, 3.3071068977703937, 5.5823855275837895, 2.72464779133693, 2.205305785707854, 1.8318543469235802, 2.681436052586538, 2.0321763267577815, 1.1670911744857346, 0.46440962195754404, 0.0), # 136
(6.856226721342027, 5.079029532954335, 5.818519360789875, 6.075145064253675, 5.345762392808551, 2.558993545319026, 2.1943535833108223, 1.942764164695343, 2.7861865298708084, 1.0979517700629406, 0.8580298427839075, 0.5099676565518481, 0.0, 7.153123481816621, 5.609644222070328, 4.290149213919538, 3.293855310188821, 5.572373059741617, 2.7198698305734803, 2.1943535833108223, 1.8278525323707329, 2.6728811964042754, 2.0250483547512257, 1.1637038721579749, 0.46172995754130325, 0.0), # 137
(6.823583250505639, 5.0490858286424665, 5.801127482774012, 6.053233696947759, 5.3281747084570235, 2.5532366206316497, 2.1832027221838817, 1.9392728620433302, 2.781037842042475, 1.0934419713677697, 0.8547083590875004, 0.508086297472132, 0.0, 7.129174188485113, 5.58894927219345, 4.273541795437502, 3.280325914103308, 5.56207568408495, 2.7149820068606623, 2.1832027221838817, 1.8237404433083213, 2.6640873542285117, 2.017744565649253, 1.1602254965548024, 0.45900780260386065, 0.0), # 138
(6.790183421472455, 5.018630447755072, 5.783253964164227, 6.030763087992216, 5.3100929861148884, 2.547312429841679, 2.171835013738304, 1.9356876057885917, 2.775733553400766, 1.0888311981601397, 0.8513103148043922, 0.5061584641473672, 0.0, 7.104563021604015, 5.567743105621037, 4.256551574021961, 3.2664935944804183, 5.551467106801532, 2.709962648104028, 2.171835013738304, 1.8195088784583422, 2.6550464930574442, 2.0102543626640723, 1.1566507928328456, 0.4562391316140975, 0.0), # 139
(6.755998141620719, 4.987619109449845, 5.764872530743658, 6.007701447023667, 5.291501159778549, 2.5412080911599104, 2.1602322693853586, 1.9319929158636655, 2.770260517039555, 1.0841110787622374, 0.8478292435581727, 0.5041810918872395, 0.0, 7.079265746302652, 5.545992010759633, 4.2391462177908625, 3.2523332362867117, 5.54052103407911, 2.704790082209132, 2.1602322693853586, 1.8151486365427931, 2.6457505798892744, 2.0025671490078896, 1.1529745061487318, 0.45341991904089507, 0.0), # 140
(6.720998318328665, 4.956007532884482, 5.745956908295441, 5.984016983678732, 5.272383163444402, 2.5349107227971404, 2.148376300536318, 1.9281733122010902, 2.7646055860527143, 1.0792732414962505, 0.844258678972432, 0.502151116001435, 0.0, 7.053258127710331, 5.523662276015784, 4.221293394862159, 3.2378197244887508, 5.529211172105429, 2.6994426370815265, 2.148376300536318, 1.8106505162836717, 2.636191581722201, 1.994672327892911, 1.1491913816590882, 0.4505461393531348, 0.0), # 141
(6.685154858974525, 4.923751437216675, 5.726480822602714, 5.959677907594033, 5.252722931108846, 2.5284074429641663, 2.1362489186024507, 1.924213314733404, 2.7587556135341176, 1.0743093146843659, 0.8405921546707598, 0.5000654717996397, 0.0, 7.026515930956373, 5.500720189796036, 4.202960773353798, 3.222927944053097, 5.517511227068235, 2.6938986406267658, 2.1362489186024507, 1.806005316402976, 2.626361465554423, 1.9865593025313446, 1.1452961645205428, 0.4476137670196978, 0.0), # 142
(6.64843867093654, 4.890806541604119, 5.706417999448617, 5.934652428406185, 5.232504396768282, 2.521685369871783, 2.1238319349950276, 1.920097443393144, 2.7526974525776393, 1.0692109266487708, 0.8368232042767458, 0.4979210945915394, 0.0, 6.999014921170094, 5.477132040506932, 4.184116021383729, 3.207632779946312, 5.505394905155279, 2.6881364207504017, 2.1238319349950276, 1.8012038356227023, 2.616252198384141, 1.9782174761353954, 1.1412835998897235, 0.44461877650946546, 0.0), # 143
(6.610820661592948, 4.857128565204509, 5.685742164616285, 5.908908755751814, 5.2117114944191085, 2.5147316217307885, 2.1111071611253194, 1.9158102181128498, 2.746417956277149, 1.0639697057116522, 0.8329453614139802, 0.49571491968682, 0.0, 6.970730863480812, 5.452864116555019, 4.164726807069901, 3.191909117134956, 5.492835912554298, 2.6821343053579896, 2.1111071611253194, 1.796236872664849, 2.6058557472095543, 1.9696362519172719, 1.1371484329232573, 0.44155714229131915, 0.0), # 144
(6.572271738321982, 4.82267322717554, 5.6644270438888595, 5.882415099267537, 5.190328158057724, 2.507533316751979, 2.0980564084045974, 1.9113361588250588, 2.739903977726521, 1.0585772801951978, 0.8289521597060527, 0.4934438823951677, 0.0, 6.94163952301784, 5.4278827063468436, 4.144760798530264, 3.175731840585593, 5.479807955453042, 2.6758706223550823, 2.0980564084045974, 1.7910952262514135, 2.595164079028862, 1.9608050330891795, 1.132885408777772, 0.4384248388341401, 0.0), # 145
(6.5327628085018805, 4.787396246674904, 5.642446363049478, 5.855139668589976, 5.16833832168053, 2.5000775731461515, 2.084661488244132, 1.906659785462309, 2.7331423700196282, 1.0530252784215943, 0.8248371327765532, 0.4911049180262681, 0.0, 6.911716664910495, 5.402154098288948, 4.124185663882766, 3.1590758352647823, 5.4662847400392565, 2.669323699647233, 2.084661488244132, 1.7857696951043938, 2.584169160840265, 1.9517132228633256, 1.1284892726098958, 0.4352178406068095, 0.0), # 146
(6.49226477951088, 4.751253342860296, 5.619773847881273, 5.827050673355748, 5.145725919283921, 2.4923515091241004, 2.0709042120551926, 1.9017656179571385, 2.7261199862503442, 1.0473053287130294, 0.8205938142490716, 0.48869496188980743, 0.0, 6.8809380542880945, 5.375644580787881, 4.102969071245358, 3.1419159861390877, 5.4522399725006885, 2.662471865139994, 2.0709042120551926, 1.7802510779457859, 2.5728629596419603, 1.9423502244519164, 1.1239547695762548, 0.43193212207820875, 0.0), # 147
(6.450748558727217, 4.714200234889411, 5.596383224167389, 5.798116323201478, 5.1224748848643, 2.4843422428966253, 2.0567663912490506, 1.8966381762420859, 2.718823679512541, 1.0414090593916896, 0.8162157377471978, 0.48621094929547143, 0.0, 6.8492794562799535, 5.348320442250185, 4.081078688735989, 3.124227178175068, 5.437647359025082, 2.6552934467389204, 2.0567663912490506, 1.7745301734975893, 2.56123744243215, 1.9327054410671598, 1.1192766448334779, 0.42856365771721927, 0.0), # 148
(6.40818505352913, 4.676192641919942, 5.572248217690963, 5.768304827763782, 5.098569152418064, 2.4760368926745198, 2.0422298372369765, 1.8912619802496888, 2.71124030290009, 1.0353280987797628, 0.8116964368945213, 0.48364981555294617, 0.0, 6.81671663601539, 5.320147971082407, 4.058482184472607, 3.1059842963392876, 5.42248060580018, 2.6477667723495646, 2.0422298372369765, 1.7685977804817998, 2.549284576209032, 1.922768275921261, 1.1144496435381928, 0.42510842199272214, 0.0), # 149
(6.364545171294852, 4.6371862831095845, 5.54734255423513, 5.737584396679283, 5.0739926559416135, 2.467422576668583, 2.0272763614302405, 1.8856215499124855, 2.7033567095068674, 1.0290540751994355, 0.8070294453146325, 0.48100849597191764, 0.0, 6.783225358623717, 5.291093455691093, 4.035147226573162, 3.0871622255983056, 5.406713419013735, 2.63987016987748, 2.0272763614302405, 1.7624446976204164, 2.5369963279708068, 1.912528132226428, 1.1094685108470261, 0.4215623893735987, 0.0), # 150
(6.31979981940262, 4.597136877616033, 5.521639959583029, 5.705923239584598, 5.048729329431348, 2.4584864130896094, 2.011887775240113, 1.8797014051630145, 2.695159752426744, 1.0225786169728959, 0.8022082966311207, 0.4782839258620715, 0.0, 6.748781389234255, 5.261123184482786, 4.011041483155603, 3.067735850918687, 5.390319504853488, 2.6315819672282204, 2.011887775240113, 1.7560617236354352, 2.524364664715674, 1.9019744131948664, 1.1043279919166058, 0.41792153432873036, 0.0), # 151
(6.273919905230675, 4.55600014459698, 5.495114159517802, 5.673289566116352, 5.022763106883663, 2.4492155201483965, 1.996045890077866, 1.8734860659338137, 2.686636284753592, 1.0158933524223301, 0.7972265244675764, 0.475473040533094, 0.0, 6.713360492976318, 5.230203445864033, 3.9861326223378812, 3.04768005726699, 5.373272569507184, 2.622880492307339, 1.996045890077866, 1.7494396572488546, 2.5113815534418316, 1.8910965220387843, 1.0990228319035604, 0.4141818313269982, 0.0), # 152
(6.226876336157249, 4.5137318032101215, 5.467738879822579, 5.63965158591116, 4.996077922294963, 2.4395970160557408, 1.9797325173547677, 1.8669600521574208, 2.677773159581286, 1.008989909869926, 0.7920776624475889, 0.472572775294671, 0.0, 6.676938434979222, 5.19830052824138, 3.9603883122379444, 3.0269697296097773, 5.355546319162572, 2.6137440730203894, 1.9797325173547677, 1.742569297182672, 2.4980389611474814, 1.879883861970387, 1.093547775964516, 0.41033925483728384, 0.0), # 153
(6.178640019560583, 4.4702875726131515, 5.439487846280506, 5.604977508605646, 4.968657709661643, 2.429618019022439, 1.9629294684820913, 1.8601078837663743, 2.6685572300036977, 1.0018599176378709, 0.7867552441947484, 0.4695800654564884, 0.0, 6.639490980372286, 5.165380720021371, 3.9337762209737415, 3.005579752913612, 5.337114460007395, 2.604151037272924, 1.9629294684820913, 1.7354414421588849, 2.4843288548308213, 1.8683258362018824, 1.0878975692561013, 0.40638977932846837, 0.0), # 154
(6.129181862818909, 4.425623171963762, 5.410334784674718, 5.569235543836427, 4.940486402980104, 2.419265647259287, 1.9456185548711045, 1.852914080693212, 2.6589753491147006, 0.9944950040483511, 0.7812528033326445, 0.4664918463282322, 0.0, 6.600993894284821, 5.131410309610554, 3.906264016663222, 2.983485012145053, 5.317950698229401, 2.594079712970497, 1.9456185548711045, 1.7280468908994906, 2.470243201490052, 1.856411847945476, 1.0820669569349437, 0.402329379269433, 0.0), # 155
(6.078472773310465, 4.3796943204196515, 5.3802534207883514, 5.532393901240125, 4.911547936246746, 2.408527018977082, 1.92778158793308, 1.845363162870473, 2.649014370008167, 0.9868867974235548, 0.7755638734848673, 0.46330505321958826, 0.0, 6.561422941846148, 5.09635558541547, 3.8778193674243364, 2.960660392270664, 5.298028740016334, 2.5835084280186624, 1.92778158793308, 1.720376442126487, 2.455773968123373, 1.8441313004133755, 1.0760506841576702, 0.39815402912905923, 0.0), # 156
(6.02648365841349, 4.332456737138511, 5.349217480404546, 5.494420790453363, 4.881826243457965, 2.39738925238662, 1.9094003790792877, 1.8374396502306942, 2.63866114577797, 0.9790269260856685, 0.7696819882750067, 0.4600166214402426, 0.0, 6.520753888185581, 5.060182835842667, 3.848409941375033, 2.937080778257005, 5.27732229155594, 2.5724155103229718, 1.9094003790792877, 1.7124208945618713, 2.4409131217289826, 1.831473596817788, 1.0698434960809091, 0.3938597033762283, 0.0), # 157
(5.971744757124192, 4.28299895523299, 5.315727969268237, 5.453861748990747, 4.849963256464532, 2.3851447556146512, 1.890042688371143, 1.8285989841164574, 2.6271098910930926, 0.9706731832582289, 0.7634127670051923, 0.45650663761295607, 0.0, 6.477188687532276, 5.021573013742516, 3.817063835025962, 2.912019549774686, 5.254219782186185, 2.5600385777630406, 1.890042688371143, 1.7036748254390366, 2.424981628232266, 1.8179539163302492, 1.0631455938536476, 0.38936354138481727, 0.0), # 158
(5.9058294135827225, 4.226247901039617, 5.271158545601992, 5.402386295273073, 4.808102031883535, 2.3677218357366487, 1.8672851053542865, 1.8157378442547942, 2.609713936325905, 0.9604561988197493, 0.7556555914158659, 0.4520908349122073, 0.0, 6.420342117536156, 4.97299918403428, 3.7782779570793297, 2.8813685964592475, 5.21942787265181, 2.542032981956712, 1.8672851053542865, 1.6912298826690346, 2.4040510159417674, 1.8007954317576913, 1.0542317091203985, 0.3842043546399652, 0.0), # 159
(5.827897675923448, 4.161737600929857, 5.214613971970593, 5.339146506245316, 4.755424070051625, 2.344692604822253, 1.8408974993535137, 1.7985330631757823, 2.5859800605943066, 0.948241130372579, 0.7463012678146054, 0.4467001299258565, 0.0, 6.349136487114865, 4.913701429184421, 3.731506339073027, 2.844723391117736, 5.171960121188613, 2.5179462884460952, 1.8408974993535137, 1.6747804320158948, 2.3777120350258123, 1.7797155020817725, 1.0429227943941186, 0.3783397819027143, 0.0), # 160
(5.738577643668768, 4.0898886365923435, 5.146697981273539, 5.264743502254037, 4.69247633295046, 2.3163360460661466, 1.8110725784027506, 1.7772001777032602, 2.556221271199738, 0.9341316386341878, 0.7354322206132944, 0.44038449792717144, 0.0, 6.264299235855278, 4.844229477198885, 3.6771611030664717, 2.8023949159025627, 5.112442542399476, 2.4880802487845646, 1.8110725784027506, 1.6545257471901047, 2.34623816647523, 1.754914500751346, 1.029339596254708, 0.37180805787203125, 0.0), # 161
(5.638497416341085, 4.011121589715708, 5.068014306410331, 5.179778403645797, 4.619805782561709, 2.282931142663013, 1.7780030505359237, 1.7519547246610676, 2.5207505754436363, 0.9182313843220465, 0.7231308742238162, 0.43319391418941966, 0.0, 6.166557803344267, 4.765133056083616, 3.615654371119081, 2.754694152966139, 5.041501150887273, 2.4527366145254947, 1.7780030505359237, 1.630665101902152, 2.3099028912808546, 1.7265928012152658, 1.0136028612820662, 0.36464741724688265, 0.0), # 162
(5.528285093462799, 3.9258570419885843, 4.979166680280469, 5.084852330767161, 4.537959380867034, 2.244756877807534, 1.7418816237869603, 1.7230122408730417, 2.4798809806274416, 0.9006440281536252, 0.7094796530580545, 0.42517835398586895, 0.0, 6.0566396291687035, 4.676961893844558, 3.5473982652902722, 2.701932084460875, 4.959761961254883, 2.4122171372222585, 1.7418816237869603, 1.6033977698625244, 2.268979690433517, 1.6949507769223873, 0.9958333360560938, 0.356896094726235, 0.0), # 163
(5.408568774556308, 3.834515575099602, 4.8807588357834515, 4.980566403964691, 4.447484089848101, 2.2020922346943936, 1.7029010061897865, 1.6905882631630231, 2.433925494052593, 0.881473230846394, 0.6945609815278929, 0.4163877925897869, 0.0, 5.935272152915463, 4.580265718487656, 3.472804907639464, 2.644419692539181, 4.867850988105186, 2.3668235684282326, 1.7029010061897865, 1.5729230247817099, 2.2237420449240504, 1.660188801321564, 0.9761517671566904, 0.34859232500905474, 0.0), # 164
(5.279976559144014, 3.7375177707373965, 4.773394505818779, 4.867521743584952, 4.348926871486572, 2.155216196518274, 1.6612539057783289, 1.6548983283548488, 2.383197123020528, 0.8608226531178229, 0.678457284045215, 0.4068722052744414, 0.0, 5.803182814171416, 4.475594258018854, 3.3922864202260747, 2.582467959353468, 4.766394246041056, 2.3168576596967885, 1.6612539057783289, 1.5394401403701956, 2.174463435743286, 1.622507247861651, 0.954678901163756, 0.33977434279430885, 0.0), # 165
(5.143136546748318, 3.6352842105905996, 4.657677423285953, 4.746319469974501, 4.242834687764114, 2.1044077464738575, 1.6171330305865146, 1.6161579732723592, 2.328008874832686, 0.8387959556853827, 0.661250985021904, 0.39668156731310017, 0.0, 5.661099052523436, 4.363497240444101, 3.3062549251095197, 2.5163878670561473, 4.656017749665372, 2.262621162581303, 1.6171330305865146, 1.5031483903384697, 2.121417343882057, 1.5821064899915007, 0.9315354846571906, 0.33048038278096364, 0.0), # 166
(4.998676836891619, 3.528235476347844, 4.53421132108447, 4.617560703479906, 4.129754500662389, 2.0499458677558273, 1.57073108864827, 1.5745827347393924, 2.2686737567905064, 0.8154967992665431, 0.6430245088698437, 0.3858658539790306, 0.0, 5.509748307558397, 4.244524393769336, 3.215122544349218, 2.4464903977996286, 4.537347513581013, 2.2044158286351494, 1.57073108864827, 1.4642470483970196, 2.0648772503311945, 1.5391869011599693, 0.9068422642168941, 0.32074867966798587, 0.0), # 167
(4.847225529096317, 3.416792149697761, 4.403599932113832, 4.481846564447728, 4.010233272163062, 1.9921095435588663, 1.5222407879975217, 1.5303881495797866, 2.205504776195428, 0.7910288445787746, 0.6238602800009175, 0.3744750405455008, 0.0, 5.34985801886317, 4.119225446000509, 3.1193014000045878, 2.3730865337363234, 4.411009552390856, 2.1425434094117013, 1.5222407879975217, 1.4229353882563331, 2.005116636081531, 1.4939488548159094, 0.8807199864227666, 0.31061746815434194, 0.0), # 168
(4.689410722884812, 3.3013748123289846, 4.26644698927354, 4.33977817322453, 3.884817964247797, 1.9311777570776578, 1.4718548366681967, 1.4837897546173817, 2.1388149403488903, 0.7654957523395476, 0.6038407228270092, 0.3625591022857782, 0.0, 5.182155626024628, 3.9881501251435596, 3.019203614135046, 2.296487257018642, 4.277629880697781, 2.0773056564643344, 1.4718548366681967, 1.3794126836268983, 1.9424089821238986, 1.4465927244081769, 0.853289397854708, 0.30012498293899864, 0.0), # 169
(4.525860517779507, 3.1824040459301473, 4.12335622546309, 4.191956650156872, 3.7540555388982577, 1.8674294915068832, 1.4197659426942213, 1.435003086676016, 2.0689172565523304, 0.7390011832663317, 0.5830482617600022, 0.3501680144731306, 0.0, 5.007368568629644, 3.8518481592044362, 2.9152413088000113, 2.217003549798995, 4.137834513104661, 2.0090043213464224, 1.4197659426942213, 1.3338782082192022, 1.8770277694491289, 1.3973188833856243, 0.824671245092618, 0.28930945872092256, 0.0), # 170
(4.3572030133028, 3.06030043218988, 3.9749313735819856, 4.038983115591321, 3.61849295809611, 1.801143730041226, 1.3661668141095222, 1.3842436825795277, 1.9961247321071884, 0.7116487980765979, 0.5615653212117798, 0.33735175238082576, 0.0, 4.826224286265092, 3.710869276189083, 2.807826606058899, 2.134946394229793, 3.992249464214377, 1.9379411556113388, 1.3661668141095222, 1.2865312357437328, 1.809246479048055, 1.3463277051971074, 0.7949862747163972, 0.27820913019908006, 0.0), # 171
(4.184066308977092, 2.9354845527968174, 3.8217761665297245, 3.881458689874438, 3.4786771838230153, 1.7325994558753692, 1.3112501589480263, 1.331727079151757, 1.9207503743149028, 0.6835422574878162, 0.5394743255942259, 0.3241602912821315, 0.0, 4.639450218517843, 3.5657632041034453, 2.6973716279711297, 2.050626772463448, 3.8415007486298056, 1.8644179108124599, 1.3112501589480263, 1.237571039910978, 1.7393385919115076, 1.2938195632914795, 0.764355233305945, 0.26686223207243803, 0.0), # 172
(4.007078504324784, 2.808376989439591, 3.664494337205808, 3.7199844933527855, 3.3351551780606408, 1.6620756522039952, 1.25520868524366, 1.2776688132165412, 1.8431071904769127, 0.6547852222174565, 0.5168576993192239, 0.310643606450315, 0.0, 4.44777380497477, 3.417079670953465, 2.584288496596119, 1.9643556666523692, 3.6862143809538255, 1.7887363385031578, 1.25520868524366, 1.187196894431425, 1.6675775890303204, 1.2399948311175955, 0.7328988674411617, 0.25530699903996285, 0.0), # 173
(3.8268676988682753, 2.6793983238068333, 3.503689618509735, 3.5551616463729245, 3.1884739027906486, 1.5898513022217866, 1.1982351010303502, 1.2222844215977202, 1.763508187894657, 0.6254813529829895, 0.4937978667986571, 0.2968516731586446, 0.0, 4.251922485222747, 3.26536840474509, 2.468989333993285, 1.8764440589489682, 3.527016375789314, 1.7111981902368083, 1.1982351010303502, 1.1356080730155618, 1.5942369513953243, 1.1850538821243084, 0.700737923701947, 0.24358166580062124, 0.0), # 174
(3.6440619921299646, 2.548969137587176, 3.3399657433410055, 3.3875912692814207, 3.039180319994703, 1.5162053891234268, 1.1405221143420232, 1.165789441119132, 1.682266373869575, 0.595734310501885, 0.4703772524444093, 0.28283446668038764, 0.0, 4.052623698848646, 3.1111791334842636, 2.3518862622220467, 1.7872029315056546, 3.36453274773915, 1.632105217566785, 1.1405221143420232, 1.0830038493738763, 1.5195901599973516, 1.1291970897604737, 0.6679931486682011, 0.23172446705337968, 0.0), # 175
(3.459289483632255, 2.4175100124692537, 3.173926444599119, 3.2178744824248353, 2.8878213916544695, 1.441416896103598, 1.082262433212606, 1.1083994086046165, 1.5996947557031045, 0.5656477554916135, 0.44667828066836407, 0.268641962288812, 0.0, 3.8506048854393393, 2.9550615851769315, 2.23339140334182, 1.69694326647484, 3.199389511406209, 1.551759172046463, 1.082262433212606, 1.0295834972168558, 1.4439106958272347, 1.0726248274749453, 0.6347852889198239, 0.2197736374972049, 0.0), # 176
(3.273178272897546, 2.2854415301416977, 3.006175455183576, 3.0466124061497295, 2.7349440797516125, 1.365764806356983, 1.0236487656760251, 1.050329860878011, 1.5161063406966853, 0.535325348669645, 0.4227833758824049, 0.2543241352571853, 0.0, 3.6465934845817, 2.7975654878290377, 2.113916879412024, 1.6059760460089345, 3.0322126813933705, 1.4704618052292153, 1.0236487656760251, 0.9755462902549877, 1.3674720398758062, 1.0155374687165768, 0.6012350910367152, 0.20776741183106345, 0.0), # 177
(3.0863564594482376, 2.153184272293141, 2.8373165079938762, 2.87440616080267, 2.581095346267794, 1.2895281030782653, 0.964873819766207, 0.9917963347631552, 1.431814136151756, 0.5048707507534501, 0.39877496249841504, 0.2399309608587752, 0.0, 3.4413169358626017, 2.6392405694465264, 1.993874812492075, 1.51461225226035, 2.863628272303512, 1.3885148686684172, 0.964873819766207, 0.9210915021987609, 1.290547673133897, 0.9581353869342235, 0.5674633015987752, 0.1957440247539219, 0.0), # 178
(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0), # 179
)
passenger_allighting_rate = (
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 0
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 1
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 2
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 3
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 4
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 5
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 6
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 7
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 8
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 9
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 10
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 11
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 12
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 13
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 14
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 15
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 16
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 17
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 18
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 19
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 20
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 21
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 22
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 23
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 24
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 25
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 26
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 27
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 28
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 29
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 30
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 31
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 32
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 33
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 34
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 35
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 36
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 37
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 38
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 39
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 40
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 41
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 42
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 43
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 44
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 45
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 46
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 47
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 48
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 49
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 50
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 51
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 52
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 53
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 54
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 55
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 56
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 57
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 58
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 59
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 60
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 61
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 62
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 63
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 64
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 65
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 66
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 67
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 68
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 69
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 70
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 71
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 72
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 73
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 74
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 75
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 76
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 77
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 78
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 79
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 80
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 81
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 82
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 83
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 84
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 85
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 86
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 87
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 88
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 89
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 90
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 91
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 92
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 93
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 94
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 95
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 96
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 97
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 98
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 99
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 100
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 101
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 102
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 103
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 104
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 105
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 106
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 107
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 108
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 109
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 110
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 111
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 112
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 113
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 114
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 115
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 116
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 117
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 118
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 119
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 120
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 121
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 122
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 123
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 124
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 125
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 126
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 127
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 128
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 129
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 130
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 131
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 132
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 133
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 134
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 135
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 136
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 137
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 138
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 139
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 140
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 141
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 142
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 143
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 144
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 145
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 146
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 147
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 148
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 149
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 150
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 151
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 152
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 153
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 154
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 155
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 156
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 157
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 158
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 159
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 160
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 161
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 162
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 163
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 164
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 165
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 166
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 167
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 168
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 169
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 170
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 171
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 172
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 173
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 174
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 175
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 176
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 177
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 178
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 179
)
"""
parameters for reproducibiliy. More information: https://numpy.org/doc/stable/reference/random/parallel.html
"""
#initial entropy
entropy = 8991598675325360468762009371570610170
#index for seed sequence child
child_seed_index = (
1, # 0
91, # 1
)
| 275.190374 | 493 | 0.768662 | 32,987 | 257,303 | 5.995331 | 0.212174 | 0.360422 | 0.34586 | 0.655313 | 0.380046 | 0.371764 | 0.367385 | 0.365964 | 0.365883 | 0.365883 | 0 | 0.849163 | 0.096128 | 257,303 | 934 | 494 | 275.485011 | 0.0012 | 0.015589 | 0 | 0.200873 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.005459 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6 |
93752da0c0412b0cc45592a640a577b821e4d0bb | 48 | py | Python | annlite/core/codec/__init__.py | jina-ai/pqlite | 2ce1ec2283b381f5153ea60141a6bb474bbf0f0c | [
"Apache-2.0"
] | 45 | 2021-12-10T07:39:39.000Z | 2022-02-20T22:58:28.000Z | annlite/core/codec/__init__.py | jina-ai/pqlite | 2ce1ec2283b381f5153ea60141a6bb474bbf0f0c | [
"Apache-2.0"
] | 30 | 2021-12-10T07:46:28.000Z | 2022-02-18T09:27:48.000Z | annlite/core/codec/__init__.py | jina-ai/annlite | e4e706e313ba5cbfb7083a5dea9e75b8d2813394 | [
"Apache-2.0"
] | null | null | null | from .pq import PQCodec
from .vq import VQCodec
| 16 | 23 | 0.791667 | 8 | 48 | 4.75 | 0.75 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.166667 | 48 | 2 | 24 | 24 | 0.95 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 6 |
9377fac5add1d70ac3652956f4890d3d0ec2595b | 69 | py | Python | app/core/models/__init__.py | michaelscales88/mWreporting_final | b0399fb32fd594c2f5a20d47c2c0dceaecb6f326 | [
"MIT"
] | 2 | 2019-06-10T21:15:03.000Z | 2020-01-02T13:12:45.000Z | app/core/models/__init__.py | michaelscales88/python-reporting-app | b0399fb32fd594c2f5a20d47c2c0dceaecb6f326 | [
"MIT"
] | 14 | 2018-01-18T19:07:15.000Z | 2018-05-16T18:44:55.000Z | app/core/models/__init__.py | michaelscales88/mWreporting_final | b0399fb32fd594c2f5a20d47c2c0dceaecb6f326 | [
"MIT"
] | null | null | null | from .associations import *
from .user import *
from .roles import *
| 17.25 | 27 | 0.73913 | 9 | 69 | 5.666667 | 0.555556 | 0.392157 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.173913 | 69 | 3 | 28 | 23 | 0.894737 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 6 |
fae7076b556212e9bc8917f4ce7ae04b0f219bad | 55 | py | Python | src/exceptionite/flask/__init__.py | MasoniteFramework/exceptions | ce15da5e9f763c563e9d687771fb0599b875b83f | [
"MIT"
] | 6 | 2019-12-13T05:22:49.000Z | 2020-01-02T20:50:24.000Z | src/exceptionite/flask/__init__.py | MasoniteFramework/exceptions | ce15da5e9f763c563e9d687771fb0599b875b83f | [
"MIT"
] | 7 | 2019-12-12T18:02:20.000Z | 2020-01-04T19:49:49.000Z | src/exceptionite/flask/__init__.py | MasoniteFramework/exceptions | ce15da5e9f763c563e9d687771fb0599b875b83f | [
"MIT"
] | 3 | 2020-08-11T22:07:46.000Z | 2022-02-21T05:22:59.000Z | from .ExceptioniteReporter import ExceptioniteReporter
| 27.5 | 54 | 0.909091 | 4 | 55 | 12.5 | 0.75 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.072727 | 55 | 1 | 55 | 55 | 0.980392 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 6 |
8794497c04aa622324ac79f5dc8802a597a5178a | 28 | py | Python | ioc_fanger_gui/__init__.py | ioc-fang/ioc-fanger-gui | 76fa32cea2c7944601a79ddb0359fcc8cdf23ff4 | [
"MIT"
] | 1 | 2021-07-01T02:02:37.000Z | 2021-07-01T02:02:37.000Z | ioc_fanger_gui/__init__.py | ioc-fang/ioc-fanger-gui | 76fa32cea2c7944601a79ddb0359fcc8cdf23ff4 | [
"MIT"
] | null | null | null | ioc_fanger_gui/__init__.py | ioc-fang/ioc-fanger-gui | 76fa32cea2c7944601a79ddb0359fcc8cdf23ff4 | [
"MIT"
] | null | null | null | from . import ioc_fanger_gui | 28 | 28 | 0.857143 | 5 | 28 | 4.4 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.107143 | 28 | 1 | 28 | 28 | 0.88 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 6 |
87c029ac490ecc74290ea46ef5f4cc17843ffd25 | 460 | py | Python | src/swimport/tests/resources/__init__.py | talos-gis/swimport | e8f0fcf02b0c9751b199f750f1f8bc57c8ff54b3 | [
"MIT"
] | 1 | 2019-03-07T20:43:42.000Z | 2019-03-07T20:43:42.000Z | src/swimport/tests/resources/__init__.py | talos-gis/swimport | e8f0fcf02b0c9751b199f750f1f8bc57c8ff54b3 | [
"MIT"
] | null | null | null | src/swimport/tests/resources/__init__.py | talos-gis/swimport | e8f0fcf02b0c9751b199f750f1f8bc57c8ff54b3 | [
"MIT"
] | null | null | null | from swimport.tests.resources.mem_check import check_memory_deg, MemoryTracker
from swimport.tests.resources.assert_err import AssertError
from swimport.tests.resources.assert_ import assert_eq, assert_ne, assert_ge, assert_le, assert_gt, assert_lt, \
assert_is, assert_is_not, assert_isinstance, assert_not_isinstance, assert_issubclass, assert_not_issubclass, \
assert_true, assert_false, assert_in, assert_not_in, assert_not_hasattr, assert_isclose
| 76.666667 | 115 | 0.85 | 66 | 460 | 5.5 | 0.424242 | 0.099174 | 0.140496 | 0.214876 | 0.176309 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.086957 | 460 | 5 | 116 | 92 | 0.864286 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.8 | 1 | 0 | true | 0 | 0.6 | 0 | 0.6 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 6 |
354ef85b92123fb716a9bbc3f0a6dda46eedac0f | 29 | py | Python | models/__init__.py | saic-vul/geometry-preserving-de | d39e6ea6cf01551d0638b4f771f455759451752d | [
"MIT"
] | 11 | 2021-02-25T12:42:17.000Z | 2022-01-28T06:37:23.000Z | models/__init__.py | saic-vul/geometry-preserving-de | d39e6ea6cf01551d0638b4f771f455759451752d | [
"MIT"
] | 1 | 2022-01-28T07:23:57.000Z | 2022-01-28T07:23:57.000Z | models/__init__.py | saic-vul/geometry-preserving-de | d39e6ea6cf01551d0638b4f771f455759451752d | [
"MIT"
] | null | null | null | from .architectures import *
| 14.5 | 28 | 0.793103 | 3 | 29 | 7.666667 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.137931 | 29 | 1 | 29 | 29 | 0.92 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 6 |
356d5ab0a9ed7d6e26f8ca5a4f27ac48852ae394 | 637 | py | Python | Module01/ModulePackage/UseModuel_191.py | fenglihanxiao/Python | 872baf3a3a5ee42740161152605ca2b1ddf4cd30 | [
"MIT"
] | null | null | null | Module01/ModulePackage/UseModuel_191.py | fenglihanxiao/Python | 872baf3a3a5ee42740161152605ca2b1ddf4cd30 | [
"MIT"
] | null | null | null | Module01/ModulePackage/UseModuel_191.py | fenglihanxiao/Python | 872baf3a3a5ee42740161152605ca2b1ddf4cd30 | [
"MIT"
] | null | null | null | """
1. 191_XXX -> Use module partially
"""
###########################################
# 1. Partial import from module
# 2. from ModulePackage.Module_189 import *
# from ModulePackage.Module_189 import show
# from ModulePackage.Module_189 import age
# from ModulePackage.Module_189 import modules
# from ModulePackage.Module_189 import Cat
#
# show()
# print(age)
# print(modules)
# print(Cat.mow())
###########################################
# 1. The last import statement takes effect
from Module01.ModulePackage.Module_189 import age
# from Module01.ModulePackage.Module_191 import age
from Module_189 import age
print(age)
| 23.592593 | 51 | 0.660911 | 77 | 637 | 5.350649 | 0.311688 | 0.322816 | 0.254854 | 0.407767 | 0.480583 | 0.169903 | 0 | 0 | 0 | 0 | 0 | 0.063063 | 0.128728 | 637 | 26 | 52 | 24.5 | 0.679279 | 0.656201 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.666667 | 0 | 0.666667 | 0.333333 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 6 |
ea37dbf67a2a91a274e7e2be9f28ec0307c6b694 | 39 | py | Python | openabis_fingerjetfx/__init__.py | openabis/openabis-fingerjetfx | 869eadd23a21a34dad6da69e26e2993495ddc7ba | [
"Apache-2.0"
] | 2 | 2021-09-13T18:34:33.000Z | 2021-10-30T19:18:32.000Z | openabis_fingerjetfx/__init__.py | openabis/openabis-fingerjetfx | 869eadd23a21a34dad6da69e26e2993495ddc7ba | [
"Apache-2.0"
] | 2 | 2021-06-08T20:35:40.000Z | 2022-01-13T01:48:52.000Z | openabis_fingerjetfx/__init__.py | openabis/openabis-fingerjetfx | 869eadd23a21a34dad6da69e26e2993495ddc7ba | [
"Apache-2.0"
] | null | null | null | from .plugin import FingerjetExtractor
| 19.5 | 38 | 0.871795 | 4 | 39 | 8.5 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.102564 | 39 | 1 | 39 | 39 | 0.971429 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 6 |
57944824e4c7ece62af3a4746230cc1a56b71128 | 45,907 | py | Python | DEEP LEARNING/segmentation/Kaggle TGS Salt Identification Challenge/v2/common_blocks/unet_models.py | Diyago/ML-DL-scripts | 40718a9d4318d6d6531bcea5998c0a18afcd9cb3 | [
"Apache-2.0"
] | 142 | 2018-09-02T08:59:45.000Z | 2022-03-30T17:08:24.000Z | DEEP LEARNING/segmentation/Kaggle TGS Salt Identification Challenge/v2/common_blocks/unet_models.py | jerinka/ML-DL-scripts | eeb5c3c7c5841eb4cdb272690e14d6718f3685b2 | [
"Apache-2.0"
] | 4 | 2019-09-08T07:27:11.000Z | 2021-10-19T05:50:24.000Z | DEEP LEARNING/segmentation/Kaggle TGS Salt Identification Challenge/v2/common_blocks/unet_models.py | jerinka/ML-DL-scripts | eeb5c3c7c5841eb4cdb272690e14d6718f3685b2 | [
"Apache-2.0"
] | 75 | 2018-10-04T17:08:40.000Z | 2022-03-08T18:50:52.000Z | from torch import nn
# from torch.nn import functional as F
import torch
from torchvision import models
import torchvision
from collections import OrderedDict
import torch.nn.parallel
import torch.optim
import torch.utils.data
import torch.utils.data.distributed
import torch.utils.model_zoo as model_zoo
from .pnasnet import PNASNet5Large
import pretrainedmodels
import torch.nn.functional as F
# from modules.wider_resnet import WiderResNet
from .resnext import *
"""
This script has been taken (and modified) from :
https://github.com/ternaus/TernausNet
@ARTICLE{arXiv:1801.05746,
author = {V. Iglovikov and A. Shvets},
title = {TernausNet: U-Net with VGG11 Encoder Pre-Trained on ImageNet for Image Segmentation},
journal = {ArXiv e-prints},
eprint = {1801.05746},
year = 2018
}
"""
def conv3x3(in_, out):
return nn.Conv2d(in_, out, 3, padding=1)
class ConvRelu(nn.Module):
def __init__(self, in_, out):
super().__init__()
self.conv = conv3x3(in_, out)
self.activation = nn.ReLU(inplace=True)
def forward(self, x):
x = self.conv(x)
x = self.activation(x)
return x
class NoOperation(nn.Module):
def forward(self, x):
return x
class DecoderBlock_old(nn.Module):
def __init__(self, in_channels, middle_channels, out_channels):
super().__init__()
self.block = nn.Sequential(
ConvRelu(in_channels, middle_channels),
nn.ConvTranspose2d(
middle_channels,
out_channels,
kernel_size=3,
stride=2,
padding=1,
output_padding=1,
),
nn.BatchNorm2d(out_channels), ##me added
nn.ReLU(inplace=True),
)
def forward(self, x):
return self.block(x)
class DecoderBlock(nn.Module):
def __init__(self, in_channels, middle_channels, out_channels):
super(DecoderBlock, self).__init__()
self.conv1 = ConvBn2d(in_channels, middle_channels)
self.conv2 = ConvBn2d(middle_channels, out_channels)
# self.deconv = nn.ConvTranspose2d(middle_channels, out_channels, kernel_size=4, stride=2, padding=1)
# self.bn = nn.BatchNorm2d(out_channels)
self.spatial_gate = SpatialAttentionGate(out_channels)
self.channel_gate = ChannelAttentionGate(out_channels)
def forward(self, x, e=None):
x = F.upsample(x, scale_factor=2, mode="bilinear")
if e is not None:
x = torch.cat([x, e], 1)
x = F.relu(self.conv1(x), inplace=True)
x = F.relu(self.conv2(x), inplace=True)
g1 = self.spatial_gate(x)
g2 = self.channel_gate(x)
x = x * g1 + x * g2
return x
class UNet11(nn.Module):
def __init__(self, num_classes=1, num_filters=32, pretrained=False):
"""
:param num_classes:
:param num_filters:
:param pretrained:
False - no pre-trained network is used
True - encoder is pre-trained with VGG11
"""
super().__init__()
self.pool = nn.MaxPool2d(2, 2)
self.encoder = models.vgg11(pretrained=pretrained).features
self.relu = self.encoder[1]
self.conv1 = self.encoder[0]
self.conv2 = self.encoder[3]
self.conv3s = self.encoder[6]
self.conv3 = self.encoder[8]
self.conv4s = self.encoder[11]
self.conv4 = self.encoder[13]
self.conv5s = self.encoder[16]
self.conv5 = self.encoder[18]
self.center = DecoderBlock(
num_filters * 8 * 2, num_filters * 8 * 2, num_filters * 8
)
self.dec5 = DecoderBlock(
num_filters * (16 + 8), num_filters * 8 * 2, num_filters * 8
)
self.dec4 = DecoderBlock(
num_filters * (16 + 8), num_filters * 8 * 2, num_filters * 4
)
self.dec3 = DecoderBlock(
num_filters * (8 + 4), num_filters * 4 * 2, num_filters * 2
)
self.dec2 = DecoderBlock(
num_filters * (4 + 2), num_filters * 2 * 2, num_filters
)
self.dec1 = ConvRelu(num_filters * (2 + 1), num_filters)
self.final = nn.Conv2d(num_filters, num_classes, kernel_size=1)
def forward(self, x):
conv1 = self.relu(self.conv1(x))
conv2 = self.relu(self.conv2(self.pool(conv1)))
conv3s = self.relu(self.conv3s(self.pool(conv2)))
conv3 = self.relu(self.conv3(conv3s))
conv4s = self.relu(self.conv4s(self.pool(conv3)))
conv4 = self.relu(self.conv4(conv4s))
conv5s = self.relu(self.conv5s(self.pool(conv4)))
conv5 = self.relu(self.conv5(conv5s))
center = self.center(self.pool(conv5))
dec5 = self.dec5(torch.cat([center, conv5], 1))
dec4 = self.dec4(torch.cat([dec5, conv4], 1))
dec3 = self.dec3(torch.cat([dec4, conv3], 1))
dec2 = self.dec2(torch.cat([dec3, conv2], 1))
dec1 = self.dec1(torch.cat([dec2, conv1], 1))
return self.final(dec1)
def unet11(pretrained=False, **kwargs):
"""
pretrained:
False - no pre-trained network is used
True - encoder is pre-trained with VGG11
carvana - all weights are pre-trained on
Kaggle: Carvana dataset https://www.kaggle.com/c/carvana-image-masking-challenge
"""
model = UNet11(pretrained=pretrained, **kwargs)
if pretrained == "carvana":
state = torch.load("TernausNet.pt")
model.load_state_dict(state["model"])
return model
class DecoderBlockV2(nn.Module):
def __init__(self, in_channels, middle_channels, out_channels, is_deconv=True):
super(DecoderBlockV2, self).__init__()
self.in_channels = in_channels
if is_deconv:
"""
Paramaters for Deconvolution were chosen to avoid artifacts, following
link https://distill.pub/2016/deconv-checkerboard/
"""
self.block = nn.Sequential(
ConvRelu(in_channels, middle_channels),
nn.ConvTranspose2d(
middle_channels, out_channels, kernel_size=4, stride=2, padding=1
),
# nn.BatchNorm2d(out_channels), ##me added
nn.ReLU(inplace=True),
)
else:
self.block = nn.Sequential(
nn.Upsample(scale_factor=2, mode="bilinear"),
ConvRelu(in_channels, middle_channels),
ConvRelu(middle_channels, out_channels),
)
def forward(self, x):
return self.block(x)
class DecoderCenter(nn.Module):
def __init__(self, in_channels, middle_channels, out_channels, is_deconv=True):
super(DecoderCenter, self).__init__()
self.in_channels = in_channels
if is_deconv:
"""
Paramaters for Deconvolution were chosen to avoid artifacts, following
link https://distill.pub/2016/deconv-checkerboard/
"""
self.block = nn.Sequential(
ConvRelu(in_channels, middle_channels),
nn.ConvTranspose2d(
middle_channels, out_channels, kernel_size=4, stride=2, padding=1
),
nn.BatchNorm2d(out_channels), ##me added
nn.ReLU(inplace=True),
)
else:
self.block = nn.Sequential(
ConvRelu(in_channels, middle_channels),
ConvRelu(middle_channels, out_channels),
# nn.BatchNorm2d(out_channels), ##me added
# nn.ReLU(inplace=True) ##me added
)
def forward(self, x):
return self.block(x)
class AlbuNet(nn.Module):
"""
UNet (https://arxiv.org/abs/1505.04597) with Resnet34(https://arxiv.org/abs/1512.03385) encoder
Proposed by Alexander Buslaev: https://www.linkedin.com/in/al-buslaev/
"""
def __init__(
self, num_classes=1, num_filters=32, pretrained=False, is_deconv=False
):
"""
:param num_classes:
:param num_filters:
:param pretrained:
False - no pre-trained network is used
True - encoder is pre-trained with resnet34
:is_deconv:
False: bilinear interpolation is used in decoder
True: deconvolution is used in decoder
"""
super().__init__()
self.num_classes = num_classes
self.pool = nn.MaxPool2d(2, 2)
self.encoder = torchvision.models.resnet34(pretrained=pretrained)
self.relu = nn.ReLU(inplace=True)
self.conv1 = nn.Sequential(
self.encoder.conv1, self.encoder.bn1, self.encoder.relu, self.pool
)
self.conv2 = self.encoder.layer1
self.conv3 = self.encoder.layer2
self.conv4 = self.encoder.layer3
self.conv5 = self.encoder.layer4
self.center = DecoderBlockV2(
512, num_filters * 8 * 2, num_filters * 8, is_deconv
)
self.dec5 = DecoderBlockV2(
512 + num_filters * 8, num_filters * 8 * 2, num_filters * 8, is_deconv
)
self.dec4 = DecoderBlockV2(
256 + num_filters * 8, num_filters * 8 * 2, num_filters * 8, is_deconv
)
self.dec3 = DecoderBlockV2(
128 + num_filters * 8, num_filters * 4 * 2, num_filters * 2, is_deconv
)
self.dec2 = DecoderBlockV2(
64 + num_filters * 2, num_filters * 2 * 2, num_filters * 2 * 2, is_deconv
)
self.dec1 = DecoderBlockV2(
num_filters * 2 * 2, num_filters * 2 * 2, num_filters, is_deconv
)
self.dec0 = ConvRelu(num_filters, num_filters)
self.final = nn.Conv2d(num_filters, num_classes, kernel_size=1)
def forward(self, x):
conv1 = self.conv1(x)
conv2 = self.conv2(conv1)
conv3 = self.conv3(conv2)
conv4 = self.conv4(conv3)
conv5 = self.conv5(conv4)
center = self.center(self.pool(conv5))
dec5 = self.dec5(torch.cat([center, conv5], 1))
dec4 = self.dec4(torch.cat([dec5, conv4], 1))
dec3 = self.dec3(torch.cat([dec4, conv3], 1))
dec2 = self.dec2(torch.cat([dec3, conv2], 1))
dec1 = self.dec1(dec2)
dec0 = self.dec0(dec1)
return self.final(dec0)
class UNetVGG16(nn.Module):
def __init__(
self,
num_classes=1,
num_filters=32,
dropout_2d=0.2,
pretrained=False,
is_deconv=False,
):
super().__init__()
self.num_classes = num_classes
self.dropout_2d = dropout_2d
self.pool = nn.MaxPool2d(2, 2)
self.encoder = torchvision.models.vgg16(pretrained=pretrained).features
self.relu = nn.ReLU(inplace=True)
self.conv1 = nn.Sequential(
self.encoder[0], self.relu, self.encoder[2], self.relu
)
self.conv2 = nn.Sequential(
self.encoder[5], self.relu, self.encoder[7], self.relu
)
self.conv3 = nn.Sequential(
self.encoder[10],
self.relu,
self.encoder[12],
self.relu,
self.encoder[14],
self.relu,
)
self.conv4 = nn.Sequential(
self.encoder[17],
self.relu,
self.encoder[19],
self.relu,
self.encoder[21],
self.relu,
)
self.conv5 = nn.Sequential(
self.encoder[24],
self.relu,
self.encoder[26],
self.relu,
self.encoder[28],
self.relu,
)
self.center = DecoderBlockV2(
512, num_filters * 8 * 2, num_filters * 8, is_deconv
)
self.dec5 = DecoderBlockV2(
512 + num_filters * 8, num_filters * 8 * 2, num_filters * 8, is_deconv
)
self.dec4 = DecoderBlockV2(
512 + num_filters * 8, num_filters * 8 * 2, num_filters * 8, is_deconv
)
self.dec3 = DecoderBlockV2(
256 + num_filters * 8, num_filters * 4 * 2, num_filters * 2, is_deconv
)
self.dec2 = DecoderBlockV2(
128 + num_filters * 2, num_filters * 2 * 2, num_filters, is_deconv
)
self.dec1 = ConvRelu(64 + num_filters, num_filters)
self.final = nn.Conv2d(num_filters, num_classes, kernel_size=1)
def forward(self, x):
conv1 = self.conv1(x)
conv2 = self.conv2(self.pool(conv1))
conv3 = self.conv3(self.pool(conv2))
conv4 = self.conv4(self.pool(conv3))
conv5 = self.conv5(self.pool(conv4))
center = self.center(self.pool(conv5))
dec5 = self.dec5(torch.cat([center, conv5], 1))
dec4 = self.dec4(torch.cat([dec5, conv4], 1))
dec3 = self.dec3(torch.cat([dec4, conv3], 1))
dec2 = self.dec2(torch.cat([dec3, conv2], 1))
dec1 = self.dec1(torch.cat([dec2, conv1], 1))
return self.final(F.dropout2d(dec1, p=self.dropout_2d))
class UNetResNet(nn.Module):
def __init__(
self,
encoder_depth,
num_classes,
num_filters=32,
dropout_2d=0.2,
pretrained=False,
is_deconv=False,
):
super().__init__()
self.num_classes = num_classes
self.dropout_2d = dropout_2d
if encoder_depth == 34:
self.encoder = torchvision.models.resnet34(pretrained=pretrained)
bottom_channel_nr = 512
elif encoder_depth == 101:
self.encoder = torchvision.models.resnet101(pretrained=pretrained)
bottom_channel_nr = 2048
elif encoder_depth == 152:
self.encoder = torchvision.models.resnet152(pretrained=pretrained)
bottom_channel_nr = 2048
else:
raise NotImplementedError(
"only 34, 101, 152 version of Resnet are implemented"
)
self.pool = nn.MaxPool2d(2, 2)
self.relu = nn.ReLU(inplace=True)
self.conv1 = nn.Sequential(
self.encoder.conv1, self.encoder.bn1, self.encoder.relu, self.pool
)
self.conv2 = self.encoder.layer1
self.conv3 = self.encoder.layer2
self.conv4 = self.encoder.layer3
self.conv5 = self.encoder.layer4
self.center = DecoderCenter(
bottom_channel_nr, num_filters * 8 * 2, num_filters * 8, False
)
self.dec5 = DecoderBlockV2(
bottom_channel_nr + num_filters * 8,
num_filters * 8 * 2,
num_filters * 8,
is_deconv,
)
self.dec4 = DecoderBlockV2(
bottom_channel_nr // 2 + num_filters * 8,
num_filters * 8 * 2,
num_filters * 8,
is_deconv,
)
self.dec3 = DecoderBlockV2(
bottom_channel_nr // 4 + num_filters * 8,
num_filters * 4 * 2,
num_filters * 2,
is_deconv,
)
self.dec2 = DecoderBlockV2(
bottom_channel_nr // 8 + num_filters * 2,
num_filters * 2 * 2,
num_filters * 2 * 2,
is_deconv,
)
self.dec1 = DecoderBlockV2(
num_filters * 2 * 2, num_filters * 2 * 2, num_filters, is_deconv
)
self.dec0 = ConvRelu(num_filters, num_filters)
self.final = nn.Conv2d(num_filters, num_classes, kernel_size=1)
def forward(self, x):
conv1 = self.conv1(x)
conv2 = self.conv2(conv1)
conv3 = self.conv3(conv2)
conv4 = self.conv4(conv3)
conv5 = self.conv5(conv4)
# pool = self.pool(conv5) # deleted pooling
# center = self.center(pool)
center = self.center(conv5)
dec5 = self.dec5(torch.cat([center, conv5], 1))
dec4 = self.dec4(torch.cat([dec5, conv4], 1))
dec3 = self.dec3(torch.cat([dec4, conv3], 1))
dec2 = self.dec2(torch.cat([dec3, conv2], 1))
dec1 = self.dec1(dec2)
dec0 = self.dec0(dec1)
return self.final(F.dropout2d(dec0, p=self.dropout_2d))
class UNetResNet_wo_pool(nn.Module):
def __init__(
self,
encoder_depth,
num_classes,
num_filters=32,
dropout_2d=0.2,
pretrained=False,
is_deconv=False,
):
super().__init__()
self.num_classes = num_classes
self.dropout_2d = dropout_2d
if encoder_depth == 34:
self.encoder = torchvision.models.resnet34(pretrained=pretrained)
bottom_channel_nr = 512
elif encoder_depth == 101:
self.encoder = torchvision.models.resnet101(pretrained=pretrained)
bottom_channel_nr = 2048
elif encoder_depth == 152:
self.encoder = torchvision.models.resnet152(pretrained=pretrained)
bottom_channel_nr = 2048
else:
raise NotImplementedError(
"only 34, 101, 152 version of Resnet are implemented"
)
self.pool = nn.MaxPool2d(2, 2)
self.relu = nn.ReLU(inplace=True)
self.input_adjust = nn.Sequential(
self.encoder.conv1, self.encoder.bn1, self.encoder.relu
)
self.conv1 = self.encoder.layer1
self.conv2 = self.encoder.layer2
self.conv3 = self.encoder.layer3
self.conv4 = self.encoder.layer4
self.dec4 = DecoderBlockV2(
bottom_channel_nr, num_filters * 8 * 2, num_filters * 8, is_deconv
)
self.dec3 = DecoderBlockV2(
bottom_channel_nr // 2 + num_filters * 8,
num_filters * 8 * 2,
num_filters * 8,
is_deconv,
)
self.dec2 = DecoderBlockV2(
bottom_channel_nr // 4 + num_filters * 8,
num_filters * 4 * 2,
num_filters * 2,
is_deconv,
)
self.dec1 = DecoderBlockV2(
bottom_channel_nr // 8 + num_filters * 2,
num_filters * 2 * 2,
num_filters * 2 * 2,
is_deconv,
)
self.final = nn.Conv2d(num_filters * 2 * 2, num_classes, kernel_size=1)
def forward(self, x):
input_adjust = self.input_adjust(x)
conv1 = self.conv1(input_adjust)
conv2 = self.conv2(conv1)
conv3 = self.conv3(conv2)
center = self.conv4(conv3)
dec4 = self.dec4(center)
dec3 = self.dec3(torch.cat([dec4, conv3], 1))
dec2 = self.dec2(torch.cat([dec3, conv2], 1))
dec1 = F.dropout2d(self.dec1(torch.cat([dec2, conv1], 1)), p=self.dropout_2d)
# print('input_adjust ', input_adjust.shape, '\ncenter ' , center.shape, '\ndec1: ', dec1.shape)
return self.final(dec1)
class UNetResNext_wo_pool(nn.Module):
def __init__(
self,
encoder_depth,
num_classes,
num_filters=32,
dropout_2d=0.2,
pretrained=False,
is_deconv=False,
):
super().__init__()
self.num_classes = num_classes
self.dropout_2d = dropout_2d
self.encoder = (
pretrainedmodels.se_resnext50_32x4d()
) # torchvision.models.resnet152(pretrained=pretrained)
self.pool = nn.MaxPool2d(2, 2)
bottom_channel_nr = 512 * 4
self.input_adjust = nn.Sequential(
self.encoder.layer0.conv1,
self.encoder.layer0.bn1,
self.encoder.layer0.relu1,
)
self.conv1 = self.encoder.layer1
self.conv2 = self.encoder.layer2
self.conv3 = self.encoder.layer3
self.conv4 = self.encoder.layer4
self.dec4 = DecoderBlockV2(
bottom_channel_nr, num_filters * 8 * 2, num_filters * 8, is_deconv
)
self.dec3 = DecoderBlockV2(
bottom_channel_nr // 2 + num_filters * 8,
num_filters * 8 * 2,
num_filters * 8,
is_deconv,
)
self.dec2 = DecoderBlockV2(
bottom_channel_nr // 4 + num_filters * 8,
num_filters * 4 * 2,
num_filters * 2,
is_deconv,
)
self.dec1 = DecoderBlockV2(
bottom_channel_nr // 8 + num_filters * 2,
num_filters * 2 * 2,
num_filters * 2 * 2,
is_deconv,
)
self.final = nn.Conv2d(num_filters * 2 * 2, num_classes, kernel_size=1)
def forward(self, x):
input_adjust = self.input_adjust(x)
conv1 = self.conv1(input_adjust)
conv2 = self.conv2(conv1)
conv3 = self.conv3(conv2)
center = self.conv4(conv3)
dec4 = self.dec4(center)
dec3 = self.dec3(torch.cat([dec4, conv3], 1))
dec2 = self.dec2(torch.cat([dec3, conv2], 1))
dec1 = F.dropout2d(self.dec1(torch.cat([dec2, conv1], 1)), p=self.dropout_2d)
print(
"input_adjust ",
input_adjust.shape,
"\ncenter ",
center.shape,
"\ndec1: ",
dec1.shape,
self.final(dec1).shape,
)
return self.final(dec1)
class UNetResNetAttentionv2(nn.Module):
def __init__(
self,
encoder_depth,
num_classes=1,
num_filters=32,
dropout_2d=0.4,
pretrained=True,
is_deconv=True,
):
super(UNetResNetAttention, self).__init__()
self.num_classes = num_classes
self.dropout_2d = dropout_2d
self.resnet = pretrainedmodels.se_resnext50_32x4d()
bottom_channel_nr = 2048
self.encoder1 = EncoderBlock(
nn.Sequential(
self.resnet.layer0.conv1,
self.resnet.layer0.bn1,
self.resnet.layer0.relu1,
),
num_filters * 2,
)
self.encoder2 = EncoderBlock(self.resnet.layer1, bottom_channel_nr // 8)
self.encoder3 = EncoderBlock(self.resnet.layer2, bottom_channel_nr // 4)
self.encoder4 = EncoderBlock(self.resnet.layer3, bottom_channel_nr // 2)
self.encoder5 = EncoderBlock(self.resnet.layer4, bottom_channel_nr)
center_block = nn.Sequential(
ConvBn2d(bottom_channel_nr, bottom_channel_nr, kernel_size=3, padding=1),
nn.ReLU(inplace=True),
ConvBn2d(
bottom_channel_nr, bottom_channel_nr // 2, kernel_size=3, padding=1
),
nn.ReLU(inplace=True),
nn.MaxPool2d(kernel_size=2, stride=2),
)
self.center = EncoderBlock(center_block, bottom_channel_nr // 2)
self.decoder5 = DecoderBlock(
bottom_channel_nr + bottom_channel_nr // 2, num_filters * 16, 64
)
self.decoder4 = DecoderBlock(64 + bottom_channel_nr // 2, num_filters * 8, 64)
self.decoder3 = DecoderBlock(64 + bottom_channel_nr // 4, num_filters * 4, 64)
self.decoder2 = DecoderBlock(64 + bottom_channel_nr // 8, num_filters * 2, 64)
self.decoder1 = DecoderBlock(64, num_filters, 64)
self.final = nn.Conv2d(64, 2, kernel_size=1)
self.logit = nn.Sequential(
nn.Conv2d(320, 64, kernel_size=3, padding=1),
nn.ReLU(inplace=True),
nn.Conv2d(64, 2, kernel_size=1, padding=0),
)
def forward(self, x):
x = self.encoder1(x) # ; print('x:', x.size())
e2 = self.encoder2(x) # ; print('e2:', e2.size())
e3 = self.encoder3(e2) # ; print('e3:', e3.size())
e4 = self.encoder4(e3) # ; print('e4:', e4.size())
e5 = self.encoder5(e4) # ; print('e5:', e5.size())
center = self.center(e5) # ; print('center:', center.size())
d5 = self.decoder5(center, e5) # ; print('d5:', d5.size())
d4 = self.decoder4(d5, e4) # ; print('d4:', d4.size())
d3 = self.decoder3(d4, e3) # ; print('d3:', d3.size())
d2 = self.decoder2(d3, e2) # ; print('d2:', d2.size())
d1 = self.decoder1(d2)
# print('d1:', d1.size())
f = torch.cat(
[
d1,
F.upsample(d2, scale_factor=2, mode="bilinear"),
F.upsample(d3, scale_factor=4, mode="bilinear"),
F.upsample(d4, scale_factor=8, mode="bilinear"),
F.upsample(d5, scale_factor=16, mode="bilinear"),
],
dim=1,
)
# f = F.dropout2d(f, p=self.dropout_2d)
# print (self.logit(d1).shape)
return self.logit(f)
class UNetResNetAttention(nn.Module):
def __init__(
self,
encoder_depth,
num_classes=1,
num_filters=32,
dropout_2d=0.4,
pretrained=True,
is_deconv=True,
):
super(UNetResNetAttention, self).__init__()
self.num_classes = num_classes
self.dropout_2d = dropout_2d
self.pool = nn.MaxPool2d(2, 2)
self.resnet = pretrainedmodels.se_resnext50_32x4d()
bottom_channel_nr = 2048
conv1 = nn.Conv2d(
3, 64, kernel_size=(7, 7), stride=(1, 1), padding=(3, 3), bias=False
)
conv1.weight = self.resnet.layer0.conv1.weight
"""
self.encoder1 = nn.Sequential(conv1,
self.resnet.layer0.bn1,
self.resnet.layer0.relu1
,self.pool
)
"""
self.encoder1 = EncoderBlock(
nn.Sequential(
conv1, self.resnet.layer0.bn1, self.resnet.layer0.relu1, self.pool
),
num_filters * 2,
)
self.encoder2 = EncoderBlock(self.resnet.layer1, bottom_channel_nr // 8)
self.encoder3 = EncoderBlock(self.resnet.layer2, bottom_channel_nr // 4)
self.encoder4 = EncoderBlock(self.resnet.layer3, bottom_channel_nr // 2)
self.encoder5 = EncoderBlock(self.resnet.layer4, bottom_channel_nr)
center_block = nn.Sequential(
ConvBn2d(bottom_channel_nr, bottom_channel_nr, kernel_size=3, padding=1),
nn.ReLU(inplace=True),
ConvBn2d(
bottom_channel_nr, bottom_channel_nr // 2, kernel_size=3, padding=1
),
nn.ReLU(inplace=True),
nn.MaxPool2d(kernel_size=2, stride=2),
)
self.center = EncoderBlock(center_block, bottom_channel_nr // 2)
self.decoder5 = DecoderBlock(
bottom_channel_nr + bottom_channel_nr // 2, num_filters * 16, 64
)
self.decoder4 = DecoderBlock(64 + bottom_channel_nr // 2, num_filters * 8, 64)
self.decoder3 = DecoderBlock(64 + bottom_channel_nr // 4, num_filters * 4, 64)
self.decoder2 = DecoderBlock(64 + bottom_channel_nr // 8, num_filters * 2, 64)
self.decoder1 = DecoderBlock(64, num_filters, 64)
self.final = nn.Conv2d(64, 2, kernel_size=1)
self.logit = nn.Sequential(
nn.Conv2d(64, 64, kernel_size=3, padding=1),
nn.ReLU(inplace=True),
nn.Conv2d(64, 2, kernel_size=1, padding=0),
)
def forward(self, x):
x = self.encoder1(x) # ; print('x:', x.size())
e2 = self.encoder2(x) # ; print('e2:', e2.size())
e3 = self.encoder3(e2) # ; print('e3:', e3.size())
e4 = self.encoder4(e3) # ; print('e4:', e4.size())
e5 = self.encoder5(e4) # ; print('e5:', e5.size())
center = self.center(e5) # ; print('center:', center.size())
d5 = self.decoder5(center, e5) # ; print('d5:', d5.size())
d4 = self.decoder4(d5, e4) # ; print('d4:', d4.size())
d3 = self.decoder3(d4, e3) # ; print('d3:', d3.size())
d2 = self.decoder2(d3, e2) # ; print('d2:', d2.size())
d1 = self.decoder1(d2)
# print('d1:', d1.size())
"""
f = torch.cat([
d1,
F.upsample(d2, scale_factor=2, mode='bilinear'),
F.upsample(d3, scale_factor=4, mode='bilinear'),
F.upsample(d4, scale_factor=8, mode='bilinear'),
F.upsample(d5, scale_factor=16, mode='bilinear'),
], dim=1)
"""
# f = F.dropout2d(f, p=self.dropout_2d)
# print (self.logit(d1).shape)
return self.final(d1)
class EncoderBlock(nn.Module):
def __init__(self, block, out_channels):
super(EncoderBlock, self).__init__()
self.block = block
self.out_channels = out_channels
self.spatial_gate = SpatialAttentionGate(out_channels)
self.channel_gate = ChannelAttentionGate(out_channels)
def forward(self, x):
x = self.block(x)
g1 = self.spatial_gate(x)
g2 = self.channel_gate(x)
return x * g1 + x * g2
class ChannelAttentionGate(nn.Module):
def __init__(self, channel, reduction=16):
super(ChannelAttentionGate, self).__init__()
self.avg_pool = nn.AdaptiveAvgPool2d(1)
self.fc = nn.Sequential(
nn.Linear(channel, channel // reduction),
nn.ReLU(inplace=True),
nn.Linear(channel // reduction, channel),
nn.Sigmoid(),
)
def forward(self, x):
b, c, _, _ = x.size()
y = self.avg_pool(x).view(b, c)
y = self.fc(y).view(b, c, 1, 1)
return y
def conv3x3(in_, out):
return nn.Conv2d(in_, out, 3, padding=1)
class ConvRelu(nn.Module):
def __init__(self, in_, out):
super().__init__()
self.conv = conv3x3(in_, out)
self.activation = nn.ReLU(inplace=True)
def forward(self, x):
x = self.conv(x)
x = self.activation(x)
return x
class ConvBn2d(nn.Module):
def __init__(
self,
in_channels,
out_channels,
kernel_size=(3, 3),
stride=(1, 1),
padding=(1, 1),
):
super(ConvBn2d, self).__init__()
self.conv = nn.Conv2d(
in_channels,
out_channels,
kernel_size=kernel_size,
stride=stride,
padding=padding,
bias=False,
)
self.bn = nn.BatchNorm2d(out_channels)
def forward(self, x):
x = self.conv(x)
x = self.bn(x)
return x
class SpatialAttentionGate(nn.Module):
def __init__(self, channel, reduction=16):
super(SpatialAttentionGate, self).__init__()
self.fc1 = nn.Conv2d(channel, reduction, kernel_size=1, padding=0)
self.fc2 = nn.Conv2d(reduction, 1, kernel_size=1, padding=0)
def forward(self, x):
x = self.fc1(x)
x = F.relu(x, inplace=True)
x = self.fc2(x)
x = torch.sigmoid(x)
# print(x.size())
return x
class UNetResNext_wo_pool_hyper(nn.Module):
def __init__(
self,
encoder_depth,
num_classes,
num_filters=32,
dropout_2d=0.2,
pretrained=False,
is_deconv=False,
):
super().__init__()
self.num_classes = num_classes
self.dropout_2d = dropout_2d
self.encoder = (
pretrainedmodels.se_resnext50_32x4d()
) # torchvision.models.resnet152(pretrained=pretrained)
self.pool = nn.MaxPool2d(2, 2)
bottom_channel_nr = 512 * 4
self.input_adjust = nn.Sequential(
self.encoder.layer0.conv1,
self.encoder.layer0.bn1,
self.encoder.layer0.relu1,
)
self.conv1 = self.encoder.layer1
self.conv2 = self.encoder.layer2
self.conv3 = self.encoder.layer3
self.conv4 = self.encoder.layer4
self.dec4 = DecoderBlockV2(
bottom_channel_nr, num_filters * 8 * 2, num_filters * 8, is_deconv
)
self.dec3 = DecoderBlockV2(
bottom_channel_nr // 2 + num_filters * 8,
num_filters * 8 * 2,
num_filters * 8,
is_deconv,
)
self.dec2 = DecoderBlockV2(
bottom_channel_nr // 4 + num_filters * 8,
num_filters * 4 * 2,
num_filters * 2,
is_deconv,
)
self.dec1 = DecoderBlockV2(
bottom_channel_nr // 8 + num_filters * 2,
num_filters * 2 * 2,
num_filters * 2 * 2,
is_deconv,
)
self.final = nn.Conv2d(num_filters * 2 * 2, num_classes, kernel_size=1)
self._mask_out = nn.Sequential(
nn.Conv2d(704, 64, kernel_size=3, stride=1, padding=1),
nn.ReLU(inplace=True),
nn.Conv2d(64, 2, kernel_size=1, stride=1, padding=0),
)
def forward(self, x):
input_adjust = self.input_adjust(x)
conv1 = self.conv1(input_adjust)
conv2 = self.conv2(conv1)
conv3 = self.conv3(conv2)
center = self.conv4(conv3)
dec4 = self.dec4(center)
dec3 = self.dec3(torch.cat([dec4, conv3], 1))
dec2 = self.dec2(torch.cat([dec3, conv2], 1))
dec1 = self.dec1(torch.cat([dec2, conv1], 1))
hcol = torch.cat(
[
dec1,
F.upsample(
dec2, scale_factor=2, mode="bilinear"
), # ,align_corners=False
F.upsample(
dec3, scale_factor=4, mode="bilinear"
), # ,align_corners=False
F.upsample(dec4, scale_factor=8, mode="bilinear"),
],
dim=1,
) # ,align_corners=False
# hcol = F.dropout2d(hcol, p = 0.5)
# print('input_adjust ', input_adjust.shape, '\ncenter ' , center.shape, '\ndec1: ', dec1.shape)
# print('hcol ', hcol.shape, '\nout ', self._mask_out(hcol).shape)
return self._mask_out(hcol)
class UNetResNext50(nn.Module):
def __init__(
self,
encoder_depth,
num_classes,
num_filters=32,
dropout_2d=0.2,
pretrained=False,
is_deconv=False,
):
super().__init__()
self.num_classes = num_classes
self.dropout_2d = dropout_2d
self.encoder = (
pretrainedmodels.se_resnext50_32x4d()
) # torchvision.models.resnet152(pretrained=pretrained)
bottom_channel_nr = 512 * 4
self.relu = nn.ReLU(inplace=True)
self.pool = nn.MaxPool2d(2, 2)
# self.input_adjust = nn.Sequential(self.encoder.layer0, self.pool)
self.input_adjust = self.encoder.layer0
self.conv1 = self.encoder.layer1
self.conv2 = self.encoder.layer2
self.conv3 = self.encoder.layer3
self.conv4 = self.encoder.layer4
self.center = DecoderCenter(
bottom_channel_nr, num_filters * 8 * 2, num_filters * 8, False
)
self.dec5 = DecoderBlockV2(
bottom_channel_nr + num_filters * 8,
num_filters * 8 * 2,
num_filters * 8,
is_deconv,
)
self.dec4 = DecoderBlockV2(
bottom_channel_nr // 2 + num_filters * 8,
num_filters * 8 * 2,
num_filters * 8,
is_deconv,
)
self.dec3 = DecoderBlockV2(
bottom_channel_nr // 4 + num_filters * 8,
num_filters * 4 * 2,
num_filters * 2,
is_deconv,
)
self.dec2 = DecoderBlockV2(
bottom_channel_nr // 8 + num_filters * 2,
num_filters * 2 * 2,
num_filters * 2 * 2,
is_deconv,
)
self.dec1 = DecoderBlockV2(
num_filters * 2 * 2, num_filters * 2 * 2, num_filters, is_deconv
)
self.dec0 = ConvRelu(num_filters, num_filters)
self.final = nn.Conv2d(num_filters, num_classes, kernel_size=1)
def forward(self, x):
input_adjust = self.input_adjust(x)
conv1 = self.conv1(input_adjust)
conv2 = self.conv2(conv1)
conv3 = self.conv3(conv2)
conv4 = self.conv4(conv3)
center = self.center(conv4)
dec5 = self.dec5(torch.cat([center, conv4], 1))
dec4 = self.dec4(torch.cat([dec5, conv3], 1))
dec3 = self.dec3(torch.cat([dec4, conv2], 1))
dec2 = self.dec2(torch.cat([dec3, conv1], 1))
dec1 = self.dec1(dec2)
dec0 = self.dec0(dec1)
# print('input_adjust ', input_adjust.shape, '\ncenter ' , center.shape, '\ndec1: ', dec1.shape, self.final(F.dropout2d(dec0, p=self.dropout_2d).shape))
return self.final(F.dropout2d(dec0, p=self.dropout_2d))
"""
center = self.conv4(conv3)
dec4 = self.dec4(center)
dec3 = self.dec3(torch.cat([dec4, conv3], 1))
dec2 = self.dec2(torch.cat([dec3, conv2], 1))
dec1 = F.dropout2d(self.dec1(torch.cat([dec2, conv1], 1)), p=self.dropout_2d)
return self.final(dec1)
"""
class UNetResNext(nn.Module):
def __init__(
self,
encoder_depth,
num_classes,
num_filters=32,
dropout_2d=0.2,
pretrained=False,
is_deconv=False,
):
super().__init__()
self.num_classes = num_classes
self.dropout_2d = dropout_2d
if encoder_depth == 34:
self.encoder = resnext34()
bottom_channel_nr = 512
elif encoder_depth == 101:
self.encoder = resnext101()
bottom_channel_nr = 2048
elif encoder_depth == 152:
self.encoder = resnext152()
bottom_channel_nr = 2048
else:
raise NotImplementedError(
"only 34, 101, 152 version of Resnext are implemented"
)
self.pool = nn.MaxPool2d(2, 2)
self.relu = nn.ReLU(inplace=True)
self.conv1 = nn.Sequential(
self.encoder.conv1, self.encoder.bn1, self.encoder.relu, self.pool
) ## this pool to delete
self.conv2 = self.encoder.layer1
self.conv3 = self.encoder.layer2
self.conv4 = self.encoder.layer3
self.conv5 = self.encoder.layer4
self.center = DecoderCenter(
bottom_channel_nr, num_filters * 8 * 2, num_filters * 8, False
)
self.dec5 = DecoderBlockV2(
bottom_channel_nr + num_filters * 8,
num_filters * 8 * 2,
num_filters * 8,
is_deconv,
)
self.dec4 = DecoderBlockV2(
bottom_channel_nr // 2 + num_filters * 8,
num_filters * 8 * 2,
num_filters * 8,
is_deconv,
)
self.dec3 = DecoderBlockV2(
bottom_channel_nr // 4 + num_filters * 8,
num_filters * 4 * 2,
num_filters * 2,
is_deconv,
)
self.dec2 = DecoderBlockV2(
bottom_channel_nr // 8 + num_filters * 2,
num_filters * 2 * 2,
num_filters * 2 * 2,
is_deconv,
)
self.dec1 = DecoderBlockV2(
num_filters * 2 * 2, num_filters * 2 * 2, num_filters, is_deconv
)
self.dec0 = ConvRelu(num_filters, num_filters)
self.final = nn.Conv2d(num_filters, num_classes, kernel_size=1)
def forward(self, x):
conv1 = self.conv1(x)
conv2 = self.conv2(conv1)
conv3 = self.conv3(conv2)
conv4 = self.conv4(conv3)
conv5 = self.conv5(conv4)
# pool = self.pool(conv5) # deleted pooling
# center = self.center(pool)
center = self.center(conv5)
dec5 = self.dec5(torch.cat([center, conv5], 1))
dec4 = self.dec4(torch.cat([dec5, conv4], 1))
dec3 = self.dec3(torch.cat([dec4, conv3], 1))
dec2 = self.dec2(torch.cat([dec3, conv2], 1))
dec1 = self.dec1(dec2)
dec0 = self.dec0(dec1)
return self.final(F.dropout2d(dec0, p=self.dropout_2d))
class UNetPNASNet(nn.Module):
def __init__(
self,
encoder_depth,
num_classes,
num_filters=32,
dropout_2d=0.2,
pretrained=False,
is_deconv=False,
):
super().__init__()
self.num_classes = num_classes
self.dropout_2d = dropout_2d
self.encoder = PNASNet5Large()
bottom_channel_nr = 4320
self.center = DecoderCenter(
bottom_channel_nr, num_filters * 8 * 2, num_filters * 8, False
)
self.dec5 = DecoderBlockV2(
bottom_channel_nr + num_filters * 8,
num_filters * 8 * 2,
num_filters * 8,
is_deconv,
)
self.dec4 = DecoderBlockV2(
bottom_channel_nr // 2 + num_filters * 8,
num_filters * 8 * 2,
num_filters * 8,
is_deconv,
)
self.dec3 = DecoderBlockV2(
bottom_channel_nr // 4 + num_filters * 8,
num_filters * 4 * 2,
num_filters * 2,
is_deconv,
)
self.dec2 = DecoderBlockV2(
num_filters * 4 * 4, num_filters * 4 * 4, num_filters, is_deconv
)
self.dec1 = DecoderBlockV2(
num_filters * 2 * 2, num_filters * 2 * 2, num_filters, is_deconv
)
self.dec0 = ConvRelu(num_filters, num_filters)
self.final = nn.Conv2d(num_filters, num_classes, kernel_size=1)
def forward(self, x):
features = self.encoder.features(x)
relued_features = self.encoder.relu(features)
avg_pooled_features = self.encoder.avg_pool(relued_features)
center = self.center(avg_pooled_features)
dec5 = self.dec5(torch.cat([center, avg_pooled_features], 1))
dec4 = self.dec4(torch.cat([dec5, relued_features], 1))
dec3 = self.dec3(torch.cat([dec4, features], 1))
dec2 = self.dec2(dec3)
dec1 = self.dec1(dec2)
dec0 = self.dec0(dec1)
return self.final(F.dropout2d(dec0, p=self.dropout_2d))
class TernausNetV2(nn.Module):
"""Variation of the UNet architecture with InplaceABN encoder."""
"https://github.com/ternaus/TernausNetV2 by Ternaus 2018"
def __init__(
self, num_classes=1, num_filters=32, is_deconv=False, num_input_channels=3
):
"""
Args:
num_classes: Number of output classes.
num_filters:
is_deconv:
True: Deconvolution layer is used in the Decoder block.
False: Upsampling layer is used in the Decoder block.
num_input_channels: Number of channels in the input images.
"""
super(TernausNetV2, self).__init__()
self.pool = nn.MaxPool2d(2, 2)
encoder = WiderResNet(structure=[3, 3, 6, 3, 1, 1], classes=0)
state_dict = torch.load("./modules/wide_resnet38_ipabn_lr_256.pth.tar")[
"state_dict"
]
state_dict = {".".join(k.split(".")[1:]): v for k, v in state_dict.items()}
encoder.load_state_dict(state_dict, strict=False)
self.conv1 = Sequential(
OrderedDict(
[("conv1", nn.Conv2d(num_input_channels, 64, 3, padding=1, bias=False))]
)
)
self.conv2 = encoder.mod2
self.conv3 = encoder.mod3
self.conv4 = encoder.mod4
self.conv5 = encoder.mod5
self.center = DecoderBlockTernaus(
1024, num_filters * 8, num_filters * 8, is_deconv=is_deconv
)
self.dec5 = DecoderBlockTernaus(
1024 + num_filters * 8,
num_filters * 8,
num_filters * 8,
is_deconv=is_deconv,
)
self.dec4 = DecoderBlockTernaus(
512 + num_filters * 8, num_filters * 8, num_filters * 8, is_deconv=is_deconv
)
self.dec3 = DecoderBlockTernaus(
256 + num_filters * 8, num_filters * 2, num_filters * 2, is_deconv=is_deconv
)
self.dec2 = DecoderBlockTernaus(
128 + num_filters * 2, num_filters * 2, num_filters, is_deconv=is_deconv
)
self.dec1 = ConvRelu(64 + num_filters, num_filters)
self.final = nn.Conv2d(num_filters, num_classes, kernel_size=1)
def forward(self, x):
conv1 = self.conv1(x)
conv2 = self.conv2(self.pool(conv1))
conv3 = self.conv3(self.pool(conv2))
conv4 = self.conv4(self.pool(conv3))
conv5 = self.conv5(self.pool(conv4))
center = self.center(self.pool(conv5))
dec5 = self.dec5(torch.cat([center, conv5], 1))
dec4 = self.dec4(torch.cat([dec5, conv4], 1))
dec3 = self.dec3(torch.cat([dec4, conv3], 1))
dec2 = self.dec2(torch.cat([dec3, conv2], 1))
dec1 = self.dec1(torch.cat([dec2, conv1], 1))
return self.final(dec1)
class DecoderBlockTernaus(nn.Module):
"""Paramaters for Deconvolution were chosen to avoid artifacts, following
link https://distill.pub/2016/deconv-checkerboard/
"""
def __init__(self, in_channels, middle_channels, out_channels, is_deconv=False):
super(DecoderBlock, self).__init__()
self.in_channels = in_channels
if is_deconv:
self.block = nn.Sequential(
ConvRelu(in_channels, middle_channels),
nn.ConvTranspose2d(
middle_channels, out_channels, kernel_size=4, stride=2, padding=1
),
nn.ReLU(inplace=True),
)
else:
self.block = nn.Sequential(
nn.Upsample(scale_factor=2, mode="nearest"),
ConvRelu(in_channels, middle_channels),
ConvRelu(middle_channels, out_channels),
)
def forward(self, x):
return self.block(x)
"""
def AttentionBlock(x,shortcut,i_filters):
g1 = Conv2D(i_filters,kernel_size = 1)(shortcut)
g1 = BatchNormalization()(g1)
x1 = Conv2D(i_filters,kernel_size = 1)(x)
x1 = BatchNormalization()(x1)
g1_x1 = Add()([g1,x1])
psi = Activation('relu')(g1_x1)
psi = Conv2D(1,kernel_size = 1)(psi)
psi = BatchNormalization()(psi)
psi = Activation('sigmoid'))(psi)
x = Multiply()([x,psi])
return x
"""
| 32.697293 | 160 | 0.565905 | 5,435 | 45,907 | 4.600368 | 0.066053 | 0.08639 | 0.039595 | 0.017278 | 0.809223 | 0.792545 | 0.779027 | 0.755229 | 0.74651 | 0.734072 | 0 | 0.058752 | 0.320017 | 45,907 | 1,403 | 161 | 32.720599 | 0.742216 | 0.070556 | 0 | 0.688785 | 0 | 0 | 0.010041 | 0.001094 | 0 | 0 | 0 | 0 | 0 | 1 | 0.048598 | false | 0 | 0.013084 | 0.006542 | 0.111215 | 0.000935 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6 |
57b9b5b148b026c23a02f8189882db715628e749 | 104 | py | Python | HelloDockerFlask/routes.py | anilvangari2005/hello-docker-flask | d83166fb9d189f9260729446f80ee2898a43ad9a | [
"MIT"
] | null | null | null | HelloDockerFlask/routes.py | anilvangari2005/hello-docker-flask | d83166fb9d189f9260729446f80ee2898a43ad9a | [
"MIT"
] | null | null | null | HelloDockerFlask/routes.py | anilvangari2005/hello-docker-flask | d83166fb9d189f9260729446f80ee2898a43ad9a | [
"MIT"
] | null | null | null | from flask import current_app as app
@app.route('/')
def hello_world():
return "Hello, Flask World!" | 20.8 | 36 | 0.711538 | 16 | 104 | 4.5 | 0.6875 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.153846 | 104 | 5 | 37 | 20.8 | 0.818182 | 0 | 0 | 0 | 0 | 0 | 0.190476 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | true | 0 | 0.25 | 0.25 | 0.75 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 1 | 1 | 0 | 0 | 6 |
57fae4ed945188f8c481699c8c2c572515e6e7a7 | 74 | py | Python | test_code/boj/bronze5/2338.py | yjinheon/solve | f47cd19d3c81d0b16586159c754deb2ffcb31ca0 | [
"Apache-2.0"
] | null | null | null | test_code/boj/bronze5/2338.py | yjinheon/solve | f47cd19d3c81d0b16586159c754deb2ffcb31ca0 | [
"Apache-2.0"
] | null | null | null | test_code/boj/bronze5/2338.py | yjinheon/solve | f47cd19d3c81d0b16586159c754deb2ffcb31ca0 | [
"Apache-2.0"
] | null | null | null | # 맞왜틀
a , b = map(int,input().split())
print(a+b)
print(a-b)
print(a *b)
| 10.571429 | 32 | 0.567568 | 16 | 74 | 2.625 | 0.5 | 0.190476 | 0.5 | 0.571429 | 0.5 | 0.5 | 0 | 0 | 0 | 0 | 0 | 0 | 0.162162 | 74 | 6 | 33 | 12.333333 | 0.677419 | 0.040541 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0 | 0 | 0 | 0.75 | 1 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 6 |
17a99b929602f512f49f60d9ad832bcd6c3254e0 | 35 | py | Python | plugins/better_code_samples/__init__.py | mohnjahoney/website_source | edc86a869b90ae604f32e736d9d5ecd918088e6a | [
"MIT"
] | 13 | 2020-01-27T09:02:25.000Z | 2022-01-20T07:45:26.000Z | plugins/better_code_samples/__init__.py | mohnjahoney/website_source | edc86a869b90ae604f32e736d9d5ecd918088e6a | [
"MIT"
] | 29 | 2020-03-22T06:57:57.000Z | 2022-01-24T22:46:42.000Z | plugins/better_code_samples/__init__.py | mohnjahoney/website_source | edc86a869b90ae604f32e736d9d5ecd918088e6a | [
"MIT"
] | 6 | 2020-07-10T00:13:30.000Z | 2022-01-26T08:22:33.000Z | from .better_code_samples import *
| 17.5 | 34 | 0.828571 | 5 | 35 | 5.4 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.114286 | 35 | 1 | 35 | 35 | 0.870968 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 6 |
17ce97412abdde5fac50906554aebfcb2aca6fd3 | 13,642 | py | Python | otcextensions/tests/unit/osclient/dns/v2/test_recordset.py | zsoltn/python-otcextensions | 4c0fa22f095ebd5f9636ae72acbae5048096822c | [
"Apache-2.0"
] | 10 | 2018-03-03T17:59:59.000Z | 2020-01-08T10:03:00.000Z | otcextensions/tests/unit/osclient/dns/v2/test_recordset.py | zsoltn/python-otcextensions | 4c0fa22f095ebd5f9636ae72acbae5048096822c | [
"Apache-2.0"
] | 208 | 2020-02-10T08:27:46.000Z | 2022-03-29T15:24:21.000Z | otcextensions/tests/unit/osclient/dns/v2/test_recordset.py | zsoltn/python-otcextensions | 4c0fa22f095ebd5f9636ae72acbae5048096822c | [
"Apache-2.0"
] | 15 | 2020-04-01T20:45:54.000Z | 2022-03-23T12:45:43.000Z | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import mock
from otcextensions.osclient.dns.v2 import recordset
from otcextensions.tests.unit.osclient.dns.v2 import fakes
class TestListRS(fakes.TestDNS):
objects = fakes.FakeRecordset.create_multiple(3)
_zone = fakes.FakeZone.create_one()
columns = (
'id', 'name', 'type', 'status', 'description', 'records'
)
data = []
for s in objects:
data.append(fakes.gen_data(s, columns))
def setUp(self):
super(TestListRS, self).setUp()
self.cmd = recordset.ListRS(self.app, None)
self.client.recordsets = mock.Mock()
self.client.find_zone = mock.Mock()
self.client.api_mock = self.client.recordsets
def test_default_zone(self):
arglist = [
'zn'
]
verifylist = [
('zone', 'zn')
]
# Verify cm is triggereg with default parameters
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
# Set the response
self.client.api_mock.side_effect = [
self.objects
]
self.client.find_zone.side_effect = [
self._zone
]
# Trigger the action
columns, data = self.cmd.take_action(parsed_args)
self.client.find_zone.assert_called_once_with(
'zn',
ignore_missing=False,
)
self.client.api_mock.assert_called_once_with(
zone=self._zone
)
self.assertEqual(self.columns, columns)
self.assertEqual(self.data, list(data))
def test_private_zone(self):
arglist = [
'zn',
'--zone-type', 'private'
]
verifylist = [
('zone', 'zn'),
('zone_type', 'private')
]
# Verify cm is triggereg with default parameters
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
# Set the response
self.client.api_mock.side_effect = [
self.objects
]
self.client.find_zone.side_effect = [
self._zone
]
# Trigger the action
columns, data = self.cmd.take_action(parsed_args)
self.client.find_zone.assert_called_once_with(
'zn',
zone_type='private',
ignore_missing=False,
)
self.client.api_mock.assert_called_once_with(
zone=self._zone
)
self.assertEqual(self.columns, columns)
self.assertEqual(self.data, list(data))
class TestShowRS(fakes.TestDNS):
_data = fakes.FakeRecordset.create_one()
_zone = fakes.FakeZone.create_one()
columns = (
'description', 'name', 'records', 'status', 'ttl', 'type'
)
data = fakes.gen_data(_data, columns)
def setUp(self):
super(TestShowRS, self).setUp()
self.cmd = recordset.ShowRS(self.app, None)
self.client.find_zone = mock.Mock()
self.client.find_recordset = mock.Mock()
self.client.api_mock = self.client.find_recordset
def test_default(self):
arglist = [
'zone',
'rs'
]
verifylist = [
('zone', 'zone'),
('recordset', 'rs')
]
# Verify cm is triggereg with default parameters
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
# Set the response
self.client.find_zone.side_effect = [
self._zone
]
self.client.api_mock.side_effect = [
self._data
]
# Trigger the action
columns, data = self.cmd.take_action(parsed_args)
self.client.find_zone.assert_called_once_with(
'zone',
ignore_missing=False,
zone_type=None
)
self.client.api_mock.assert_called_once_with(
zone=self._zone,
name_or_id='rs'
)
self.assertEqual(self.columns, columns)
self.assertEqual(self.data, data)
def test_private(self):
arglist = [
'zone',
'rs',
'--zone-type', 'private'
]
verifylist = [
('zone', 'zone'),
('recordset', 'rs'),
('zone_type', 'private')
]
# Verify cm is triggereg with default parameters
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
# Set the response
self.client.find_zone.side_effect = [
self._zone
]
self.client.api_mock.side_effect = [
self._data
]
# Trigger the action
columns, data = self.cmd.take_action(parsed_args)
self.client.find_zone.assert_called_once_with(
'zone',
ignore_missing=False,
zone_type='private'
)
self.client.api_mock.assert_called_once_with(
zone=self._zone,
name_or_id='rs'
)
self.assertEqual(self.columns, columns)
self.assertEqual(self.data, data)
class TestCreateRS(fakes.TestDNS):
_data = fakes.FakeRecordset.create_one()
_zone = fakes.FakeZone.create_one()
columns = (
'description', 'name', 'records', 'status', 'ttl', 'type'
)
data = fakes.gen_data(_data, columns)
def setUp(self):
super(TestCreateRS, self).setUp()
self.cmd = recordset.CreateRS(self.app, None)
self.client.create_recordset = mock.Mock()
self.client.find_zone = mock.Mock()
self.client.api_mock = self.client.create_recordset
def test_create(self):
arglist = [
'zn',
'--name', 'rs',
'--description', 'descr',
'--type', 'A',
'--ttl', '500',
'--record', 'a=b',
'--record', 'c=d',
]
verifylist = [
('zone', 'zn'),
('name', 'rs'),
('description', 'descr'),
('type', 'A'),
('ttl', 500),
('record', ['a=b', 'c=d']),
]
# Verify cm is triggereg with default parameters
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
# Set the response
self.client.find_zone.side_effect = [
self._zone
]
self.client.api_mock.side_effect = [
self._data
]
# Trigger the action
columns, data = self.cmd.take_action(parsed_args)
self.client.api_mock.assert_called_once_with(
zone=self._zone,
description='descr',
name='rs',
type='A',
ttl=500,
records=['a=b', 'c=d']
)
self.assertEqual(self.columns, columns)
self.assertEqual(self.data, data)
def test_create_private(self):
arglist = [
'zn',
'--name', 'rs',
'--description', 'descr',
'--type', 'A',
'--ttl', '500',
'--record', 'a=b',
'--record', 'c=d',
'--zone-type', 'private'
]
verifylist = [
('zone', 'zn'),
('name', 'rs'),
('description', 'descr'),
('type', 'A'),
('ttl', 500),
('record', ['a=b', 'c=d']),
('zone_type', 'private')
]
# Verify cm is triggereg with default parameters
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
# Set the response
self.client.find_zone.side_effect = [
self._zone
]
self.client.api_mock.side_effect = [
self._data
]
# Trigger the action
columns, data = self.cmd.take_action(parsed_args)
self.client.find_zone.assert_called_once_with(
'zn',
ignore_missing=False,
zone_type='private'
)
self.client.api_mock.assert_called_once_with(
zone=self._zone,
description='descr',
name='rs',
type='A',
ttl=500,
records=['a=b', 'c=d']
)
self.assertEqual(self.columns, columns)
self.assertEqual(self.data, data)
class TestSetRS(fakes.TestDNS):
_data = fakes.FakeRecordset.create_one()
_zone = fakes.FakeZone.create_one()
columns = (
'description', 'name', 'records', 'status', 'ttl', 'type'
)
data = fakes.gen_data(_data, columns)
def setUp(self):
super(TestSetRS, self).setUp()
self.cmd = recordset.SetRS(self.app, None)
self.client.update_recordset = mock.Mock()
self.client.find_zone = mock.Mock()
self.client.find_recordset = mock.Mock()
self.client.api_mock = self.client.update_recordset
def test_set(self):
arglist = [
'zn',
'rs',
'--description', 'descr',
'--ttl', '500',
'--record', 'a=b',
'--record', 'c=d',
]
verifylist = [
('zone', 'zn'),
('recordset', 'rs'),
('description', 'descr'),
('ttl', 500),
('record', ['a=b', 'c=d']),
]
# Verify cm is triggereg with default parameters
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
# Set the response
self.client.find_zone.side_effect = [
self._zone
]
self.client.api_mock.side_effect = [
self._data
]
self.client.find_recordset.side_effect = [
self._data
]
# Trigger the action
columns, data = self.cmd.take_action(parsed_args)
self.client.find_recordset.assert_called_with(zone=self._zone,
name_or_id='rs')
self.client.api_mock.assert_called_once_with(
recordset=self._data,
description='descr',
records=['a=b', 'c=d'],
ttl=500,
zone_id=self._zone.id
)
self.assertEqual(self.columns, columns)
self.assertEqual(self.data, data)
class TestDeleteRS(fakes.TestDNS):
_zone = fakes.FakeZone.create_one()
_rs = fakes.FakeRecordset.create_one()
def setUp(self):
super(TestDeleteRS, self).setUp()
self.cmd = recordset.DeleteRS(self.app, None)
self.client.delete_recordset = mock.Mock()
self.client.find_zone = mock.Mock()
self.client.find_recordset = mock.Mock()
self.client.api_mock = self.client.delete_recordset
def test_delete_multiple(self):
arglist = [
'zn',
't1',
't2',
]
verifylist = [
('zone', 'zn'),
('recordset', ['t1', 't2'])
]
# Verify cm is triggereg with default parameters
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
# Set the response
self.client.find_zone.side_effect = [
self._zone
]
self.client.find_recordset.side_effect = [self._rs, self._rs]
self.client.api_mock.side_effect = [{}, {}]
# Trigger the action
self.cmd.take_action(parsed_args)
find_calls = [
mock.call(zone=self._zone, name_or_id='t1', ignore_missing=False),
mock.call(zone=self._zone, name_or_id='t2', ignore_missing=False)
]
self.client.find_recordset.assert_has_calls(find_calls)
calls = [
mock.call(zone=self._zone, recordset=self._rs,
ignore_missing=False),
mock.call(zone=self._zone, recordset=self._rs,
ignore_missing=False)
]
self.client.api_mock.assert_has_calls(calls)
self.assertEqual(2, self.client.api_mock.call_count)
def test_private(self):
arglist = [
'zn',
't1',
'--zone-type', 'private'
]
verifylist = [
('zone', 'zn'),
('recordset', ['t1']),
('zone_type', 'private')
]
# Verify cm is triggereg with default parameters
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
# Set the response
self.client.find_zone.side_effect = [
self._zone
]
self.client.find_recordset.side_effect = [self._rs, self._rs]
self.client.api_mock.side_effect = [{}, {}]
# Trigger the action
self.cmd.take_action(parsed_args)
self.client.find_zone.assert_called_once_with(
'zn',
ignore_missing=False,
zone_type='private'
)
find_calls = [
mock.call(zone=self._zone, name_or_id='t1', ignore_missing=False),
]
self.client.find_recordset.assert_has_calls(find_calls)
calls = [
mock.call(zone=self._zone, recordset=self._rs,
ignore_missing=False),
]
self.client.api_mock.assert_has_calls(calls)
self.assertEqual(1, self.client.api_mock.call_count)
| 27.013861 | 78 | 0.545008 | 1,471 | 13,642 | 4.861999 | 0.10741 | 0.088087 | 0.058725 | 0.059424 | 0.826902 | 0.762164 | 0.739513 | 0.736298 | 0.722735 | 0.71854 | 0 | 0.004954 | 0.334189 | 13,642 | 504 | 79 | 27.06746 | 0.782451 | 0.094194 | 0 | 0.677871 | 0 | 0 | 0.065606 | 0 | 0 | 0 | 0 | 0 | 0.095238 | 1 | 0.039216 | false | 0 | 0.008403 | 0 | 0.112045 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6 |
aa038448a8dfcb16b6af694382fcd364dda8cbcb | 349 | py | Python | src/UQpy/StochasticProcess/supportive/__init__.py | marrov/UQpy | b04a267b3080e3d4d38e876547ba0d3b979734f3 | [
"MIT"
] | 132 | 2018-03-13T13:56:33.000Z | 2022-03-21T13:59:17.000Z | src/UQpy/StochasticProcess/supportive/__init__.py | marrov/UQpy | b04a267b3080e3d4d38e876547ba0d3b979734f3 | [
"MIT"
] | 140 | 2018-05-21T13:40:01.000Z | 2022-03-29T14:18:01.000Z | src/UQpy/StochasticProcess/supportive/__init__.py | marrov/UQpy | b04a267b3080e3d4d38e876547ba0d3b979734f3 | [
"MIT"
] | 61 | 2018-05-02T13:40:05.000Z | 2022-03-06T11:31:21.000Z | """Collection of baseclasses"""
from UQpy.StochasticProcess.supportive.inverse_wiener_khinchin_transform import inverse_wiener_khinchin_transform
from UQpy.StochasticProcess.supportive.wiener_khinchin_transform import wiener_khinchin_transform
from UQpy.StochasticProcess.supportive.scaling_correlation_function import scaling_correlation_function
| 58.166667 | 113 | 0.911175 | 38 | 349 | 8 | 0.394737 | 0.184211 | 0.302632 | 0.345395 | 0.381579 | 0.381579 | 0.381579 | 0 | 0 | 0 | 0 | 0 | 0.045845 | 349 | 5 | 114 | 69.8 | 0.912913 | 0.071633 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 6 |
aa207aa791c6468d5f0031a81c52055b6debdda2 | 342 | py | Python | airflow_kubernetes_job_operator/__init__.py | Fahadsaadullahkhan/KubernetesJobOperator | d96f9498667f937503d1e45142060904674f823f | [
"MIT"
] | 35 | 2020-02-10T16:55:41.000Z | 2022-03-18T01:25:00.000Z | airflow_kubernetes_job_operator/__init__.py | Fahadsaadullahkhan/KubernetesJobOperator | d96f9498667f937503d1e45142060904674f823f | [
"MIT"
] | 26 | 2020-02-10T05:36:44.000Z | 2022-03-02T18:44:47.000Z | airflow_kubernetes_job_operator/__init__.py | Fahadsaadullahkhan/KubernetesJobOperator | d96f9498667f937503d1e45142060904674f823f | [
"MIT"
] | 8 | 2020-02-28T23:24:07.000Z | 2021-11-29T21:35:46.000Z | from airflow_kubernetes_job_operator.kubernetes_job_operator import KubernetesJobOperator
from airflow_kubernetes_job_operator.kubernetes_legacy_job_operator import KubernetesLegacyJobOperator
from airflow_kubernetes_job_operator.utils import resolve_relative_path
from airflow_kubernetes_job_operator.job_runner import JobRunnerDeletePolicy
| 68.4 | 102 | 0.94152 | 40 | 342 | 7.55 | 0.375 | 0.218543 | 0.347682 | 0.317881 | 0.490066 | 0.278146 | 0 | 0 | 0 | 0 | 0 | 0 | 0.046784 | 342 | 4 | 103 | 85.5 | 0.92638 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 6 |
a4d48ad0248fe1af64ba1428f148209c1a0f2f99 | 39 | py | Python | schloader/__init__.py | mikehummell/schloader | ba6f279189924de241db1058975d8569b7208a22 | [
"MIT"
] | null | null | null | schloader/__init__.py | mikehummell/schloader | ba6f279189924de241db1058975d8569b7208a22 | [
"MIT"
] | null | null | null | schloader/__init__.py | mikehummell/schloader | ba6f279189924de241db1058975d8569b7208a22 | [
"MIT"
] | null | null | null | from schloader.DBObject import DBObject | 39 | 39 | 0.897436 | 5 | 39 | 7 | 0.8 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.076923 | 39 | 1 | 39 | 39 | 0.972222 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 6 |
a4e924f0e277979ac2f91537feee510f67291e28 | 151 | py | Python | Django_React/music_controller/frontend/views.py | OtavioTavares/ProjectWeb | 167086ceaed193d7da14a1d7f3ec80b849d42071 | [
"Apache-2.0"
] | null | null | null | Django_React/music_controller/frontend/views.py | OtavioTavares/ProjectWeb | 167086ceaed193d7da14a1d7f3ec80b849d42071 | [
"Apache-2.0"
] | null | null | null | Django_React/music_controller/frontend/views.py | OtavioTavares/ProjectWeb | 167086ceaed193d7da14a1d7f3ec80b849d42071 | [
"Apache-2.0"
] | null | null | null | from django.shortcuts import render
# Create your views here.
def index(request, *args,**kwargs):
return render (request, 'frontend/index.html')
| 21.571429 | 50 | 0.735099 | 20 | 151 | 5.55 | 0.85 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.145695 | 151 | 6 | 51 | 25.166667 | 0.860465 | 0.152318 | 0 | 0 | 0 | 0 | 0.150794 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.333333 | false | 0 | 0.333333 | 0.333333 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 6 |
a4faafc7fa526206104827af32c06a306f18155f | 12 | py | Python | login.py | famousday/test417 | 5db526f4314529bc9b7f2a0ecb4f5f8eb0cb487b | [
"MIT"
] | null | null | null | login.py | famousday/test417 | 5db526f4314529bc9b7f2a0ecb4f5f8eb0cb487b | [
"MIT"
] | null | null | null | login.py | famousday/test417 | 5db526f4314529bc9b7f2a0ecb4f5f8eb0cb487b | [
"MIT"
] | null | null | null | a = 0
b = 1
| 4 | 5 | 0.333333 | 4 | 12 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.333333 | 0.5 | 12 | 2 | 6 | 6 | 0.333333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6 |
35097601448ff065e632e3f182081c6493931b6b | 103 | py | Python | itr1.py | Kantheesh/Learning-Python | d2dc9f1b9f652e6a6d84028e86a1daf77551eb5f | [
"MIT"
] | null | null | null | itr1.py | Kantheesh/Learning-Python | d2dc9f1b9f652e6a6d84028e86a1daf77551eb5f | [
"MIT"
] | null | null | null | itr1.py | Kantheesh/Learning-Python | d2dc9f1b9f652e6a6d84028e86a1daf77551eb5f | [
"MIT"
] | null | null | null | inp = "40673"
for i in inp:
print(i)
input()
inp = "anc"
for i in inp:
print(i)
input() | 10.3 | 14 | 0.524272 | 18 | 103 | 3 | 0.444444 | 0.148148 | 0.222222 | 0.333333 | 0.740741 | 0.740741 | 0.740741 | 0 | 0 | 0 | 0 | 0.071429 | 0.320388 | 103 | 10 | 15 | 10.3 | 0.7 | 0 | 0 | 0.75 | 0 | 0 | 0.084211 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.25 | 1 | 0 | 0 | null | 0 | 1 | 1 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6 |
10482b8744b3d9e29dedd321caa9e2c123030dff | 119 | py | Python | tests/conftest.py | daylinmorgan/click-help-colors | 136ebb7380d9a317a8d93528755ef4396eda5712 | [
"MIT"
] | 59 | 2019-10-01T10:25:30.000Z | 2022-03-31T12:56:28.000Z | tests/conftest.py | daylinmorgan/click-help-colors | 136ebb7380d9a317a8d93528755ef4396eda5712 | [
"MIT"
] | 11 | 2019-11-12T10:53:55.000Z | 2021-11-08T19:14:45.000Z | tests/conftest.py | daylinmorgan/click-help-colors | 136ebb7380d9a317a8d93528755ef4396eda5712 | [
"MIT"
] | 8 | 2020-03-12T18:22:38.000Z | 2021-12-09T21:27:24.000Z | import pytest
import click
from click.testing import CliRunner
@pytest.fixture
def runner():
return CliRunner()
| 11.9 | 35 | 0.764706 | 15 | 119 | 6.066667 | 0.666667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.168067 | 119 | 9 | 36 | 13.222222 | 0.919192 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.166667 | true | 0 | 0.5 | 0.166667 | 0.833333 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 1 | 1 | 0 | 0 | 6 |
10595c00dd6d306be329a5f9afd759761d326fbb | 30,140 | py | Python | chatter/tests/test_chat.py | onstop4/Chatter | 75df9a019234069c476bc42035cbb04ef6a57df0 | [
"MIT"
] | null | null | null | chatter/tests/test_chat.py | onstop4/Chatter | 75df9a019234069c476bc42035cbb04ef6a57df0 | [
"MIT"
] | null | null | null | chatter/tests/test_chat.py | onstop4/Chatter | 75df9a019234069c476bc42035cbb04ef6a57df0 | [
"MIT"
] | null | null | null | # from unittest import skip
from channels.auth import AuthMiddlewareStack
from channels.routing import ProtocolTypeRouter, URLRouter
from channels.testing import WebsocketCommunicator
from django.test import TransactionTestCase
from chatter.models import Room, User
import chatter.routing
application = ProtocolTypeRouter(
{"websocket": AuthMiddlewareStack(URLRouter(chatter.routing.websocket_urlpatterns))}
)
TIMEOUT = 2
class ChatroomConnectionTests(TransactionTestCase):
"""
Performs tests related to connecting and joining chat rooms.
"""
def setUp(self):
"""
Sets up environment for tests. This includes three users (one room owner, an
"allowed" user, and a "bad" user). Three rooms are also created. The bad user
is banned from the public and confirmed rooms and is not invited to the private
room. The allowed user is not banned from any room, and they are invited to the
private room.
"""
self.owner = User.objects.create_user("owner", "owner@example.com", "12345")
self.allowed_user = User.objects.create_user(
"allowed_user", "allowed@example.com", "12345"
)
self.bad_user = User.objects.create_user(
"banned_user", "banned@example.com", "12345"
)
self.public_room = Room.objects.create(
name="Room", number="1234567890", owner=self.owner
)
self.public_room_websocket_url = f"/ws/chat/{self.public_room.number}/"
self.public_room.banned_users.add(self.bad_user)
self.public_room.save()
self.confirmed_room = Room.objects.create(
name="Room",
number="2345678901",
owner=self.owner,
access_type=Room.AccessTypes.CONFIRMED,
)
self.confirmed_room_websocket_url = f"/ws/chat/{self.confirmed_room.number}/"
self.confirmed_room.banned_users.add(self.bad_user)
self.confirmed_room.save()
self.private_room = Room.objects.create(
name="Room",
number="3456789012",
owner=self.owner,
access_type=Room.AccessTypes.PRIVATE,
)
self.private_room_websocket_url = f"/ws/chat/{self.private_room.number}/"
self.private_room.invited_users.add(self.allowed_user)
self.private_room.save()
async def test_join_good_public(self):
"""
Tests that users can join public rooms as long as they are not banned.
"""
# Connect as allowed_user.
communicator = WebsocketCommunicator(
application, self.public_room_websocket_url
)
communicator.scope["user"] = self.allowed_user
connected = (await communicator.connect())[0]
self.assertTrue(connected)
response = await communicator.receive_json_from(TIMEOUT)
self.assertEqual(
{
"update": "joined successfully",
"joined as": self.allowed_user.username,
},
response,
)
# Connect as anonymous user.
communicator2 = WebsocketCommunicator(
application, f"{self.public_room_websocket_url}?guest=test"
)
connected = (await communicator2.connect())[0]
self.assertTrue(connected)
response = await communicator2.receive_json_from(TIMEOUT)
self.assertEqual(
{"update": "joined successfully", "joined as": "guest_test"},
response,
)
async def test_join_good_confirmed(self):
"""
Tests that users can join confirmed rooms as long as they are not banned.
"""
communicator = WebsocketCommunicator(
application, self.confirmed_room_websocket_url
)
communicator.scope["user"] = self.allowed_user
connected = (await communicator.connect())[0]
self.assertTrue(connected)
response = await communicator.receive_json_from(TIMEOUT)
self.assertEqual(
{
"update": "joined successfully",
"joined as": self.allowed_user.username,
},
response,
)
async def test_join_good_private(self):
"""
Tests that users can join private rooms as long as they are invited.
"""
communicator = WebsocketCommunicator(
application, self.private_room_websocket_url
)
communicator.scope["user"] = self.allowed_user
connected = (await communicator.connect())[0]
self.assertTrue(connected)
response = await communicator.receive_json_from(TIMEOUT)
self.assertEqual(
{
"update": "joined successfully",
"joined as": self.allowed_user.username,
},
response,
)
async def test_join_not_found(self):
"""
Tests that connection is closed with proper error message when a room has not
been found.
"""
# Connect as allowed_user.
communicator = WebsocketCommunicator(application, "/ws/chat/54321/")
communicator.scope["user"] = self.allowed_user
connected, code = await communicator.connect()
self.assertEqual((False, 4001), (connected, code))
# Connect as anonymous user.
communicator2 = WebsocketCommunicator(application, "/ws/chat/54321/")
connected, code = await communicator2.connect()
self.assertEqual((False, 4001), (connected, code))
async def test_join_bad_username(self):
"""
Tests that connection is closed with proper error message when guest user has a
bad username.
"""
# Username specified is space character.
communicator = WebsocketCommunicator(
application, f"{self.public_room_websocket_url}?guest=%20"
)
connected, code = await communicator.connect()
self.assertEqual((False, 4002), (connected, code))
# Username specified is blank.
communicator2 = WebsocketCommunicator(
application, f"{self.public_room_websocket_url}?guest="
)
connected, code = await communicator2.connect()
self.assertEqual((False, 4002), (connected, code))
# Username specified includes space character.
communicator3 = WebsocketCommunicator(
application, f"{self.public_room_websocket_url}?guest=test%20bad"
)
connected, code = await communicator3.connect()
self.assertEqual((False, 4002), (connected, code))
# No username is specified.
communicator4 = WebsocketCommunicator(
application, self.public_room_websocket_url
)
connected, code = await communicator4.connect()
self.assertEqual((False, 4002), (connected, code))
async def test_join_confirm_required(self):
"""
Tests that connection is closed with proper error message when a guest user
tries to join a confirmed room.
"""
communicator = WebsocketCommunicator(
application, f"{self.confirmed_room_websocket_url}?guest=test"
)
connected, code = await communicator.connect()
self.assertEqual((False, 4003), (connected, code))
async def test_join_not_invited(self):
"""
Tests that connection is closed with proper error message when a normal user
tries to join a private room that have not been invited to. Also tests that
guest users will receive same error message when they try to join private
rooms.
"""
# Connect as allowed_user.
communicator = WebsocketCommunicator(
application, self.private_room_websocket_url
)
communicator.scope["user"] = self.bad_user
connected, code = await communicator.connect()
self.assertEqual((False, 4004), (connected, code))
# Connect as anonymous user.
communicator2 = WebsocketCommunicator(
application, f"{self.private_room_websocket_url}?guest=test"
)
connected, code = await communicator2.connect()
self.assertEqual((False, 4004), (connected, code))
async def test_join_banned(self):
"""
Tests that connection is closed with proper error message when user is banned
from room.
"""
# Attempting to join public room.
communicator = WebsocketCommunicator(
application, self.public_room_websocket_url
)
communicator.scope["user"] = self.bad_user
connected, code = await communicator.connect()
self.assertEqual((False, 4005), (connected, code))
# Attempting to join confirmed room.
communicator2 = WebsocketCommunicator(
application, self.confirmed_room_websocket_url
)
communicator2.scope["user"] = self.bad_user
connected, code = await communicator2.connect()
self.assertEqual((False, 4005), (connected, code))
async def test_join_already_in_room(self):
"""
Tests that a user cannot join a room that they are already a participant in.
Also tests that a guest user cannot join a room with the same username as
another guest participant.
"""
# Connect as self.allowed_user.
communicator = WebsocketCommunicator(
application, self.public_room_websocket_url
)
communicator.scope["user"] = self.allowed_user
connected = (await communicator.connect())[0]
self.assertTrue(connected)
response = await communicator.receive_json_from(TIMEOUT)
self.assertEqual(
{
"update": "joined successfully",
"joined as": self.allowed_user.username,
},
response,
)
# Attempt to join while original connection is still active.
communicator2 = WebsocketCommunicator(
application, self.public_room_websocket_url
)
communicator2.scope["user"] = self.allowed_user
connected, code = await communicator2.connect()
self.assertEqual((False, 4006), (connected, code))
# Connect as anonymous user.
communicator3 = WebsocketCommunicator(
application, f"{self.public_room_websocket_url}?guest=test"
)
connected = (await communicator3.connect())[0]
self.assertTrue(connected)
response = await communicator3.receive_json_from(TIMEOUT)
self.assertEqual(
{
"update": "joined successfully",
"joined as": "guest_test",
},
response,
)
# Attempt to join while original connection is still active.
communicator4 = WebsocketCommunicator(
application, f"{self.public_room_websocket_url}?guest=test"
)
connected, code = await communicator4.connect()
self.assertEqual((False, 4006), (connected, code))
async def test_rejoin_after_disconnect(self):
"""
Tests that a user can rejoin a room after disconnecting. Also
tests that a guest user can rejoin a room after disconnecting,
assuming no one else joined using the same guest username.
"""
# Connect as self.allowed_user.
communicator = WebsocketCommunicator(
application, self.public_room_websocket_url
)
communicator.scope["user"] = self.allowed_user
connected = (await communicator.connect())[0]
self.assertTrue(connected)
response = await communicator.receive_json_from(TIMEOUT)
self.assertEqual(
{
"update": "joined successfully",
"joined as": self.allowed_user.username,
},
response,
)
await communicator.disconnect()
# Rejoin.
communicator2 = WebsocketCommunicator(
application, self.public_room_websocket_url
)
communicator2.scope["user"] = self.allowed_user
connected = (await communicator2.connect())[0]
self.assertTrue(connected)
response = await communicator2.receive_json_from(TIMEOUT)
self.assertEqual(
{
"update": "joined successfully",
"joined as": self.allowed_user.username,
},
response,
)
# Connect as anonymous user.
communicator3 = WebsocketCommunicator(
application, f"{self.public_room_websocket_url}?guest=test"
)
connected = (await communicator3.connect())[0]
self.assertTrue(connected)
response = await communicator3.receive_json_from(TIMEOUT)
self.assertEqual(
{
"update": "joined successfully",
"joined as": "guest_test",
},
response,
)
await communicator3.disconnect()
# Rejoin.
communicator4 = WebsocketCommunicator(
application, f"{self.public_room_websocket_url}?guest=test"
)
connected = (await communicator4.connect())[0]
self.assertTrue(connected)
response = await communicator4.receive_json_from(TIMEOUT)
self.assertEqual(
{
"update": "joined successfully",
"joined as": "guest_test",
},
response,
)
class ChatroomActionTests(TransactionTestCase):
"""
Performs tests related to requesting actions from server.
"""
def setUp(self):
"""
Sets up environment for tests. Creates two users (one room owner and one normal
user). A public room is also created.
"""
self.owner = User.objects.create_user("owner", "owner@example.com", "12345")
self.user = User.objects.create_user("user", "user@example.com", "12345")
self.room = Room.objects.create(
name="Room", number="1234567890", owner=self.owner
)
self.room_websocket_url = f"/ws/chat/{self.room.number}/"
self.room.invited_users.add(self.owner)
self.room.save()
async def test_get_info(self):
"""
Tests getting room participants.
"""
# Connect owner as room participant.
owner_communicator = WebsocketCommunicator(application, self.room_websocket_url)
owner_communicator.scope["user"] = self.owner
await owner_communicator.connect()
# Connect normal user as room participant.
user_communicator = WebsocketCommunicator(application, self.room_websocket_url)
user_communicator.scope["user"] = self.user
await user_communicator.connect()
await user_communicator.receive_json_from(TIMEOUT)
await user_communicator.send_json_to({"action": "get info"})
response = await user_communicator.receive_json_from(TIMEOUT)
self.assertEqual(
{
"update": "info",
"name": "Room",
"access type": "PUBLIC",
"owner": "owner",
"participants": ["owner", "user"],
},
response,
)
async def test_change_room_name(self):
"""
Tests changing room name.
"""
# Connect owner as room participant.
owner_communicator = WebsocketCommunicator(application, self.room_websocket_url)
owner_communicator.scope["user"] = self.owner
await owner_communicator.connect()
await owner_communicator.receive_json_from(TIMEOUT)
# Connect normal user as room participant.
user_communicator = WebsocketCommunicator(application, self.room_websocket_url)
user_communicator.scope["user"] = self.user
await user_communicator.connect()
await user_communicator.receive_json_from(TIMEOUT)
# Owner requests that room name is changed.
await owner_communicator.send_json_to(
{"action": "change room name", "name": "New Name"}
)
# Owner is alerted that room name was changed.
response = await owner_communicator.receive_json_from(TIMEOUT)
self.assertEqual({"update": "name change", "name": "New Name"}, response)
# Normal user is alerted that room name was changed.
response = await user_communicator.receive_json_from(TIMEOUT)
self.assertEqual({"update": "name change", "name": "New Name"}, response)
async def test_send_new_messages(self):
"""
Tests that all room participants will receive a chat message sent by one
participant.
"""
expected_response = {
"update": "new message",
"message": "Test message.",
"username": self.user.username,
}
# Connect owner as room participant.
owner_communicator = WebsocketCommunicator(application, self.room_websocket_url)
owner_communicator.scope["user"] = self.owner
await owner_communicator.connect()
await owner_communicator.receive_json_from(TIMEOUT)
# Connect normal user as room participant.
user_communicator = WebsocketCommunicator(application, self.room_websocket_url)
user_communicator.scope["user"] = self.user
await user_communicator.connect()
await user_communicator.receive_json_from(TIMEOUT)
# Normal user sends message.
await user_communicator.send_json_to(
{"action": "send message", "message": "Test message."}
)
# Normal user receives update concerning new message.
response = await user_communicator.receive_json_from(TIMEOUT)
self.assertEqual(expected_response, response)
# Owner receives update concerning new message.
response = await owner_communicator.receive_json_from(TIMEOUT)
self.assertEqual(expected_response, response)
async def test_change_access_type_to_confirmed(self):
"""
Tests that guest users are kicked (and cannot rejoin) when room access type is
changed to CONFIRMED. Also tests that remaining users receive info related to
access type change, including the number of users that have been kicked.
"""
# Connect owner as room participant.
owner_communicator = WebsocketCommunicator(application, self.room_websocket_url)
owner_communicator.scope["user"] = self.owner
await owner_communicator.connect()
await owner_communicator.receive_json_from(TIMEOUT)
# Connect normal user as room participant.
user_communicator = WebsocketCommunicator(application, self.room_websocket_url)
user_communicator.scope["user"] = self.user
await user_communicator.connect()
await user_communicator.receive_json_from(TIMEOUT)
# Connect anonymous user as room participant.
guest_communicator = WebsocketCommunicator(
application, f"{self.room_websocket_url}?guest=test"
)
await guest_communicator.connect()
await guest_communicator.receive_json_from(TIMEOUT)
# Owner changes room access type to CONFIRMED, kicking out anonymous user.
await owner_communicator.send_json_to(
{"action": "change room access type", "access type": "CONFIRMED"}
)
# Anonymous user is kicked.
response = await guest_communicator.receive_json_from(TIMEOUT)
self.assertEqual(
{"update": "kicked you because access change", "access type": "CONFIRMED"},
response,
)
# Owner is alerted that users have been kicked and that the room access type
# has changed.
response = await owner_communicator.receive_json_from(TIMEOUT)
self.assertEqual(
{
"update": "users kicked because access change",
"access type": "CONFIRMED",
"quantity": 1,
},
response,
)
response = await owner_communicator.receive_json_from(TIMEOUT)
self.assertEqual(
{
"update": "info",
"name": "Room",
"access type": "CONFIRMED",
"owner": "owner",
"participants": ["owner", "user"],
},
response,
)
# Normal user is still connected and receives notifications for the change in
# room access type.
await user_communicator.send_json_to(
{"action": "send message", "message": "test"}
)
response = await user_communicator.receive_json_from(TIMEOUT)
self.assertEqual(
{
"update": "users kicked because access change",
"access type": "CONFIRMED",
"quantity": 1,
},
response,
)
response = await user_communicator.receive_json_from(TIMEOUT)
self.assertEqual(
{
"update": "info",
"name": "Room",
"access type": "CONFIRMED",
"owner": "owner",
"participants": ["owner", "user"],
},
response,
)
response = await user_communicator.receive_json_from(TIMEOUT)
self.assertEqual(
{"update": "new message", "message": "test", "username": "user"}, response
)
# Anonymous user cannot rejoin.
guest_communicator2 = WebsocketCommunicator(
application, f"{self.room_websocket_url}?guest=test"
)
connected, code = await guest_communicator2.connect()
self.assertEqual((False, 4003), (connected, code))
async def test_change_access_type_to_private(self):
"""
Tests that uninvited users are kicked (and cannot rejoin) when room access type
is changed to PRIVATE. Also tests that remaining users receive info related to
access type change, including the number of users that have been kicked.
"""
# Connect owner as room participant.
owner_communicator = WebsocketCommunicator(application, self.room_websocket_url)
owner_communicator.scope["user"] = self.owner
await owner_communicator.connect()
await owner_communicator.receive_json_from(TIMEOUT)
# Owner changes room access type to CONFIRMED.
await owner_communicator.send_json_to(
{"action": "change room access type", "access type": "CONFIRMED"}
)
await owner_communicator.receive_json_from(TIMEOUT)
await owner_communicator.receive_json_from(TIMEOUT)
# Connect normal user as room participant.
user_communicator = WebsocketCommunicator(application, self.room_websocket_url)
user_communicator.scope["user"] = self.user
await user_communicator.connect()
await user_communicator.receive_json_from(TIMEOUT)
# Owner changes room access type to PRIVATE, kicking out normal user.
await owner_communicator.send_json_to(
{"action": "change room access type", "access type": "PRIVATE"}
)
# Normal user is kicked.
response = await user_communicator.receive_json_from(TIMEOUT)
self.assertEqual(
{"update": "kicked you because access change", "access type": "PRIVATE"},
response,
)
# Owner is alerted that users have been kicked and that the room access type
# has changed.
response = await owner_communicator.receive_json_from(TIMEOUT)
self.assertEqual(
{
"update": "users kicked because access change",
"access type": "PRIVATE",
"quantity": 1,
},
response,
)
response = await owner_communicator.receive_json_from(TIMEOUT)
self.assertEqual(
{
"update": "info",
"name": "Room",
"access type": "PRIVATE",
"owner": "owner",
"participants": ["owner"],
},
response,
)
# Normal user cannot rejoin.
user_communicator2 = WebsocketCommunicator(application, self.room_websocket_url)
user_communicator2.scope["user"] = self.user
connected, code = await user_communicator2.connect()
self.assertEqual((False, 4004), (connected, code))
async def test_kick_user(self):
"""
Tests that a room participant can be kicked by room owner.
"""
# Connect owner as room participant.
owner_communicator = WebsocketCommunicator(application, self.room_websocket_url)
owner_communicator.scope["user"] = self.owner
await owner_communicator.connect()
await owner_communicator.receive_json_from(TIMEOUT)
# Connect normal user as room participant.
user_communicator = WebsocketCommunicator(application, self.room_websocket_url)
user_communicator.scope["user"] = self.user
await user_communicator.connect()
await user_communicator.receive_json_from(TIMEOUT)
# Owner requests that normal user is kicked.
await owner_communicator.send_json_to(
{"action": "kick user", "username": self.user.username}
)
# Normal user is kicked.
response = await user_communicator.receive_json_from(TIMEOUT)
self.assertEqual({"update": "kicked you"}, response)
# Owner is alerted that normal user was kicked.
response = await owner_communicator.receive_json_from(TIMEOUT)
self.assertEqual(
{"update": "user kicked", "username": self.user.username}, response
)
# Normal user rejoins.
user_communicator2 = WebsocketCommunicator(application, self.room_websocket_url)
user_communicator2.scope["user"] = self.user
await user_communicator2.connect()
response = await user_communicator2.receive_json_from(TIMEOUT)
self.assertEqual(
{
"update": "joined successfully",
"joined as": self.user.username,
},
response,
)
# Connect anonymous user as room participant.
guest_communicator = WebsocketCommunicator(
application, f"{self.room_websocket_url}?guest=test"
)
await guest_communicator.connect()
await guest_communicator.receive_json_from(TIMEOUT)
# Owner requests that anonymous user is kicked.
await owner_communicator.send_json_to(
{"action": "kick user", "username": "guest_test"}
)
# Anonymous user is kicked.
response = await guest_communicator.receive_json_from(TIMEOUT)
self.assertEqual({"update": "kicked you"}, response)
# Owner is alerted that anonymous user was kicked.
response = await owner_communicator.receive_json_from(TIMEOUT)
self.assertEqual({"update": "user kicked", "username": "guest_test"}, response)
# Anonymous user rejoins.
guest_communicator2 = WebsocketCommunicator(
application, f"{self.room_websocket_url}?guest=test"
)
await guest_communicator2.connect()
response = await guest_communicator2.receive_json_from(TIMEOUT)
self.assertEqual(
{
"update": "joined successfully",
"joined as": "guest_test",
},
response,
)
async def test_ban_user(self):
"""
Tests that a room participant can be banned by room owner. Also tests that this
does not apply to guest users.
"""
# Connect owner as room participant.
owner_communicator = WebsocketCommunicator(application, self.room_websocket_url)
owner_communicator.scope["user"] = self.owner
await owner_communicator.connect()
await owner_communicator.receive_json_from(TIMEOUT)
# Connect normal user as room participant.
user_communicator = WebsocketCommunicator(application, self.room_websocket_url)
user_communicator.scope["user"] = self.user
await user_communicator.connect()
await user_communicator.receive_json_from(TIMEOUT)
# Owner requests that normal user is banned.
await owner_communicator.send_json_to(
{"action": "ban user", "username": self.user.username}
)
# Normal user is banned.
response = await user_communicator.receive_json_from(TIMEOUT)
self.assertEqual({"update": "banned you"}, response)
# Owner is alerted that normal user was banned.
response = await owner_communicator.receive_json_from(TIMEOUT)
self.assertEqual(
{"update": "user banned", "username": self.user.username}, response
)
# Normal user cannot rejoin.
user_communicator2 = WebsocketCommunicator(application, self.room_websocket_url)
user_communicator2.scope["user"] = self.user
connected, code = await user_communicator2.connect()
self.assertEqual((False, 4005), (connected, code))
# Connect anonymous user as room participant.
guest_communicator = WebsocketCommunicator(
application, f"{self.room_websocket_url}?guest=test"
)
await guest_communicator.connect()
await guest_communicator.receive_json_from(TIMEOUT)
# Owner requests that anonymous user is banned. Request will be ignored.
await owner_communicator.send_json_to(
{"action": "ban user", "username": "guest_test"}
)
# Anonymous user is still connected.
await guest_communicator.send_json_to(
{"action": "send message", "message": "test"}
)
response = await guest_communicator.receive_json_from(TIMEOUT)
self.assertEqual(
{"update": "new message", "message": "test", "username": "guest_test"},
response,
)
| 37.118227 | 88 | 0.626642 | 3,039 | 30,140 | 6.058572 | 0.069102 | 0.030469 | 0.041549 | 0.060939 | 0.851021 | 0.818651 | 0.803661 | 0.746633 | 0.709537 | 0.668803 | 0 | 0.009612 | 0.285468 | 30,140 | 811 | 89 | 37.163995 | 0.845329 | 0.106636 | 0 | 0.620301 | 0 | 0 | 0.11838 | 0.031018 | 0 | 0 | 0 | 0 | 0.110902 | 1 | 0.003759 | false | 0 | 0.011278 | 0 | 0.018797 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6 |
10656c179937ecd6f44530ea00b4c5a0743ab01b | 21,558 | py | Python | student/tests.py | daniel-mizrahi/Quick-Tutor | 04d27a82e34faa1aa8e1f7ee40f16b3d1474d019 | [
"Apache-2.0"
] | null | null | null | student/tests.py | daniel-mizrahi/Quick-Tutor | 04d27a82e34faa1aa8e1f7ee40f16b3d1474d019 | [
"Apache-2.0"
] | 5 | 2020-05-06T07:40:06.000Z | 2021-09-22T18:58:32.000Z | student/tests.py | daniel-mizrahi/Quick-Tutor | 04d27a82e34faa1aa8e1f7ee40f16b3d1474d019 | [
"Apache-2.0"
] | null | null | null | from quick_tutor.models import Course, Length, Student, Tutor, Request, Profile
from quick_tutor.forms import RequestForm
from .views import student_request_tutor, student_request_form, begin_timing, confirm_payment, cancel_request
from django.test import TestCase
from django.test.client import RequestFactory
from django.test.utils import override_settings
from django.urls import reverse
from django.contrib.auth.models import User, AnonymousUser
from django.contrib.auth import get_user_model
from django.contrib.sessions.middleware import SessionMiddleware
from django.contrib.messages.middleware import MessageMiddleware
from django.contrib.messages.storage.fallback import FallbackStorage
from allauth.socialaccount.models import SocialAccount, SocialLogin
from allauth.socialaccount.helpers import complete_social_login
from django.contrib.auth.models import User
# Create your tests here.
class StudentTestCase(TestCase):
"""Test Cases designed to ensure that the student app is working correctly."""
# required fixtures for these test cases
fixtures = ['course_data.json', 'app_data.json', 'times.json']
def setUp(self):
# The creation of Sherriff
Sherriff = User.objects.create_user(username="mark", first_name="Mark", last_name="Sherriff",
email="testsherriff@virginia.edu")
Sherriff_profile = Profile.objects.get(user=Sherriff)
Sherriff_profile.phone = "434-982-2688"
Sherriff_profile.notify_email = False
Sherriff_profile.save()
Sherriff_tutor = Tutor.objects.get(profile=Sherriff_profile)
Sherriff_tutor.courses.add(Course.objects.get(name="CS 3240"))
Sherriff_student = Student.objects.get(profile=Sherriff_profile)
Sherriff_student.courses.add(Course.objects.get(name="CS 2150"))
# The creation of Bloomfield
Bloomfield = User.objects.create_user(username="aaron", password="bloomboi", first_name="Aaron", last_name="Bloomfield",
email="testaaron@virginia.edu")
Bloomfield_profile = Profile.objects.get(user=Bloomfield)
Bloomfield_profile.phone = "434-982-2215"
Bloomfield_profile.notify_email = False
Bloomfield_profile.save()
Bloomfield_tutor = Tutor.objects.get(profile=Profile.objects.get(user=Bloomfield))
Bloomfield_tutor.courses.add(Course.objects.get(name="CS 2150"))
Bloomfield_student = Student.objects.get(profile=Profile.objects.get(user=Bloomfield))
Bloomfield_student.courses.add(Course.objects.get(name="CS 3240"))
def test_has_courses(self):
Bloomfield_student = Student.objects.get(profile=Profile.objects.get(user=User.objects.get(username="aaron")))
self.assertEqual(str(Bloomfield_student.courses.all()), '<QuerySet [<Course: CS 3240>]>')
self.assertNotEqual(str(Bloomfield_student.courses.all()), '<QuerySet [<Course: CS 9999>]>')
# Learned test format from this link: https://micropyramid.com/blog/django-unit-test-cases-with-forms-and-views/
# Testing RequestForm validity
def test_form_valid(self):
form = RequestForm(user=User.objects.get(username="aaron"),
data={'title': "Help", 'course': Course.objects.get(name="CS 3240"),
'length': Length.objects.get(name="5 minutes"), 'message': "Teach me Sherriff",
'location': "Olsson 120"})
self.assertTrue(form.is_valid())
def test_form_invalid_course(self):
form = RequestForm(user=User.objects.get(username="aaron"),
data={'title': "Help", 'course': Course.objects.get(name="CS 2150"),
'length': Length.objects.get(name="5 minutes"), 'message': "Teach me Sherriff",
'location': "Olsson 120"})
self.assertFalse(form.is_valid())
def test_form_valid_message_blank(self):
form = RequestForm(user=User.objects.get(username="aaron"),
data={'title': "Help", 'course': Course.objects.get(name="CS 3240"),
'length': Length.objects.get(name="5 minutes"), 'message': "",
'location': "Olsson 120"})
self.assertTrue(form.is_valid())
def test_form_invalid_title_blank(self):
form = RequestForm(user=User.objects.get(username="aaron"),
data={'title': "", 'course': Course.objects.get(name="CS 3240"),
'length': Length.objects.get(name="5 minutes"), 'message': "Teach me Sherriff",
'location': "Olsson 120"})
self.assertFalse(form.is_valid())
# Testing various pages when logged in (or not logged in) as a student
def test_home_view(self):
user_login = self.client.login(email="testaaron@virginia.edu", password="bloomboi")
self.assertTrue(user_login)
response = self.client.get("/")
self.assertEqual(response.status_code, 200)
self.assertTemplateUsed(response, "login/index.html")
def test_bad_login(self):
user_login = self.client.login(email="testaaron@virginia.edu", password="bloombad")
self.assertFalse(user_login)
def test_home_view_logged_out(self):
response = self.client.get("/")
self.assertEqual(response.status_code, 200)
self.assertTemplateUsed(response, "login/index.html")
def test_student_home_view(self):
user_login = self.client.login(email="testaaron@virginia.edu", password="bloomboi")
self.assertTrue(user_login)
response = self.client.get("/student/student_home/")
self.assertEqual(response.status_code, 200)
self.assertTemplateUsed(response, "student/student_home.html")
def test_student_home_view_logged_out(self):
response = self.client.get("/student/student_home/")
self.assertEqual(response.status_code, 302)
def test_student_request_tutor_view(self):
user_login = self.client.login(email="testaaron@virginia.edu", password="bloomboi")
self.assertTrue(user_login)
response = self.client.get("/student/student_request_tutor/")
self.assertEqual(response.status_code, 200)
self.assertTemplateUsed(response, "student/student_request_tutor.html")
def test_student_request_tutor_view_logged_out(self):
response = self.client.get("/student/student_home/")
self.assertEqual(response.status_code, 302)
def test_no_request_before_submission(self):
bloomy = User.objects.get(username="aaron")
self.assertFalse(hasattr(bloomy.profile.student, 'request'))
def test_submit_bad_request_no_location(self):
self.assertEqual(Request.objects.count(), 0)
user_login = self.client.login(email="testaaron@virginia.edu", password="bloomboi")
self.assertTrue(user_login)
response = self.client.post("/student/student_request_form/",
{'title': "Help", 'course': Course.objects.get(name="CS 3240").pk,
'length': Length.objects.get(name="5 minutes").pk,
'message': "Teach me Sherriff",
'location': ""})
self.assertEqual(response.status_code, 200)
self.assertEqual(Request.objects.count(), 0)
def test_submit_bad_request_logged_out(self):
self.assertEqual(Request.objects.count(), 0)
bloomy = User.objects.get(username="aaron")
response = self.client.post("/student/student_request_form/",
{'title': "Help", 'course': Course.objects.get(name="CS 3240").pk,
'length': Length.objects.get(name="5 minutes").pk,
'message': "Teach me Sherriff",
'location': "Olsson 120"})
self.assertEqual(response.status_code, 302)
self.assertEqual(Request.objects.count(), 0)
def test_submit_good_request(self):
self.assertEqual(Request.objects.count(), 0)
user_login = self.client.login(email="testaaron@virginia.edu", password="bloomboi")
self.assertTrue(user_login)
bloomy = User.objects.get(username="aaron")
response = self.client.post("/student/student_request_form/",
{'title': "Help", 'course': Course.objects.get(name="CS 3240").pk,
'length': Length.objects.get(name="5 minutes").pk,
'message': "Teach me Sherriff",
'location': "Olsson 120"})
self.assertEqual(response.status_code, 302)
self.assertEqual(Request.objects.count(), 1)
class StudentRequests(TestCase):
fixtures = ['course_data.json', 'app_data.json', 'times.json']
@override_settings(SOCIALACCOUNT_AUTO_SIGNUP=True)
def setUp(self):
# Thanks to https://github.com/Sammcb/TEMPS/tree/master/pages for helping me test http requests
# As well as helping with signing in with google
User = get_user_model()
factory = RequestFactory()
self.request = factory.get('/google/login/callback/')
self.request.user = AnonymousUser()
SessionMiddleware().process_request(self.request)
MessageMiddleware().process_request(self.request)
user = User(username='aaron', email='testaaron@virginia.edu')
account = SocialAccount(user=user, provider='Gmail', uid='123')
sociallogin = SocialLogin(user=user, account=account)
complete_social_login(self.request, sociallogin)
self.assertTrue(self.request.user.is_authenticated)
# The creation of Sherriff
Sherriff = User.objects.create_user(username="mark", first_name="Mark",
last_name="Sherriff", email="testsherriff@virginia.edu")
Sherriff.set_password("sherriff's password")
Sherriff_profile = Profile.objects.get(user=Sherriff)
Sherriff_profile.phone = "434-982-2688"
Sherriff_profile.save()
Sherriff_tutor = Tutor.objects.get(profile=Sherriff_profile)
Sherriff_tutor.courses.add(Course.objects.get(name="CS 3240"))
Sherriff_student = Student.objects.get(profile=Sherriff_profile)
Sherriff_student.courses.add(Course.objects.get(name="CS 2150"))
# The creation of Bloomfield
Bloomfield = User.objects.get(username="aaron")
Bloomfield_profile = Profile.objects.get(user=Bloomfield)
Bloomfield_profile.phone = "434-982-2215"
Bloomfield_profile.save()
Bloomfield_tutor = Tutor.objects.get(profile=Profile.objects.get(user=Bloomfield))
Bloomfield_tutor.courses.add(Course.objects.get(name="CS 2150"))
Bloomfield_student = Student.objects.get(profile=Profile.objects.get(user=Bloomfield))
Bloomfield_student.courses.add(Course.objects.get(name="CS 3240"))
def test_view_request_form(self):
req = RequestFactory().get(reverse("student:student_request_tutor"))
setattr(req, 'session', 'session')
messages = FallbackStorage(req)
setattr(req, '_messages', messages)
req.user = self.request.user
resp = student_request_tutor(req)
self.assertTrue(self.request.user.is_authenticated)
self.assertEquals(resp.status_code, 200)
def test_create_request(self):
student_request = Request.objects.create(title="Help with Django",
course=Course.objects.get(name="CS 3240"),
length=Length.objects.get(name="30 minutes"),
message="I'm really struggling with Django right now.",
location="Thornton Hall",
student=Student.objects.get(profile=Profile.objects.get(
user=User.objects.get(username="aaron"))))
self.assertEqual(student_request, Request.objects.get(
student=Student.objects.get(profile=Profile.objects.get(user=User.objects.get(username="aaron")))))
def test_create_request_view(self):
self.assertEquals(self.request.user, User.objects.get(username="aaron"))
form_data = {'title': 'Help with Django',
'course': Course.objects.get(name="CS 3240").pk,
'length': Length.objects.get(name="30 minutes").pk,
'message': "I'm really struggling with Django right now.",
'location': 'Thornton Hall', }
form = RequestForm(self.request.user, form_data)
self.assertTrue(form.is_valid())
self.assertTrue(self.request.user.is_authenticated)
req = RequestFactory().post(reverse('student:student_request_form'), data=form_data)
setattr(req, 'session', 'session')
messages = FallbackStorage(req)
setattr(req, '_messages', messages)
req.user = self.request.user
resp = student_request_form(req)
self.assertTrue(Request.objects.get(
student=Student.objects.get(profile=Profile.objects.get(user=User.objects.get(username="aaron")))))
def test_begin_timing_view(self):
student_request = Request.objects.create(title="Help with Django",
course=Course.objects.get(name="CS 3240"),
length=Length.objects.get(name="30 minutes"),
message="I'm really struggling with Django right now.",
location="Thornton Hall",
student=Student.objects.get(profile=Profile.objects.get(
user=User.objects.get(username="aaron"))),
tutor=Tutor.objects.get(profile=Profile.objects.get(
user=User.objects.get(username="mark"))),
state=Request.RequestStates.ACCEPTED)
self.assertTrue(Request.objects.get(title="Help with Django"))
req = RequestFactory().post(reverse('student:begin_timing'))
setattr(req, 'session', 'session')
messages = FallbackStorage(req)
setattr(req, '_messages', messages)
req.user = self.request.user
resp = begin_timing(req)
self.assertEqual(Request.objects.get(title="Help with Django").state, Request.RequestStates.TIMING)
def test_confirm_payment_view(self):
student_request = Request.objects.create(title="Help with Django",
course=Course.objects.get(name="CS 3240"),
length=Length.objects.get(name="30 minutes"),
message="I'm really struggling with Django right now.",
location="Thornton Hall",
student=Student.objects.get(profile=Profile.objects.get(
user=User.objects.get(username="aaron"))),
tutor=Tutor.objects.get(profile=Profile.objects.get(
user=User.objects.get(username="mark"))),
state=Request.RequestStates.COMPLETE)
self.assertTrue(Request.objects.get(title="Help with Django"))
req = RequestFactory().post(reverse('student:confirm_payment'))
setattr(req, 'session', 'session')
messages = FallbackStorage(req)
setattr(req, '_messages', messages)
req.user = self.request.user
resp = confirm_payment(req)
with self.assertRaises(Request.DoesNotExist):
Request.objects.get(title="Help with Django")
with self.assertRaises(Request.DoesNotExist):
Request.objects.get(student=Student.objects.get(profile=Profile.objects.get(user=User.objects.get(username="aaron"))))
with self.assertRaises(Request.DoesNotExist):
Request.objects.get(tutor=Tutor.objects.get(profile=Profile.objects.get(user=User.objects.get(username="mark"))))
def test_cancel_unaccepted_request_view(self):
student_request = Request.objects.create(title="Help with Django",
course=Course.objects.get(name="CS 3240"),
length=Length.objects.get(name="30 minutes"),
message="I'm really struggling with Django right now.",
location="Thornton Hall",
student=Student.objects.get(profile=Profile.objects.get(
user=User.objects.get(username="aaron"))))
self.assertTrue(Request.objects.get(title="Help with Django"))
req = RequestFactory().post(reverse('student:cancel_request'))
setattr(req, 'session', 'session')
messages = FallbackStorage(req)
setattr(req, '_messages', messages)
req.user = self.request.user
resp = cancel_request(req)
with self.assertRaises(Request.DoesNotExist):
Request.objects.get(title="Help with Django")
with self.assertRaises(Request.DoesNotExist):
Request.objects.get(
student=Student.objects.get(profile=Profile.objects.get(user=User.objects.get(username="aaron"))))
with self.assertRaises(Request.DoesNotExist):
Request.objects.get(
tutor=Tutor.objects.get(profile=Profile.objects.get(user=User.objects.get(username="mark"))))
def test_cancel_accepted_request_view(self):
student_request = Request.objects.create(title="Help with Django",
course=Course.objects.get(name="CS 3240"),
length=Length.objects.get(name="30 minutes"),
message="I'm really struggling with Django right now.",
location="Thornton Hall",
student=Student.objects.get(profile=Profile.objects.get(
user=User.objects.get(username="aaron"))),
tutor=Tutor.objects.get(profile=Profile.objects.get(
user=User.objects.get(username="mark"))),
state=Request.RequestStates.ACCEPTED)
self.assertTrue(Request.objects.get(title="Help with Django"))
req = RequestFactory().post(reverse('student:cancel_request'))
setattr(req, 'session', 'session')
messages = FallbackStorage(req)
setattr(req, '_messages', messages)
req.user = self.request.user
resp = cancel_request(req)
with self.assertRaises(Request.DoesNotExist):
Request.objects.get(title="Help with Django")
with self.assertRaises(Request.DoesNotExist):
Request.objects.get(
student=Student.objects.get(profile=Profile.objects.get(user=User.objects.get(username="aaron"))))
with self.assertRaises(Request.DoesNotExist):
Request.objects.get(
tutor=Tutor.objects.get(profile=Profile.objects.get(user=User.objects.get(username="mark"))))
# Attempting to cancel a completed request instead of confirming payment should do nothing.
def test_cannot_cancel_completed_request_view(self):
student_request = Request.objects.create(title="Help with Django",
course=Course.objects.get(name="CS 3240"),
length=Length.objects.get(name="30 minutes"),
message="I'm really struggling with Django right now.",
location="Thornton Hall",
student=Student.objects.get(profile=Profile.objects.get(
user=User.objects.get(username="aaron"))),
tutor=Tutor.objects.get(profile=Profile.objects.get(
user=User.objects.get(username="mark"))),
state=Request.RequestStates.COMPLETE)
self.assertTrue(Request.objects.get(title="Help with Django"))
req = RequestFactory().post(reverse('student:cancel_request'))
setattr(req, 'session', 'session')
messages = FallbackStorage(req)
setattr(req, '_messages', messages)
req.user = self.request.user
resp = cancel_request(req)
self.assertTrue(Request.objects.get(title="Help with Django"))
| 58.901639 | 130 | 0.599174 | 2,235 | 21,558 | 5.672036 | 0.103356 | 0.107281 | 0.039757 | 0.048592 | 0.803266 | 0.793248 | 0.779838 | 0.754122 | 0.746864 | 0.729431 | 0 | 0.013936 | 0.287689 | 21,558 | 365 | 131 | 59.063014 | 0.811605 | 0.031543 | 0 | 0.691083 | 0 | 0 | 0.130495 | 0.03073 | 0 | 0 | 0 | 0 | 0.178344 | 1 | 0.082803 | false | 0.025478 | 0.047771 | 0 | 0.143312 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6 |
10695e7679898bb2730b575a34c2e9d680ff7a37 | 70 | py | Python | api_keys.py | delran531/python-api-challenge | dfa69db0bd352de702dbdf2ad8ecb106e02c26eb | [
"ADSL"
] | null | null | null | api_keys.py | delran531/python-api-challenge | dfa69db0bd352de702dbdf2ad8ecb106e02c26eb | [
"ADSL"
] | null | null | null | api_keys.py | delran531/python-api-challenge | dfa69db0bd352de702dbdf2ad8ecb106e02c26eb | [
"ADSL"
] | null | null | null | # OpenWeatherMap API Key
api_key = "6b39ee4e8d260251590219a4fa63240f"
| 23.333333 | 44 | 0.842857 | 6 | 70 | 9.666667 | 0.666667 | 0.206897 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.365079 | 0.1 | 70 | 2 | 45 | 35 | 0.555556 | 0.314286 | 0 | 0 | 0 | 0 | 0.695652 | 0.695652 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.