Commit fdbcc43b authored by marc's avatar marc
Browse files

Initial commit

parent 99be895c
...@@ -30,13 +30,15 @@ class CreatePointings(Ui_FormCreatePoinings): ...@@ -30,13 +30,15 @@ class CreatePointings(Ui_FormCreatePoinings):
raise URLError("Could not connect to Internet" + str(e)) raise URLError("Could not connect to Internet" + str(e))
raise NameError("Could not connect to Internet" + str(e)) raise NameError("Could not connect to Internet" + str(e))
self.target = Null self.target = Null
self.measList = []
''' '''
Define slot and connections for GUI Define slot and connections for GUI
''' '''
self.comboBox.currentIndexChanged.connect(self.updateRADEC) self.comboBox.currentIndexChanged.connect(self.updateRADEC)
self.buttonBoxCreatePointings.accepted.connect(self.createPointings) self.buttonBoxCreatePointings.accepted.connect(self.createPointings)
#self.buttonBoxCreatePointings.rejected.connect(sys.exit(app.exec_())) self.buttonBoxCreatePointings.rejected.connect(self.writePointings)
def updateRADEC(self): def updateRADEC(self):
self.target = SkyCoord.from_name(self.comboBox.currentText()) self.target = SkyCoord.from_name(self.comboBox.currentText())
...@@ -50,7 +52,6 @@ class CreatePointings(Ui_FormCreatePoinings): ...@@ -50,7 +52,6 @@ class CreatePointings(Ui_FormCreatePoinings):
n = int(self.spinBoxStepsRA.text()) n = int(self.spinBoxStepsRA.text())
m = int(self.spinBoxStepsDec.text()) m = int(self.spinBoxStepsDec.text())
stepSize = float(self.doubleSpinBoxDistanceDec.text()) stepSize = float(self.doubleSpinBoxDistanceDec.text())
measList = []
centrePoint = SkyCoord.from_name(self.comboBox.currentText()) centrePoint = SkyCoord.from_name(self.comboBox.currentText())
raCentrePoint=centrePoint.ra.degree raCentrePoint=centrePoint.ra.degree
decCentrePoint=centrePoint.dec.degree decCentrePoint=centrePoint.dec.degree
...@@ -68,21 +69,23 @@ class CreatePointings(Ui_FormCreatePoinings): ...@@ -68,21 +69,23 @@ class CreatePointings(Ui_FormCreatePoinings):
#raOffset=raCentrePoint+((stepSize*raStep+stepSize/2)*raSign)/math.cos(math.radians(decOffset)) #raOffset=raCentrePoint+((stepSize*raStep+stepSize/2)*raSign)/math.cos(math.radians(decOffset))
raOffset=raCentrePoint+((stepSize*(raStep+1))*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)) 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 pointings+=1
return (measList)
def writePointings(self, measList):
def writePointings(self):
logger.debug('Start writePointings') logger.debug('Start writePointings')
index=0 index=0
with open('pointings.dat','w') as f: with open('pointings.dat','w') as f:
for pointing in measList: for pointing in self.measList:
f.write('{}\t{}\t{}\n'.format(index, measList[index].ra.deg, measList[index].dec.deg) ) f.write('{}\t{}\t{}\n'.format(index, self.measList[index].ra.deg, self.measList[index].dec.deg) )
logger.debug('{}\t{}\t{}\n'.format(index, measList[index].ra.deg, measList[index].dec.deg) ) logger.debug('{}\t{}\t{}\n'.format(index, self.measList[index].ra.deg, self.measList[index].dec.deg) )
index+=1 index+=1
f.flush() f.flush()
logger.debug('End createPointings') logger.debug('End createPointings')
f.close() f.close()
sys.exit(app.exec_())
if __name__ == '__main__': if __name__ == '__main__':
...@@ -91,5 +94,5 @@ if __name__ == '__main__': ...@@ -91,5 +94,5 @@ if __name__ == '__main__':
myForm = CreatePointings(formCreatePointings) myForm = CreatePointings(formCreatePointings)
formCreatePointings.show() formCreatePointings.show()
myList = myForm.createPointings() myList = myForm.createPointings()
myForm.writePointings(myList) myForm.writePointings()
sys.exit(app.exec_()) 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