Commit 1e880aca authored by niejuzi's avatar niejuzi
Browse files

updated combined_file

parent 11d00f8d
Loading
Loading
Loading
Loading
+195 −181
Original line number Diff line number Diff line
@@ -3,7 +3,6 @@ import time
from functools import partial
from multiprocessing import Pool
from subprocess import Popen

import healpy as hp
import numpy as np
from astropy import table
@@ -14,13 +13,14 @@ from astropy.wcs import WCS

from .. import PACKAGE_PATH
from ..core.processor import CsstProcessor
from csst.msc.data_manager import CsstMscDataManager

CONFIG_PATH = PACKAGE_PATH + "/msc/pos_calib_config/"


class CsstProcMscPositionCalibration(CsstProcessor):

    def join_data(self, img_list, wht_list, flg_list, path_output):
    def join_data(self, img_list, wht_list, flg_list):
        """
        Prepare data for running scamp; Combine all image data, weight files, flag files to their one frame.

@@ -32,18 +32,14 @@ class CsstProcMscPositionCalibration(CsstProcessor):
            weith files to join together, e.g.,MSC_210304093000_0000000_06_img.fits
        flg_list:
            flag files to join together, e.g.,e.g.,MSC_210304093000_0000000_06_flg.fits
        path_output:
            the output dir for the joined file.

        Returns
        -------
        The joined multi-extension file(not stacked), weight, flag files.
        e.g., MSC_210304093000_0000000_img.fits,MSC_210304093000_0000000_wht.fits, MSC_210304093000_0000000_flg.fits.
        e.g., combined_img.fits,combined_wht.fits, combined_flg.fits.

        """

        img_prefix = img_list[0][0].header['FILENAME'][0:-7]
        output_imgnm = path_output + img_prefix + '_img.fits'
        output_imgnm = self.dm.pc_combined_file("img","fits")
        hdul_img = fits.HDUList()
        for i in range(0, len(img_list)):
            h0 = fits.PrimaryHDU(header=img_list[i][0].header)
@@ -52,7 +48,7 @@ class CsstProcMscPositionCalibration(CsstProcessor):
            hdul_img.append(h1)
        hdul_img.writeto(output_imgnm, overwrite=True)

        output_whtnm = path_output + img_prefix + '_wht.fits'
        output_whtnm = self.dm.pc_combined_file("wht","fits")
        hdul_wht = fits.HDUList()
        for i in range(0, len(wht_list)):
            h0 = fits.PrimaryHDU(header=wht_list[i][0].header)
@@ -61,7 +57,7 @@ class CsstProcMscPositionCalibration(CsstProcessor):
            hdul_wht.append(h1)
        hdul_wht.writeto(output_whtnm, overwrite=True)

        output_flgnm = path_output + img_prefix + '_flg.fits'
        output_flgnm = self.dm.pc_combined_file("flg","fits")
        hdul_flg = fits.HDUList()
        for i in range(0, len(flg_list)):
            h0 = fits.PrimaryHDU(header=flg_list[i][0].header)
@@ -70,86 +66,84 @@ class CsstProcMscPositionCalibration(CsstProcessor):
            hdul_flg.append(h1)
        hdul_flg.writeto(output_flgnm, overwrite=True)

    def run_sextractor(self, fn_list, path_output):
    def run_sextractor(self,ccd_ids):
        """
        Run sextractor

        Parameters 
        ----------
        fn_list:
            file name list, e.g.,MSC_210304093000_0000000_06_img.fits...
        config_sextractor:
            the path for sextractor configuration file.
        path_output:
            the current working dir

        ccd_ids:
            ccd list...
        Returns
        -------
        The photometric catalog, with position and flux, e.g.,MSC_210304093000_0000000_06_img.acat
        The photometric catalog, with position and flux, e.g.,MSC_210304093000_0000000_06_img.cat
        """
        fn = fn_list
        cat_list = []
        fn_list = []
        for this_ccd_id in ccd_ids:
            sex_cat = self.dm.l1_sci(ccd_id = this_ccd_id, suffix="img", ext="cat")
            fn = self.dm.l1_sci(ccd_id=this_ccd_id, suffix="img", ext="fits")
            cat_list.append(sex_cat)
            fn_list.append(fn)
        
        config_sextractor = CONFIG_PATH + "new_csst_realtime.no.weight.sex"
        sex_comd1 = 'sex -c ' + config_sextractor + ' '
        sex_comd2 = fn + ' -CATALOG_NAME ' + fn[0:-5] + '.acat'
        sex_comd2 = fn_list + ' -CATALOG_NAME ' + cat_list
        sex_comd3 = ' -PARAMETERS_NAME ' + CONFIG_PATH + 'csst_realtime.param' + ' -FILTER_NAME ' + CONFIG_PATH + 'csst_realtime.conv' + ' -STARNNW_NAME ' + CONFIG_PATH + 'csst_realtime.nnw'
        sex_comd = sex_comd1 + sex_comd2 + sex_comd3
        print(sex_comd)
        p = Popen(sex_comd, shell=True)
        p.wait()

    def combine_catalog(self, img_list, path_output):
    def combine_catalog(self, ccd_ids):
        """
        Combine the sextractor catalog together

        Parameters
        -----------
        img_list:
            image list, in table format
        path_output:
            the output dir

        ccd_ids: ccd list
        Returns
        -------
        The combined catalog,e.g., MSC_210304093000_0000000.acat.fits
        The combined catalog,e.g., combined_cat.fits
        """
        fn = path_output + img_list[0][0].header['FILENAME'][0:-7]
        output_catnm = str(fn + '.acat.fits')
        fn = self.dm.pc_combined_file("cat","fits")
        hdul = fits.HDUList()
        if len(img_list) == 18:
            for i in range(0, len(img_list)):
                image_prefix = img_list[i][0].header['FILENAME']
                cat_nm = path_output + image_prefix + '.acat'
        for this_ccd_id in ccd_ids:
            cat_nm = self.dm.l1_sci(ccd_id=this_ccd_id, suffix="img", ext="cat")
            cat_i = fits.open(cat_nm)
            data=cat_i[2].data
            msk=(data['MAGERR_AUTO']<0.2)&(data['CLASS_STAR']>0.5)&(data['CLASS_STAR']<=1.0)
            data=data[msk]
            cat_i[2].data=data
            hdul.append(cat_i[0])
            hdul.append(cat_i[1])
            hdul.append(cat_i[2])
            hdul.writeto(output_catnm, overwrite=True)
        else:
            print('the length of file list in not equal to 18, needs to check')
        hdul.writeto(fn, overwrite=True)
 
    def run_scamp(self, img_list, path_output):
    def run_scamp(self, wcs_refine=False):
        """
        Run scamp

        Parameters
        ---------
        img_list:
            to join a file 'image_prefix+.acat.fits', e.g.,MSC_210304093000_0000000.acat.fits
        config_scamp:
            the config file path for scamp

        Returns
        -------
        Image header updated with WCS keywords, MSC_210304093000_0000000.acat.head.
        Image header updated with WCS keywords, combined_cat.head.
        """
        image_prefix = (img_list[0][0].header)['FILENAME'][0:-7]
        config_scamp = CONFIG_PATH + "default2.scamp"
        scamp_comd = 'scamp ' + image_prefix + '.acat.fits -ASTREFCAT_NAME= ' + 'ref.cat\
        cb_fn = self.dm.pc_combined_file("cat","fits")
        config_scamp = CONFIG_PATH + "csst.scamp"
        scamp_comd = 'scamp ' + cb_fn + ' -ASTREFCAT_NAME= ' + 'ref.cat\
        -MERGEDOUTCAT_NAME ' + 'merged.cat -FULLOUTCAT_NAME ' + 'full.cat\
        -c ' + config_scamp
        print(scamp_comd)
        p = Popen(scamp_comd, shell=True)
        p.wait()
        if wcs_refine:
            Popen('cp '+ self.dm.pc_combined_file("cat","head")+" "+self.dm.pc_combined_file("cat","ahead"),shell=True)
            scamp_comd = 'scamp ' + cb_fn + ' -ASTREFCAT_NAME= ' + 'ref.cat\
            -MERGEDOUTCAT_NAME ' + 'merged.cat -FULLOUTCAT_NAME ' + 'full.cat\
            -c ' + config_scamp + '-AHEADER_SUFFIX '+ self.dm.pc_combined_file("cat","ahead")
            print(scamp_comd)
            p=Popen(scamp_comd,shell=True)
            p.wait()


    def convert_hdu_to_ldac(self, hdu):
        """
@@ -182,14 +176,14 @@ class CsstProcMscPositionCalibration(CsstProcessor):
        tbl2.header['EXTNAME'] = 'LDAC_OBJECTS'
        return tbl1, tbl2

    def get_refcat(self, img_list, path_gaia, search_radius, silent=True):
    def get_refcat(self, img_list, path_gaia, search_radius, silent=True,pm_correct=True):
        """
        Get reference catalog for scamp. The reference cat is GAIA EDR3.

        Parameters
        ----------
        image_prefix:
            a image to get its reference catalog, e.g.,MSC_210304093000_0000000_img.fits.
            a image to get its reference catalog, e.g.,combined_img.fits.
            Usually the center of the image is the wcs parameters CRVAL1,CRVAL1.
        search_radius:
            circle radius for searching, units: degree. e.g., 2 degree for a 1x1 deg^2 image.
@@ -199,19 +193,24 @@ class CsstProcMscPositionCalibration(CsstProcessor):
        Returns
        -------
        outcat:
            filename of the cross matched catalog.
            This catalog is used as a reference catalog for running scamp.
            e.g.,MSC_210304093000_0000000.gaialac.fits

            filename of the cross matched catalog: ref.cat
        """
        image_prefix = (img_list[0][0].header)['FILENAME'][0:-7]
        fname = image_prefix + '_img.fits'
        gaianame = image_prefix + '.gaia.fits'
        gaialacnm = image_prefix + '.gaialac.fits'
        outcat = gaianame
        outcat = self.dm.pc_ref_cat
        fnmae =  cb_fn = self.dm.pc_combined_file("img","fits")
        hdu = fits.open(fname)
        header1 = hdu[0].header
        header2 = hdu[1].header
        if (pm_correct):
            oday=header1['DATE-OBS']
            otime=header1['TIME-OBS']
            exptime=header1['EXPTIME']
            odaytime=header1['DATE-OBS']+'T'+header1['TIME-OBS']
            t = Time(oday, format='isot', scale='utc')
            t.format = 'decimalyear'
            t1=Time(2016.0, format='decimalyear', scale='utc')
            deltatime= t.value -2016.0
            print('(Time - 2016.0) = deltatime =', deltatime)
        else:   
            deltatime=0.00  
        ra = float(header2['CRVAL1'])
        dec = float(header2['CRVAL2'])
@@ -244,7 +243,6 @@ class CsstProcMscPositionCalibration(CsstProcessor):
            refcat = table.vstack(refcat, join_type='inner')
        refcat.rename_column('ra', 'X_WORLD')
        refcat.rename_column('dec', 'Y_WORLD')
        print('delta_time between obs_cat and ref_cat:', deltatime)

        mask = (refcat['pmdec'] != refcat['pmdec'])
        refcat['pmdec'][mask] = 0
@@ -258,21 +256,16 @@ class CsstProcMscPositionCalibration(CsstProcessor):
        refcat.rename_column('ra_error', 'ERRA_WORLD')
        refcat.rename_column('dec_error', 'ERRB_WORLD')
        refcat.rename_column('phot_g_mean_mag', 'MAG')
        if outcat: refcat.write(outcat, format='fits', overwrite=True)

        if os.path.isfile(gaianame):
            print('exist')
            hdu = fits.open(gaianame)
        hdu = refcat
        hdu1 = self.convert_hdu_to_ldac(hdu)
        hdup = fits.PrimaryHDU()
        hdu = hdu1[0]
        tbhdu = hdu1[1]
        thdulist = fits.HDUList([hdup, hdu, tbhdu])
            if os.path.isfile(gaialacnm): os.remove(gaialacnm)
            thdulist.writeto(gaialacnm)
        thdulist.writeto(outcat)

        print('##################### end #####################')
        return gaialacnm

    def rewrite_wcs_head(self, head):
        """
@@ -308,7 +301,7 @@ class CsstProcMscPositionCalibration(CsstProcessor):
        f.close()
        return wcshead

    def check_astrometry(self, img_list, path_output):
    def check_astrometry(self, img_list):
        """
        Check position calibration quality

@@ -316,8 +309,6 @@ class CsstProcMscPositionCalibration(CsstProcessor):
        ------------
        img_list:
            list of images, in table format
        path_output:
            work dir

        Returns
        -------
@@ -333,54 +324,74 @@ class CsstProcMscPositionCalibration(CsstProcessor):
        print('############## check the astrometry quality and save files ################')
        r1 = []
        d1 = []
        image_prefix = (img_list[0][0].header)['FILENAME'][0:-7]
        fn = path_output + image_prefix
        wcshead = self.rewrite_wcs_head(fn + '.acat.head')
        acat = fits.open(fn + '.acat.fits')
        acat_change = str(fn + '.acat.change.fits')
        cat_suffix = '.acat'
        fn_head = self.dm.pc_combined_file("cat","head")
        fn_scat = self.dm.pc_combined_file("cat","fits")
        data_scat = fits.open(fn_scat)

        wcshead = self.rewrite_wcs_head(fn_head)
        scat = fits.open(fn_scat)
        hdul = fits.HDUList()
        if len(img_list) == 18:
        for i in range(0, len(img_list)):
            wcshdr = fits.getheader(wcshead, i, ignore_missing_simple=True)  # read headers and change to RA---TPV,DEC--TPV for wcs_transfer package
            wcshdr['CTYPE1'] = 'RA---TPV'
            wcshdr['CTYPE2'] = 'DEC--TPV'
            w = WCS(wcshdr)
                # print(wcshdr)
                cat_nm = path_output + (img_list[i][0].header)['FILENAME'] + cat_suffix
                cat_i = fits.open(cat_nm)
                sexcat = cat_i[2].data
                ra_sex = sexcat['ALPHA_J2000']
                dec_sex = sexcat['DELTA_J2000']
            sexcat = data_scat[i*3+2].data
            x = sexcat['XWIN_IMAGE']
            y = sexcat['YWIN_IMAGE']
            r, d = w.all_pix2world(x, y, 0)  # convert xwin,ywin to ra,de
            sexcat['ALPHA_J2000'] = r
            sexcat['DELTA_J2000'] = d
                cat_i[2].data = sexcat
                hdul.append(cat_i[0])
                hdul.append(cat_i[1])
                hdul.append(cat_i[2])
            r1 = np.hstack((r1, r))
            d1 = np.hstack((d1, d))
        obsc = SkyCoord(ra=r1 * u.degree, dec=d1 * u.degree)
        tmp_cat = np.zeros((len(obsc), 2))
        tmp_cat[:, 0] = obsc.ra
        tmp_cat[:, 1] = obsc.dec
            np.savetxt(path_output + 'scamp_coord.txt', tmp_cat, fmt="%.10f %.10f", delimiter="\n")
            hdul.writeto(acat_change, overwrite=True)  # update the cat with new ra,dec (from 1st scamp wcs.)
        else:
            print('the length of fitslist is not equal to 18,needs to check')

    def write_headers(self, img_list):
        np.savetxt(dm.pc_scamp_coord, tmp_cat, fmt="%.10f %.10f", delimiter="\n")

        gaia_cat=Table.read(self.dm.pc_ref_cat) 
        gaia_ra=gaia_cat['X_WORLD']
        gaia_dec=gaia_cat['Y_WORLD']
        refc=SkyCoord(ra=gaia_ra*u.degree,dec=gaia_dec*u.degree)
        idx, d2d, d3d = obsc.match_to_catalog_sky(refc)
        ref_uid=np.unique(idx)
        obs_uid=np.full_like(ref_uid,-1)
        tmpj=-1
        ccdraoff_med=ccddecoff_med=ccdra_rms=ccddec_rms=-1
        for i in ref_uid:
            tmpj=tmpj+1
            iid=(idx == i)
            iiid = (d2d.deg[iid] == d2d.deg[iid].min())
            obs_uid[tmpj]=iid.nonzero()[0][iiid.nonzero()[0]][0]

        uidlim=d2d[obs_uid].arcsecond <1. # set match radius=1 arcsec
        if uidlim.sum()>0:
            obs_uidlim=obs_uid[uidlim]
            ref_uidlim=ref_uid[uidlim]
            ccdraoff=(obsc[obs_uidlim].ra- refc[ref_uidlim].ra).arcsec*np.cos(obsc[obs_uidlim].dec.deg*np.pi/180.)
            ccdraoff_med=np.median(ccdraoff)
            ccdra_rms=np.std(ccdraoff)
            ccddecoff=(obsc[obs_uidlim].dec- refc[ref_uidlim].dec).arcsec
            ccddec_rms=np.std(ccddecoff)
            ccddecoff_med=np.median(ccddecoff)
            match_num=len(ccdraoff)
            print('################# astrometry result: ##############')
            if (match_num<100):
                print('### bad astrometry ###')
        print('median ra_off, dec_off (mas) from scamp:',ccdraoff_med*1000.,ccddecoff_med*1000.)  
        print('rms ra_off, dec_off (mas) from scamp:',ccdra_rms*1000.,ccddec_rms*1000.)  
        print('############################################')    
        return ccdraoff,ccddecoff,ccdraoff_med,ccddecoff_med,ccdra_rms,ccddec_rms

    def write_headers(self, ccd_ids):
        """
        Wrtie history to header
        """
        head_suffix = img_list[0][0].header['FILENAME'][0:-7] + '.acat.head.fits'
        head_suffix = self.dm.pc_combined_head_fits
        hdul2 = fits.open(head_suffix, ignore_missing_simple=True)
        if len(img_list) == 18:
            for i in range(0, len(img_list)):
                fits_nm = img_list[i][0].header['FILENAME'] + '.head'
        for this_ccd_id in ccd_ids:
             fits_nm = self.dm.l1_sci(this_ccd_id, suffix="img", ext="head")
             hdul1 = fits.open(fits_nm, mode='update', ignore_missing_simple=True)
             hdr = hdul1[0].header
             hdr2 = hdul2[i].header
@@ -393,59 +404,62 @@ class CsstProcMscPositionCalibration(CsstProcessor):
             hdr.set('WCS_V', WCS_V, 'Version of WCS calibration')
             hdr.set('WCS_P', WCS_P, 'Configure file name of WCS')
             hdr.set('WCS_TOL', WCS_TOL, 'Time of last wcs calibration')
                # hdul1.flush()
                # hdul1.close()
        else:
            print('The total number of the fits files is not 18.')

    def prepare(self, path_gaia, path_output, search_radius=2.0):
        self.path_gaia = path_gaia
        self.path_output = path_output
        self.search_radius = search_radius

    def run(self, img_list, wht_list, flg_list, fn_list, path_gaia, path_output, search_radius):
             hdul1.flush()
             hdul1.close()

    def make_plots(self, ccdoff):
        print('##### Analyzing the scampe result, making some pltos.... ####')
        plt.figure(figsize=(11,5))
        ax1=plt.subplot(121)
        bin=0.05
        plt.grid(color='grey',ls='--')
        plt.plot(ccdoff[0],ccdoff[1],'ko',markersize=3,alpha=0.3)
        plt.xlabel(r'$\Delta$ RA (arcsec)',fontsize=12)
        plt.ylabel(r'$\Delta$ Dec (arcsec)',fontsize=12)
        ax2=plt.subplot(122)
        plt.grid(color='grey',ls='--')
        plt.hist(ccdoff[0],bins=np.arange(-1,1, bin),histtype="step",color="r",label=r'$\Delta$RA (arcsec)')
        plt.hist(ccdoff[1],bins=np.arange(-1,1, bin),histtype="step",color="b",label=r'$\Delta$Dec (arcsec)')
        plt.legend()
        a=str(float(ccdoff[2]))
        b=str(float(ccdoff[4]))
        c=str(float(ccdoff[3]))
        d=str(float(ccdoff[5]))
        plt.text(-0.95,45,r'$\mu$='+a[0:6]+r',  $\sigma$='+b[0:5]+' (arcsec)',color='red')
        plt.text(-0.95,35,r'$\mu$='+c[0:6]+r',  $\sigma$='+d[0:5]+' (arcsec)',color='blue')
        plt.xlabel('coord_diff (arcsec)',fontsize=12)            
        plt.savefig(self.dm.pc_radecoff,dpi=300)


    def prepare(self, dm):
        self.dm = dm

    def run(self, img_list, wht_list, flg_list, ccd_ids, path_gaia, search_radius, pm_correct=True, wcs_refine=False, plot=False):
        print('preparing files for position calibration....')
        self.join_data(img_list, wht_list, flg_list, path_output=path_output)
        self.join_data(img_list, wht_list, flg_list)
        print('################## run sextractor ###################')
        p = Pool()
        prod_x = partial(self.run_sextractor, path_output=path_output)
        result = p.map(prod_x, fn_list)
        prod_x = partial(self.run_sextractor)
        result = p.map(prod_x, ccd_ids)
        p.close()
        p.join()
        print('################## sextractor done ###################')
        print('############### combine sextractor catalog ###############')
        self.combine_catalog(img_list, path_output)
        self.combine_catalog(ccd_ids)
        print('############### get reference catalog ###############3')
        refcat = self.get_refcat(img_list, path_gaia=path_gaia, search_radius=search_radius, silent=True)
        Popen('cp ' + refcat + ' ref.cat', shell=True)
        self.get_refcat(img_list, path_gaia=path_gaia, search_radius=search_radius, silent=True,pm_correct=True)
        print('############### run scamp ##################')
        self.run_scamp(img_list, path_output=path_output)
        self.run_scamp(wcs_refine=wcs_refine)
        print('################ scamp done #################')
        print('Checking astrometry quality....')
        self.check_astrometry(img_list, path_output)
        ccdoff = self.check_astrometry(img_list)
        print('################ updating headers.... #############')
        self.write_headers(img_list)
        self.write_headers(ccd_ids)
        print('#### Position calibration process done ####')

    def cleanup(self, img_list, path_output):
        # clean up environment
        image_prefix = img_list[0][0].header['FILENAME'][0:-7]
        for i in range(0, len(img_list)):
            fn = img_list[i][0].header['FILENAME'] + '.acat'
            if os.path.isfile(path_output + fn): os.remove(path_output + fn)
        if os.path.isfile(path_output + image_prefix + '.gaia.fits'):
            os.remove(path_output + image_prefix + '.gaia.fits')
        if os.path.isfile(path_output + image_prefix + '.gaialac.fits'):
            os.remove(path_output + image_prefix + '.gaialac.fits')
        if os.path.isfile(path_output + 'scamp.xml'):
            os.remove(path_output + 'scamp.xml')
        if os.path.isfile(path_output + 'full_1.cat'):
            os.remove(path_output + 'full_1.cat')
        if os.path.isfile(path_output + 'merged_1.cat'):
            os.remove(path_output + 'merged_1.cat')
        if os.path.isfile(path_output + image_prefix + '_img.fits.back'):
            os.remove( path_output + image_prefix + '_img.fits.back')
        if os.path.isfile(path_output + image_prefix + '_wht.fits'):
            os.remove(path_output + image_prefix + '_wht.fits')
        if os.path.isfile(path_output + image_prefix + '_flg.fits'):
            os.remove(path_output + image_prefix + '_flg.fits')
        if plot:
            make_plot(ccdoff)
                    
        def cleanup(self):
            pass

csst/msc/calib_pos.py~

0 → 100644
+465 −0

File added.

Preview size limit exceeded, changes collapsed.

+289 −0

File added.

Preview size limit exceeded, changes collapsed.

+25 −9
Original line number Diff line number Diff line
@@ -107,8 +107,24 @@ def do_one_exposure(ver_sim="C5.1", dir_l0="", dir_l1="", dir_pcref="", path_aux

    # Step 2. Calibrate Position
    pcProc = CsstProcMscPositionCalibration()
    pcProc.run(img_list, wht_list, flg_list, fn_list, dir_pcref, dir_l1, 2.0)
    pcProc.cleanup(img_list, dir_l1)
    pcProc.prepare(dm)   
    if (img_list):
        pcProc.run(img_list, wht_list, flg_list, ccd_ids, dir_pcref, 2.0, pm_correct=True, wcs_refine=True, plot=True)
    else:
        for this_ccd_id in ccd_ids:
            fp_img = dm.l1_sci(ccd_id=this_ccd_id, suffix="img",ext="fits")
            fp_wht = dm.l1_sci(ccd_id=this_ccd_id, suffix="wht",ext="fits")
            fp_flg = dm.l1_sci(ccd_id=this_ccd_id, suffix="flg",ext="fits")
            img = CsstMscImgData.read(fp_img)
            wht = CsstMscImgData.read(fp_wht)
            flg = CsstMscImgData.read(fp_flg)
            img_list.append(img)
            wht_list.append(wht)
            flg_list.append(flg)
        pcProc.run(img_list, wht_list, flg_list, ccd_ids, dir_pcref, 2.0, pm_correct=True, wcs_refine=True, plot=True)

    pcProc.cleanup()

    """
    pcProc = CsstProcMscPositionCalibration()
    pcProc.prepare(dm)
@@ -120,13 +136,13 @@ def do_one_exposure(ver_sim="C5.1", dir_l0="", dir_l1="", dir_pcref="", path_aux
    img_list, dir_l1
    """

    # Step 3. Calibrate Flux
    fcProc = CsstProcFluxCalibration()
    # fcProc.prepare()
    fcProc.run(
        fn_list, img_list, wht_list, flg_list, wcsdir=dir_l1, L1dir=dir_l1, workdir=dir_l1, refdir=dir_l0,
        addhead=True, morehead=False, plot=False, nodel=False, update=False, upcat=True)
    fcProc.cleanup(fn_list, dir_l1)
    ## Step 3. Calibrate Flux
    #fcProc = CsstProcFluxCalibration()
    ## fcProc.prepare()
    #fcProc.run(
        #fn_list, img_list, wht_list, flg_list, wcsdir=dir_l1, L1dir=dir_l1, workdir=dir_l1, refdir=dir_l0,
        #addhead=True, morehead=False, plot=False, nodel=False, update=False, upcat=True)
    #fcProc.cleanup(fn_list, dir_l1)

    """
    fcProc = CsstProcFluxCalibration()

csst/msc/pipeline.py~

0 → 100644
+187 −0

File added.

Preview size limit exceeded, changes collapsed.

Loading