Пример #1
0
def score_function_custom_maker(filename='trajectory.hdf5', decay=4):
    """
    param: trajectory file with key "filled_path"
           decay
    """
    with h5py.File(filename, 'r') as file:
        filled_path = file['filled_path'][:]
        file.close()
    score_function = trajectory_to_score_function.score_function_maker(filled_path.T, decay)
    
    return score_function
if test_trajectory_to_score_function:
    import triple_well_2D.triple_well as tw
    import triple_well_2D.tools_2D as too
    """
    input:
    trajectory
    transverse decay
    """

    #arguments
    trajectory = positions
    decay = decay
    sigma = noise

    #result
    score_function = trajectory_to_score_function.score_function_maker(
        trajectory.T, decay)

    #visualise
    too.visualise_scorefunction(score_function=score_function,
                                sigma=sigma,
                                target_state=tw.target_state,
                                score_threshold=None,
                                force_matrix=tw.force_matrix,
                                xmin=-4,
                                xmax=4,
                                ymin=-3,
                                ymax=6)

#%%7
if test_warp_score_function_ell:
    import triple_well_2D.triple_well as tw
Пример #3
0
    plt.legend(loc='lower right')
    plt.savefig('../../Report/overleaf/low_noise_histo', bbox_inches='tight')
    #plt.show()

if write:
    with h5py.File(filename, 'a') as file:
        file.create_dataset('original_path', data=path)
        file.create_dataset('filled_path', data=filled_path)
        file.close()

#%%

if check_score_function:
    decay = 2
    score_function = trajectory_to_score_function.score_function_maker(
        filled_path.T, decay)

    #visualise
    plt.figure()
    print(len(filled_path[0]))
    #filled_path = histogram_to_trajectory.positions_filler(filled_path, 100)
    print(len(filled_path[0]))
    plt.scatter(filled_path[0],
                filled_path[1],
                label='path',
                color='red',
                zorder=10,
                s=3)
    #plt.text(-0.2, 1,'(a)',horizontalalignment='center', verticalalignment='center', transform = plt.gca().transAxes, fontsize=9)
    too.visualise_scorefunction(score_function=score_function,
                                initial_state=tw.initial_state,