def test_tract_quick(self):
        """
        Test a single RC2 tract in quick mode
        """
        tract = 9697
        filter_name = 'HSC-I'

        self.test_dir = tempfile.mkdtemp(dir='./', prefix='TestPatchHsc-')

        config = supreme.Configuration.load_yaml(
            os.path.join('./', 'configs', 'config_quick_tract_rc2.yaml'))

        mapper = supreme.MultiMapper(self.butler,
                                     config,
                                     self.test_dir,
                                     ncores=2)
        mapper([tract], [filter_name])

        expected_dict = OrderedDict()
        expected_dict['patch_inputs'] = [4500, '2,1', '2,2']
        expected_dict['exptime_sum'] = [199.0, 401.0, 'float64']
        expected_dict['airmass_wmean'] = [1.14, 1.3, 'float64']
        expected_dict['coadd_image_mean'] = [-0.1, 15.0, 'float64']
        expected_dict['coadd_mask_or'] = [-1, 54000, 'int32']

        mod_times1 = self.check_expected_maps_tract(expected_dict, tract,
                                                    filter_name)

        # Run a second run, clobber=True
        mapper([tract], [filter_name], clobber=True)
        mod_times2 = self.check_expected_maps_tract(expected_dict, tract,
                                                    filter_name)
        self.check_mod_times(mod_times1, mod_times2, 'greater')

        # And a third run, clobber=False
        mapper([tract], [filter_name], clobber=False)
        mod_times3 = self.check_expected_maps_tract(expected_dict, tract,
                                                    filter_name)
        self.check_mod_times(mod_times2, mod_times3, 'equal')

        # A fourth run, clobber=False, extra map to test coadd operation skipping
        config.map_types['nexp'] = ['sum']
        mapper = supreme.MultiMapper(self.butler,
                                     config,
                                     self.test_dir,
                                     ncores=2)
        mapper([tract], [filter_name], clobber=False)
        mod_times3 = self.check_expected_maps_tract(expected_dict, tract,
                                                    filter_name)
        self.check_mod_times(mod_times2, mod_times3, 'equal')
    def test_tract_quick_nofilter(self):
        """
        Test building a tract that doesn't exist
        """
        tract = 9697
        filter_name = 'HSC-R'

        self.test_dir = tempfile.mkdtemp(dir='./', prefix='TestPatchHsc-')

        config = supreme.Configuration.load_yaml(
            os.path.join('configs/config_quick_tract_rc2.yaml'))

        mapper = supreme.MultiMapper(self.butler, config, self.test_dir)
        mapper([tract], [filter_name])
    def test_find_filter(self):
        """
        Find a filter.
        """
        tract = 9697
        filter_names = ['HSC-G', 'HSC-R', 'HSC-I', 'HSC-Z', 'HSC-Y']

        mapper = supreme.MultiMapper(self.butler, None, './')
        multi_dict = mapper([tract], filter_names, find_only=True)

        # Should only return the one filter, 'HSC-I', with 2 patches
        self.assertEqual(len(multi_dict), 1)
        self.assertTrue(tract in multi_dict)
        self.assertEqual(len(multi_dict[tract]), 1)
        self.assertTrue('HSC-I' in multi_dict[tract])
        self.assertEqual(len(multi_dict[tract]['HSC-I']), 2)
    def test_find_patch(self):
        """
        Find a single patch.
        """
        tract = 9697
        filter_name = 'HSC-I'

        mapper = supreme.MultiMapper(self.butler, None, './')
        multi_dict = mapper([tract], [filter_name], patches=['2,2', '5,5'], find_only=True)

        # Should only return the one patch, '2,2'
        self.assertEqual(len(multi_dict), 1)
        self.assertTrue(tract in multi_dict)
        self.assertEqual(len(multi_dict[tract]), 1)
        self.assertTrue('HSC-I' in multi_dict[tract])
        self.assertEqual(len(multi_dict[tract]['HSC-I']), 1)
        self.assertEqual(multi_dict[tract]['HSC-I'][0], '2,2')
Exemple #5
0
    def test_patch_quick(self):
        """
        Test a single RC2 patch in quick mode
        """
        tract = 3828
        filter_name = 'i'
        patch = '2,2'

        self.test_dir = tempfile.mkdtemp(dir='./', prefix='TestPatchImSim-')

        config = supreme.Configuration.load_yaml(os.path.join('configs/config_quick_dc2.yaml'))

        mapper = supreme.MultiMapper(self.butler, config, self.test_dir)
        mapper([tract], [filter_name], [patch], consolidate=False)

        # Check that everything is there
        expected_dict = OrderedDict()
        expected_dict['patch_inputs'] = [2, 1]
        expected_dict['airmass_max'] = [1.0, 1.2, 'float64']
        expected_dict['airmass_min'] = [1.0, 1.2, 'float64']
        expected_dict['airmass_wmean'] = [1.0, 1.2, 'float64']
        expected_dict['boresight_dist_wmean'] = [0.0080, 0.015, 'float64']
        expected_dict['background_wmean'] = [2290.0, 2297.0, 'float64']
        expected_dict['bgmean_wmean'] = [2290.0, 2297.0, 'float64']
        expected_dict['exptime_sum'] = [29.0, 61.0, 'float64']
        expected_dict['nexp_sum'] = [0, 3, 'int32']
        expected_dict['psf_size_wmean'] = [1.35, 1.75, 'float64']
        expected_dict['psf_e1_wmean'] = [-0.01, 0.01, 'float64']
        expected_dict['psf_e2_wmean'] = [-0.01, 0.01, 'float64']
        expected_dict['dcr_dra_wmean'] = [-0.65, -0.075, 'float64']
        expected_dict['dcr_ddec_wmean'] = [-0.01, 0.12, 'float64']
        expected_dict['dcr_e1_wmean'] = [-0.43, 0.01, 'float64']
        expected_dict['dcr_e2_wmean'] = [-0.03, 0.01, 'float64']
        expected_dict['parallactic_wmean'] = [-1.6, -0.62, 'float64']
        expected_dict['coadd_image_mean'] = [0.0, 2.0, 'float64']
        expected_dict['coadd_variance_mean'] = [0.4, 0.45, 'float64']
        expected_dict['coadd_mask_or'] = [-1, 21000, 'int32']
        expected_dict['maglim_aper_wmean'] = [21.50, 21.95, 'float64']
        expected_dict['maglim_psf_wmean'] = [22.75, 23.30, 'float64']

        self.check_expected_maps_patch(expected_dict, tract, patch, filter_name)
    def test_patch_slow(self):
        """
        Test a single RC2 patch in slow mode
        """
        tract = 9697
        filter_name = 'HSC-I'
        patch = '2,2'

        self.test_dir = tempfile.mkdtemp(dir='./', prefix='TestPatchHsc-')

        config = supreme.Configuration.load_yaml(
            os.path.join('configs/config_slow_rc2.yaml'))

        mapper = supreme.MultiMapper(self.butler, config, self.test_dir)
        mapper([tract], [filter_name], [patch], consolidate=False)

        expected_dict = OrderedDict()
        expected_dict['patch_inputs'] = [2, 1]
        expected_dict['exptime_sum'] = [199.0, 401.0, 'float64']

        self.check_expected_maps_patch(expected_dict, tract, patch,
                                       filter_name)
    def test_tract_quick(self):
        """
        Test a single RC2 tract in quick mode
        """
        tract = 3828
        filter_name = 'i'

        self.test_dir = tempfile.mkdtemp(dir='./', prefix='TestPatchImSim-')

        config = supreme.Configuration.load_yaml(
            os.path.join('configs/config_quick_tract_dc2.yaml'))

        mapper = supreme.MultiMapper(self.butler,
                                     config,
                                     self.test_dir,
                                     ncores=2)
        mapper([tract], [filter_name])

        expected_dict = OrderedDict()
        expected_dict['patch_inputs'] = [14000, '2,2']
        expected_dict['exptime_sum'] = [29.0, 61.0, 'float64']
        expected_dict['airmass_wmean'] = [1.0, 1.2, 'float64']

        self.check_expected_maps_tract(expected_dict, tract, filter_name)
    def test_patch_slow(self):
        """
        Test a single DC2 patch in slow mode
        """
        tract = 3828
        filter_name = 'i'
        patch = '2,2'

        self.test_dir = tempfile.mkdtemp(dir='./', prefix='TestPatchImSim-')

        config = supreme.Configuration.load_yaml(
            os.path.join('configs/config_slow_dc2.yaml'))

        mapper = supreme.MultiMapper(self.butler, config, self.test_dir)
        mapper([tract], [filter_name], [patch], consolidate=False)

        expected_dict = OrderedDict()
        expected_dict['patch_inputs'] = [2, 1]
        expected_dict['exptime_sum'] = [29.0, 61.0, 'float64']
        expected_dict['skylevel_wmean'] = [2292.0, 2298.0, 'float64']
        expected_dict['skysigma_wmean'] = [0.2, 0.5, 'float64']

        self.check_expected_maps_patch(expected_dict, tract, patch,
                                       filter_name)
Exemple #9
0
    parser.add_argument('-t', '--tracts', action='store', type=str, required=True,
                        help='Name of tract(s), ^ delimited')
    parser.add_argument('-f', '--filters', action='store', type=str, required=True,
                        help='Name of filter(s), ^ delimited')
    parser.add_argument('-p', '--patches', action='store', type=str, required=False,
                        help='Name of patch(es), ^ delimited')
    parser.add_argument('-C', '--cores', action='store', type=int, required=True,
                        default=1, help='Number of cores to run on')
    parser.add_argument('-P', '--individual_patches', action='store_true', required=False,
                        help='Save individual patches instead of consolidating tracts')
    parser.add_argument('-k', '--clobber', action='store_true', required=False,
                        help='Clobber any existing files')
    parser.add_argument('-d', '--do_raise', action='store_true', required=False,
                        help='Raise if there are any failures.')

    args = parser.parse_args()

    butler = dafPersist.Butler(args.repo)
    config = supreme.Configuration.load_yaml(args.configfile)

    tracts = [int(t) for t in args.tracts.split('^')]
    filters = [f for f in args.filters.split('^')]
    if args.patches is not None:
        patches = [p for p in args.patches.split('^')]
    else:
        patches = None

    mapper = supreme.MultiMapper(butler, config, args.outputpath, ncores=args.cores)
    mapper(tracts, filters, patches=patches, consolidate=not args.individual_patches,
           clobber=args.clobber, do_raise=args.do_raise)
Exemple #10
0
    def test_patch_quick(self):
        """
        Test a single RC2 patch in quick mode
        """
        tract = 9697
        filter_name = 'HSC-I'
        patch = '2,2'

        self.test_dir = tempfile.mkdtemp(dir='./', prefix='TestPatchHsc-')

        config = supreme.Configuration.load_yaml(
            os.path.join('configs/config_quick_rc2.yaml'))

        mapper = supreme.MultiMapper(self.butler, config, self.test_dir)
        mapper([tract], [filter_name], [patch], consolidate=False)

        # Check that everything is there
        expected_dict = OrderedDict()
        expected_dict['patch_inputs'] = [2, 1]
        expected_dict['airmass_max'] = [1.15, 1.3, 'float64']
        expected_dict['airmass_min'] = [1.15, 1.3, 'float64']
        expected_dict['airmass_wmean'] = [1.15, 1.3, 'float64']
        expected_dict['boresight_dist_wmean'] = [0.006, 0.012, 'float64']
        expected_dict['background_wmean'] = [690.0, 790.0, 'float64']
        expected_dict['bgmean_wmean'] = [690.0, 790.0, 'float64']
        expected_dict['exptime_sum'] = [199.0, 401.0, 'float64']
        expected_dict['nexp_sum'] = [0, 3, 'int32']
        expected_dict['psf_size_wmean'] = [1.15, 1.45, 'float64']
        expected_dict['psf_e1_wmean'] = [0.0, 0.15, 'float64']
        expected_dict['psf_e2_wmean'] = [-0.15, 0.15, 'float64']
        expected_dict['skylevel_wmean'] = [690.0, 790.0, 'float64']
        expected_dict['skysigma_wmean'] = [8.4, 9.0, 'float64']
        expected_dict['dcr_dra_wmean'] = [-0.65, -0.48, 'float64']
        expected_dict['dcr_ddec_wmean'] = [0.39, 0.42, 'float64']
        expected_dict['dcr_e1_wmean'] = [-0.23, -0.06, 'float64']
        expected_dict['dcr_e2_wmean'] = [-0.53, -0.38, 'float64']
        expected_dict['parallactic_wmean'] = [-0.99, -0.87, 'float64']
        expected_dict['coadd_image_mean'] = [-0.1, 15.0, 'float64']
        expected_dict['coadd_variance_mean'] = [0.005, 0.03, 'float64']
        expected_dict['coadd_mask_or'] = [-1, 54000, 'int32']
        expected_dict['maglim_aper_wmean'] = [23.44, 23.85, 'float64']
        expected_dict['maglim_psf_wmean'] = [25.0, 25.5, 'float64']

        mod_times1 = self.check_expected_maps_patch(expected_dict, tract,
                                                    patch, filter_name)

        # Run a second run, clobber=True
        mapper([tract], [filter_name], [patch],
               consolidate=False,
               clobber=True)
        mod_times2 = self.check_expected_maps_patch(expected_dict, tract,
                                                    patch, filter_name)
        self.check_mod_times(mod_times1, mod_times2, 'greater')

        # And a third run, clobber=False
        mapper([tract], [filter_name], [patch],
               consolidate=False,
               clobber=False)
        mod_times3 = self.check_expected_maps_patch(expected_dict, tract,
                                                    patch, filter_name)
        self.check_mod_times(mod_times2, mod_times3, 'equal')