FORTRAN Generation
(/./ftp/cats/J/ApJS/258/26)

Conversion of standardized ReadMe file for file /./ftp/cats/J/ApJS/258/26 into FORTRAN code for reading data files line by line.

Note that special values are assigned to unknown or unspecified numbers (also called NULL numbers); when necessary, the coordinate components making up the right ascension and declination are converted into floating-point numbers representing these angles in degrees.



      program load_ReadMe
C=============================================================================
C  F77-compliant program generated by readme2f_1.81 (2015-09-23), on 2026-Aug-16
C=============================================================================
*  This code was generated from the ReadMe file documenting a catalogue
*  according to the "Standard for Documentation of Astronomical Catalogues"
*  currently in use by the Astronomical Data Centers (CDS, ADC, A&A)
*  (see full documentation at URL http://vizier.u-strasbg.fr/doc/catstd.htx)
*  Please report problems or questions to   
C=============================================================================

      implicit none
*  Unspecified or NULL values, generally corresponding to blank columns,
*  are assigned one of the following special values:
*     rNULL__    for unknown or NULL floating-point values
*     iNULL__    for unknown or NULL   integer      values
      real*4     rNULL__
      integer*4  iNULL__
      parameter  (rNULL__=--2147483648.)  	! NULL real number
      parameter  (iNULL__=(-2147483647-1))	! NULL int  number
      integer    idig			! testing NULL number

C=============================================================================
Cat. J/ApJS/258/26     Spectroscopic binaries from LAMOST MRS. I.     (Zhang+, 2022)
*================================================================================
*The spectroscopic binaries from the LAMOST Medium-Resolution Survey.
*I. Searching for double-lined spectroscopic binaries with a convolutional
*neural network.
*    Zhang B., Jing Y.-J., Yang F., Wan J.-C., Ji X., Fu J.-N., Liu C.,
*    Zhang X.-B., Luo F., Tian H., Zhou Y.-T., Wang J.-X., Guo Y.-J., Zong W.,
*    Xiong J.-P., Li J.
*   <Astrophys. J. Suppl. Ser., 258, 26 (2022)>
*   =2022ApJS..258...26Z
C=============================================================================

C  Internal variables

      integer*4 i__

c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

C  Declarations for 'table4.dat'	! The 5 million binary probabilities and RVs
                               obtained from the LAMOST MRS DR8 (v1.0)

      integer*4 nr__
      parameter (nr__=5893382)	! Number of records
      character*519 ar__   	! Full-size record

C  J2000 position composed of: RAdeg DEdeg
      integer*4     ObsID       ! LAMOST observational ID
      integer*4     LMJM        ! (min) Local Modified Julian Minute
      real*8        BJDmid      ! (d) Barycentric Julian Date of the middle of
*                                     exposure
      integer*4     LMJD        ! (d) Local Modified Julian Day
*                                     (only used for spectral naming)
      character*20  planid      ! Plan ID
      integer*4     spid        ! Spectrograph ID
      integer*4     fiber       ! Fiber ID (fiberid)
      real*8        RAdeg       ! (deg) Right ascension (J2000) (ra)
      real*8        DEdeg       ! (deg) Declination (J2000) (dec)
      real*8        SNRB        ! ?=- S/N ratio of the blue arm (snr_B)
      real*8        SNRR        ! ?=- S/N ratio of the red arm (snr_R)
      real*8        RVobsB      ! (km/s) ?=- RV measured from blue arm spectra
*                                     (rv_obs_B)
      real*8        e_RVobsB    ! (km/s) ?=- RVobsB uncertainty (rv_obs_err_B)
      real*8        RVabsB      ! (km/s) ?=- RV calibrated to Gaia eDR3 (rv_abs_B)
      real*8        e_RVabsB    ! (km/s) ?=- Total error of absolute RV
*                                     (rv_err_abs_B)
      integer*4     TeffB       ! (K) ?=- Effective temperature of the best
*                                     template (rv_teff_B)
      real*8        CCFmaxB     ! ?=- CCF max value (ccfmax_B)
      real*8        RVobsR      ! (km/s) ?=- RV measured from red arm spectra
*                                     (rv_obs_R)
      real*8        e_RVobsR    ! (km/s) ?=- RVobsR uncertainty (rv_obs_err_R)
      real*8        RVabsR      ! (km/s) ?=- RV calibrated to Gaia eDR3 (rv_abs_R)
      real*8        e_RVabsR    ! (km/s) ?=- Total error of absolute RV
*                                     (rv_err_abs_R)
      integer*4     TeffR       ! (K) ?=- Effective temperature of the best
*                                     template (rv_teff_R)
      real*8        CCFmaxR     ! ?=- CCF max value (ccfmax_R)
      real*8        PbpB8_0     ! ?=- P_q_^{Lambda}^=8 with q=0 for the blue
*                                     arm (pb_B_8_0)
      real*8        PbpB8_16    ! ?=- P_q_^{Lambda}^=8 with q=16 for the blue
*                                     arm (pb_B_8_16)
      real*8        PbpB8_50    ! ?=- P_q_^{Lambda}^=8 with q=50 for the blue
*                                     arm (pb_B_8_50)
      real*8        PbpB8_84    ! ?=- P_q_^{Lambda}^=8 with q=84 for the blue
*                                     arm (pb_B_8_84)
      real*8        PbpB8_100   ! ?=- P_q_^{Lambda}^=8 with q=100 for the blue
*                                     arm (pb_B_8_100)
      real*8        PbpB16_0    ! ?=- P_q_^{Lambda}^=16 with q=0 for the blue
*                                     arm (pb_B_16_0)
      real*8        PbpB16_16   ! ?=- P_q_^{Lambda}^=16 with q=16 for the blue
*                                     arm (pb_B_16_16)
      real*8        PbpB16_50   ! ?=- P_q_^{Lambda}^=16 with q=50 for the blue
*                                     arm (pb_B_16_50)
      real*8        PbpB16_84   ! ?=- P_q_^{Lambda}^=16 with q=84 for the blue
*                                     arm (pb_B_16_84)
      real*8        PbpB16_100  ! ?=- P_q_^{Lambda}^=16 with q=100 for the
*                                     blue arm (pb_B_16_100)
      real*8        PbpB32_0    ! ?=- P_q_^{Lambda}^=32 with q=0 for the blue
*                                     arm (pb_B_32_0)
      real*8        PbpB32_16   ! ?=- P_q_^{Lambda}^=32 with q=16 for the blue
*                                     arm (pb_B_32_16)
      real*8        PbpB32_50   ! ?=- P_q_^{Lambda}^=32 with q=50 for the blue
*                                     arm (pb_B_32_50)
      real*8        PbpB32_84   ! ?=- P_q_^{Lambda}^=32 with q=84 for the blue
*                                     arm (pb_B_32_84)
      real*8        PbpB32_100  ! ?=- P_q_^{Lambda}^=32 with q=100 for the
*                                     blue arm (pb_B_32_100)
      integer*4     GoodB       ! [0/1] True for good blue spectra (S/N>5)
*                                     (pb_flag_B)
      integer*4     NbadB       ! [0/9999] Number of bad pixels for the blue
*                                     arm (npixbad_B)
      real*8        PbpR8_0     ! ?=- P_q_^{Lambda}^=8 with q=0 for the red
*                                     arm (pb_R_8_0)
      real*8        PbpR8_16    ! ?=- P_q_^{Lambda}^=8 with q=16 for the red
*                                     arm (pb_R_8_16)
      real*8        PbpR8_50    ! ?=- P_q_^{Lambda}^=8 with q=50 for the red
*                                     arm (pb_R_8_50)
      real*8        PbpR8_84    ! ?=- P_q_^{Lambda}^=8 with q=84 for the red
*                                     arm (pb_R_8_84)
      real*8        PbpR8_100   ! ?=- P_q_^{Lambda}^=8 with q=100 for the red
*                                     arm (pb_R_8_100)
      real*8        PbpR16_0    ! ?=- P_q_^{Lambda}^=16 with q=0 for the red
*                                     arm (pb_R_16_0)
      real*8        PbpR16_16   ! ?=- P_q_^{Lambda}^=16 with q=16 for the red
*                                     arm (pb_R_16_16)
      real*8        PbpR16_50   ! ?=- P_q_^{Lambda}^=16 with q=50 for the red
*                                     arm (pb_R_16_50)
      real*8        PbpR16_84   ! ?=- P_q_^{Lambda}^=16 with q=84 for the red
*                                     arm (pb_R_16_84)
      real*8        PbpR16_100  ! ?=- P_q_^{Lambda}^=16 with q=100 for the red
*                                     arm (pb_R_16_100)
      real*8        PbpR32_0    ! ?=- P_q_^{Lambda}^=32 with q=0 for the red
*                                     arm (pb_R_32_0)
      real*8        PbpR32_16   ! ?=- P_q_^{Lambda}^=32 with q=16 for the red
*                                     arm (pb_R_32_16)
      real*8        PbpR32_50   ! ?=- P_q_^{Lambda}^=32 with q=50 for the red
*                                     arm (pb_R_32_50)
      real*8        PbpR32_84   ! ?=- P_q_^{Lambda}^=32 with q=84 for the red
*                                     arm (pb_R_32_84)
      real*8        PbpR32_100  ! ?=- P_q_^{Lambda}^=32 with q=100 for the red
*                                     arm (pb_R_32_100)
      integer*4     GoodR       ! [0/1] True for good red spectra (S/N>5)
*                                     (pb_flag_R)
      integer*4     NbadR       ! [0/9999] Number of bad pixels for the red
*                                     arm (npixbad_R)
      real*8        Gbp_Grp     ! (mag) [-0.75/7.7]?=- Intrinsic color 
*                                     (G_BP_-G_RP_)_0_ (bprp0)

C=============================================================================

C  Loading file 'table4.dat'	! The 5 million binary probabilities and RVs
*                               obtained from the LAMOST MRS DR8 (v1.0)

C  Format for file interpretation

    1 format(
     +  I9,1X,I8,1X,F13.5,1X,I5,1X,A20,1X,I2,1X,I3,1X,F10.6,1X,F9.6,
     +  1X,F10.6,1X,F10.6,1X,F10.4,1X,F9.4,1X,F10.4,1X,F9.4,1X,I5,1X,
     +  F9.6,1X,F10.4,1X,F9.4,1X,F10.4,1X,F9.4,1X,I5,1X,F9.6,1X,F8.6,
     +  1X,F8.6,1X,F8.6,1X,F8.6,1X,F8.6,1X,F8.6,1X,F8.6,1X,F8.6,1X,
     +  F8.6,1X,F8.6,1X,F8.6,1X,F8.6,1X,F8.6,1X,F8.6,1X,F8.6,1X,I1,1X,
     +  I4,1X,F8.6,1X,F8.6,1X,F8.6,1X,F8.6,1X,F8.6,1X,F8.6,1X,F8.6,1X,
     +  F8.6,1X,F8.6,1X,F8.6,1X,F8.6,1X,F8.6,1X,F8.6,1X,F8.6,1X,F8.6,
     +  1X,I1,1X,I4,1X,F9.6)

C  Effective file loading

      open(unit=1,status='old',file=
     +'table4.dat')
      write(6,*) '....Loading file: table4.dat'
      do i__=1,5893382
        read(1,'(A519)')ar__
        read(ar__,1)
     +  ObsID,LMJM,BJDmid,LMJD,planid,spid,fiber,RAdeg,DEdeg,SNRB,
     +  SNRR,RVobsB,e_RVobsB,RVabsB,e_RVabsB,TeffB,CCFmaxB,RVobsR,
     +  e_RVobsR,RVabsR,e_RVabsR,TeffR,CCFmaxR,PbpB8_0,PbpB8_16,
     +  PbpB8_50,PbpB8_84,PbpB8_100,PbpB16_0,PbpB16_16,PbpB16_50,
     +  PbpB16_84,PbpB16_100,PbpB32_0,PbpB32_16,PbpB32_50,PbpB32_84,
     +  PbpB32_100,GoodB,NbadB,PbpR8_0,PbpR8_16,PbpR8_50,PbpR8_84,
     +  PbpR8_100,PbpR16_0,PbpR16_16,PbpR16_50,PbpR16_84,PbpR16_100,
     +  PbpR32_0,PbpR32_16,PbpR32_50,PbpR32_84,PbpR32_100,GoodR,NbadR,
     +  Gbp_Grp
        if (idig(ar__(89:98)).EQ.0) SNRB =  rNULL__
        if (idig(ar__(100:109)).EQ.0) SNRR =  rNULL__
        if (idig(ar__(111:120)).EQ.0) RVobsB =  rNULL__
        if (idig(ar__(122:130)).EQ.0) e_RVobsB =  rNULL__
        if (idig(ar__(132:141)).EQ.0) RVabsB =  rNULL__
        if (idig(ar__(143:151)).EQ.0) e_RVabsB =  rNULL__
        if (TeffB .EQ. 45) TeffB =  iNULL__
        if (idig(ar__(159:167)).EQ.0) CCFmaxB =  rNULL__
        if (idig(ar__(169:178)).EQ.0) RVobsR =  rNULL__
        if (idig(ar__(180:188)).EQ.0) e_RVobsR =  rNULL__
        if (idig(ar__(190:199)).EQ.0) RVabsR =  rNULL__
        if (idig(ar__(201:209)).EQ.0) e_RVabsR =  rNULL__
        if (TeffR .EQ. 45) TeffR =  iNULL__
        if (idig(ar__(217:225)).EQ.0) CCFmaxR =  rNULL__
        if (idig(ar__(227:234)).EQ.0) PbpB8_0 =  rNULL__
        if (idig(ar__(236:243)).EQ.0) PbpB8_16 =  rNULL__
        if (idig(ar__(245:252)).EQ.0) PbpB8_50 =  rNULL__
        if (idig(ar__(254:261)).EQ.0) PbpB8_84 =  rNULL__
        if (idig(ar__(263:270)).EQ.0) PbpB8_100 =  rNULL__
        if (idig(ar__(272:279)).EQ.0) PbpB16_0 =  rNULL__
        if (idig(ar__(281:288)).EQ.0) PbpB16_16 =  rNULL__
        if (idig(ar__(290:297)).EQ.0) PbpB16_50 =  rNULL__
        if (idig(ar__(299:306)).EQ.0) PbpB16_84 =  rNULL__
        if (idig(ar__(308:315)).EQ.0) PbpB16_100 =  rNULL__
        if (idig(ar__(317:324)).EQ.0) PbpB32_0 =  rNULL__
        if (idig(ar__(326:333)).EQ.0) PbpB32_16 =  rNULL__
        if (idig(ar__(335:342)).EQ.0) PbpB32_50 =  rNULL__
        if (idig(ar__(344:351)).EQ.0) PbpB32_84 =  rNULL__
        if (idig(ar__(353:360)).EQ.0) PbpB32_100 =  rNULL__
        if (idig(ar__(369:376)).EQ.0) PbpR8_0 =  rNULL__
        if (idig(ar__(378:385)).EQ.0) PbpR8_16 =  rNULL__
        if (idig(ar__(387:394)).EQ.0) PbpR8_50 =  rNULL__
        if (idig(ar__(396:403)).EQ.0) PbpR8_84 =  rNULL__
        if (idig(ar__(405:412)).EQ.0) PbpR8_100 =  rNULL__
        if (idig(ar__(414:421)).EQ.0) PbpR16_0 =  rNULL__
        if (idig(ar__(423:430)).EQ.0) PbpR16_16 =  rNULL__
        if (idig(ar__(432:439)).EQ.0) PbpR16_50 =  rNULL__
        if (idig(ar__(441:448)).EQ.0) PbpR16_84 =  rNULL__
        if (idig(ar__(450:457)).EQ.0) PbpR16_100 =  rNULL__
        if (idig(ar__(459:466)).EQ.0) PbpR32_0 =  rNULL__
        if (idig(ar__(468:475)).EQ.0) PbpR32_16 =  rNULL__
        if (idig(ar__(477:484)).EQ.0) PbpR32_50 =  rNULL__
        if (idig(ar__(486:493)).EQ.0) PbpR32_84 =  rNULL__
        if (idig(ar__(495:502)).EQ.0) PbpR32_100 =  rNULL__
        if (idig(ar__(511:519)).EQ.0) Gbp_Grp =  rNULL__
c    ..............Just test output...........
        write(6,1)
     +  ObsID,LMJM,BJDmid,LMJD,planid,spid,fiber,RAdeg,DEdeg,SNRB,
     +  SNRR,RVobsB,e_RVobsB,RVabsB,e_RVabsB,TeffB,CCFmaxB,RVobsR,
     +  e_RVobsR,RVabsR,e_RVabsR,TeffR,CCFmaxR,PbpB8_0,PbpB8_16,
     +  PbpB8_50,PbpB8_84,PbpB8_100,PbpB16_0,PbpB16_16,PbpB16_50,
     +  PbpB16_84,PbpB16_100,PbpB32_0,PbpB32_16,PbpB32_50,PbpB32_84,
     +  PbpB32_100,GoodB,NbadB,PbpR8_0,PbpR8_16,PbpR8_50,PbpR8_84,
     +  PbpR8_100,PbpR16_0,PbpR16_16,PbpR16_50,PbpR16_84,PbpR16_100,
     +  PbpR32_0,PbpR32_16,PbpR32_50,PbpR32_84,PbpR32_100,GoodR,NbadR,
     +  Gbp_Grp
c    .......End.of.Just test output...........
      end do
      close(1)

C=============================================================================
      stop
      end

C Locate position of first digit in string; or return 0
      integer function idig(c)
      character*(*) c
      character*1 c1
      integer lc,i
      lc=len(c)
      idig=0
      do i=1,lc
         if(c(i:i).ne.' ') go to 1
      end do
    1 if(i.gt.lc) return
      c1=c(i:i)
      if(c1.eq.'.'.or.c1.eq.'-'.or.c1.eq.'+') i=i+1
      if(i.gt.lc) return
      c1=c(i:i)
      if(c1.ge.'0'.and.c1.le.'9') idig=i
      return
      end