From 9bb2b4d2ac6b3940493134ea2c0cd13e6d1cb4ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20M=C3=BChrke?= Date: Fri, 29 Dec 2023 11:37:34 +0100 Subject: [PATCH] Chore: update --- src/mail_test.py | 29 +++++++++++++++++++++++++++++ src/main.py | 18 ++++++++++-------- 2 files changed, 39 insertions(+), 8 deletions(-) create mode 100644 src/mail_test.py diff --git a/src/mail_test.py b/src/mail_test.py new file mode 100644 index 0000000..7fda0c4 --- /dev/null +++ b/src/mail_test.py @@ -0,0 +1,29 @@ +import smtplib + + +def main(): + smtp_obj = smtplib.SMTP('smtp.mail.me.com', 587) + smtp_obj.starttls() + smtp_obj.login('lmuehrke@mac.com', 'zFak-1903-PinGirEis') + + pairs = {'name_1': 'lmuehrke@mac.com', 'name_2': 'lmuehrke@me.com'} + + try: + for name in pairs.keys(): + msg = ('From: {}\r\nTo: {}\r\n\r\nHi, {}'.format(smtp_obj.user, + pairs.get(name), + name)) + + print('Sending email to {} at {}...'.format(name, pairs.get(name))) + + send_status = smtp_obj.sendmail(from_addr=smtp_obj.user, + to_addrs=pairs.get(name), + msg=msg) + + if send_status != {}: + print('There was a problem sending mail to {}.\n{}'.format(name, send_status)) + finally: + smtp_obj.quit() + +if __name__ == '__main__': + main() \ No newline at end of file diff --git a/src/main.py b/src/main.py index 29de68e..e6e1257 100644 --- a/src/main.py +++ b/src/main.py @@ -9,7 +9,6 @@ import argparse import pathlib - from test import * from qiskit import QuantumCircuit @@ -37,6 +36,8 @@ def __init__(self, id, name, receiver): parser.add_argument('-t', '--test', action='store_true', help='The run is only for testing purposes.') + parser.add_argument('-s','--shots', type=int, default=4096, + help='How often should the measurment be executed') parser.add_argument('-vo','--validate_off', action='store_true', help='Disable the validation. I advise against it but I\'m not your mum') parser.add_argument('-ll','--loop_lebel', choices=range(1,5), default=2, @@ -54,11 +55,13 @@ def __init__(self, id, name, receiver): if not args.backend: args.test = True + else: + backend_str = args.backend if args.test: - backend = 'ibmq_qasm_simulator' + backend_str = 'ibmq_qasm_simulator' - print(args.test, args.backend) + shots = args.shots try: config_file = open(args.config_path) @@ -76,20 +79,19 @@ def __init__(self, id, name, receiver): raise ValueError('No provider_token, configure config.json or use the CLI argument.') provider = IBMProvider(token=provider_token) + backend = provider.get_backend(backend_str) num_participants = len(config_data['Participants']) num_qbits = math.ceil(math.log2(num_participants**2)) - + qc = QuantumCircuit(num_qbits, num_qbits) for i in range(num_qbits): qc.h(i) qc.measure(list(range(num_qbits)), list(range(num_qbits))) - #TODO: Add CLI cmd to change this - simulator == -t / --test - backend = provider.get_backend('ibmq_qasm_simulator') - #TODO: Add CLI cmd to change this - also to split it up, to make retries less costly. - shots = 512 + if args.verbose: + print(qc) transpiled_circuit = transpile(qc, backend)