def main(): parser = argparse.ArgumentParser( description="Ingest 2MASS PSC into Starplex") parser.add_argument('data_dir', action='store', help="Directory with psc_*.gz files") parser.add_argument('--name', action='store', default='starplex', help="Database name") parser.add_argument('--user', action='store', default='starplex', help="Database user") parser.add_argument('--pw', action='store', default=None, help="Database password") parser.add_argument('--url', action='store', default='localhost', help="Database URL") parser.add_argument('--port', action='store', default=5432, type=int, help="Database port") parser.add_argument('--ra', action='store', nargs=2, default=[0., 360.], type=float, help="Min and max RA range") parser.add_argument('--dec', action='store', nargs=2, default=[-90., 90.], type=float, help="Min and max Dec range") args = parser.parse_args() log.setLevel('INFO') connect(user=args.user, name=args.name) session = Session() create_all() tm_ingester = TwoMassPSCIngest(session, args.data_dir) tm_ingester.ingest_region('2MASS_PSC', [7.5, 17], [36, 47])
def setup_class(self): connect(user='******', name='starplex_test') self.session = Session() drop_all() create_all() init_catalog(self.session, self.mock.catalog_name, self.mock.instrument_name, self.mock.bands, self.mock.band_sys, self.mock.footprints, meta=self.mock.meta) add_observations(self.session, self.mock.catalog_name, self.mock.instrument_name, self.mock.bands, self.mock.band_sys, self.mock.x, self.mock.y, self.mock.ra, self.mock.ra_err, self.mock.dec, self.mock.dec_err, self.mock.mag, self.mock.mag_err, self.mock.cfrac)
def setup_class(self): print "engine init", engine connect(user='******', name='starplex_test') print "engine after connect", engine self.session = Session() drop_all() create_all() catalog = Catalog(self.mock_dataset.catalog_name, self.mock_dataset.instrument_name, None, fits_path=self.mock_dataset.fits_path) for i in xrange(self.mock_dataset.n): cstar = CatalogStar(0., 0., self.mock_dataset.ra[i], self.mock_dataset.dec[i], 0., 0., 1.) for j, bandname in enumerate(self.mock_dataset.bands): bp = Bandpass.as_unique(self.session, bandname, self.mock_dataset.band_sys) obs = Observation(self.mock_dataset.mags[j][i], 0.) obs.bandpass = bp cstar.observations.append(obs) catalog.catalog_stars.append(cstar) self.session.add(catalog)
def setup_class(self): connect(user='******', name='starplex_test') self.session = Session() create_all()