Commit fdbcc43b authored by marc's avatar marc
Browse files

Initial commit

parent 99be895c
......@@ -30,13 +30,15 @@ class CreatePointings(Ui_FormCreatePoinings):
raise URLError("Could not connect to Internet" + str(e))
raise NameError("Could not connect to Internet" + str(e))
self.target = Null
self.measList = []
'''
Define slot and connections for GUI
'''
self.comboBox.currentIndexChanged.connect(self.updateRADEC)
self.buttonBoxCreatePointings.accepted.connect(self.createPointings)
#self.buttonBoxCreatePointings.rejected.connect(sys.exit(app.exec_()))
self.buttonBoxCreatePointings.rejected.connect(self.writePointings)
def updateRADEC(self):
self.target = SkyCoord.from_name(self.comboBox.currentText())
......@@ -50,7 +52,6 @@ class CreatePointings(Ui_FormCreatePoinings):
n = int(self.spinBoxStepsRA.text())
m = int(self.spinBoxStepsDec.text())
stepSize = float(self.doubleSpinBoxDistanceDec.text())
measList = []
centrePoint = SkyCoord.from_name(self.comboBox.currentText())
raCentrePoint=centrePoint.ra.degree
decCentrePoint=centrePoint.dec.degree
......@@ -68,21 +69,23 @@ class CreatePointings(Ui_FormCreatePoinings):
#raOffset=raCentrePoint+((stepSize*raStep+stepSize/2)*raSign)/math.cos(math.radians(decOffset))
raOffset=raCentrePoint+((stepSize*(raStep+1))*raSign)/math.cos(math.radians(decOffset))
logger.debug('raOffset: {0} raSign {1}'.format(raOffset,raSign))
measList.append(SkyCoord(ra=raOffset*u.degree,dec=decOffset*u.degree,frame='icrs'))
self.measList.append(SkyCoord(ra=raOffset*u.degree,dec=decOffset*u.degree,frame='icrs'))
pointings+=1
return (measList)
def writePointings(self, measList):
def writePointings(self):
logger.debug('Start writePointings')
index=0
with open('pointings.dat','w') as f:
for pointing in measList:
f.write('{}\t{}\t{}\n'.format(index, measList[index].ra.deg, measList[index].dec.deg) )
logger.debug('{}\t{}\t{}\n'.format(index, measList[index].ra.deg, measList[index].dec.deg) )
for pointing in self.measList:
f.write('{}\t{}\t{}\n'.format(index, self.measList[index].ra.deg, self.measList[index].dec.deg) )
logger.debug('{}\t{}\t{}\n'.format(index, self.measList[index].ra.deg, self.measList[index].dec.deg) )
index+=1
f.flush()
logger.debug('End createPointings')
f.close()
sys.exit(app.exec_())
if __name__ == '__main__':
......@@ -91,5 +94,5 @@ if __name__ == '__main__':
myForm = CreatePointings(formCreatePointings)
formCreatePointings.show()
myList = myForm.createPointings()
myForm.writePointings(myList)
myForm.writePointings()
sys.exit(app.exec_())
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment