if len(jobCalibrations) > 0: jobSuccess = True job = jobs[0] time.sleep(4) resultsURL = "http://nova.astrometry.net/api/jobs/%s/calibration" % (job) print("Requesting results from ", resultsURL) response = requests.post(resultsURL) print(response.text) wcsURL = "http://nova.astrometry.net/wcs_file/4014529" print("Requesting results from ", wcsURL) response = requests.post(wcsURL) print(response.text) # Use wget to grab the WCS file wcsFilename = generallib.addSuffixToFilename(runObject.runID, "wcs") wcsURL = "http://nova.astrometry.net/wcs_file/%s" % job wcsCommand = ["wget"] wcsCommand.append("-O") wcsCommand.append(wcsFilename) wcsCommand.append(wcsURL) subprocess.call(wcsCommand) runObject.addProperty("wcsFITS", wcsFilename) runObject.save() # Read the WCS solution and add this to the JSON object wcsFile = fits.open(runObject.getProperty("wcsFITS")) header = wcsFile[0].header wcs = wcslib.wcsSolution()
color=filterColours[f], fmt='.', ecolor='gray', capsize=0, marker='.', ms=4, alpha=1.0) axes = matplotlib.pyplot.gca() matplotlib.rcParams['legend.loc'] = 'upper right' axes.legend() matplotlib.pyplot.draw() if arg.save is not None: savename = generallib.addSuffixToFilename(arg.save, "all") print("Writing to file: %s" % savename) matplotlib.pyplot.savefig(savename) zoomPlot = matplotlib.pyplot.figure(figsize=(plotWidth, plotHeight * 1.4)) colours = ['g', 'r', 'purple', 'brown'] filterColours = { 'u': 'blue', 'g': 'green', 'r': 'red', 'i': 'purple', 'z': 'brown' } offset = 0.1 midDates = {} startPhase = 0.9
vxy = float(hdulist[mainImage].header['VXY']) hdulist.close() vmin, vmax = numpy.median(data) - data.std(), numpy.median(data) + 4 * data.std() contrastData = generallib.percentiles(data, percentileLower, percentileUpper) matplotlib.pyplot.imshow(contrastData, origin='lower', cmap=colourMap, aspect='equal', extent=(-nx*vxy,nx*vxy, -ny*vxy,ny*vxy)) (vx, vy) = trm.roche.vlobe2(q, n=200) matplotlib.pyplot.plot(vx*scale, vy*scale, color='g') (vx, vy) = trm.roche.vlobe1(q, n=200) matplotlib.pyplot.plot(vx*scale, vy*scale, ls="--", color='g') (vx, vy) = trm.roche.vstream(q, step=0.01, vtype=1, n=70) matplotlib.pyplot.plot(vx*scale, vy*scale, color='g') matplotlib.pyplot.xlabel("$\mathrm{V}_\mathrm{x} (\mathrm{km}\,\mathrm{s}^{-1})$") matplotlib.pyplot.ylabel("$\mathrm{V}_\mathrm{y} (\mathrm{km}\,\mathrm{s}^{-1})$") axis = matplotlib.pyplot.gca() print("Scale:", axis.get_xscale()) axis.set_autoscale_on(False) axis.xaxis.set_label_position('top') axis.xaxis.tick_top() matplotlib.pyplot.draw() if arg.save: filename = generallib.addSuffixToFilename(arg.save, "map") print("Writing file: %s"%filename) matplotlib.pyplot.savefig(filename) matplotlib.pyplot.show(block=arg.p)
if arg.json is not None: t.writeToJSON(arg.json) print(len(targets)) for object in targets: photometryPlot = matplotlib.pyplot.figure(figsize=(plotWidth, plotHeight)) xValues = object.getColumn('HJD') yValues = object.getColumn('mag') yErrors = object.getColumn('err') matplotlib.pyplot.errorbar(xValues, yValues, color='k', yerr=yErrors, fmt = '.', ecolor='gray', capsize=0) matplotlib.pyplot.gca().invert_yaxis() matplotlib.pyplot.xlabel('HJD') matplotlib.pyplot.ylabel('CRTS magnitude') matplotlib.pyplot.gca().set_xlim(left=min(xValues), right=max(xValues)) if arg.save is not None: filename = generallib.addSuffixToFilename(arg.save, "full") print("Writing to file: %s"%filename) matplotlib.pyplot.savefig(filename) matplotlib.pyplot.draw() t = targets[0] # Do a Periodogram startFrequency = 1.1 # Cycles/day stopFrequency = 20 # Cycles/day spacing = 0.0001 numsamples = int((stopFrequency-startFrequency)/spacing) f0,df,Nf = startFrequency, spacing, numsamples startTime = numpy.min(xValues)
print("HDULength is %d thefore we have %d images"%(length, numImages)) for index in range(numImages): num = index*2 + 1 data = hdulist[num].data nx = int(hdulist[num].header['NAXIS1']) ny = int(hdulist[num].header['NAXIS2']) vxy = float(hdulist[num].header['VXY']) vmin, vmax = numpy.median(data) - data.std(), numpy.median(data) + 4 * data.std() contrastData = generallib.percentiles(data, 5, 98) #plt.imshow(data, cmap='viridis', aspect='equal', vmin=vmin, vmax=vmax, extent=(-nx*vxy,nx*vxy, -ny*vxy,ny*vxy)) dopplerPlot = matplotlib.pyplot.figure(figsize=(plotHeight, plotHeight)) matplotlib.pyplot.imshow(contrastData, origin='lower', cmap='viridis', aspect='equal', extent=(-nx*vxy,nx*vxy, -ny*vxy,ny*vxy)) #matplotlib.pyplot.imshow(data, origin='lower', cmap='viridis', aspect='equal', vmin=vmin, vmax=vmax, extent=(-nx*vxy,nx*vxy, -ny*vxy,ny*vxy)) (vx, vy) = trm.roche.vlobe2(q, n=200) matplotlib.pyplot.plot(vx*scale, vy*scale, color='g') (vx, vy) = trm.roche.vlobe1(q, n=200) matplotlib.pyplot.plot(vx*scale, vy*scale, ls="--", color='g') (vx, vy) = trm.roche.vstream(q, step=0.01, vtype=1, n=80) matplotlib.pyplot.plot(vx*scale, vy*scale, color='g') matplotlib.pyplot.draw() if arg.save: if numImages>1: filename = generallib.addSuffixToFilename(arg.save, str(index)) else: filename = arg.save print("Writing file: %s"%filename) matplotlib.pyplot.savefig(filename) matplotlib.pyplot.show(block=True)