示例#1
0
def main():
    r = 0.038 / 2
    d = 0.024
    mark = 30

    tables = TableImporter()
    writer = CSVWriter()

    table = tables.get_table()

    writer.string_write(["theory", "exp", "error"])

    while table is not None:
        times = get_1d_data(table, 0)
        ys = get_1d_data(table, 2)
        h = get_h(mark)
        valid_ys = filter_descending_movement(ys)
        valid_ys_in_meter = change_to_meter(valid_ys)

        start_point = (times[1], valid_ys_in_meter[1])
        end_point = (times[len(valid_ys) - 2],
                     valid_ys_in_meter[len(valid_ys_in_meter) - 2])

        exp_time = end_point[0] - start_point[0]
        theory_time = theoretical_time(start_point, end_point, h, r, d)
        error = (exp_time - theory_time) / theory_time * 100

        writer.write([theory_time, exp_time, error])

        table = tables.get_table()
示例#2
0
async def get_artists_data(client):
    queries_count = int(ARTISTS_NEEDED / 200)
    offset = 0
    csv_writer = CSVWriter()
    for idx in range(queries_count):
        artists_list = list()
        resp = await client.artists_list(offset=offset+200*idx)
        for artist in resp['obj']['data']:
            artist_id = artist['chartmetric_artist_id']
            fan_stats = await collect_fan_stats(artist_id, client)
            artist.update(fan_stats)
            tracks_helper = TracksCollector(artist_id, client)
            tracks_list = await tracks_helper.tracks_list()
            tracks = []
            for track in tracks_list:
                tmp_dict = dict(artist_id=artist_id)
                if 'id' in track:
                    tmp_dict['track_id'] = track['id']
                else:
                    tmp_dict['track_id'] = track['track_id']
                tmp_dict['name'] = track['name']
                if track['release_dates']:
                    tmp_dict['release_dates'] = ' '.join(
                        [d if d else '' for d in track['release_dates']])
                tracks.append(tmp_dict)
            csv_writer.write(tracks, 'artists_tracks')
            artists_list.append(artist)

        print(f'Took {offset+200*idx} offset')
        csv_writer.write(artists_list, 'artists')
    await client.close()
示例#3
0
def main():
    tables = TableImporter()
    writer = CSVWriter()

    table = tables.get_table()

    while table is not None:
        writer.write(compute(table))
        table = tables.get_table()
示例#4
0
def main():
    degree = 60

    tables = TableImporter()
    writer = CSVWriter()

    data_to_write = []
    table = tables.get_table()
    while table is not None:
        x_velocity = compute_x_velocity(table)
        initial_velocity = compute_initial_velocity(x_velocity, degree)
        times = get_times(table)
        ys = get_ys(table)
        theory_ys = compute_y_at_times(initial_velocity, degree, times)
        data_to_write.append(rms(ys, theory_ys))

        table = tables.get_table()

    writer.write(data_to_write)
示例#5
0
def main():
    tables = TableImporter()
    writer = CSVWriter()
    table = tables.get_table(delimiter=",", header=5, footer=7)

    error_rate_result = []
    step = 3

    while table is not None:
        consistent_table = slice(table, 0, [15, 45])
        average_rpm = average(get_column(consistent_table, 3))
        w = rpm_to_rad_per_sec(average_rpm)

        theory_rotation = compute_theory_rotation(step_to_length(step), w)
        experiment_degree = linear_regression(get_column(consistent_table, 0),
                                              get_column(consistent_table, 1))
        experiment_rotation = degree_to_radian(experiment_degree)

        error_rate_result.append(
            (experiment_rotation - theory_rotation) / theory_rotation * 100)

        table = tables.get_table(delimiter=",", header=5, footer=7)

    writer.write(error_rate_result)
示例#6
0
def verify():
    jama = Jama()
    csv = CSVWriter()
    projects = jama.getProjects()
    csv.write("projects.csv", projects)
    project_ids = [project["id"] for project in projects]
    item_type_ids = [item_type["id"] for item_type in jama.getItemTypes()]
    for item_type_id in item_type_ids:
        csv.write("{}.csv".format(item_type_id), jama.getItems(item_type_id))
    relationships = []
    for project_id in project_ids:
        # if the relationships file gets too big you can create a file for each project's relationships
        # instead of extending this list
        relationships.extend(jama.getRelationships(project_id))
    csv.write("relationships.csv", relationships)

    # if the comments file gets too big you can split the list and scv.write() each half
    csv.write("comments.csv", jama.getComments())
示例#7
0
def main():
    tables = TableImporter()
    writer = CSVWriter()

    table = tables.get_table()

    while table is not None:
        min_max_table = get_min_max(table, 2)

        period = get_period(min_max_table)
        amplitude = get_amplitude(min_max_table, 2)

        writer.string_write(["period"], end=",")
        writer.write(period)

        writer.string_write(["amplitude"], end=",")
        writer.write(amplitude)
        writer.write([])

        table = tables.get_table()