-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathballsurface.py
More file actions
77 lines (53 loc) · 1.52 KB
/
Copy pathballsurface.py
File metadata and controls
77 lines (53 loc) · 1.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
"""Setup script for ball_surface"""
import polars as pl
from pathlib import Path
import matplotlib.pyplot as plt
import os
import sys
from python_scripts.utils.file_io import display, get_config
# Parse inputs and create folders etc.
config, particle_filepath, object_filepath = get_config(objects=True)
box = config["sim_box_size"]
root_path = Path.cwd()
#----------------------------------------------------------------------------------
# Particles
#----------------------------------------------------------------------------------
print(particle_filepath)
base_particle = {
"t": 0.0,
"id": 0,
"ptype": 0,
"x" : 0.022,
"y" : 0.005,
"z" : 0.005,
"vx" : 0.0,
"vy" : 0.0,
"vz" : 0.0,
"wx" : 0.0,
"wy" : 0.0,
"wz" : 0.0,
"radius" : 0.005,
"mass" : 5.2E-4,#density 1000kgm^-3
"inertia": 0.0,
"r": 255.0,
"g": 255.0,
"b" : 0.0,
"a" : 255.0,
}
particle2 = base_particle.copy()
particle2["z"] = 0.045
particle2["id"] = 0
particle2["ptype"] = 0
df = pl.DataFrame(particle2)
df = df.with_columns(
pl.col("id").cast(pl.UInt64),
pl.col("ptype").cast(pl.UInt64)
)
df.write_parquet(particle_filepath)
#--------------------------------------------------------------------------------------------
# Objects
#--------------------------------------------------------------------------------------------
rectangle = []
df.write_parquet(object_filepath)
print(df)
display(df, box)