francesco215 / requirements_for_self-organization_video Goto Github PK
View Code? Open in Web Editor NEWthis is the repository for the video for the paper https://francesco215.github.io/Language_CA/
this is the repository for the video for the paper https://francesco215.github.io/Language_CA/
We need an animation that draws lots of circles in a snake pattern like the one of the website
As usual each node can have two possible values (0 or 1), so they can have two colors WHITE
or BLACK
, and we also need a function that animates the color changes. Maybe we can just reuse the update_fill
function already present in the code
Each circle will be connected by a segment with the color=hamiltonian_color
i'd say that is better to put the code in a separate python file inside the project folder
In the website code i wrote a function that returns the realtive position in a
I don't know how deep i have to go into the explanation of this function, but printing the output a couple of times should be enough. if you need any clarifiaction you can always ask
function Serpentine(i, nSH) {
//nSH represents the variable numSpinsHorizontal
if (i<nSH) return [i, 0]
if (i==nSH) return [nSH-1, 1]
if (i<=2*nSH) return [2*nSH-i, 2]
if (i==2*nSH+1) return [0,3]
let recursive=Serpentine(i%(2*(nSH+1)),nSH);
recursive[1]+=4*Math.floor(i/(2*nSH+2));
return recursive
}
Start with the sequence described in #8
We need a function roll_chain
that rolls all the elements of the sequence
Ok i said there could be the need for an extra animation, and there is
We need a function that plots a network with manim called something like plot_network(nodes, edges)
and it will show something like this
The main difference with the image is that the nodes
can have two possible values (0 or 1), so they can have two colors WHITE
or BLACK
, and we also need a function that animates the color changes. Maybe we can just reuse the update_fill
function already present in the code
The edges will be an small_world
function
The edges can all have the same color hamiltonian_color
There are several ways to choose the positions of the nodes, the easiest one would be to choose them at random inside the frame.
However there are some ploblems with this method (like nodes overlapping and the entire thing looking very garbled), so there are more advanced tecniques of plotting graphs, so look into those, there should be some premade python function out there
Manim has a Graph
mobject class, might be wise to look into it
You start with a text generated from the tokenize
function defined in #7
then each token is turned into a variable name
(something similar to this, but with circles instead of squares and colored)
write a function tokenization(text)
that colors the text
The way it colors the text is explained in this link
For our visualization purpuses the function tokenization takes a list of strings text
where each element in the text is a token.
For example in the image above the input text
will be ['Many',' words',' map',' to',' one',' token',...]
there will also be a list of colors that will be used to color the text. The i
-th token will be colored with the color colors[i%len(colors)]
It will return 2 animations:
If you prefer you can make two function (one for each animation)
Start with a system as specified in #10
Write a function that implements an animation that highlight a set of links.
By highighting i mean a combination of this three features:
the highlited link can be also just one of them, probably one way of doing it would be like defining a function highlight_links(links)
, and the links
variable is a list of tuples like [(1,2),(6,8),(6,1)]
. In this particular case the connection between the indices 1
and 2
, 6
and 8
and 6
and 1
will be highlited, all the others will be dimmed down
Start with a system as specified in #9
Make and animation that draws all the lines connecting each couple of elements.
each line connecting the node line[i][j]
.
The color of each line will be determined by mapping its value with a color map like the ones from matplotlib
I'm bringing up matplotlib because i'm not sure if you can use a colormap in manim. I did a quick search but the stuff i found is a bit ambigous...
If you can't use a colormap in manim it means that you probably will have to use matplotlib in all of the other animations related to this one (#7, #8 and #9). Btw, i found a cool tutorial to get started with matplotlib
If you can use a colormap in Manim, great! it means you can do as you please
As of now the 2D grid is shaped in such a way that it fits inside the window size.
However, we need an animation that looks at the system from further away
Something similar to this video
Make sure it supports the feature in #2
here in the video i zoom out and then change color of one square, and then draw the boundaries.
as you can see the grid['squares']
refer to the squares before doing the zooming out via the function zoom_out
the code is in the spin_grid.py
file and goes at follows:
#zooming out
self.play(*zoom_out(grid,scale=.7), run_time=5)
#here the color is changed in the square as if it was never zoomed out
animation=grid['squares'][73].animate.set_color(RED)
self.play(animation)
#here the boundaries are drawn as if the grid never zoomed out
self.play(*add_boundaries(grid))
In the current representation, the boundary delineating opposing spins in the 2D Ising model is constructed by animating the drawing of individual segments in an independent manner.
Instead of isolating each segment, consider a method where the boundary is drawn by tracing around the collective path formed by opposing spins.
If two domains meet at just one corner split the two domains like in the image below
a useful example you might want to look at is the one where a point draws a trace
Not sure if this is needed as a separate issue...
Anyway, the idea is to do the reverse animation of #9
we need a function draw_arrows_for_chain()
that returns an animation that draws arrows connecting different circles
the function draw_arrows_for_chain(links)
has as argument links
that is an array that specifies where the arrow start from and where they go (similar to how you did the functions that connect the circles for the animation below)
make sure it's compatible with the code for issue #13
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.