Skip to content

Commit 36124cc

Browse files
committed
small bugfix
1 parent ff8ba5a commit 36124cc

File tree

4 files changed

+53
-55
lines changed

4 files changed

+53
-55
lines changed

gui_tools.py

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -104,30 +104,30 @@ def __init__(self,master,**kw):
104104
AutoScroll.__init__(self,master)
105105

106106
def set_foregroundcolor(ax, color):
107-
'''For the specified axes, sets the color of the frame, major ticks,
108-
tick labels, axis labels, title and legend
109-
'''
110-
for tl in ax.get_xticklines() + ax.get_yticklines():
111-
tl.set_color(color)
112-
for spine in ax.spines:
113-
ax.spines[spine].set_edgecolor(color)
114-
for tick in ax.xaxis.get_major_ticks():
115-
tick.label1.set_color(color)
116-
for tick in ax.yaxis.get_major_ticks():
117-
tick.label1.set_color(color)
118-
ax.axes.xaxis.label.set_color(color)
119-
ax.axes.yaxis.label.set_color(color)
120-
ax.axes.xaxis.get_offset_text().set_color(color)
121-
ax.axes.yaxis.get_offset_text().set_color(color)
122-
ax.axes.title.set_color(color)
123-
lh = ax.get_legend()
124-
if lh != None:
125-
lh.get_title().set_color(color)
126-
lh.legendPatch.set_edgecolor('none')
127-
labels = lh.get_texts()
128-
for lab in labels:
129-
lab.set_color(color)
130-
for tl in ax.get_xticklabels():
131-
tl.set_color(color)
132-
for tl in ax.get_yticklabels():
133-
tl.set_color(color)
107+
'''For the specified axes, sets the color of the frame, major ticks,
108+
tick labels, axis labels, title and legend
109+
'''
110+
for tl in ax.get_xticklines() + ax.get_yticklines():
111+
tl.set_color(color)
112+
for spine in ax.spines:
113+
ax.spines[spine].set_edgecolor(color)
114+
for tick in ax.xaxis.get_major_ticks():
115+
tick.label1.set_color(color)
116+
for tick in ax.yaxis.get_major_ticks():
117+
tick.label1.set_color(color)
118+
ax.axes.xaxis.label.set_color(color)
119+
ax.axes.yaxis.label.set_color(color)
120+
ax.axes.xaxis.get_offset_text().set_color(color)
121+
ax.axes.yaxis.get_offset_text().set_color(color)
122+
ax.axes.title.set_color(color)
123+
lh = ax.get_legend()
124+
if lh != None:
125+
lh.get_title().set_color(color)
126+
lh.legendPatch.set_edgecolor('none')
127+
labels = lh.get_texts()
128+
for lab in labels:
129+
lab.set_color(color)
130+
for tl in ax.get_xticklabels():
131+
tl.set_color(color)
132+
for tl in ax.get_yticklabels():
133+
tl.set_color(color)

main.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@ def sort(zoznam):
5353
objSort=[]
5454
order={}
5555
for x in zoznam:
56-
for i in range(len(x)):
56+
for i,xi in enumerate(x):
5757
try:
58-
int(x[i])
58+
int(xi)
5959
break
6060
except: pass
6161
order[x[:i]+x[i:].rjust(10,'0')]=x

objects_import.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ def sipsI(name):
102102
constellations=stars.load()
103103
abbrevConst={x.lower():y for x,y in stars.abbrev().items()} #malym -> osetrenie problem s velkostou pismen
104104

105-
skratky=[x.lower() for x in constellations.keys()] #malym -> osetrenie problem s velkostou pismen
105+
skratky=[x.lower() for x in constellations] #malym -> osetrenie problem s velkostou pismen
106106
objects=objClass.objects(constellations)
107107
f=open(name,'r')
108108
group='' #type of object in catalog (M,NGC etc.)
@@ -130,11 +130,9 @@ def sipsI(name):
130130
except: pass
131131
if d.strip().lower() in skratky:
132132
const0=d.strip()
133-
continue
134133
elif d.strip().lower() in abbrevConst:
135134
const0=abbrevConst[d.strip().lower()]
136-
continue
137-
typ=d
135+
else: typ=d
138136
size=''
139137
if '(' in line: note=line[line.find('(')+1:line.find(')')]
140138
else: note=''

stars.py

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -20,28 +20,28 @@ def sid_time(jd):
2020
return sid
2121

2222
def printDMS(x):
23-
#output in format d:m:s
24-
sgn=''
25-
if np.sign(x)<0: sgn='-'
26-
x=abs(x)
27-
d=int(abs(x))
28-
m=int(round((abs(x)-d)*60.,3))
29-
s=abs(round((abs(x)-d-m/60.)*3600.,2))
30-
xx=sgn+str(d).rjust(2,'0')+':'+str(m).rjust(2,'0')+':'+('%.2f' %s).rjust(5,'0')
31-
return xx
23+
'''output in format d:m:s'''
24+
sgn=''
25+
if np.sign(x)<0: sgn='-'
26+
x=abs(x)
27+
d=int(abs(x))
28+
m=int(round((abs(x)-d)*60.,3))
29+
s=abs(round((abs(x)-d-m/60.)*3600.,2))
30+
xx=sgn+str(d).rjust(2,'0')+':'+str(m).rjust(2,'0')+':'+('%.2f' %s).rjust(5,'0')
31+
return xx
3232

3333
def readDMS(x,deg=True):
34-
#input in format d:m:s
35-
sgn=1
36-
if x[0]=='-':
37-
sgn=-1
38-
x=x[1:]
39-
d=int(x[:x.find(':')])
40-
x=x[x.find(':')+1:]
41-
m=int(x[:x.find(':')])
42-
s=float(x[x.find(':')+1:])
43-
if deg: return sgn*(d+m/60.+s/3600.)
44-
else: return sgn*d,m,s
34+
'''input in format d:m:s'''
35+
sgn=1
36+
if x[0]=='-':
37+
sgn=-1
38+
x=x[1:]
39+
d=int(x[:x.find(':')])
40+
x=x[x.find(':')+1:]
41+
m=int(x[:x.find(':')])
42+
s=float(x[x.find(':')+1:])
43+
if deg: return sgn*(d+m/60.+s/3600.)
44+
else: return sgn*d,m,s
4545

4646
class star:
4747
def __init__(self,name,ra,dec,mag,size='0',typ='NA',note='',const=''):
@@ -58,7 +58,7 @@ def __init__(self,name,ra,dec,mag,size='0',typ='NA',note='',const=''):
5858
def altAz(self,jd,lon,lat):
5959
#type of output (same as input - number, list, numpy.array)
6060
out_type='lst'
61-
if (isinstance(jd,int) or isinstance(jd,float)):
61+
if isinstance(jd,(int,float)):
6262
#all input args are numbers
6363
out_type='num'
6464

@@ -214,7 +214,7 @@ def testPoint(self,ra,dec):
214214
ra,dec=self._transform(ra,dec,coef)
215215
ra0,dec0=self._transform(ra0,dec0,coef)
216216

217-
for i in range(len(ra0)):
217+
for i,ra0i in enumerate(ra0):
218218
poly.append([ra0[i],dec0[i]])
219219

220220
if ra>max(ra0) or ra<min(ra0): continue

0 commit comments

Comments
 (0)