queso-cluster 0.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. queso_cluster-0.0.0/LICENSE +0 -0
  2. queso_cluster-0.0.0/PKG-INFO +36 -0
  3. queso_cluster-0.0.0/README.md +3 -0
  4. queso_cluster-0.0.0/pyproject.toml +49 -0
  5. queso_cluster-0.0.0/queso_cluster/addon/aia.py +103 -0
  6. queso_cluster-0.0.0/queso_cluster/addon/logg.py +66 -0
  7. queso_cluster-0.0.0/queso_cluster/addon/multiline.py +5 -0
  8. queso_cluster-0.0.0/queso_cluster/addon/prep.py +36 -0
  9. queso_cluster-0.0.0/queso_cluster/addon/products.py +403 -0
  10. queso_cluster-0.0.0/queso_cluster/addon/style.py +185 -0
  11. queso_cluster-0.0.0/queso_cluster/atoms/aux.py +170 -0
  12. queso_cluster-0.0.0/queso_cluster/atoms/base.py +395 -0
  13. queso_cluster-0.0.0/queso_cluster/atoms/mask.py +29 -0
  14. queso_cluster-0.0.0/queso_cluster/atoms/norm.py +38 -0
  15. queso_cluster-0.0.0/queso_cluster/atoms/scores.py +212 -0
  16. queso_cluster-0.0.0/queso_cluster/base.py +283 -0
  17. queso_cluster-0.0.0/queso_cluster/loaders/event.py +108 -0
  18. queso_cluster-0.0.0/queso_cluster/loaders/fiss.py +50 -0
  19. queso_cluster-0.0.0/queso_cluster/loaders/iris.py +13 -0
  20. queso_cluster-0.0.0/queso_cluster/loaders/visp.py +103 -0
  21. queso_cluster-0.0.0/queso_cluster/runners/base.py +169 -0
  22. queso_cluster-0.0.0/queso_cluster/td.py +137 -0
  23. queso_cluster-0.0.0/queso_cluster/ti.py +86 -0
  24. queso_cluster-0.0.0/queso_cluster/writer.py +67 -0
  25. queso_cluster-0.0.0/queso_cluster.egg-info/PKG-INFO +36 -0
  26. queso_cluster-0.0.0/queso_cluster.egg-info/SOURCES.txt +32 -0
  27. queso_cluster-0.0.0/queso_cluster.egg-info/dependency_links.txt +1 -0
  28. queso_cluster-0.0.0/queso_cluster.egg-info/requires.txt +10 -0
  29. queso_cluster-0.0.0/queso_cluster.egg-info/top_level.txt +2 -0
  30. queso_cluster-0.0.0/setup.cfg +4 -0
  31. queso_cluster-0.0.0/setup.py +24 -0
  32. queso_cluster-0.0.0/tests/epoch.py +105 -0
  33. queso_cluster-0.0.0/tests/evo.py +101 -0
  34. queso_cluster-0.0.0/tests/main.py +314 -0
File without changes
@@ -0,0 +1,36 @@
1
+ Metadata-Version: 2.4
2
+ Name: queso-cluster
3
+ Version: 0.0.0
4
+ Summary: Quantifying the Evolution of Spectra with Optimization
5
+ Home-page: https://queso.sriley.dev
6
+ Author: Sarah Olivia Riley
7
+ Author-email: Sarah Riley <sarah.riley1@montana.edu>
8
+ Maintainer-email: Sarah Riley <sarah.riley1@montana.edu>
9
+ Project-URL: Homepage, https://queso.sriley.dev
10
+ Project-URL: Documentation, https://queso.sriley.dev
11
+ Project-URL: Repository, https://github.com/SharkSorceress/queso-cluster
12
+ Classifier: Development Status :: 2 - Pre-Alpha
13
+ Classifier: Intended Audience :: Science/Research
14
+ Classifier: Natural Language :: English
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Topic :: Scientific/Engineering :: Astronomy
17
+ Requires-Python: >=3.9
18
+ Description-Content-Type: text/markdown
19
+ License-File: LICENSE
20
+ Requires-Dist: numpy>=1.25
21
+ Requires-Dist: dkist
22
+ Requires-Dist: scipy
23
+ Requires-Dist: numba
24
+ Requires-Dist: astropy
25
+ Requires-Dist: numba_progress
26
+ Requires-Dist: dask
27
+ Requires-Dist: pyyaml
28
+ Requires-Dist: tol-colors
29
+ Requires-Dist: pint
30
+ Dynamic: author
31
+ Dynamic: home-page
32
+ Dynamic: license-file
33
+
34
+ # Quantifying the Evolution of Spectra with Optimization (QuESO)
35
+ **Author:** Sarah Olivia Riley (Montana State University)
36
+
@@ -0,0 +1,3 @@
1
+ # Quantifying the Evolution of Spectra with Optimization (QuESO)
2
+ **Author:** Sarah Olivia Riley (Montana State University)
3
+
@@ -0,0 +1,49 @@
1
+ [build-system]
2
+ requires = ["setuptools", "wheel"]
3
+
4
+ [project]
5
+ name = "queso-cluster"
6
+ version = "0.0.0"
7
+ authors = [
8
+ {name = "Sarah Riley", email="sarah.riley1@montana.edu"}
9
+ ]
10
+
11
+ maintainers = [
12
+ {name = "Sarah Riley", email="sarah.riley1@montana.edu"}
13
+ ]
14
+
15
+ description = "Quantifying the Evolution of Spectra with Optimization"
16
+ readme = "README.md"
17
+ requires-python=">=3.9"
18
+
19
+ dependencies = [
20
+ "numpy>=1.25",
21
+ "dkist",
22
+ "scipy",
23
+ "numba",
24
+ "astropy",
25
+ "numba_progress",
26
+ "dask",
27
+ "pyyaml",
28
+ "tol-colors",
29
+ "pint"
30
+ ]
31
+
32
+ classifiers = [
33
+ # How mature is this project? Common values are
34
+ # 1 - Planning
35
+ # 2 - Pre-Alpha
36
+ # 3 - Alpha
37
+ # 4 - Beta
38
+ # 5 - Production/Stable
39
+ "Development Status :: 2 - Pre-Alpha",
40
+ "Intended Audience :: Science/Research",
41
+ "Natural Language :: English",
42
+ "Programming Language :: Python :: 3.11",
43
+ "Topic :: Scientific/Engineering :: Astronomy",
44
+ ]
45
+
46
+ [project.urls]
47
+ Homepage = "https://queso.sriley.dev"
48
+ Documentation = "https://queso.sriley.dev"
49
+ Repository = "https://github.com/SharkSorceress/queso-cluster"
@@ -0,0 +1,103 @@
1
+ #> file: ./QuESO/addon/aia
2
+ #> lang: python
3
+ #> synopsis:
4
+ #> author: <>
5
+
6
+ from scipy.io import readsav
7
+ import numpy as np
8
+
9
+ from .logg import loggTimer
10
+
11
+
12
+ @loggTimer
13
+ def delayAIA(fname, epochDev):
14
+ #> detail:
15
+ #> param type fname:
16
+ #> param type epochDev:
17
+ #> return (type):
18
+ #> test-method:
19
+
20
+ eD = epochDev
21
+ print(eD.shape)
22
+ print(fname)
23
+ jq_delayCube = readsav(fname)
24
+
25
+ #jq_delayCube['arr'][0] --> background of pixel
26
+ #jq_delayCube['arr'][1] --> background noise of pixel (standard deviation)
27
+ #jq_delayCube['arr'][2] --> AIA brightness at ViSP slit time
28
+ #jq_delayCube['arr'][3] --> time of the ViSP slit
29
+ #jq_delayCube['arr'][4] --> xpos
30
+ #jq_delayCube['arr'][5] --> ypos
31
+ #jq_delayCube['arr'][6] --> brightness of peak (before ViSP time)
32
+ #jq_delayCube['arr'][7] --> time of peak before ViSP time
33
+ #jq_delayCube['arr'][8] --> brightness of peak (after ViSP time)
34
+ #jq_delayCube['arr'][9] --> time of peak after ViSP time
35
+
36
+
37
+ jq_AIAFrame = np.zeros((514, 295)) + np.nan
38
+ #momentFrame = np.zeros(len(jq_delayCube['arr'][:, 4])) + np.nan
39
+
40
+ #moment_compare = eD.dataSquare[:, eD.spectralWindow[0]:eD.spectralWindow[1]].mean(axis=-1).reshape(eD.shape[0], eD.shape[1])
41
+
42
+ #aia_correct = lambda x: x.reshape((295, 514)).T.reshape(514*295)
43
+ correct = lambda x: x.reshape(eD.shape[1], eD.shape[0]).T.reshape(eD.shape[0]*eD.shape[1])
44
+
45
+ jq_AIAMask = np.zeros(jq_AIAFrame.shape) + np.nan
46
+ jq_indxMap = np.zeros(jq_AIAFrame.shape) + np.nan
47
+ jq_AIABright = np.zeros(jq_AIAFrame.shape) + np.nan
48
+
49
+ #print([0.01937, eD.deltas['pxlAlongSlit']])
50
+ #print([0.21420, eD.deltas['pxlSlitWidth']])
51
+
52
+ dy = 0.01937
53
+ dx = 0.214167
54
+
55
+
56
+ for i in range(len(jq_delayCube['arr'][:, 4])):
57
+ xx = int(np.floor(jq_delayCube['arr'][int(i), 4]*dx*6))
58
+ yy = int(np.floor(jq_delayCube['arr'][int(i), 5]*dy*6))
59
+
60
+ if jq_delayCube['arr'][i, 7] > 0:
61
+ jq_AIAFrame[xx, yy] = jq_delayCube['arr'][i, 3] - jq_delayCube['arr'][i, 7]
62
+ jq_AIAMask[xx, yy] = 1
63
+
64
+ jq_AIABright[xx, yy] = jq_delayCube['arr'][i, 2]
65
+ if jq_delayCube['arr'][i, 9] > 0:
66
+ jq_AIAFrame[xx, yy] = jq_delayCube['arr'][i, 3] - jq_delayCube['arr'][i, 9]
67
+ jq_AIAMask[xx, yy] = 1
68
+
69
+ jq_AIABright[xx, yy] = jq_delayCube['arr'][i, 2]
70
+
71
+ jq_indxMap[xx, yy] = i
72
+
73
+
74
+ visp_jqDelayFrame = np.zeros(eD.dataSquare.shape[0]) + np.nan
75
+ visp_jqMaskFrame = np.zeros(eD.dataSquare.shape[0]) + np.nan
76
+ visp_aiaIndx = np.zeros(eD.dataSquare.shape[0]) + np.nan
77
+ visp_aiaBright = np.zeros(eD.dataSquare.shape[0]) + np.nan
78
+ for i in range(eD.dataSquare.shape[0]):
79
+ yy = int(np.floor((i / eD.shape[0])*dy*6))
80
+ xx = int(np.floor(np.mod(i, eD.shape[0])*dx*6))
81
+
82
+ if ~(np.isnan(jq_AIAMask[xx, yy])):
83
+ visp_jqMaskFrame[i] = jq_AIAMask[xx, yy]
84
+ visp_aiaIndx[i] = jq_indxMap[xx, yy]
85
+ visp_aiaBright[i] = jq_AIABright[xx, yy]
86
+ visp_jqDelayFrame[i] = jq_AIAFrame[xx, yy]
87
+
88
+ delayCube = correct(visp_jqDelayFrame)/60.#)/60.
89
+ aiaATvisp = correct(visp_aiaBright)
90
+ aiaIndxMap = correct(visp_aiaIndx)
91
+
92
+ mask_map = np.zeros(delayCube.shape)
93
+ mask_map[np.where(~np.isnan(delayCube))] = 1
94
+
95
+ import matplotlib.pyplot as plt
96
+ fig = plt.figure(layout='constrained', figsize=(10, 5), dpi=300)
97
+ ax = fig.add_subplot(111)
98
+
99
+ ax.imshow(mask_map.reshape(eD.shape[0], eD.shape[1]).T, cmap='Greys_r', origin='lower', extent=[0, eD.shape[0]*dx, 0, eD.shape[1]*dy])
100
+ fig.savefig("./maskTest.png")
101
+ plt.close()
102
+
103
+ return(delayCube, aiaATvisp, aiaIndxMap, mask_map.astype(bool))
@@ -0,0 +1,66 @@
1
+ #> file: ./QuESO/addon/logg
2
+ #> lang: python
3
+ #> synopsis:
4
+ #> author: <>
5
+ import logging
6
+ import timeit
7
+
8
+ logger = logging.getLogger("queso_cluster")
9
+ logger.addHandler(logging.NullHandler())
10
+
11
+ def loggTimer(func):
12
+ #> detail:
13
+ #> param type func:
14
+ #> return (type):
15
+ #> test-method:
16
+ def wrapper(*args, **kwargs):
17
+ __log__ = logg("start", val="{}".format(func.__name__))
18
+ value = func(*args, **kwargs)
19
+ logg("stop", _log=__log__)
20
+ return(value)
21
+ return(wrapper)
22
+
23
+
24
+ def logg(tag, val=None, _time=None, _log=None):
25
+ #> detail:
26
+ #> param type tag:
27
+ #> param type [None] val:
28
+ #> param type [None] _time:
29
+ #> param type [None] _log:
30
+ #> return (type):
31
+ #> test-method:
32
+ ptag = '[' + tag.upper() + '\t]'
33
+ if _log is not None:
34
+ val, _time = _log
35
+ if _time is not None:
36
+ dur = timeit.default_timer() - _time
37
+ match tag:
38
+ case 'aloha':
39
+ if _log is not None:
40
+ log_str = ptag + '[' + duration_string(dur) + ']'
41
+ else:
42
+ #print(ptag + 'DURATION\tMESSAGES\tRUNNERS')
43
+ logger.info(ptag)
44
+ return(None, timeit.default_timer())
45
+ case 'start':
46
+ log_str = ptag + '\t\t' + val.upper()
47
+ logger.info(log_str)
48
+ return(val.upper(), timeit.default_timer())
49
+ case 'stop':
50
+ log_str = ptag + '[' + duration_string(dur) + ']\t' + val.upper()
51
+ case 'msg':
52
+ log_str = ptag + '\t\t' + val.upper()
53
+ case 'warn':
54
+ logger.warning(val.upper())
55
+ return None
56
+ case 'error':
57
+ logger.error(val.upper())
58
+ return None
59
+ logger.info(log_str)
60
+
61
+ def duration_string(dur):
62
+ #> detail:
63
+ #> param type dur:
64
+ #> return (type):
65
+ #> test-method:
66
+ return("{:02d}h {:02d}m {:02d}s".format(int(dur/3600), int(int(dur/60) % 60), int(dur % 60)))
@@ -0,0 +1,5 @@
1
+ #> file: ./QuESO/addon/multiline
2
+ #> lang: python
3
+ #> synopsis:
4
+ #> author: <>
5
+
@@ -0,0 +1,36 @@
1
+ import matplotlib as mpl
2
+ import matplotlib.pyplot as plt
3
+ import numpy as np
4
+
5
+ from . import style as sty
6
+ def figureBackup01(analysisObj, dataSquare=None):
7
+ ii, jj = analysisObj.spectralWindow
8
+ if dataSquare is None:
9
+ dataSquare = analysisObj.dataSquare
10
+
11
+ moment0_integrated = dataSquare[:, ii:jj+1].mean(axis=-1).compute()
12
+ print(moment0_integrated.shape)
13
+ moment0_continuum = dataSquare[:, analysisObj.continuum].compute()
14
+ print(moment0_continuum.shape)
15
+
16
+ i0_layerCount = len(analysisObj.clusterConfig['intrinsic'])
17
+
18
+ fig = plt.figure(layout='constrained', figsize=(5*i0_layerCount, 5), dpi=300)
19
+
20
+ moment0 = {'window': moment0_integrated, 'continuum': moment0_continuum}
21
+ binWidth = {'window': 0.01, 'continuum': 0.01}
22
+
23
+ for i in range(i0_layerCount):
24
+ label = analysisObj.config.clusterConfig['intrinsic'][i]['label']
25
+ bins = analysisObj.config.clusterConfig['intrinsic'][i]['layerConfig']['bins']
26
+
27
+ ax = fig.add_subplot(1, i0_layerCount, i+1)
28
+ histBins = np.arange(0, np.ceil(np.nanmax(moment0[label])*10)/10, step=binWidth[label])
29
+ ax.hist(moment0[label], bins=histBins, range=histBins, rwidth=1, fill=False, histtype='step', color='black')
30
+ _, color_pallet = sty._genColorPallet(len(np.diff(bins)))
31
+
32
+ for j in range(len(bins)-2):
33
+ ax.axvline(x = bins[j+1] , color=mpl.colors.rgb2hex(color_pallet[j+1]))
34
+
35
+
36
+ return(fig)