Esempio n. 1
0
 def _checkcomponents(self, dirty, fluxthreshold=0.6, positionthreshold=1.0):
     comps = find_skycomponents(dirty, fwhm=1.0, threshold=10 * fluxthreshold, npixels=5)
     assert len(comps) == len(self.components), "Different number of components found: original %d, recovered %d" % \
                                                (len(self.components), len(comps))
     cellsize = abs(dirty.wcs.wcs.cdelt[0])
     
     for comp in comps:
         # Check for agreement in direction
         ocomp, separation = find_nearest_skycomponent(comp.direction, self.components)
         assert separation / cellsize < positionthreshold, "Component differs in position %.3f pixels" % \
                                                           separation / cellsize
Esempio n. 2
0
                original_comps.append(comp)
                insert_skycomponent(model, comp)

    predict_skycomponent_visibility(vt, original_comps)


    cmodel = smooth_image(model)
    show_image(cmodel)
    plt.title("Smoothed model image")
    plt.savefig('1.jpg')
    #plt.show()

    comps = find_skycomponents(cmodel, fwhm=1.0, threshold=10.0, npixels=5)
    plt.clf()
    for i in range(len(comps)):
        ocomp, sep = find_nearest_skycomponent(comps[i].direction, original_comps)
        plt.plot((comps[i].direction.ra.value  - ocomp.direction.ra.value)/cmodel.wcs.wcs.cdelt[0],
                (comps[i].direction.dec.value - ocomp.direction.dec.value)/cmodel.wcs.wcs.cdelt[1],
                '.', color='r')

    plt.xlabel('delta RA (pixels)')
    plt.ylabel('delta DEC (pixels)')
    plt.title("Recovered - Original position offsets")
    plt.savefig('2.jpg')
    # plt.show()

    wstep = 8.0
    # nw = int(1.1 * 800/wstep)
    nw1 = int(1.1 * 2.0 * numpy.max(numpy.abs(vt.w)) / wstep)
    # gcfcf = create_awterm_convolutionfunction(model, nw=110, wstep=8, oversampling=8,