Ejemplo n.º 1
0
def states_to_lightcurve(times, obs_vecs, sun_vecs, attitudes, spacecraft_geometry, quats = False):

    lightcurve = []

    iters = len(times)
    count = 0
    for time, obs_vec, sun_vec, attitude in zip(times, obs_vecs, sun_vecs, attitudes):

        #now = utc0 + datetime.timedelta(seconds = time)

        #sun_vec = AF.vect_earth_to_sun(now)

        if quats:
            eta = attitude[0]
            eps = attitude[1:4]
            dcm_body2eci = CF.quat2dcm(eta, eps)
        else:
            dcm_body2eci = CF.euler2dcm(ROTATION, attitude)
        sun_vec_body = dcm_body2eci.T@sun_vec
        obs_vec_body = dcm_body2eci.T@obs_vec
        power = spacecraft_geometry.calc_reflected_power(obs_vec_body, sun_vec_body)

        lightcurve.append(power)

        count += 1
        loading_bar(count/iters, 'Simulating Lightcurve')

    lightcurve = hstack(lightcurve)

    return lightcurve
Ejemplo n.º 2
0
        print(facet.name, facet.center, facet.unit_normal)

    num_frames = len(obs_vecs)
    print(num_frames)

    # obs_body = array([ 0.67027951, -0.02873575, -0.74155218])
    # sun_body = array([-0.01285413, -0.99098831,  0.13332702])
    # image = generate_image(SC, obs_body, sun_body, win_dim = (4,4), dpm = 5)
    # plt.imshow(image, cmap = 'Greys')
    # plt.show()

    frames = []
    count = 0
    max_val = 0
    for quat, obs_vec, sun_vec in zip(attitudes, obs_vecs, sun_vecs):
        dcm_eci2body = CF.quat2dcm(quat[0], quat[1:4]).T
        image = generate_image(SC,
                               dcm_eci2body @ obs_vec,
                               dcm_eci2body @ sun_vec,
                               win_dim=(4, 4),
                               dpm=5)
        im_max = amax(image)
        if im_max > max_val:
            max_val = im_max
        frames.append(image)
        count += 1
        loading_bar(count / num_frames, 'Rendering gif')

    frames = [frame / max_val for frame in frames]

    imageio.mimsave('./boxwing_vis.gif', frames, fps=10)
Ejemplo n.º 3
0
    states = load('true_states.npy')
    sc_positions = load('sc_pos.npy')
    tel_positions = load('tel_pos.npy')
    sun_positions = load('sun_pos.npy')

    print(len(states))

    frames = []

    for state, sc_pos, tel_pos, sun_pos, i in zip(states, sc_positions,
                                                  tel_positions, sun_positions,
                                                  range(len(states))):
        eta = state[0]
        eps = state[1:4]
        C_eci2body = CF.quat2dcm(eps, eta).T
        obs_vec_eci = sc_pos - tel_pos
        obs_vec_eci = obs_vec_eci / norm(obs_vec_eci)
        sun_vec_eci = sc_pos - sun_pos
        sun_vec_eci = sun_vec_eci / norm(sun_vec_eci)

        obs_vec_body = C_eci2body @ obs_vec_eci
        sun_vec_body = C_eci2body @ sun_vec_eci

        image = generate_image(facets, obs_vec_body, sun_vec_body, dpm=10)
        frames.append(image.astype(uint8))
        print(str(i) + '/' + str(len(states)), end='\r')
    print('')

    fig = plt.figure()
    ax = plt.axes()