Commit 3d7404e7 authored by Fang Yuedong's avatar Fang Yuedong
Browse files

bug fix: datetime conversion in ImageHeader.py

parent 964a402e
Loading
Loading
Loading
Loading
+5 −3
Original line number Original line Diff line number Diff line
@@ -352,7 +352,7 @@ def generatePrimaryHeader(xlen = 9216, ylen = 9232, pointNum = '1', ra = 60, dec
    # ccdnum = str(k)
    # ccdnum = str(k)


    datetime_obs = datetime.utcfromtimestamp(time_pt)
    datetime_obs = datetime.utcfromtimestamp(time_pt)
    datetime_obs = datetime_obs.replace(microsecond=round(datetime_obs.microsecond, -5))
    datetime_obs = datetime.utcfromtimestamp(np.round(datetime_obs.timestamp(), 1))
    # date_obs = datetime_obs.strftime("%y%m%d")
    # date_obs = datetime_obs.strftime("%y%m%d")
    # time_obs = datetime_obs.strftime("%H%M%S%f")[:-5]
    # time_obs = datetime_obs.strftime("%H%M%S%f")[:-5]


@@ -558,9 +558,11 @@ def generateExtensionHeader(chip, xlen = 9216, ylen = 9232,ra = 60, dec = -40, p
    # t_s2 = str(tend_read.datetime).split()
    # t_s2 = str(tend_read.datetime).split()
    # h_ext['ROTIME1'] = t_s2[0] + 'T' + t_s2[1]
    # h_ext['ROTIME1'] = t_s2[0] + 'T' + t_s2[1]


    tstart1=tstart.datetime.replace(microsecond=round(tstart.datetime.microsecond, -5))
    # tstart1=tstart.datetime.replace(microsecond=round(tstart.datetime.microsecond, -5))
    tstart1 = datetime.utcfromtimestamp(np.round(datetime.utcfromtimestamp(tstart.unix).timestamp(), 1))
    h_ext['ROTIME0'] = tstart1.strftime("%Y-%m-%dT%H:%M:%S.%f")[:-5]
    h_ext['ROTIME0'] = tstart1.strftime("%Y-%m-%dT%H:%M:%S.%f")[:-5]
    tend_read1 = tend_read.datetime.replace(microsecond=round(tend_read.datetime.microsecond, -5))
    # tend_read1 = tend_read.datetime.replace(microsecond=round(tend_read.datetime.microsecond, -5))
    tend_read1 = datetime.utcfromtimestamp(np.round(datetime.utcfromtimestamp(tend_read.unix).timestamp(), 1))
    h_ext['ROTIME1'] = tend_read1.strftime("%Y-%m-%dT%H:%M:%S.%f")[:-5]
    h_ext['ROTIME1'] = tend_read1.strftime("%Y-%m-%dT%H:%M:%S.%f")[:-5]
    # h_ext['POS_ANG'] = pa
    # h_ext['POS_ANG'] = pa
    header_wcs = WCS_def(xlen=xlen, ylen=ylen, gapy=898.0, gapx1=534, gapx2=1309, ra_ref=ra, dec_ref=dec, pa=pa, pixel_scale=pixel_scale, pixel_size=pixel_size, 
    header_wcs = WCS_def(xlen=xlen, ylen=ylen, gapy=898.0, gapx1=534, gapx2=1309, ra_ref=ra, dec_ref=dec, pa=pa, pixel_scale=pixel_scale, pixel_size=pixel_size,