def test_datetime_to_serial_date():
    np.testing.assert_allclose(dtt.datetime_to_serial_date(dt1),
                               serial1,
                               atol=1E-5)
    np.testing.assert_allclose(dtt.datetime_to_serial_date(dt2),
                               serial2,
                               atol=1E-5)
    np.testing.assert_allclose(dtt.datetime_to_serial_date(dt3),
                               serial3,
                               atol=1E-5)
Esempio n. 2
0
def get_default_header(endianess="<"):
    """Returns a header pre-populated with default values."""
    dt = np.dtype(get_header_dtype_list())
    header = np.zeros((1, ), dtype=dt)
    header["ID"][0] = "IMGBLO".encode()
    header["MAGIC"][0] = magics[0]
    header["Data_offset_1"][0] = 0x1000  # Always this value observed
    header["UNKNOWN1"][0] = 131141  # Very typical value (always?)
    header["Acquisition_time"][0] = datetime_to_serial_date(
        datetime.datetime.fromtimestamp(86400, dateutil.tz.tzutc()))
    # Default to UNIX epoch + 1 day
    # Have to add 1 day, as dateutil's timezones dont work before epoch
    return header
Esempio n. 3
0
def get_default_header(endianess='<'):
    """Returns a header pre-populated with default values.
    """
    dt = np.dtype(get_header_dtype_list())
    header = np.zeros((1,), dtype=dt)
    header['ID'][0] = 'IMGBLO'.encode()
    header['MAGIC'][0] = magics[0]
    header['Data_offset_1'][0] = 0x1000     # Always this value observed
    header['UNKNOWN1'][0] = 131141          # Very typical value (always?)
    header['Acquisition_time'][0] = datetime_to_serial_date(
        datetime.datetime.fromtimestamp(86400, dateutil.tz.tzutc()))
    # Default to UNIX epoch + 1 day
    # Have to add 1 day, as dateutil's timezones dont work before epoch
    return header
Esempio n. 4
0
def test_datetime_to_serial_date():
    assert_allclose(dtt.datetime_to_serial_date(dt1), serial1, atol=1E-5)
    assert_allclose(dtt.datetime_to_serial_date(dt2), serial2, atol=1E-5)
    assert_allclose(dtt.datetime_to_serial_date(dt3), serial3, atol=1E-5)
Esempio n. 5
0
def test_datetime_to_serial_date():
    nt.assert_almost_equal(dtt.datetime_to_serial_date(dt1), serial1, places=5)
    nt.assert_almost_equal(dtt.datetime_to_serial_date(dt2), serial2, places=5)
    nt.assert_almost_equal(dtt.datetime_to_serial_date(dt3), serial3, places=5)