Esempio n. 1
0
def main(filename):
    """
    Takes a spacetime file, inverts the coordinates, and outputs an
    inverted file.
    """
    spacetime_data = read_3simplices_from_data_file(filename)
    new_spacetime = invert_time_for_spacetime(spacetime_data)
    print_output_file(spacetime_data[0],new_spacetime,filename)
Esempio n. 2
0
def main(filename):
    """
    Takes a spacetime file, inverts the coordinates, and outputs an
    inverted file.
    """
    spacetime_data = read_3simplices_from_data_file(filename)
    new_spacetime = invert_time_for_spacetime(spacetime_data)
    print_output_file(spacetime_data[0], new_spacetime, filename)
Esempio n. 3
0
def extract_2_volume_ensemble(filename_list):
    """
    Reads in each *.3sx2p1 file in filename_list and produces a list
    of lists of 2-volume information as a function of proper time.

    Returns a vector. The first element contains header data, which is
    assumed to be the same for all elements of the ensemble.
    """
    # Do the first spacetime seperately to extract header data
    first_spacetime = vs.read_3simplices_from_data_file(filename_list[0])
    header_data = first_spacetime[0]
    spacetimes = [first_spacetime[1]]

    # We need to calculate the average of N3-31 and N3-13 for all spacetimes
    N3 = eval(header_data[11])/2

    # Extract the remaining spacetimes
    for f in filename_list[1:]:
        temp = vs.read_3simplices_from_data_file(f)
        spacetimes.append(temp[1])
        N3 += eval(temp[0][11])/2

    # Extract the 2-simplex information 
    sl2simplices = [vs.get_all_sl2simplices([header_data,s]) \
                        for s in spacetimes]

    # Run garbage collection
    del spacetimes

    # Average the N3s instead of summing them
    N3 = N3/len(filename_list)

    # Extract volumes as a function of time
    volumes = [vs.make_v_of_t(s) for s in sl2simplices]

    # Delete the old lists
    del sl2simplices

    return [header_data,volumes,N3]
Esempio n. 4
0
def extract_2_volume_ensemble(filename_list):
    """
    Reads in each *.3sx2p1 file in filename_list and produces a list
    of lists of 2-volume information as a function of proper time.

    Returns a vector. The first element contains header data, which is
    assumed to be the same for all elements of the ensemble.
    """
    # Do the first spacetime seperately to extract header data
    first_spacetime = vs.read_3simplices_from_data_file(filename_list[0])
    header_data = first_spacetime[0]
    spacetimes = [first_spacetime[1]]

    # We need to calculate the average of N3-31 and N3-13 for all spacetimes
    N3 = eval(header_data[11]) / 2

    # Extract the remaining spacetimes
    for f in filename_list[1:]:
        temp = vs.read_3simplices_from_data_file(f)
        spacetimes.append(temp[1])
        N3 += eval(temp[0][11]) / 2

    # Extract the 2-simplex information
    sl2simplices = [vs.get_all_sl2simplices([header_data,s]) \
                        for s in spacetimes]

    # Run garbage collection
    del spacetimes

    # Average the N3s instead of summing them
    N3 = N3 / len(filename_list)

    # Extract volumes as a function of time
    volumes = [vs.make_v_of_t(s) for s in sl2simplices]

    # Delete the old lists
    del sl2simplices

    return [header_data, volumes, N3]
Esempio n. 5
0
def get_raw_time_slices(filename, t_low, t_high):
    """
    Given the filename/filepath of a *.3sx2p1 file, extract the
    2-simplices for the high and low simplices we'll use to make our
    boundary conditions as a pair of lists (in a list).
    """

    # Load spacetime
    spacetime = vs.read_3simplices_from_data_file(filename)
    # Assign time slices
    t_slice_low = vs.get_spacelike_2simplices_at_t(spacetime[1], t_low)
    t_slice_high = vs.get_spacelike_2simplices_at_t(spacetime[1], t_high)

    # spacetime[0] contains coupling constant and spacetime
    # size. Useful for file naming conventions.
    return [t_slice_low, t_slice_high, spacetime[0]]
Esempio n. 6
0
def get_raw_time_slices(filename,t_low,t_high):
    """
    Given the filename/filepath of a *.3sx2p1 file, extract the
    2-simplices for the high and low simplices we'll use to make our
    boundary conditions as a pair of lists (in a list).
    """

    # Load spacetime
    spacetime = vs.read_3simplices_from_data_file(filename)
    # Assign time slices
    t_slice_low = vs.get_spacelike_2simplices_at_t(spacetime[1],t_low)
    t_slice_high = vs.get_spacelike_2simplices_at_t(spacetime[1],t_high)

    # spacetime[0] contains coupling constant and spacetime
    # size. Useful for file naming conventions.
    return [t_slice_low, t_slice_high,spacetime[0]]