Compare commits
6 Commits
818a403bf9
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 9361af1635 | |||
| b75a427aad | |||
| 847305ae29 | |||
| c7d24cb61b | |||
| a7cc19c1f9 | |||
| ffb9f743c8 |
4
.gitignore
vendored
Normal file
4
.gitignore
vendored
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
*.DS_Store
|
||||||
|
*.pyc
|
||||||
|
*.egg-info/
|
||||||
|
*__pycache__/
|
||||||
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)
|
||||||
@@ -10,4 +10,4 @@ requires-python = ">=3.10"
|
|||||||
dependencies = []
|
dependencies = []
|
||||||
|
|
||||||
[tool.setuptools.packages.find]
|
[tool.setuptools.packages.find]
|
||||||
where = ["src"]
|
where = ["."]
|
||||||
|
|||||||
Reference in New Issue
Block a user