SusiePHaltmann commited on
Commit
bcc480e
·
1 Parent(s): 687e493

Request. to upload 5.31.22 10:56 FST

Browse files
Files changed (1) hide show
  1. app.py +11 -31
app.py CHANGED
@@ -1,39 +1,19 @@
1
- import streamlit as st
2
 
3
- @st.cache
4
  import sys
5
- if len(sys.argv) != 2:
6
- print("Please provide a filename")
7
- sys.exit(1)
8
-
9
- filename = sys.argv[1]
10
-
11
- # Your code goes here
12
-
13
-
14
- if __name__ == "__main__":
15
- main()
16
- def load_model():
17
- model = Megatron()
18
- return model
19
-
20
- @st.cache(allow_output_mutation=True) # this line is important!
21
- def generate_tileset(model, seed):
22
- tileset = model.generate_tileset(seed) # this will take some time to run the first time, but will be cached thereafter
23
-
24
- return tileset
25
 
26
- @st.cache(allow_output_mutation=True)
27
- def load_tileset():
28
- tileset = Image.open('nsmbwii_tileset.png')
29
- return tileset
30
 
31
- def main():
 
32
 
33
- st.title('NSMBWII Tileset Generator')
34
 
35
- input_tileset = load_tileset()
36
 
37
- st.image(input_tileset, caption='Input Tileset', use_column_width=True)
38
 
39
- tile_size = st.slider('Tile Size', min_value=8, max
 
 
 
1
 
 
2
  import sys
3
+ import streamlit as st
4
+ from HaltmannDiffusionv0 Copied import *
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
 
6
+ st.title("Haltmannn Diffusion")
7
+ st.markdown("This app simulates the diffusion of particles in a 2D square lattice with periodic boundary conditions, using the Haltmannn algorithm.")
 
 
8
 
9
+ L = st.slider("Lattice size", 2, 200, 10) #size of the lattice (number of sites on each side) -> must be even!
10
+ N = st.slider("Number of particles", 1, L**2/2, 10) #number of particles -> can't be more than L**2/4! (otherwise there's not enough room for them all!)
11
 
12
+ #initialize the system: create a list of 'particle' objects, each with random position and velocity vectors:
13
 
14
+ particles = [Particle(np.random.randint(0, L), np.random.randint(0, L), np.random.uniform(-1., 1.), np.random.uniform(-1., 1.)) for i in range(N)]
15
 
16
+ #set up the plot:
17
 
18
+ fig = plt.figure() #create a figure object
19
+ ax = fig