def main():
	file = arg_parser().resources_file
	resources = json.loads(read_file(file))
	for instance_id in resources['EC2_Instances']:
		print(instance_id['ID'])
		terminate_instance(instance_id['ID'])

	print("Removing file {0}... ".format(file), end="")
	os.remove(file)
	print('[OK]')
Exemple #2
0
def main():
    arguments = arg_parser()
    linux_commands = 'linux_deploy'
    linux_image_id = arguments.image_id
    instance_type = 't2.micro'
    security_group_id = arguments.sg_id
    key_pair = arguments.key_pair
    subnet_id = arguments.subnet_id

    linux_instance = create_linux_instance(linux_image_id,
                                           read_file(linux_commands),
                                           instance_type, security_group_id,
                                           subnet_id, key_pair)
    wait_until_ok(linux_instance.id)

    resources = {'EC2_Instances': [{'Name': 'Linux', 'ID': linux_instance.id}]}
    write_json(resources, linux_instance.id)
    print("Linux id is: {0}".format(linux_instance.id))
Exemple #3
0
# plt.show()
#FOR THETA
os.chdir('G:/Harsh_Data_Backup/Data/New_Data')
for ch in range(1, 63):
    mean_acc = 0
    cc_max = 0
    gg_max = 0
    for cc in range(0, 1):
        for gg in range(0, 1):
            c = 1 + 10 * cc
            g = 1 + 10 * gg
            # print (g)
            mean_for_fixed_par = 0
            for sub in range(1, 8):
                file_name = "s" + str(sub) + "c" + str(ch) + ".txt"
                sig = rw.read_file(file_name)
                sig = np.array(sig)
                dt = 1 / 256
                lpsd = []
                mpsd = []
                hpsd = []
                for i in range(0, 540):
                    seg = sig[512 * i:512 * i + 512]
                    #print (len(seg))
                    seg = np.array(seg)
                    Sps = np.absolute(fft(seg)) / 3000
                    sfreq = fftfreq(seg.size, d=dt)
                    keep = sfreq > 0
                    Sps = Sps[keep]
                    sfreq = sfreq[keep]
                    # print (sfreq.size)
Exemple #4
0
        "http://euro.ecom.cmu.edu/people/faculty/mshamos/1976ShamosBentley.pdf".."""
        for i in range(len(strip)):
            if (i + 198 < len(strip)):
                for j in range(i + 1, i + 198):
                    if  strip[j][1] - min_distance < strip[i][1] <= strip[j][1] + min_distance \
                    and strip[j][2] - min_distance < strip[i][2] <= strip[j][2] + min_distance \
                    and strip[j][3] - min_distance < strip[i][3] <= strip[j][3] + min_distance \
                    and distance(strip[i], strip[j]) < min_distance:
                        min_distance = distance(strip[i], strip[j])
                        if distance(strip[i], strip[j]) < glob_min:
                            glob_min = distance(strip[i], strip[j])
                            pair_1 = strip[i]
                            pair_2 = strip[j]
            else:
                for j in range(i + 1, len(strip)):
                    if  strip[j][1] - min_distance < strip[i][1] <= strip[j][1] + min_distance \
                    and strip[j][2] - min_distance < strip[i][2] <= strip[j][2] + min_distance \
                    and strip[j][3] - min_distance < strip[i][3] <= strip[j][3] + min_distance \
                    and distance(strip[i], strip[j]) < min_distance:
                        min_distance = distance(strip[i], strip[j])
                        if distance(strip[i], strip[j]) < glob_min:
                            glob_min = distance(strip[i], strip[j])
                            pair_1 = strip[i]
                            pair_2 = strip[j]
        return min_distance


#Read input and write input to exterior file
collection = read_write.read_file()
minimum_distance = find_min(collection)
read_write.write_file(minimum_distance, pair_1, pair_2)
Exemple #5
0
    high_f = 7
elif (band_name == "a"):
    low_f = 8
    high_f = 12
elif (band_name == "b"):
    low_f = 12
    high_f = 30
elif (band_name == "g"):
    low_f = 30
    high_f = 100
else:
    print("error")
    sys.exit()

for sub in range(1, 8):
    for ch in range(1, 63):
        os.chdir("G:/Harsh_Data_Backup/Data/New_Data")
        file_name = "s" + str(sub) + "c" + str(ch) + ".txt"
        sig = np.array(rw.read_file(file_name))
        filtered_sig = []
        filtered_sig = np.array(filtered_sig)
        for i in range(0, 540):
            segment = sig[i * 512:(i + 1) * 512]
            filt_segment = filt.butter_filter(segment, sample_freq, low_f,
                                              high_f)
            #print ((type(filtered_sig),type(filt_segment)))
            filtered_sig = np.concatenate((filtered_sig, filt_segment), axis=0)
        os.chdir("G:/Harsh_Data_Backup/Data/New_Data_filtered/" + band_name)
        rw.write_to_file(file_name, filtered_sig)
        print(sub, ch, band_name)
Exemple #6
0
        print('\n')
        print('#' * 32)
        print('Thank You for Your Co-operation \nExiting.....')
        print('#' * 32)
        print('\n\n')

        print('$' * 26)
        print("$ Bank Accounts Database $")
        print('$' * 26, f'\n')

        try:
            save_file(str(new_account))
        except NameError:
            pass
            # print('Could not save Account Information')
        read_file()

        break

    print('\n\n')

    bool_action = True
    while bool_action:
        while True:
            action = str(
                input(
                    'Please input \'d\' to Deposit, \'w\' to withdraw, \'i\' to '
                    'print your Account Info, '
                    '\'p\' to print your Account Statement or \'e\' to exit'))
            if num_there(action):
                print('Input should be alphabets')