Example #1
0
    def test_qa_main(self):
        """Test plots/pages made for some main survey target types.
        """
        # ADM note that these might not all be in the test files
        # ADM but this also tests passing via tcnames.
        tcnames = ["ALL", "BGS_FAINT"]

        # ADM the large max_bin_area helps speed the tests.
        make_qa_page(self.targfile, qadir=self.testdir, max_bin_area=99.,
                     imaging_map_file=self.pixmapfile, tcnames=tcnames)

        pngs, htmls = len(glob("*png")), len(glob("*html"))
        dats, alls = len(glob("*dat")), len(glob("./*"))
        sysplots = len(_load_systematics())

        # ADM one webpage is made per tc, plus the index.html.
        self.assertEqual(htmls, len(tcnames)+1)
        # ADM 4 N(m) plots are made per tc.
        self.assertEqual(dats, 4*len(tcnames))
        # ADM 11 plots made per tc. plus 2 lots of systematics plots.
        self.assertEqual(pngs, 11*len(tcnames)+2*sysplots)
        # ADM there are only .html, .dat and .png files.
        self.assertEqual(pngs+htmls+dats, alls)
Example #2
0
    #    filepath = '{}/sweep-{}.fits'.format(sweepdir, radec)
    #    data = fitsio.read('t/'+basename(filepath))
    #    # ADM use find_gaia_files to determine which Gaia files potentially
    #    # ADM match the sweeps objects of interest
    #    for gaiafile in find_gaia_files(data):
    #        # ADM for each of the relevant Gaia files, read the first 5 rows
    #        gaiadata = fitsio.read(gaiafile, rows=range(5))
    #        # ADM and write them to a special Gaia directory
    #        fitsio.write('tgaia/'+basename(gaiafile), gaiadata, clobber=True)

    # ADM adding a file to make a mask for bright stars
    # ADM this should go in its own directory /t2 (others are in t1)
    # ADM post version 0.40.0 of desitarget, masking uses Gaia not
    # ADM the sweeps, so this has been supplanted by make_testgaia.py.
    # filepath = '{}/sweep-{}.fits'.format(sweepdir, '190m005-200p000')
    # data, hdr = read_tractor(filepath, header=True)
    # ADM the "CONTINUE" comment keyword is not yet implemented
    # ADM in fitsio, so delete it to prevent fitsio barfing on headers
    # hdr.delete("CONTINUE")
    # keep = np.where(data["FLUX_Z"] > 100000)
    # fitsio.write('t2/'+basename(filepath), data[keep], header=hdr, clobber=True)

    # ADM adding a fake pixel weight map
    sysdic = _load_systematics()
    npix = hp.nside2npix(2)
    pixmap = np.ones(npix, dtype=[(k, '>f4') for k in sysdic.keys()])
    pixmap = rfn.append_fields(pixmap, "ALL", np.ones(npix), dtypes='>f4')
    fitsio.write('t/pixweight.fits', pixmap, clobber=True)

    print('Done...t={:.2f}s'.format(time() - start))