Compare commits
3 Commits
a7cc19c1f9
...
b75a427aad
| Author | SHA1 | Date | |
|---|---|---|---|
| b75a427aad | |||
| 847305ae29 | |||
| c7d24cb61b |
10
README.md
10
README.md
@@ -0,0 +1,10 @@
|
||||
# Particle Cloud
|
||||
|
||||
A sample library created for students of [Diller Digital's](https://dillerdigital.com) _Software Engineering in the Age of AI_ class.
|
||||
|
||||
**Class Date**
|
||||
|
||||
15 June 2026
|
||||
|
||||
**Students in Attendance**
|
||||
-
|
||||
46
particlecloud/util.py
Normal file
46
particlecloud/util.py
Normal file
@@ -0,0 +1,46 @@
|
||||
import random
|
||||
import sys
|
||||
|
||||
import numpy as np
|
||||
|
||||
|
||||
FILE_COLUMN_NAMES = [
|
||||
"n", "m", "v1", "v2", "v3", "p1", "p2", "p3",
|
||||
]
|
||||
|
||||
|
||||
def write_data_file(filename, n=20, missing_values=False):
|
||||
"""Write a csv file with data
|
||||
"""
|
||||
|
||||
with open(filename, "w") as fp:
|
||||
fp.write(", ".join(FILE_COLUMN_NAMES) + ",\n")
|
||||
for i in range(n):
|
||||
vals = []
|
||||
vals.append(random.gauss(3., 0.5))
|
||||
vals.extend(
|
||||
(
|
||||
random.gauss(0., 25),
|
||||
random.gauss(0., 25),
|
||||
random.gauss(0., 25),
|
||||
)
|
||||
)
|
||||
vals.extend(
|
||||
(
|
||||
random.gauss(0., 1.5),
|
||||
random.gauss(0., 1.5),
|
||||
random.gauss(0., 1.5),
|
||||
)
|
||||
)
|
||||
if missing_values:
|
||||
if random.randint(0,10) < 1:
|
||||
idx = random.randint(1, len(vals))
|
||||
vals[idx] = np.nan
|
||||
line = f"{i}, " + ", ".join(f"{v:7.5f}" for v in vals) + ",\n"
|
||||
fp.write(line)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
missing_values = sys.argv[-1] == '-m'
|
||||
|
||||
write_data_file("sample_data.csv", n=20, missing_values=True)
|
||||
Reference in New Issue
Block a user