def from_filename(cls, filename, filenamemask=None, download=True, **kwargs): """ Parameters ---------- download: [bool] -optional- Downloads the maskfile if necessary. **kwargs goes to ztfquery.io.get_file() """ from ztfquery import io sciimgpath = io.get_file(filename, suffix="sciimg.fits", downloadit=download, **kwargs) mskimgpath = io.get_file(filename if filenamemask is None else filenamemask, suffix="mskimg.fits", downloadit=download,**kwargs) return cls(sciimgpath, mskimgpath)
def fetch_parquetsource_data(filename, datakey, sources=None): """ """ data = pandas.read_parquet(io.get_file(filename, suffix="psfshape.parquet", check_suffix=False), columns=[datakey]) if sources is not None: data = data.loc[sources] return data.values.tolist()
def _get_ziff_psf_cat_(file_, whichpsf="psf_PixelGrid_BasisPolynomial5.piff"): """ """ files_needed = io.get_file( file_, suffix=[whichpsf, "sciimg.fits", "mskimg.fits", "shapecat_gaia.fits"], check_suffix=False) # Dask psffile, sciimg, mkimg, catfile = files_needed[0], files_needed[ 1], files_needed[2], files_needed[3] ziff = base.ZIFF(sciimg, mkimg, fetch_psf=False) cat_toshape = base.catlib.Catalog.load(catfile, wcs=ziff.wcs) psf = base.piff.PSF.read(file_name=psffile, logger=None) return ziff, psf, cat_toshape
def get_file_delayed(file_, waittime=None, suffix=["sciimg.fits", "mskimg.fits"], overwrite=False, show_progress=True, maxnprocess=1, **kwargs): """ """ if waittime is not None: time.sleep(waittime) return io.get_file(file_, suffix=suffix, overwrite=overwrite, show_progress=show_progress, maxnprocess=maxnprocess)
def from_filename(cls, filename, pointingkey=["RA", "DEC"], suffix=None, **kwargs): """ load the ztfimg.WCS solution built upon astropy's WCS solution. given the filename information. This looks for the header file (or that of the associated suffix) and calls the from_header() class method = it knows how to convert (x,y), (u,v) and (ra,dec) systems = Parameters ---------- filename: [string] name of the file having the header containing the wcs information. (see suffix). This call ztfquery.io.get_file(). It looks for the given file locally and download it if necessary (see kwargs). suffix: [string or None] -optional- ztfquery.io.get_file() option. It enables to change the suffix of the given filename. pointing: [strings] -optional- header keys cointaining the RA, DEC position of the telescope pointing. **kwargs goes to ztfquery.io.get_file() Returns ------- ztfimg.WCS solution """ from ztfquery import io header = io.fits.getheader( io.get_file(filename, suffix=suffix, **kwargs)) return cls.from_header(header, pointingkey=pointingkey)
# # = ending args = parser.parse_args() # # # print("\nINFORMATION\n".center(80, '-')) print(f"* ziff version {__version__}") requested = args.infile print(f"* requested: {requested}") # science_file = [io.get_file(f_) for f_ in requested] print(f" -> corresponding to {science_file}") # Catalog print(f"* Star catalog: {args.catalog}") # # - Filters addfilter = { f"{addfilter_[0]}_outrange": [addfilter_[0], [float(addfilter_[1]), float(addfilter_[2])]] for addfilter_ in args.addfilter } if len(addfilter) > 0: