Check LSLGA in DR8

John Moustakas


In [1]:
import os, pdb
import numpy as np
from glob import glob
import fitsio
from astropy.table import vstack, Table, hstack

In [2]:
import seaborn as sns
sns.set(context='talk', style='ticks', font_scale=1.6)
%matplotlib inline

In [4]:
dr8dir = '/global/project/projectdirs/cosmo/data/legacysurvey/dr8'
outdir = '/global/project/projectdirs/desi/users/ioannis/dr8-lslga'
lslgafile = '/global/project/projectdirs/cosmo/staging/largegalaxies/v2.0/LSLGA-v2.0.fits'

In [5]:
lslga = Table(fitsio.read(lslgafile))
#lslga

In [19]:
def build_lslga_dr8(northsouth, overwrite=False):
    cols = ['RA', 'DEC', 'TYPE', 'BRICKNAME', 'REF_CAT', 
            'FRACDEV', 'SHAPEEXP_R', 'SHAPEEXP_E1', 'SHAPEEXP_E2',
            'SHAPEDEV_R', 'SHAPEDEV_E1', 'SHAPEDEV_E2', 'REF_ID']

    outfile = os.path.join(outdir, 'dr8-lslga-{}.fits'.format(northsouth))
    if not os.path.isfile(outfile) or overwrite:
        out = []
        catfile = glob(os.path.join(dr8dir, northsouth, 'sweep', '8.0', 'sweep-*.fits'))
        #catfile = glob(os.path.join(dr8dir, northsouth, 'tractor', '???', 'tractor*.fits'))
        for ii, ff in enumerate(catfile):#[:3]):
            if ii % 20 == 0:
                print('{} / {}'.format(ii, len(catfile)))
            cc = fitsio.read(ff, columns=cols, upper=True)
            ckeep = np.where(cc['REF_CAT'] == b'L2')[0]
            out.append(Table(cc[ckeep]))
        out = vstack(out)
        
        # find and remove duplicates
        #uval, cnt = np.unique(out['REF_ID'], return_counts=True)
        #dup_refid = uval[cnt > 1]

        # now match against the LSLGA
        match = np.hstack([np.where(refid == lslga['LSLGA_ID'])[0] for refid in out['REF_ID']])
        
        lss = lslga[match]
        lss.rename_column('RA', 'RA_LSLGA')
        lss.rename_column('DEC', 'DEC_LSLGA')
        lss.rename_column('TYPE', 'MORPHTYPE')

        out = hstack((lss, out))
        
        print('Writing {}'.format(outfile))
        out.write(outfile, overwrite=True)
    else:
        print('Reading {}'.format(outfile))
        out = Table(fitsio.read(outfile))
    return out

In [20]:
%time north = build_lslga_dr8('north', overwrite=False)


0 / 286
20 / 286
40 / 286
60 / 286
80 / 286
100 / 286
120 / 286
140 / 286
160 / 286
180 / 286
200 / 286
220 / 286
240 / 286
260 / 286
280 / 286
Writing /global/project/projectdirs/desi/users/ioannis/dr8-lslga/dr8-lslga-north.fits
CPU times: user 2min 44s, sys: 56.9 s, total: 3min 41s
Wall time: 4min 10s

In [22]:
%time south = build_lslga_dr8('south', overwrite=False)


0 / 437
20 / 437
40 / 437
60 / 437
80 / 437
100 / 437
120 / 437
140 / 437
160 / 437
180 / 437
200 / 437
220 / 437
240 / 437
260 / 437
280 / 437
300 / 437
320 / 437
340 / 437
360 / 437
380 / 437
400 / 437
420 / 437
Writing /global/project/projectdirs/desi/users/ioannis/dr8-lslga/dr8-lslga-south.fits
CPU times: user 9min 18s, sys: 3min 34s, total: 12min 53s
Wall time: 13min 52s

In [47]:
def merge_north_south(overwrite=False):
    mergedfile = os.path.join(outdir, 'dr8-lslga-northsouth.fits')
    if not os.path.isfile(mergedfile) or overwrite:
        out = []
        for northsouth in ('north', 'south'):
            catfile = os.path.join(outdir, 'dr8-lslga-{}.fits'.format(northsouth))
            cat = Table(fitsio.read(catfile))
            cat['REGION'] = northsouth
            out.append(cat)
        out = vstack(out)
        print('Writing {}'.format(mergedfile))
        out.write(mergedfile, overwrite=True)
    else:
        print('Reading {}'.format(mergedfile))
        out = Table(fitsio.read(mergedfile))
    return out

In [48]:
%time cat = merge_north_south(overwrite=True)


Writing /global/project/projectdirs/desi/users/ioannis/dr8-lslga/dr8-lslga-northsouth.fits
CPU times: user 16.5 s, sys: 426 ms, total: 16.9 s
Wall time: 17.6 s

In [49]:
cat


Out[49]:
<Table length=403604>
LSLGA_IDGALAXYPGCRA_LSLGADEC_LSLGAMORPHTYPEBARRINGMULTIPLECOMPACTNESSTPAD25BADIAM_REFZSB_D25MAGMAG_REFWISE_RAWISE_DECCNTRW1MPROW1SIGMPROW2MPROW2SIGMPROW3MPROW3SIGMPROW4MPROW4SIGMPRORCHI2CC_FLAGSEXT_FLGPH_QUALXSCPROXW1RSEMIW1BAW1PAW1GMAGW1GERRW2GMAGW2GERRW3GMAGW3GERRW4GMAGW4GERRIN_ALLWISEIN_DESINEAR_BRIGHTSTARBRICKNAMETYPERADECFRACDEVSHAPEDEV_RSHAPEDEV_E1SHAPEDEV_E2SHAPEEXP_RSHAPEEXP_E1SHAPEEXP_E2REF_CATREF_IDREGION
int64bytes29int64float64float64bytes4bytes3bytes3bytes3bytes3float32float32float32float32bytes3float32float32float32bytes1float64float64int64float64float64float64float64float64float64float64float64float32bytes4int32bytes4float64float64float64float64float64float64float64float64float64float64float64float64boolboolboolbytes8bytes4float64float64float32float32float32float32float32float32float32bytes2int64str5
14446PGC18840231884023141.429712529.9424196E?nannannannan-5.094.470.363078060.36307806iso0.05989076624.6604818.232B141.429882329.9424617140813020135102399613.6680.02513.4340.03210.0850.0628.4210.3141.95400001AAABnannannannannannannannannannannannanTrueTrueFalse1415p300EXP141.4298614216317629.9425042494774270.00.00.00.04.4602566-0.57790524-0.10098956L214446north
360448PGC18859321885932142.5046439999999829.992207699999998SBcBnannannan4.936.430.43651580.8128305iso0.0268539123.34948216.521B142.504681529.9922294142613020135101833213.980.02813.8570.04110.6890.1048.44nan4.02100005AAAU0.0810.050.7125.013.720.01413.7170.03411.1180.0879.5330.729TrueTrueFalse1424p300DEV142.5047366420882329.9924063109530971.052.3818970.091540450.21338910.00.00.0L2360448north
991749PGC18671831867183147.1467689999999829.466061199999995S?nannannannan3.088.480.562341330.22908677iso0.1131716225.7374818.359B147.146257329.4661434147412870135106094414.0840.03313.7550.04210.7720.1198.672nan1.29600000AABUnannannannannannannannannannannannanTrueTrueFalse1471p295COMP147.146883754525729.4660731585232830.26515345.21392150.034630653-0.005168736412.5653105-0.84547350.09161035L2991749north
936109UGC0498326553140.7243165000000129.3290403SABcBnannanD5.05.30.63826350.8550667iso0.02245086423.3884815.735B140.72422329.3290205140512870135105814114.2730.0314.1080.04410.6470.098.6670.3983.53200005AAAC1.4110.560.7825.013.640.0113.6360.04710.7540.0659.2930.735TrueTrueFalse1406p292COMP140.724265745791229.329019762708820.0155358850.64649796-0.180280570.3998442615.13089750.00422607970.033641696L2936109north
1288301PGC18689601868960149.519251529.521296399999997Sbcnannannannan3.878.870.338844120.53703177iso0.0893491423.96848117.69B149.51922429.5213114149112870135105556114.0960.02713.9110.03910.5590.0838.5430.3141.657d0000AAABnannannannannannannannannannannannanTrueTrueFalse1494p295EXP149.519187816341529.521298080150570.00.00.00.04.19832-0.399558720.17533746L21288301north
480891IC249027121143.2651350000000129.9283201SABbBnannannan3.6177.20.96605090.674528iso0.0244645923.15248114.599B143.265245529.92837142613020135102364411.3320.02211.4290.0218.9940.0336.950.09618.400005AAAA0.9117.450.76-5.010.9770.00610.9730.0088.4110.0146.7130.073TrueTrueFalse1432p300COMP143.2651713498253229.9283531405974980.566268868.5139870.21420135-0.08173127513.3102330.150069620.03789386L2480891north
1270041SDSSJ095530.97+295527.84090945148.878961529.9243707nannannannannannan145.740.337775650.43179256r0.2524506225.00062218.729B148.878857929.9244662149513020135101357114.340.02813.970.03811.8530.2878.297nan1.73900001AABUnannannannannannannannannannannannanTrueTrueFalse1487p300EXP148.8790414928507729.924403518179410.00.00.00.04.7754460.11539114-0.03364276L21270041north
1284218PGC18658501865850146.7696375000000229.423734000000003EnannanMnan-5.023.850.35481340.60255957iso0.0989040823.5004817.122B146.769689529.4235671147412870135106360413.2530.04113.1430.04411.9470.4298.102nan1.38600000AACUnannannannannannannannannannannannanTrueTrueFalse1468p295DEV146.7697359893452629.423750415209091.03.2087450.1204856260.108940580.00.00.0L21284218north
817184PGC18793351879335143.6661329.8195847S?nannannannan0.442.010.602559570.33884415iso0.0625689523.9664816.438B143.66612829.8195638144313020135101324612.630.02412.5610.02510.3480.0828.2770.2927.30800005AAAB0.517.110.540.012.3480.00712.2990.01210.4150.0688.8940.589TrueTrueFalse1436p297COMP143.6662182424108829.819532841314010.42377175.22147750.0213607680.1650871510.0688840.0371585750.7094191L2817184north
826763PGC18795951879595143.714203529.8259234Scnannannannan4.781.680.588843640.29512095iso0.0625025724.83248117.354B143.71486929.8259378144313020135101327814.1590.03513.9610.04610.9230.1438.22nan1.38600004AABU2.35nannannannannannannannannannannanTrueTrueFalse1436p297COMP143.7141913008444229.8258890541747770.118571822.4860249-0.28585702-0.0926713811.205339-0.719062270.25517362L2826763north
.............................................................................................................................................................................................
801256PGC07024070240345.11355000000003-15.37Sbcnannannannan3.9102.50.69023980.52480745isonan23.12348215.3B345.1134211-15.3703334344301520135102284612.9910.02512.870.0279.0140.0356.1840.0518.82500001AAAAnannannannannannannannannannannannanTrueFalseFalse3451m152EXP345.11334615704607-15.3703230923726670.00.00.00.09.323799-0.23263115-0.12231542L2801256south
229099PGC912914912914345.3909165-15.310222199999998nannannannannannan130.00.338844120.61659503isonan23.6084817.33B345.3909089-15.3103215345901520135101318713.1010.02513.0520.02911.728nan9.046nan1.89100001AAUUnannannannannannannannannannannannanTrueFalseFalse3453m152DEV345.3908925540459-15.3103283964695421.02.3546110.14913413-0.231101530.00.00.0L2229099south
58186PGC915086915086345.441-15.1468889nannannannannannannan0.454988060.88104886isonan23.5084816.59B345.4408466-15.1473349345901520135103380913.1730.03613.1310.04311.060.1788.1310.422.36100005AABC1.619.960.91-45.012.8610.00812.8190.0210.930.1088.7030.343TrueFalseFalse3453m152DEV345.44084859637735-15.1470095772238121.07.1446540.0210463030.0465186240.00.00.0L258186south
702965PGC916896916896345.47462549999995-15.012722199999997nannannannannannan114.00.346736850.58884364isonan23.69848317.37B345.4745713-15.0126736345901520135103380312.6430.02312.2270.0268.0390.025.030.0361.52700004AAAA0.329.630.8285.012.7950.00812.4430.0168.7860.0175.740.024TrueFalseFalse3453m150EXP345.47451164425075-15.0126269526651070.00.00.00.03.348878-0.18262979.5841184e-05L2702965south
133475PGC915899915899345.25820849999997-15.088194400000003nannannannannannan130.00.39810720.64565426isonan23.48848216.86B345.2580002-15.0880483345901520135103652114.2450.02914.0010.04510.0320.0657.5230.1461.81900005AAAB0.959.870.68-50.014.1550.0214.050.05210.6920.0838.1460.25TrueFalseFalse3451m150DEV345.25802612651574-15.088077169706261.018.702951-0.078467116-0.259111730.00.00.0L2133475south
623765PGC917031917031345.1396245-15.003972199999998nannannannannannan111.00.363078060.48977882isonan24.1284817.7B345.139628-15.0040875345901520135103649413.7080.02913.6420.0412.121nan8.592nan1.16900000AAUUnannannannannannannannannannannannanTrueFalseFalse3451m150DEV345.1396751037598-15.004154655907781.04.596584-0.3599573-0.179158720.00.00.0L2623765south
1391062PGC09177491774345.85686599999997-15.224372199999998Scnannannannan5.4176.00.650129740.22490546isonan24.97348217.28B0.00.0-10.00.00.00.00.00.00.00.00.000.00.00.00.00.00.00.00.00.00.00.00.0FalseFalseFalse3459m152EXP345.8572887811437-15.2246017572731970.00.00.00.07.4088210.6795431-0.12320798L21391062south
1034609PGC913646913646345.6561255-15.253472199999997nannannannannannan38.50.346736850.74131024isonan23.75848217.43B345.6563211-15.2533169345901520135103381613.3290.02513.2840.03211.748nan8.746nan1.94600001AAUUnannannannannannannannannannannannanTrueFalseFalse3456m152DEV345.65632740087807-15.2533318155018841.02.33658580.0039985060.118554060.00.00.0L21034609south
244913PGC914021914021345.71340000000004-15.2267881nannannannannannan123.00.338844120.8709636isonan23.4484817.17B345.7131716-15.2271931345901520135103382514.0540.0413.9690.05110.7260.1437.756nan1.49400000AABUnannannannannannannannannannannannanTrueFalseFalse3456m152DEV345.7133014662982-15.2268225739960031.035.0059550.031914312-0.0210827850.00.00.0L2244913south
345482PGC910414910414345.72675-15.500694400000002nannannannannannan97.00.389045120.52480745isonan23.6684817.09B345.7275541-15.5008275345901520135101579614.1630.04513.9860.05911.4290.247.844nan1.48300004AABU2.69nannannannannannannannannannannanTrueFalseFalse3456m155EXP345.7268374650203-15.5007385319063250.00.00.00.04.827437-0.3309322-0.08476246L2345482south

In [50]:
urefid, uindx = np.unique(cat['REF_ID'], return_index=True)
dup = np.delete(np.arange(len(cat)), uindx)
cat[dup]
cat[cat['REF_ID'] == 462171]


Out[50]:
<Table length=3>
LSLGA_IDGALAXYPGCRA_LSLGADEC_LSLGAMORPHTYPEBARRINGMULTIPLECOMPACTNESSTPAD25BADIAM_REFZSB_D25MAGMAG_REFWISE_RAWISE_DECCNTRW1MPROW1SIGMPROW2MPROW2SIGMPROW3MPROW3SIGMPROW4MPROW4SIGMPRORCHI2CC_FLAGSEXT_FLGPH_QUALXSCPROXW1RSEMIW1BAW1PAW1GMAGW1GERRW2GMAGW2GERRW3GMAGW3GERRW4GMAGW4GERRIN_ALLWISEIN_DESINEAR_BRIGHTSTARBRICKNAMETYPERADECFRACDEVSHAPEDEV_RSHAPEDEV_E1SHAPEDEV_E2SHAPEEXP_RSHAPEEXP_E1SHAPEEXP_E2REF_CATREF_IDREGION
int64bytes29int64float64float64bytes4bytes3bytes3bytes3bytes3float32float32float32float32bytes3float32float32float32bytes1float64float64int64float64float64float64float64float64float64float64float64float32bytes4int32bytes4float64float64float64float64float64float64float64float64float64float64float64float64boolboolboolbytes8bytes4float64float64float32float32float32float32float32float32float32bytes2int64str5
462171PGC18947951894795222.7623750000000230.2149495EnannanMnan-5.015.190.67764150.699842iso0.1268407424.59148216.808B222.762316530.2149434222613020135103204012.670.02312.5440.02311.3530.1128.968nan4.87800005AABU0.8510.950.8330.012.5330.00712.4550.00911.7940.14111.0031.685TrueTrueFalse2226p302REX222.7578833149621630.210703313099890.00.00.00.060.00.00.0L2462171north
462171PGC18947951894795222.7623750000000230.2149495EnannanMnan-5.015.190.67764150.699842iso0.1268407424.59148216.808B222.762316530.2149434222613020135103204012.670.02312.5440.02311.3530.1128.968nan4.87800005AABU0.8510.950.8330.012.5330.00712.4550.00911.7940.14111.0031.685TrueTrueFalse2229p302PSF222.76314533383530.2141298605712480.00.00.00.00.00.00.0L2462171north
462171PGC18947951894795222.7623750000000230.2149495EnannanMnan-5.015.190.67764150.699842iso0.1268407424.59148216.808B222.762316530.2149434222613020135103204012.670.02312.5440.02311.3530.1128.968nan4.87800005AABU0.8510.950.8330.012.5330.00712.4550.00911.7940.14111.0031.685TrueTrueFalse2229p302DEV222.762279625371130.2149410419382251.05.69699050.0797715860.0288791060.00.00.0L2462171south

In [58]:
ww = [tt.strip() == 'REX' for tt in cat['TYPE']]
cat[ww]


Out[58]:
<Table length=3923>
LSLGA_IDGALAXYPGCRA_LSLGADEC_LSLGAMORPHTYPEBARRINGMULTIPLECOMPACTNESSTPAD25BADIAM_REFZSB_D25MAGMAG_REFWISE_RAWISE_DECCNTRW1MPROW1SIGMPROW2MPROW2SIGMPROW3MPROW3SIGMPROW4MPROW4SIGMPRORCHI2CC_FLAGSEXT_FLGPH_QUALXSCPROXW1RSEMIW1BAW1PAW1GMAGW1GERRW2GMAGW2GERRW3GMAGW3GERRW4GMAGW4GERRIN_ALLWISEIN_DESINEAR_BRIGHTSTARBRICKNAMETYPERADECFRACDEVSHAPEDEV_RSHAPEDEV_E1SHAPEDEV_E2SHAPEEXP_RSHAPEEXP_E1SHAPEEXP_E2REF_CATREF_IDREGION
int64bytes29int64float64float64bytes4bytes3bytes3bytes3bytes3float32float32float32float32bytes3float32float32float32bytes1float64float64int64float64float64float64float64float64float64float64float64float32bytes4int32bytes4float64float64float64float64float64float64float64float64float64float64float64float64boolboolboolbytes8bytes4float64float64float32float32float32float32float32float32float32bytes2int64str5
315741PGC19905551990555229.1951040000000132.302775800000006nannannannannannan24.00.39810720.52480745isonan24.07848217.45B229.19503132.3027161229413180135105997814.2950.05514.3890.06513.069nan9.64nan1.00200000AAUUnannannannannannannannannannannannanTrueTrueFalse2291p322REX229.195122049818732.302759519361960.00.00.00.00.216221050.00.0L2315741north
462171PGC18947951894795222.7623750000000230.2149495EnannanMnan-5.015.190.67764150.699842iso0.1268407424.59148216.808B222.762316530.2149434222613020135103204012.670.02312.5440.02311.3530.1128.968nan4.87800005AABU0.8510.950.8330.012.5330.00712.4550.00911.7940.14111.0031.685TrueTrueFalse2226p302REX222.7578833149621630.210703313099890.00.00.00.060.00.00.0L2462171north
1371413SDSSJ150625.84+305821.24012714226.6077254999999630.9726027S?nannannannan10.030.490.370680750.8912509iso0.07942060424.53848318.065B226.607706530.9725723226013020135105476215.550.03615.3720.07111.9920.1749.3070.4851.05300000AABCnannannannannannannannannannannannanTrueTrueFalse2267p310REX226.607669659857130.9725390240993260.00.00.00.05.0374550.00.0L21371413north
595523PGC19220941922120225.91201830.882962899999995Scnannannannan4.7nan0.39355010.79250133iso0.0625382623.5384816.935B225.91142430.8831464226013020135105731814.0780.04114.0150.0510.5570.0688.348nan1.69300001AAAUnannannannannannannannannannannannanTrueTrueFalse2258p310REX225.9119743973363730.8829266357068160.00.00.00.04.3155150.00.0L2595523north
840119SDSSJ151418.44+345836.94012783228.576865534.9769283S?nannannannan10.0147.270.350751880.8851156iso0.0903331624.60048118.247B228.576964934.9769404228413480135103231415.6450.03615.5270.07712.230.2229.699nan1.05700000AABUnannannannannannannannannannannannanTrueTrueFalse2285p350REX228.5768562712245334.976920874770850.00.00.00.05.4314250.00.0L2840119north
1294129SDSSJ150553.63+334621.14005415226.473451533.772516100000004S?nannannannan10.0nan0.358096450.90573263iso0.057103524.37948217.981B226.473679633.7726567226713330135104279115.5720.03615.4180.0712.480.2638.874nan1.14700000AABUnannannannannannannannannannannannanTrueTrueFalse2263p337REX226.4735431217536633.772563761795130.00.00.00.05.0893760.00.0L21294129north
1145374SDSSJ145933.78+325040.04541143224.8907459999999832.8444592nannannannannannan148.530.341979440.40457588iso0.00881509824.6184818.32B0.00.0-10.00.00.00.00.00.00.00.00.000.00.00.00.00.00.00.00.00.00.00.00.0FalseTrueFalse2249p327REX224.8908680374929632.8446741468427560.00.00.00.01.93476940.00.0L21145374north
385434SDSSJ151755.64+314119.04005695229.481833531.688612199999998ScnannanMnan6.3141.650.53456440.8035261iso0.03446917624.3464817.078B229.481815231.6886705229413180135103100314.9740.03114.8980.0511.2660.1069.3570.4181.63500001AAACnannannannannannannannannannannannanTrueTrueFalse2293p317REX229.481798796181931.688612725160760.00.00.00.06.5307950.00.0L2385434north
571417SDSSJ144941.27+301925.34434422222.4219095000000330.3237081S?nannannannan10.0120.20.349140320.7161434iso0.0980711724.3894818.046B222.421969430.3236811222613020135103514015.1860.03214.9780.05511.1120.0929.3870.4641.08300000AAACnannannannannannannannannannannannanTrueTrueFalse2223p302REX222.4219213299570330.3236872680009770.00.00.00.03.32507470.00.0L2571417north
278113PGC19133031913303229.9447320000000230.6770026Sbcnannannannan4.1123.790.36559480.84527886iso0.1164428823.68548217.242B229.944861230.6769775229513020135104744913.7640.02913.5580.0339.8780.0498.4950.3391.39100pp4AAAB0.418.910.945.013.640.01113.4530.01510.2930.0918.7310.405TrueTrueFalse2300p307REX229.9447143160897730.6770319350172650.00.00.00.03.54609820.00.0L2278113north
.............................................................................................................................................................................................
276432PGC28069322806932198.5502620.5189801Smnannannannan9.0nan0.660693470.9225714iso0.02168324.46348216.735B198.550298620.5189511198512120135100562215.0920.03614.8840.06411.3340.1588.605nan2.01500001AABUnannannannannannannannannannannannanTrueTrueFalse1985p205REX198.5502622370729620.5188841513874040.00.00.00.010.7397890.00.0L2276432south
368539PGC17140531714053197.98780524.701189199999998Scdnannannannan6.8152.550.464515270.8128305iso0.02363601723.92048316.957B197.988075924.700526198112420135103919314.6090.03714.2450.05211.7230.2758.3050.2864.219hh001AABBnannannannannannannannannannannannanTrueTrueTrue1980p247REX197.9832059962364224.7075372471511870.00.00.00.04.3072250.00.0L2368539south
856292PGC05285052850221.97984619.0516611S?nannanMnan1.2nan0.91201080.38018942iso0.0802221626.46848118.04B221.979999819.0516683222411960135100803114.230.02714.0820.03810.3340.0528.7040.3262.52900005AAAB0.288.840.8780.013.9340.01213.9380.05110.9970.059.4010.426TrueTrueFalse2220p190REX221.9785931746072319.0568925090975120.00.00.00.019.8729040.00.0L2856292south
295018PGC14789851478985222.1060379999999615.2329185S?nannannannan4.223.460.346736850.887156iso0.0666037423.17448216.846B222.106054815.2329975222211510135103117313.9780.02613.8130.0379.9780.0468.4270.2391.76100001AAABnannannannannannannannannannannannanTrueTrueFalse2220p152REX222.1060405105436615.2329535566797760.00.00.00.02.99740270.00.0L2295018south
125618PGC05302153021222.752389516.4764096Sbcnannannannan4.5nan0.476430950.6353309iso0.03999833823.4974816.479B222.75257716.4763822223211660135101618514.1270.02613.9550.03610.5180.0638.4320.2352.63900005AAAB1.089.870.85-65.013.8290.01213.7750.03310.8130.0589.2950.504TrueTrueFalse2228p165REX222.752516402273916.476380824247420.00.00.00.05.8961470.00.0L2125618south
361276PGC05312253122223.1321654999999915.022251800000001Sbcnannannannan4.3112.320.52722990.8165824iso0.06084142323.23148215.993B223.132215315.0222814223811510135103766412.9030.02412.7630.0258.7330.0246.9420.0757.15200005AAAA0.6310.660.88-65.012.780.00812.5960.0139.1060.0157.4190.073TrueTrueFalse2230p150REX223.1321447715317815.0221816624371840.00.00.00.04.7124110.00.0L2361276south
874726PGC05333853338223.8267089999999716.548138899999998Sbcnannannannan4.1nan0.59566210.9354057iso0.04409450322.98448215.481B223.82669216.5482625223211660135102662212.6990.02312.4390.0238.6080.026.3440.0498.8200005AAAA0.4113.70.9250.012.2580.00812.070.018.620.016.7110.065TrueTrueFalse2238p165REX223.8266669702486216.548213955625280.00.00.00.06.28084230.00.0L2874726south
309778PGC15273321527332228.4361579999999817.212657800000002Scnannannannan5.3167.110.341979440.7655966iso0.0670136923.2164816.918B228.436159817.2126331227911660135105553613.9870.02613.8740.03510.1680.0518.5170.2692.06600001AAABnannannannannannannannannannannannanTrueTrueFalse2284p172REX228.4361350801815117.21265694965090.00.00.00.04.15147730.00.0L2309778south
45896PGC14803221480322225.9310515.2801nannannannannannan102.00.50118720.21877615isonan25.72848118.6B225.930328815.2801329225311510135102752015.310.03414.7930.05411.3790.1288.517nan1.265dd000AABUnannannannannannannannannannannannanTrueTrueFalse2259p152REX225.9279048118585515.2807766988005990.00.00.00.01.87790750.00.0L245896south
1010435PGC15905681590568221.326996519.3892517Sbcnannannannan4.2nan0.405508520.9332543iso0.0597993723.53848316.87B221.327529219.3891441220811960135102322214.3990.0414.3020.05310.7890.0868.8870.5121.49600000AAACnannannannannannannannannannannannanTrueTrueFalse2214p195REX221.326904284545319.3892186886305250.00.00.00.05.50197120.00.0L21010435south

Test out the code for adding this catalog as a separate layer


In [73]:
from astrometry.util.fits import fits_table
T = fits_table(os.path.join(outdir, 'dr8-lslga-northsouth.fits'))

In [96]:
def get_ba_pa(e1, e2):
    ee = np.hypot(e1, e2)
    ba = (1 - ee) / (1 + ee)
    #pa = -np.rad2deg(np.arctan2(e2, e1) / 2)
    pa = 180 - (-np.rad2deg(np.arctan2(e2, e1) / 2))
    return ba, pa

def lslga_model(T):
    ba, pa = [], []
    for Tone in T:
        ttype = Tone.type.strip()
        if ttype == 'DEV' or ttype == 'COMP':
            e1, e2 = Tone.shapedev_e1, Tone.shapedev_e2
            _ba, _pa = get_ba_pa(e1, e2)
        elif ttype == 'EXP' or ttype == 'REX':
            e1, e2 = Tone.shapeexp_e1, Tone.shapeexp_e2
            _ba, _pa = get_ba_pa(e1, e2)
        else: # PSF
            _ba, _pa = np.nan, np.nan 
        ba.append(_ba)
        pa.append(_pa)
    T.ba_model = np.hstack(ba)
    T.pa_model = np.hstack(pa)
    T.radius_model_arcsec = T.fracdev * T.shapedev_r + (1 - T.fracdev) * T.shapeexp_r
    T.radius_arcsec = T.d25 / 2. * 60.
    return T

In [97]:
rr = lslga_model(T[:10])

In [98]:
rr.pa, rr.pa_model
rr.ba, rr.ba_model
rr.radius_arcsec, rr.radius_arcsec_model


Out[98]:
(array([10.892342, 13.095474, 16.87024 , 19.147905, 10.165323, 28.981527,
        10.133269, 10.644402, 18.076786, 17.66531 ], dtype=float32),
 array([ 4.4602566, 52.381897 , 10.616065 , 14.9058695,  4.19832  ,
        10.594269 ,  4.775446 ,  3.208745 ,  8.014689 , 10.171474 ],
       dtype=float32))

In [ ]: