-
Notifications
You must be signed in to change notification settings - Fork 7
/
demo.py
136 lines (116 loc) · 6.41 KB
/
demo.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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
'''
PyCIS - Python Computational Inference from Structure
demo_new.py: Main interface to PyCIS, with examples
Benjamin Feuge-Miller: [email protected]
The University of Texas at Austin,
Oden Institute Computational Astronautical Sciences and Technologies (CAST) group
*Date of Modification: December 17, 2021
**NOTICE: For acknowledgements, copyright, licensing see 'notices' in README
'''
## IMPORT NECESSARY LIBRARIES
import faulthandler; faulthandler.enable()
import os
import time
from pylib.main_pipe import run_pycis
def astrianavstardemo():
''' Demo of GEO navstar observation, tighter angular tolerance for detection '''
#SPECIFY DATA INPUT AND FOLDERS
satfolder='data' #folder of all data
satlist = ['20201224_26407_navstar-48',] #folder of test data
datatype='fits' #test data suffix
imgfolder='results_NavstarDemo' #where to store results
framerange = [-1,18] #frames of test data to use, default all [-1,-1]
imscale = 1 #scale of test data to import (crop precentage)
numsteps = 5 #number of partitioning parallelization steps (numsteps-x-numsteps partitioning)
#PRINTING OPTIONS
printonly = 0 #flag to only print input data and exit (initial visualization)
makeimg = 1 #flag to print still images
makegif = 1 #flag to print animations
printcluster=0 #flag to print 2nd order clustering
vs = 0.25 #scale of printing (precentage)
fps=5 #fps of animation .gif
#PIPELINE FLOW OPTIONS
solvemarkov=0 #flag solve local markov kernels or assume global uniformity
resolve=0 #flag to enable/disable resolving of 1st-order line detections
cluster = 2 #flag to disable(0)/ resolve (1)/ or use existing (2) 2nd-order clustering
solveastro=0 #flag to disable(0)/ resolve (1)/ or use existing (2) astrometry solution
imgastro=1 #flag to use image data in ranking star values (1) or rank by NFA (0)
tle=[] #optional TLE to use, if present generates an 'expected track' for precision-recall analysis
#HYPERPARAMETERS
a=0.0 #gradient kernel for 1st-order line detection. 3x3 sobel kernel (0) or radius of GR kernel.
t=1.3 #tightening factor for 1st-order angular tolerance (threshold tau/t)
median = 0 #flag to subtract the median value of each pixel, e.g. to remove hot pixels
binfactor=1 #integer binning factor
#OTHER PARAMETERS
e2 = 0 #meaninfulness threshold of clustering algorithm, used in precision- recall analysis
shift=0 #artifical suppression of tracking error by shifting FITS frames
#RUN PYCIS
tlist = [] #record runtime for multiple hyperparameter options
for dummy_parameter in [0,]: #may iterate over several hyperparameter options
imgname = 'a%dt%dm%db%d'%(a,int(t*10),median,binfactor) #image name to save, listing hyperparameter options
linename = '%s_e%d'%(imgname,int(e2*100)) #For PR analysis, can fix 1st-order detections and redo clustering for e2 options
stime = time.time()
run_pycis(
satfolder,satlist,datatype,numsteps,
imgfolder,imgname,vs,makegif,printcluster,
solvemarkov,resolve,printonly,
imscale,framerange,a,t,median,shift,e2=e2,makeimg=makeimg,
linename=linename,binfactor=binfactor,fps=fps,tle=tle,
imgastro=imgastro,cluster=cluster,solveastro=solveastro)
tlist.append(time.time() - stime)
print('TIME:')
print(tlist)
def astriademo():
''' Demo of LEO starlink observation, binning and median subtraction '''
#SPECIFY DATA INPUT AND FOLDERS
satfolder='data' #folder of all data
satlist = ['20201220_45696_starlink-1422',] #folder of test data
datatype='fits' #test data suffix
imgfolder='results_StarlinkDemo' #where to store results
framerange = [8,33] #frames of test data to use, default all [-1,-1]
imscale = 1 #scale of test data to import (crop precentage)
numsteps = 5 #number of partitioning parallelization steps (numsteps-x-numsteps partitioning)
#PRINTING OPTIONS
printonly = 0 #flag to only print input data and exit (initial visualization)
makeimg = 1 #flag to print still images
makegif = 1 #flag to print animations
printcluster=0 #flag to print 2nd order clustering
vs = 0.25 #scale of printing (precentage)
fps=5 #fps of animation .gif
#PIPELINE FLOW OPTIONS
solvemarkov=0 #flag solve local markov kernels or assume global uniformity
resolve=0 #flag to enable/disable resolving of 1st-order line detections
cluster = 2 #flag to disable(0)/ resolve (1)/ or use existing (2) 2nd-order clustering
solveastro=0 #flag to disable(0)/ resolve (1)/ or use existing (2) astrometry solution
imgastro=1 #flag to use image data in ranking star values (1) or rank by NFA (0)
tle=[] #optional TLE to use, if present generates an 'expected track' for precision-recall analysis
#HYPERPARAMETERS
a=0.0 #gradient kernel for 1st-order line detection. 3x3 sobel kernel (0) or radius of GR kernel.
t=1.0 #tightening factor for 1st-order angular tolerance (threshold tau/t)
median = 1 #flag to subtract the median value of each pixel, e.g. to remove hot pixels
binfactor=2 #integer binning factor
#OTHER PARAMETERS
e2 = 0 #meaninfulness threshold of clustering algorithm, used in precision- recall analysis
shift=0 #artifical suppression of tracking error by shifting FITS frames
#RUN PYCIS
tlist = [] #record runtime for multiple hyperparameter options
for dummy_parameter in [0,]: #may iterate over several hyperparameter options
imgname = 'a%dt%dm%db%d'%(a,int(t*10),median,binfactor) #image name to save, listing hyperparameter options
linename = '%s_e%d'%(imgname,int(e2*100)) #For PR analysis, can fix 1st-order detections and redo clustering for e2 options
stime = time.time()
run_pycis(
satfolder,satlist,datatype,numsteps,
imgfolder,imgname,vs*float(binfactor),makegif,printcluster,
solvemarkov,resolve,printonly,
imscale,framerange,a,t,median,shift,e2=e2,makeimg=makeimg,
linename=linename,binfactor=binfactor,fps=fps,tle=tle,
imgastro=imgastro,cluster=cluster,solveastro=solveastro)
tlist.append(time.time() - stime)
print('TIME:')
print(tlist)
if __name__=="__main__":
'''
Run example demo scripts. Be sure to download input ASTRIANet data according to README.
'''
astrianavstardemo()
astriademo()