-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.py
31 lines (23 loc) · 1.2 KB
/
config.py
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
import json
import math
import pickle
import os
import pyroprinting
def loadConfig():
with open("clusterConfig.json", mode='r') as clusterConfigJson:
return Config(clusterConfigJson)
regionsPickleFileName = "regions.pickle"
class Config:
def __init__(self, clusterConfigJson):
decoded = json.load(clusterConfigJson)
self.regions = [pyroprinting.Region.fromDecodedJSON(decodedRegion) for decodedRegion in decoded["regions"]]
# self.threshold = decoded["threshold"]
# self.radii = {region: math.sqrt(2*region.dispCount * (1 - self.threshold)) for region in self.regions}
# self.radii = {region: pyroprinting.distFromPearson(self.threshold, region.dispCount) for region in self.regions}
# print(self.threshold, tuple((region.name, radius) for region, radius in self.radii.items()))
self.radii = {region: pyroprinting.distFromPearson(region.clusterThreshold, region.dispCount) for region in self.regions}
# print(tuple((region.name, region.clusterThreshold, radius) for region, radius in self.radii.items()))
self.minNeighbors = decoded["minNeighbors"]
self.pointsPerLeaf = decoded["pointsPerLeaf"]
self.dimsPerSplit = decoded["dimsPerSplit"]
self.isolateSubsetSize = decoded["isolateSubsetSize"]