markdown
stringlengths
0
37k
code
stringlengths
1
33.3k
path
stringlengths
8
215
repo_name
stringlengths
6
77
license
stringclasses
15 values
Keep in mind that increasing the number of folds will give you a larger training dataset, but will lead to more repetitions, and therefore a slower evaluation:
plot_cv(KFold(n_splits=10), iris.target)
Day_1_Scientific_Python/scikit-learn/13-Cross-Validation.ipynb
paris-saclay-cds/python-workshop
bsd-3-clause
Another helpful cross-validation generator is ShuffleSplit. This generator simply splits of a random portion of the data repeatedly. This allows the user to specify the number of repetitions and the training set size independently:
plot_cv(ShuffleSplit(n_splits=5, test_size=.2), iris.target)
Day_1_Scientific_Python/scikit-learn/13-Cross-Validation.ipynb
paris-saclay-cds/python-workshop
bsd-3-clause
If you want a more robust estimate, you can just increase the number of iterations:
plot_cv(ShuffleSplit(n_splits=10, test_size=.2), iris.target)
Day_1_Scientific_Python/scikit-learn/13-Cross-Validation.ipynb
paris-saclay-cds/python-workshop
bsd-3-clause
Complex Impedances You could also renormalize to a complex port impedance if you're crazy. For example, renormalizing to 50j, one would expect: $$ \Gamma^{'} = \frac{50-50j}{50+50j} = 50\frac{1-j}{1+j} = -50j $$ However, one finds an unexpected result when plotting the Smith chart:
match_at_50 = rf.wr10.match() match_at_50.renormalize(50j) # same as renormalize(50j, s_def='power') match_at_50.plot_s_smith(**kw) # expect -1j
doc/source/examples/networktheory/Renormalizing S-parameters.ipynb
jhillairet/scikit-rf
bsd-3-clause
This is because the default behaviour of scikit-rf is to use power-waves scattering parameter definition (since it is the most popular one is CAD softwares). But the power-waves definition is known to fail in such a case. This is why scikit-rf also implement the pseudo-waves scattering parameters definition, but you ha...
match_at_50 = rf.wr10.match() match_at_50.renormalize(50j, s_def='pseudo') match_at_50.plot_s_smith(**kw) # expect -1j
doc/source/examples/networktheory/Renormalizing S-parameters.ipynb
jhillairet/scikit-rf
bsd-3-clause
The binary files are small in size and store every floating point number exactly, so you don't have to worry about efficiency or loosing precision. You can make lots of checkpoints if you want! Let's reset REBOUND (that deletes the particles from memory) and then read the binary file we just saved.
rebound.reset() rebound.load("checkpoint.bin") rebound.status()
python_tutorials/Checkpoints.ipynb
quasars100/Resonance_testing_scripts
gpl-3.0
Generating random weather samples with a IID model with no time dependencies Let's first create some random samples of a symbolic random variable corresponding to the weather with two values Sunny (S) and cloudy (C) and generate random weather for 365 days. The assumption in this model is that the weather of each day i...
values = ['S', 'C'] probabilities = [0.5, 0.5] weather = Random_Variable('weather', values, probabilities) samples = weather.sample(365) print(",".join(samples))
Markov Chains and Hidden Markov Models.ipynb
gtzan/mir_book
cc0-1.0
Now let lets visualize these samples using yellow for sunny and grey for cloudy
state2color = {} state2color['S'] = 'yellow' state2color['C'] = 'grey' def plot_weather_samples(samples, state2color, title): colors = [state2color[x] for x in samples] x = np.arange(0, len(colors)) y = np.ones(len(colors)) plt.figure(figsize=(10,1)) plt.bar(x, y, color=colors, width=1) plt.t...
Markov Chains and Hidden Markov Models.ipynb
gtzan/mir_book
cc0-1.0
Markov Chain Now instead of independently sampling the weather random variable lets form a markov chain. The Markov chain will start at a particular state and then will either stay in the same state or transition to a different state based on a transition probability matrix. To accomplish that we basically create a ra...
def markov_chain(transmat, state, state_names, samples): (rows, cols) = transmat.shape rvs = [] values = list(np.arange(0,rows)) # create random variables for each row of transition matrix for r in range(rows): rv = Random_Variable("row" + str(r), values, transmat[r]) rvs.a...
Markov Chains and Hidden Markov Models.ipynb
gtzan/mir_book
cc0-1.0
Note: Look back at the Random Variables notebook for an example of generating melodies using a Markov Chain with a transition probability matrix that is calculated by analyzing a corpus of chorales. Generating samples using a Hidden Markov Model Lets now look at how a Hidden Markov Model would work by having a Markov ...
state2color = {} state2color['S'] = 'yellow' state2color['C'] = 'grey' # generate random samples for a year samples = weather.sample(365) states = markov_chain(transmat1,0,['S','C'], 365) plot_weather_samples(states, state2color, "markov chain 1") # create two random variables one of the sunny state and one for the...
Markov Chains and Hidden Markov Models.ipynb
gtzan/mir_book
cc0-1.0
Multinomial HMM Lets do the same generation process using the multinomail HMM model supported by the hmmlearn python package.
transmat = np.array([[0.7, 0.3], [0.2, 0.8]]) start_prob = np.array([1.0, 0.0, 0.0]) # yellow and red have high probs for sunny # blue and grey have high probs for cloudy emission_probs = np.array([[0.6, 0.3, 0.1, 0.0], [0.0, 0.1, 0.4, 0.5]]) model = hmm.Multinomial...
Markov Chains and Hidden Markov Models.ipynb
gtzan/mir_book
cc0-1.0
Estimating the parameters of an HMM Let's sample the generative HMM and get a sequence of 1000 observations. Now we can learn in an unsupervised way the paraemters of a two component multinomial HMM just using these observations. Then we can compare the learned parameters with the original parameters of the model used ...
# generate the samples X, Z = model.sample(1000) # learn a new model estimated_model = hmm.MultinomialHMM(n_components=2, n_iter=10000).fit(X)
Markov Chains and Hidden Markov Models.ipynb
gtzan/mir_book
cc0-1.0
Let's compare the estimated model parameters with the original model.
print("Transition matrix") print("Estimated model:") print(estimated_model.transmat_) print("Original model:") print(model.transmat_) print("Emission probabilities") print("Estimated model") print(estimated_model.emissionprob_) print("Original model") print(model.emissionprob_)
Markov Chains and Hidden Markov Models.ipynb
gtzan/mir_book
cc0-1.0
Predicting a sequence of states given a sequence of observations We can also use the trained HMM model to predict a sequence of hidden states given a sequence of observations. This is the tasks of maximum likelihood sequence estimation. For example in Speech Recognition it would correspond to estimating a sequence of p...
Z2 = estimated_model.predict(X) state2color = {} state2color[0] = 'yellow' state2color[1] = 'grey' plot_weather_samples(Z, state2color, 'Original states') plot_weather_samples(Z2, state2color, 'Predicted states') # note the reversal of colors for the states as the order of components is not the same. # we can easily...
Markov Chains and Hidden Markov Models.ipynb
gtzan/mir_book
cc0-1.0
The estimated model can be sampled just like the original model
X, Z = estimated_model.sample(365) state2color = {} state2color[0] = 'yellow' state2color[1] = 'grey' plot_weather_samples(Z, state2color, 'states generated by estimated model ') samples = [item for sublist in X for item in sublist] obs2color = {} obs2color[0] = 'yellow' obs2color[1] = 'red' obs2color[2] = 'blue' o...
Markov Chains and Hidden Markov Models.ipynb
gtzan/mir_book
cc0-1.0
A HMM example using Chords Let's do pretend music example by having the states model a chord progression consisting of D (II), G(V), C (I) chords and the observations consist of chord type i.e whether they are minor7, major7, or dominant7. This is an extremely simplified model of how harmony works but it does do a bit ...
# probabities of each state D(II), G(V), C(I). The transitions are semi-plausible but set by hand. # in a full problem they would be learned from data transmat = np.array([[0.4, 0.4, 0.2], [0.1, 0.1, 0.8], [0.0, 0.3, 0.7]]) start_prob = np.array([1.0, 0.0, 0.0]) # the emis...
Markov Chains and Hidden Markov Models.ipynb
gtzan/mir_book
cc0-1.0
Playing back the generated chords Now that we have generated a sequence of chords symbols with a little bit of work we can play it back using Music21
from music21 import * # create some chords for II, V, I d7 = chord.Chord(['D4','F4', 'A4', 'C5']) dmin7 = chord.Chord(['D4','F-4', 'A4', 'C5']) dmaj7 = chord.Chord(['D4','F#4', 'A4', 'C#5']) c7 = d7.transpose(-2) cmin7 = dmin7.transpose(-2) cmaj7 = dmaj7.transpose(-2) g7 = d7.transpose(5) gmin7 = dmin7.transpose(5)...
Markov Chains and Hidden Markov Models.ipynb
gtzan/mir_book
cc0-1.0
Datos La base de datos está en formato delimitado por comas (csv). Este archivo es el resultado de la extracción de datos a los archivos que el INEGI distribuye en sus anuarios estadísticos.
data = pd.read_csv("test.csv") Markdown('La base de datos tiene {} filas y {} columnas. Cada columna es una variable:'.format(data.shape[0], data.shape[1]))
01_Agua/.ipynb_checkpoints/agua-checkpoint.ipynb
Caranarq/01_Dmine
gpl-3.0
Las 38 variables que contiene la base de datos son:
vdesc = data.columns[0:8] for i,a in enumerate(data.columns): print(i,a)
01_Agua/.ipynb_checkpoints/agua-checkpoint.ipynb
Caranarq/01_Dmine
gpl-3.0
Las primeras ocho variables, con índices del cero al siete, son aspectos descriptivos. A partir de la novena columna, con índice ocho, se encuentran las variables con información cuantitativa sobre consumo, almacenamiento, fuentes de agua, entre otras. Cada fila corresponde a un municipio y cada municipio corresponde a...
# Agrupación de todos los municipios según su clave SUN. zm = data.groupby("cve_sun").count() print("Zonas metropolitanas en total: ",zm.shape[0])
01_Agua/.ipynb_checkpoints/agua-checkpoint.ipynb
Caranarq/01_Dmine
gpl-3.0
Selección de datos para el estudio Para la creación de indicadores es necesario contar con información completa. En esta sección se seleccionarán de la base de datos, las ciudades del SUN con información completa. Python identifica las celdas sin información disponible con el indicador NaN. Por lo tanto, para identific...
# Agrupación según clave SUN con todas las variables con valor diferente a "NaN". zm_sinNaN = data.dropna().groupby("cve_sun").count() print("Zonas metropolitanas sin valores 'NaN': ",zm_sinNaN.shape[0])
01_Agua/.ipynb_checkpoints/agua-checkpoint.ipynb
Caranarq/01_Dmine
gpl-3.0
Tal y como muestran las líneas de código anteriores, exiten 59 zonas metropolitanas; cada una está compuesta por cierto número de municipios. Sin embargo, la tabla de datos original tiene muchos valores vacíos (NaN) por lo que, al filtar todos los municipios que no tienen valores vacíos y al agruparlos según su clave S...
# Lista de claves SUN de las ciudades sin 'NaNs' para filtrar. cves_sinNaN = zm_sinNaN.index.tolist() # Filtro de ciudades con la lista anterior. zm = zm.loc[zm.index.isin(cves_sinNaN)] # ¿Qué ciudades tienen la información completa para todos sus municipios?() (zm_sinNaN / zm)[:10]
01_Agua/.ipynb_checkpoints/agua-checkpoint.ipynb
Caranarq/01_Dmine
gpl-3.0
Aquellas ciudades cuya proporción es igual a uno serán seleccionadas.
# Municipios por ciudad con información completa entre el total de los municipios que existen en esa ciudad. zm = zm_sinNaN / zm # Filtar aquellas ciudades cuyos municipios cuentan con toda la información disponible. zm = zm[zm['_id'] == 1] zm.head()
01_Agua/.ipynb_checkpoints/agua-checkpoint.ipynb
Caranarq/01_Dmine
gpl-3.0
Ya que se tienen las claves SUN de las ciudades sin datos faltantes hay que filtrar los datos de los municipios y declarar una nueva variable con esta información.
muns = data.loc[data['cve_sun'].isin(zm.index.tolist())] muns.head()
01_Agua/.ipynb_checkpoints/agua-checkpoint.ipynb
Caranarq/01_Dmine
gpl-3.0
Las ciudades que cuentan con la información completa para todos sus municipios son las siguientes:
infoc = muns[muns.columns[5:8]].sort_values('cve_sun') infoc.to_csv(r'.\datasets\infoc.csv') infoc
01_Agua/.ipynb_checkpoints/agua-checkpoint.ipynb
Caranarq/01_Dmine
gpl-3.0
El siguiente mapa muestra los municipios pertenecientes a Zonas Urbanas que cuentan con información completa:
Image('info_map.png', width=640)
01_Agua/.ipynb_checkpoints/agua-checkpoint.ipynb
Caranarq/01_Dmine
gpl-3.0
Indicadores 01 - Disponibilidad y acceso al agua AG01.1 - PROPORCIÓN DE LA POBLACIÓN QUE UTILIZA SERVICIOS DE AGUA POTABLE MANEJADOS DE MANERA SALUDABLE Los servicios de agua potable manejados de manera saludable se definen como aquéllas fuentes mejoradas de agua potable que se encuentran dentro de las instalaciones y...
dispyacc = list(); dispyacc.append(data.columns[8]) dispyacc = dispyacc + data.columns[13:24].tolist(); dispyacc
01_Agua/.ipynb_checkpoints/agua-checkpoint.ipynb
Caranarq/01_Dmine
gpl-3.0
El campo "entubada_total" es el porcentaje de viviendas dentro del municipio que cuentan con agua potable entubada mientras que "entubada_dentro_de_vivienda" y "entubada_fuera_de_vivienda_dentro_de_terreno" muestran la proporción de estas viviendas que cuentan con tubería hasta la vivienda o cuya tubería entra al terre...
print('Los datos disponibles en la base de datos acerca de agua entubada son los siguientes:') print('\tTotal de municipios en la base de datos: {}'.format(len(data['entubada_total']))) print('\tMunicipios que cuentan con registros de agua entubada: {}'.format(len(data['entubada_total'].dropna()))) # Dataset de agua e...
01_Agua/.ipynb_checkpoints/agua-checkpoint.ipynb
Caranarq/01_Dmine
gpl-3.0
Quitando los municipios que no tienen información disponible, las estadísticas básicas de la información disponible son las siguientes:
data_disponibilidad['entubada_total'].dropna().describe()
01_Agua/.ipynb_checkpoints/agua-checkpoint.ipynb
Caranarq/01_Dmine
gpl-3.0
Los primeros 3 cuartiles están por debajo del 99%, mientras que es de extrañar que el valor máximo sea 157884. Muy probablemente los valores que superan el 100 están capturados de manera errónea, por lo que serán excluidos del análisis.
# Casos que serán excluidos del análisis data_disponibilidad[data_disponibilidad['entubada_total']>100] # Declaracion de variable con datos para el análisis analisis_disponibilidad = data_disponibilidad[data_disponibilidad['entubada_total']<100] analisis_disponibilidad = analisis_disponibilidad.set_index('entidad')
01_Agua/.ipynb_checkpoints/agua-checkpoint.ipynb
Caranarq/01_Dmine
gpl-3.0
Una vez excluidos estos valores, las estadísticas básicas de la información son las siguientes:
analisis_disponibilidad['entubada_total'].describe() analisis_disponibilidad.boxplot(column = 'entubada_total', by = 'entidad', figsize = (14, 4)) plt.suptitle('') plt.title('Acceso al agua potable en ciudades por entidad', fontsize=16) plt.ylabel('% de acceso al agua') plt.show()
01_Agua/.ipynb_checkpoints/agua-checkpoint.ipynb
Caranarq/01_Dmine
gpl-3.0
La informacion de este análisis puede ser exportada en formato CSV para integrarla al sistema de información Geográfica de la Plataforma de Conocimiento sobre Ciudades Sustentables.
analisis_disponibilidad.to_csv('AG01_1.csv')
01_Agua/.ipynb_checkpoints/agua-checkpoint.ipynb
Caranarq/01_Dmine
gpl-3.0
The equation of motion: $$ \begin{gather} m \frac{d^2 \vec{r} }{dt^2} = \frac{q}{c} [ \vec{v} \vec{B} ] \end{gather} $$ For the case of a uniform magnetic field along the $z$-axis: $$ \vec{B} = B_z = B, \quad B_x = 0, \quad B_y = 0 $$ In Cortesian coordinates:
eq_x = Eq( Derivative(x(t), t, 2), q / c / m * Bz * Derivative(y(t),t) ) eq_y = Eq( Derivative(y(t), t, 2), - q / c / m * Bz * Derivative(x(t),t) ) eq_z = Eq( Derivative(z(t), t, 2), 0 ) display( eq_x, eq_y, eq_z )
examples/single_particle_in_magnetic_field/Single Particle in Uniform Magnetic Field.ipynb
epicf/ef
mit
The constants of integration can be found from the initial conditions $z(0) = z_0$ and $v_z(0) = v_{z0}$:
c1_c2_system = [] initial_cond_subs = [(t, 0), (z(0), z_0), (diff(z(t),t).subs(t,0), vz_0) ] c1_c2_system.append( z_eq.subs( initial_cond_subs ) ) c1_c2_system.append( vz_eq.subs( initial_cond_subs ) ) c1, c2 = symbols("C1, C2") c1_c2 = solve( c1_c2_system, [c1, c2] ) c1_c2
examples/single_particle_in_magnetic_field/Single Particle in Uniform Magnetic Field.ipynb
epicf/ef
mit
So that
z_sol = z_eq.subs( c1_c2 ) vz_sol = vz_eq.subs( c1_c2 ).subs( [( diff(z(t),t), vz(t) ) ] ) display( z_sol, vz_sol )
examples/single_particle_in_magnetic_field/Single Particle in Uniform Magnetic Field.ipynb
epicf/ef
mit
For some reason I have not been able to solve the system of differential equations for $x$ and $y$ directly with Sympy's dsolve function:
#dsolve( [eq_x, eq_y], [x(t),y(t)] )
examples/single_particle_in_magnetic_field/Single Particle in Uniform Magnetic Field.ipynb
epicf/ef
mit
It is necessary to resort to the manual solution. The method is to differentiate one of them over time and substitute the other. This will result in oscillator-type second-order equations for $v_y$ and $v_x$. Their solution is known. Integrating one more time, it is possible to obtain laws of motion $x(t)$ and $y(t)$.
v_subs = [ (Derivative(x(t),t), vx(t)), (Derivative(y(t),t), vy(t)) ] eq_vx = eq_x.subs( v_subs ) eq_vy = eq_y.subs( v_subs ) display( eq_vx, eq_vy ) eq_d2t_vx = Eq( diff(eq_vx.lhs,t), diff(eq_vx.rhs,t)) eq_d2t_vx = eq_d2t_vx.subs( [(eq_vy.lhs, eq_vy.rhs)] ) display( eq_d2t_vx )
examples/single_particle_in_magnetic_field/Single Particle in Uniform Magnetic Field.ipynb
epicf/ef
mit
The solution of the last equation is
C1, C2, Omega = symbols( "C1, C2, Omega" ) vx_eq = Eq( vx(t), C1 * cos( Omega * t ) + C2 * sin( Omega * t )) display( vx_eq ) omega_eq = Eq( Omega, Bz * q / c / m ) display( omega_eq )
examples/single_particle_in_magnetic_field/Single Particle in Uniform Magnetic Field.ipynb
epicf/ef
mit
where $\Omega$ is a cyclotron frequency.
display( vx_eq ) vy_eq = Eq( vy(t), solve( Eq( diff(vx_eq.rhs,t), eq_vx.rhs ), ( vy(t) ) )[0] ) vy_eq = vy_eq.subs( [(Omega*c*m / Bz / q, omega_eq.rhs * c * m / Bz / q)]).simplify() display( vy_eq )
examples/single_particle_in_magnetic_field/Single Particle in Uniform Magnetic Field.ipynb
epicf/ef
mit
For initial conditions $v_x(0) = v_{x0}, v_y(0) = v_{y0}$:
initial_cond_subs = [(t,0), (vx(0), vx_0), (vy(0), vy_0) ] vx0_eq = vx_eq.subs( initial_cond_subs ) vy0_eq = vy_eq.subs( initial_cond_subs ) display( vx0_eq, vy0_eq ) c1_c2 = solve( [vx0_eq, vy0_eq] ) c1_c2_subs = [ ("C1", c1_c2[c1]), ("C2", c1_c2[c2]) ] vx_eq = vx_eq.subs( c1_c2_subs ) vy_eq = vy_eq.subs( c1_c2_subs ...
examples/single_particle_in_magnetic_field/Single Particle in Uniform Magnetic Field.ipynb
epicf/ef
mit
These equations can be integrated to obtain the laws of motion:
x_eq = vx_eq.subs( vx(t), diff(x(t),t)) x_eq = dsolve( x_eq ) y_eq = vy_eq.subs( vy(t), diff(y(t),t)) y_eq = dsolve( y_eq ).subs( C1, C2 ) display( x_eq, y_eq )
examples/single_particle_in_magnetic_field/Single Particle in Uniform Magnetic Field.ipynb
epicf/ef
mit
For nonzero $\Omega$:
x_eq = x_eq.subs( [(Omega, 123)] ).subs( [(123, Omega)] ).subs( [(Rational(1,123), 1/Omega)] ) y_eq = y_eq.subs( [(Omega, 123)] ).subs( [(123, Omega)] ).subs( [(Rational(1,123), 1/Omega)] ) display( x_eq, y_eq )
examples/single_particle_in_magnetic_field/Single Particle in Uniform Magnetic Field.ipynb
epicf/ef
mit
For initial conditions $x(0) = x_0, y(0) = y_0$:
initial_cond_subs = [(t,0), (x(0), x_0), (y(0), y_0) ] x0_eq = x_eq.subs( initial_cond_subs ) y0_eq = y_eq.subs( initial_cond_subs ) display( x0_eq, y0_eq ) c1_c2 = solve( [x0_eq, y0_eq] ) c1_c2_subs = [ ("C1", c1_c2[0][c1]), ("C2", c1_c2[0][c2]) ] x_eq = x_eq.subs( c1_c2_subs ) y_eq = y_eq.subs( c1_c2_subs ) display(...
examples/single_particle_in_magnetic_field/Single Particle in Uniform Magnetic Field.ipynb
epicf/ef
mit
Finally
display( x_eq, y_eq, z_sol ) display( vx_eq, vy_eq, vz_sol ) display( omega_eq )
examples/single_particle_in_magnetic_field/Single Particle in Uniform Magnetic Field.ipynb
epicf/ef
mit
Список файлов: * empty - файл полученный с томографа без коррекций * corr - то же изображение что и empty, но с коррекцией * tomo - то же, что и empty, но полученное в ходе проведения эксперимента * white - пустой пучок используемый для нормировки изображений (получен в тот-же день при калибровке) * black_1, black_2 - ...
empty = plt.imread(data_root+'first_projection.tif').astype('float32') corr = plt.imread(data_root+'first_projection_corr.tif').astype('float32') tomo = plt.imread(data_root+'Raw/pin_2.24um_0000.tif').astype('float32') white = np.fromfile(data_root+'white0202_2016-02-11.ffr',dtype='<u2').astype('float32').reshape((2096...
tomo/yaivan/empty_frames.ipynb
buzmakov/tomography_scripts
mit
Вот пучок без объекта. По осям - отсчёты детектора. Здесь и далее первая картинка и центральное сечение - как есть. Вторая картинка - с применениейм медианной фильтрации (чтобы убрать шумы сцинстиллятора).
show_frame(white, 'White')
tomo/yaivan/empty_frames.ipynb
buzmakov/tomography_scripts
mit
Вот темновой ток 1 по осям - отсчёты детектора
show_frame(black_1, 'Black_1')
tomo/yaivan/empty_frames.ipynb
buzmakov/tomography_scripts
mit
Вот темновой ток 2 по осям - отсчёты детектора
show_frame(black_2, 'Black_2')
tomo/yaivan/empty_frames.ipynb
buzmakov/tomography_scripts
mit
Вот разница между темновыми токами
show_frame(black_1 - black_2, 'Black_1 - Black_2')
tomo/yaivan/empty_frames.ipynb
buzmakov/tomography_scripts
mit
Вот никак не скорректированное изображение
show_frame(empty, 'Empty')
tomo/yaivan/empty_frames.ipynb
buzmakov/tomography_scripts
mit
Вот отнормированное изображение (силами томографа) Странно, что на центральном срезе максимум не на 65535 (2^16), а примерно 65535*0.8. Это значит что нам при реконструкции нужно нормироваться не на 65535 при взятии логарифма, а на максимум по синограмме?
show_frame(corr, 'Corr')
tomo/yaivan/empty_frames.ipynb
buzmakov/tomography_scripts
mit
Вот изображение из томографического зксперимента
show_frame(tomo, 'tomo image')
tomo/yaivan/empty_frames.ipynb
buzmakov/tomography_scripts
mit
Вот разница изображений отнормированных томографом в ручном режиме и режиме томографа Они видимо немого сдвинуты
show_frame(corr - tomo, 'corr / tomo image')
tomo/yaivan/empty_frames.ipynb
buzmakov/tomography_scripts
mit
Вот моя попытка отнормировать изображение Видны следы от прямого пучка (сетка на заднем фоне), но это видимо связано с тем, что прямой пучок зависит от расстояний детектор-источник (сферичность интенсивности), и прямой пучок был померян для другого рассотояния. К тому-же интенсивнось прямого пучка видимо была меньше (в...
white_norm = (white - black_1) white_norm[white_norm<1] = 1 empty_norm = (empty/16 - black_1) empty_norm[empty_norm<1] =1 my_corr = empty_norm/white_norm my_corr[my_corr>1.1] = 1.1 show_frame(my_corr, 'my_corr image')
tomo/yaivan/empty_frames.ipynb
buzmakov/tomography_scripts
mit
Скорректированный пучок нами поделеённый на скорреткироваанный скайсканом. Они вроде совпадают, с точностью до шумов. Отсюда следует, что нормировка происходит по формуле $$Signal=k\times 2^{16}\frac{I_1-dark}{I_0-dark}, k=0.87$$
show_frame(my_corr*65535*0.87/corr, 'my_corr/corr image')
tomo/yaivan/empty_frames.ipynb
buzmakov/tomography_scripts
mit
Hamilton (1989) switching model of GNP This replicates Hamilton's (1989) seminal paper introducing Markov-switching models. The model is an autoregressive model of order 4 in which the mean of the process switches between two regimes. It can be written: $$ y_t = \mu_{S_t} + \phi_1 (y_{t-1} - \mu_{S_{t-1}}) + \phi_2 (y_...
# Get the RGNP data to replicate Hamilton dta = pd.read_stata('http://www.stata-press.com/data/r14/rgnp.dta').iloc[1:] dta.index = pd.DatetimeIndex(dta.date, freq='QS') dta_hamilton = dta.rgnp # Plot the data dta_hamilton.plot(title='Growth rate of Real GNP', figsize=(12,3)) # Fit the model mod_hamilton = sm.tsa.Mark...
examples/notebooks/markov_autoregression.ipynb
josef-pkt/statsmodels
bsd-3-clause
Let's go over the columns: - event_id: the unique identifier for this contract win. - asof_date: EventVestor's timestamp of event capture. - trade_date: for event announcements made before trading ends, trade_date is the same as event_date. For announcements issued after market close, trade_date is next market open day...
ba_sid = symbols('BA').sid wins = contract_win[contract_win.sid == ba_sid][['timestamp', 'contract_amount','amount_units','contract_entity']].sort('timestamp') # When displaying a Blaze Data Object, the printout is automatically truncated to ten rows. wins
notebooks/data/eventvestor.contract_win/notebook.ipynb
quantopian/research_public
apache-2.0
Finally, suppose we want the above as a DataFrame:
ba_df = odo(wins, pd.DataFrame) # Printing a pandas DataFrame displays the first 30 and last 30 items, and truncates the middle. ba_df
notebooks/data/eventvestor.contract_win/notebook.ipynb
quantopian/research_public
apache-2.0
Build topology
def build_topology(nodes, edges): topology = nx.Graph() # add all nodes for index, row in nodes.iterrows(): node_name = row["name"] node_attributes = row.drop(["name"]).to_dict() topology.add_node(node_name, **node_attributes) # add all edges for index, row in edges...
clustering/by_topology/lom2-agnostic-code.ipynb
clustbench/network-tests2
lgpl-2.1
Actually do the work
import itertools @pd_diskcache("paths.pkl") def find_comp_to_comp_shortest_paths(topology, comp_nodes): paths_ugly = dict(nx.all_pairs_shortest_path(topology)) # calculates shortest paths and stores them in a dict of dicts # build a table with all computational node pairs # they are not duplicated...
clustering/by_topology/lom2-agnostic-code.ipynb
clustbench/network-tests2
lgpl-2.1
Calculate feature lists of these paths We also add a new column to paths table here Helper functions
def interleave(it1, it2): """ >>> list(interleave([1, 2, 3, 4], ["a", "b", "c"])) [1, 'a', 2, 'b', 3, 'c', 4] """ return ( item for item in itertools.chain.from_iterable(itertools.zip_longest(it1, it2)) if item is not None) def get_node_features(topology, node): """Retur...
clustering/by_topology/lom2-agnostic-code.ipynb
clustbench/network-tests2
lgpl-2.1
$$p(x)=\mathcal{N}(0, I) \ q(x)=\mathcal{N}(0, I)$$
# Gaussian variance difference. gvd5_fname = 'ex3-gvd5-me2_n500_rs100_Jmi2_Jma384_a0.050_trp0.50.p' gvd5_results = load_plot_vs_Js(gvd5_fname, show_legend=True) plt.legend(bbox_to_anchor=(1.8, 1.05)) plt.xticks([1, 10, 1e2, 1e3]) plt.savefig(gvd5_fname.replace('.p', '.pdf', 1), bbox_inches='tight') # plt.legend(ncol=2...
ipynb/ex3_results.ipynb
wittawatj/kernel-gof
mit
$$p(x)=\mathcal{N}(0, I) \ q(x)=\mathcal{N}(0, \mathrm{diag}(2,1,1,\ldots))$$
# Gauss-Bernoulli RBM. H1 case # rbm_h1_fname = 'ex3-gbrbm_dx5_dh3_v5em3-me2_n500_rs100_Jmi2_Jma384_a0.050_trp0.50.p' # rbm_h1_results = load_plot_vs_Js(rbm_h1_fname, show_legend=True)
ipynb/ex3_results.ipynb
wittawatj/kernel-gof
mit
Simulate a bivariate relationship Let's simulate two variables, $X$ and $Y$, where $Y$ is a function of $X$ plus some independent noise.
npts = 25 X = np.linspace(0, 5, npts) + stats.norm.rvs(loc=0, scale=1, size=npts) a = 1.0 b = 1.5 Y = b*X + a + stats.norm.rvs(loc=0, scale=2, size=npts) g = sbn.jointplot(X, Y) g.set_axis_labels("X", "Y") pass
2016-04-18-Linear-Regression.ipynb
Bio204-class/bio204-notebooks
cc0-1.0
Linear Regression -- finding the line of "best fit" What if we wanted to estimate the linear function that relates $Y$ to $X$? Linear functions are those whose graphs are straight lines. A linear function of a variable $x$ is usually written as: $$ \hat{y} = f(x) = bx + a $$ where $a$ and $b$ are constants. In ge...
# calculate regression using built-in scipy.stats.linregress # we'll show the underlying calculations later in the notebook rgr = stats.linregress(X,Y) b = rgr.slope a = rgr.intercept # plot scatter plt.scatter(X, Y, color='steelblue', s=30) # plot regression line plt.plot(X, b*X + a, color='indianred', alpha=0.5) ...
2016-04-18-Linear-Regression.ipynb
Bio204-class/bio204-notebooks
cc0-1.0
Solution for the least-squares criterion The slope, $b$, and intercept, $a$, that minimize this quantity are: \begin{align} b &= \frac{s_{xy}}{s^2_x} = r_{xy}\frac{s_y}{s_x}\ \ a &= \overline{y} - b\overline{x} \end{align}
# here's a simple function to calculate the least squares regression of Y on X def lsqr_regression(X, Y): covxy = np.cov(X, Y, ddof=1)[0,1] varx = np.var(X, ddof=1) b = covxy/varx a = np.mean(Y) - b * np.mean(X) return b, a def plot_regression_line(X, Y, b, a, axis, **kw): minx = min(X) m...
2016-04-18-Linear-Regression.ipynb
Bio204-class/bio204-notebooks
cc0-1.0
Residuals Residuals are the difference between the observed value of $y$ and the predicted value. You can think of residuals as the proportion of $y$ unaccounted for by the regression. $$ residuals = y - \hat{y} $$ When the linear regression model is appropriate, residuals should should centered around zero and shoud...
# yhat is the predicted values of y from x Yhat = b * X + a # residuals are the differnce between predicted and actual residuals = Y - Yhat plt.scatter(X, residuals, color='steelblue') plt.hlines(0, min(X)*0.99, max(X)*1.01,color='indianred') plt.xlabel("X") plt.ylabel("Residuals") pass
2016-04-18-Linear-Regression.ipynb
Bio204-class/bio204-notebooks
cc0-1.0
Regression as sum-of-squares decomposition Like ANOVA, regression can be viewed as a decomposition of the sum-of-squares deviances. $$ ss(y) = ss(\hat{y}) + ss(residuals) $$
ssy = np.sum((Y - np.mean(Y))**2) ssyhat = np.sum((Yhat - np.mean(Yhat))**2) ssresiduals = np.sum((residuals - np.mean(residuals))**2) print("SSTotal:", ssy) print("SSYhat:", ssyhat) print("SSResiduals:", ssresiduals) print("SSYhat + SSresiduals:", ssyhat + ssresiduals)
2016-04-18-Linear-Regression.ipynb
Bio204-class/bio204-notebooks
cc0-1.0
Variance "explained" by a regression model In the same way we did for ANOVA, we can use the sum-of-square decomposition to understand the relative proportion of variance "explained" (accounted for) by the regression model. We call this quanity the "Coefficient of Determination", and it's designated $R^2$. $$ R^2 = \...
regr = stats.linregress(X, Y) regr print("Regression slope: ", regr.slope) print("Regression intercept: ", regr.intercept) print("P-value for the null hypothesis that slope = 0:", regr.pvalue) print("Coefficient of determination, R^2:", regr.rvalue**2) R2 = (1 - (ssresiduals/ssy)) R2
2016-04-18-Linear-Regression.ipynb
Bio204-class/bio204-notebooks
cc0-1.0
Regression confidence intervals To understand regression confidence intervals, let's simulate the sampling distribution of the slope and intercept. For this simulation we will hold $X$ fixed, and repeatedly generate samples of $Y$.
npts = 25 x = np.linspace(0,5,npts) + stats.norm.rvs(loc=0, scale=2, size=npts) A = 1 B = 1.5 slopes = [] intercepts = [] yhat = [] nsims = 1000 for i in range(nsims): y = B*x + A + stats.norm.rvs(loc=0, scale=2, size=npts) b = np.corrcoef(x,y,ddof=1)[0,1] * (np.std(y,ddof=1)/np.std(x,ddof=1)) a = np.me...
2016-04-18-Linear-Regression.ipynb
Bio204-class/bio204-notebooks
cc0-1.0
Seaborn will automatically draw CIs for you The seaborn.regplot function will draw the bivariate scatter, the corresponding linear regression, and confidence interval for you.
rp = sbn.regplot(X, Y) pass
2016-04-18-Linear-Regression.ipynb
Bio204-class/bio204-notebooks
cc0-1.0
Illustration of regression with Iris data
url = "http://roybatty.org/iris.csv" iris = pd.read_csv(url) iris.columns = iris.columns.str.replace('.',"_") iris.head() setosa = iris.query('Species == "setosa"') setosa.shape g = sbn.jointplot(setosa.Sepal_Length, setosa.Sepal_Width, space=0.15,) g.set_axis_labels("Sepal Length", "Sepal Width") plt.subplots_adjus...
2016-04-18-Linear-Regression.ipynb
Bio204-class/bio204-notebooks
cc0-1.0
Create a function to get all the statistics of a variable and create summaries. This will be used to write summaries for things like weight vectors and biases.
# Code from - https://www.tensorflow.org/get_started/summaries_and_tensorboard def variable_summaries(var): # Attach a scope for the summary with tf.name_scope("summaries"): mean = tf.reduce_mean(var) tf.summary.scalar('mean', mean) with tf.name_scope('stddev'): stdd...
notebooks/Feed Forward Neural network with TensorBoard.ipynb
abhay1/tf_rundown
mit
Create a function for a neural network layer
def nn_layer(input_tensor, input_dim, output_dim, layer_name, act=tf.nn.relu): # Scope the entire layer with its name with tf.name_scope(layer_name): # Scope for the weights with tf.name_scope("weights"): weights = tf.Variable(tf.truncated_normal([input_dim, output_dim], stddev=0.1))...
notebooks/Feed Forward Neural network with TensorBoard.ipynb
abhay1/tf_rundown
mit
Build the network
# Build the network hidden1 = nn_layer(x, num_features, layer_1_size, "layer1") hidden2 = nn_layer(hidden1, layer_1_size, layer_2_size, "layer2") # Final layer - Use tf.identity to make sure there are no activations logits = nn_layer(hidden2, layer_2_size, num_classes, "softmax", act=tf.identity)
notebooks/Feed Forward Neural network with TensorBoard.ipynb
abhay1/tf_rundown
mit
Compute the Loss
# Compute the cross entropy with tf.name_scope('cross_entropy'): deltas = tf.nn.softmax_cross_entropy_with_logits(labels=y, logits=logits) with tf.name_scope('total'): cross_entropy_loss = tf.reduce_mean(deltas) tf.summary.scalar('cross_entropy', cross_entropy_loss)
notebooks/Feed Forward Neural network with TensorBoard.ipynb
abhay1/tf_rundown
mit
Define the optimizer
with tf.name_scope('train_step'): train_step = tf.train.GradientDescentOptimizer(learning_rate).minimize(cross_entropy_loss)
notebooks/Feed Forward Neural network with TensorBoard.ipynb
abhay1/tf_rundown
mit
Compute the accuracies
with tf.name_scope("evaluation"): with tf.name_scope("correct_prediction"): correct_predictions = tf.equal(tf.argmax(logits, 1), tf.argmax(y, 1)) with tf.name_scope("accuracy"): accuracy = tf.reduce_mean(tf.cast(correct_predictions, tf.float32)) tf.summary.scalar("accuracy", accuracy)
notebooks/Feed Forward Neural network with TensorBoard.ipynb
abhay1/tf_rundown
mit
Now lets run our graph as usual
# Initializing global variables init = tf.global_variables_initializer() # Merge all the summaries summaries = tf.summary.merge_all() # Create a session to run the graph with tf.Session() as sess: # Run initialization sess.run(init) summary_writer = tf.summary.FileWriter(log_path, sess.graph) ...
notebooks/Feed Forward Neural network with TensorBoard.ipynb
abhay1/tf_rundown
mit
Prepare Data Input shape for X will be (28, 28, 1) images in this case.
def parse_file(filename): xdata, ydata = [], [] fin = open(filename, "rb") i = 0 for line in fin: if i % 10000 == 0: print("{:s}: {:d} lines read".format( os.path.basename(filename), i)) cols = line.strip().split(",") ydata.append(int(cols[0])) ...
src/keras/02-mnist-cnn.ipynb
sujitpal/polydlot
apache-2.0
Define Network Model defined is identical to that in Keras example mnist_cnn.py.
model = Sequential() model.add(Conv2D(32, (3, 3), activation="relu", input_shape=(28, 28, 1))) model.add(Conv2D(64, (3, 3), activation="relu")) model.add(MaxPooling2D(pool_size=(2, 2))) model.add(Dropout(0.25)) model.add(Flatten()) model.add(Dense(128, activation="relu")) model.add(Dropout(0.5)) model.add(Dense(NUM_CLA...
src/keras/02-mnist-cnn.ipynb
sujitpal/polydlot
apache-2.0
Train Network The Tensorboard callback, if enabled will write out the training logs to the directory given by TENSORBOARD_LOGS_DIR, and you can now start the tensorboard server using the following command: tensorboard --logdir=/path/to/TENSORBOARD_LOGS_DIR The tensorboard application can be accessed from the browser a...
checkpoint = ModelCheckpoint(filepath=BEST_MODEL, save_best_only=True) tensorboard = TensorBoard(log_dir=TENSORBOARD_LOGS_DIR, histogram_freq=1, batch_size=BATCH_SIZE, write_graph=True, write_grads=True, ...
src/keras/02-mnist-cnn.ipynb
sujitpal/polydlot
apache-2.0
Data Preparation
df = load_responses_with_traces() df['click_dt_local'] = df.apply(lambda x: utc_to_local(x['click_dt_utc'], x['geo_data']['timezone']), axis = 1) df = df[df['click_dt_local'].notnull()].copy() print('Num Responses with a timezone', df.shape[0])
src/analysis/Temporal Distributions.ipynb
ewulczyn/readers
mit
Set up for hour of day plots
df['local_hour_of_day'] = df['click_dt_local'].apply(lambda x: x.hour) df['local_hour_of_day_div2'] = df['click_dt_local'].apply(lambda x: 2 * int(x.hour / 2)) df['local_hour_of_day_div3'] = df['click_dt_local'].apply(lambda x: 3 * int(x.hour / 3)) df['local_hour_of_day_div4'] = df['click_dt_local'].apply(lambda x: 4 *...
src/analysis/Temporal Distributions.ipynb
ewulczyn/readers
mit
Set up for Day of Week and Weekend vs Weekday plots
def get_day_of_week(t): return t.weekday() def get_day_type(t): if t.weekday() > 4: return 1 else: return 0 df['local_day_of_week'] = df['click_dt_local'].apply(get_day_of_week) df['local_day_type'] = df['click_dt_local'].apply(get_day_type) day_of_week_xticks = [ 'Mond...
src/analysis/Temporal Distributions.ipynb
ewulczyn/readers
mit
Plots Motivation Weekday vs Weekend
d_single_motivation = df[df['motivation'].apply(lambda x: len(x.split('|')) == 1)] print('Num Response Traces with a single motivation:', d_single_motivation.shape) x = 'local_day_type' hue = 'motivation' d = d_single_motivation xticks = day_type_xticks figsize = (4, 6) xlim = (-0.25, 1.25) hue_order = ['media', 'wor...
src/analysis/Temporal Distributions.ipynb
ewulczyn/readers
mit
The proportion of respondents motivated by work/school drops significantly from weekday to weekend. The proportion of respondents motivated by media increase significantly from weekday to weekend. All other motivations see a very silgtht increase. Motivation by Day of Week
x = 'local_day_of_week' hue = 'motivation' d = d_single_motivation xticks = day_of_week_xticks figsize = (6, 6) xlim = (-0.25, 6.25) hue_order = ['media', 'work/school', 'intrinsic learning', 'bored/random', 'conversation', 'current event', 'personal decision'] plot_over_time(d, x, xticks, hue, hue_order, figsize, xli...
src/analysis/Temporal Distributions.ipynb
ewulczyn/readers
mit
Motivations besides media and work/school maintain a fairly constant proportion throughout the week. The work/school proportion stays at a high contant 20% M-Th, drops until Saturday to almost 10% and then rebounds on Sunday to 15%. Similarly, media stays at a high contant M-F, then Jumps up during the weekend. Motiva...
x = 'local_hour_of_day_div4' hue = 'motivation' d = d_single_motivation d = d[d['local_day_type'] == 0] xticks = hour_of_day_div4_xticks figsize = (8, 6) xlim = (-0.5, 20.5) hue_order = ['media', 'work/school', 'intrinsic learning', 'bored/random', 'conversation', 'current event', 'personal decision'] plot_over_time(d...
src/analysis/Temporal Distributions.ipynb
ewulczyn/readers
mit
The familiar pattern. Motivations besides media and work/school maintain a fairly constant proportion throughout the day. Work/school maintains the highest proportion during work/school hours. Media has the highest proportion outside of work/school hours. Information Depth: Weekday vs Weekend
x = 'local_day_type' hue = 'information depth' xticks = day_type_xticks figsize = (4, 8) xlim = (-0.25, 1.25) hue_order = ['in-depth', 'overview', 'fact'] plot_over_time(df, x, xticks, hue, hue_order, figsize, xlim )
src/analysis/Temporal Distributions.ipynb
ewulczyn/readers
mit
Non of the differences are significant, athough it appears as if a higher proportion of respondents are seeking an in depth reading on the weekend. Information Depth: Hour of Day
x = 'local_hour_of_day_div4' hue = 'information depth' d = df[df['local_day_type'] == 0] xticks = hour_of_day_div4_xticks figsize = (8, 6) xlim = (-0.5, 20.5) hue_order = ['in-depth', 'overview', 'fact'] plot_over_time(d, x, xticks, hue, hue_order, figsize, xlim )
src/analysis/Temporal Distributions.ipynb
ewulczyn/readers
mit
Not much. Maybe a bump in overview and a dip in fact during the day. Information Depth: Weekday vs Weekend
x = 'local_day_type' hue = 'prior knowledge' xticks = day_type_xticks figsize = (4, 8) xlim = (-0.25, 1.25) hue_order = ['familiar', 'unfamiliar'] plot_over_time(df, x, xticks, hue, hue_order, figsize, xlim )
src/analysis/Temporal Distributions.ipynb
ewulczyn/readers
mit
Again, no significant change. Weekend readrs may be more likely to familiar with the topic. Information Depth: Hour of Day
x = 'local_hour_of_day_div4' hue = 'prior knowledge' d = df[df['local_day_type'] == 0] xticks = hour_of_day_div4_xticks figsize = (8, 6) xlim = (-0.5, 20.5) hue_order = ['familiar', 'unfamiliar'] plot_over_time(d, x, xticks, hue, hue_order, figsize, xlim )
src/analysis/Temporal Distributions.ipynb
ewulczyn/readers
mit
We can convert lists to TensorArray, so appending to lists also works, with a few modifications:
def f(n): numbers = [] # We ask you to tell us about the element dtype. autograph.utils.set_element_type(numbers, tf.int32) for i in range(n): numbers.append(i) return numbers.stack() # Stack the list so that it can be used as a Tensor tf_f = autograph.to_graph(f) with tf.Graph().as_default(): with tf...
tensorflow/contrib/autograph/examples/notebooks/dev_summit_2018_demo.ipynb
allenlavoie/tensorflow
apache-2.0
And all of these functionalities, and more, can be composed into more complicated code:
def print_primes(n): """Returns all the prime numbers less than n.""" assert n > 0 primes = [] autograph.utils.set_element_type(primes, tf.int32) for i in range(2, n): is_prime = True for k in range(2, i): if i % k == 0: is_prime = False break if not is_prime: contin...
tensorflow/contrib/autograph/examples/notebooks/dev_summit_2018_demo.ipynb
allenlavoie/tensorflow
apache-2.0
This function specifies the main training loop. We instantiate the model (using the code above), instantiate an optimizer (here we'll use SGD with momentum, nothing too fancy), and we'll instantiate some lists to keep track of training and test loss and accuracy over time. In the loop inside this function, we'll grab a...
def train(train_ds, test_ds, hp): m = mlp_model((28 * 28,)) opt = tf.train.MomentumOptimizer(hp.learning_rate, 0.9) train_losses = [] train_losses = autograph.utils.set_element_type(train_losses, tf.float32) test_losses = [] test_losses = autograph.utils.set_element_type(test_losses, tf.float32) train_acc...
tensorflow/contrib/autograph/examples/notebooks/dev_summit_2018_demo.ipynb
allenlavoie/tensorflow
apache-2.0
Next, we set up the RNNColobot model, which is very similar to the one we used in the main exercise. Autograph doesn't fully support classes yet (but it will soon!), so we'll write the model using simple functions.
def model_components(): lower_cell = tf.contrib.rnn.LSTMBlockCell(256) lower_cell.build(tf.TensorShape((None, 256))) upper_cell = tf.contrib.rnn.LSTMBlockCell(128) upper_cell.build(tf.TensorShape((None, 256))) relu_layer = tf.layers.Dense(3, activation=tf.nn.relu) relu_layer.build(tf.TensorShape((None, 128)...
tensorflow/contrib/autograph/examples/notebooks/dev_summit_2018_demo.ipynb
allenlavoie/tensorflow
apache-2.0
We'll create copies of the point and line reflected in the circle, using $X = C\hat X\tilde C$, where $\hat X$ is the grade involution.
point_refl = circle * point.gradeInvol() * ~circle line_refl = circle * line.gradeInvol() * ~circle
docs/tutorials/cga/visualization-tools.ipynb
arsenovic/clifford
bsd-3-clause
pyganja pyganja is a python interface to the ganja.js (github) library. To use it, typically we need to import two names from the library:
from pyganja import GanjaScene, draw import pyganja; pyganja.__version__
docs/tutorials/cga/visualization-tools.ipynb
arsenovic/clifford
bsd-3-clause
GanjaScene lets us build scenes out of geometric objects, with attached labels and RGB colors:
sc = GanjaScene() sc.add_object(point, color=(255, 0, 0), label='point') sc.add_object(line, color=(0, 255, 0), label='line') sc.add_object(circle, color=(0, 0, 255), label='circle') sc_refl = GanjaScene() sc_refl.add_object(point_refl, color=(128, 0, 0), label='point_refl') sc_refl.add_object(line_refl, color=(0, 128...
docs/tutorials/cga/visualization-tools.ipynb
arsenovic/clifford
bsd-3-clause
Once we've built our scene, we can draw it, specifying a scale (which here we use to zoom out), and the signature of our algebra (which defaults to conformal 3D):
draw(sc, sig=layout.sig, scale=0.5)
docs/tutorials/cga/visualization-tools.ipynb
arsenovic/clifford
bsd-3-clause