Compare commits

...

4 Commits

Author SHA1 Message Date
9361af1635 ignore pycaches 2026-05-15 12:48:09 -05:00
b75a427aad simplify the function to create particles
goal is to leave lots of room for student improvements
in class.

also, introduce missingness in the data
2026-05-15 09:38:04 -05:00
847305ae29 Add initial content to the README 2026-05-13 16:36:59 -05:00
c7d24cb61b sample data generator 2026-05-13 16:01:37 -05:00
3 changed files with 57 additions and 0 deletions

1
.gitignore vendored
View File

@@ -1,3 +1,4 @@
*.DS_Store *.DS_Store
*.pyc *.pyc
*.egg-info/ *.egg-info/
*__pycache__/

View File

@@ -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
View 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)