def _parse_td_protocol(self, td_protocol_name):
     """Input must be a string, parsed to figure out the protocol to use."""
     if td_protocol_name == 'doublebang':
         self.td_protocol = protocol_ansatz.DoubleBangProtocolAnsatz()
     elif td_protocol_name == 'bangramp':
         self.td_protocol = protocol_ansatz.BangRampProtocolAnsatz()
     elif td_protocol_name == 'triplebang':
         self.td_protocol = protocol_ansatz.TripleBangProtocolAnsatz()
     else:
         raise ValueError('Other protocols must be given explicitly.')
Example #2
0
import sys
import numpy as np
import pandas as pd

import logging

if '../../' not in sys.path:
    sys.path.append('../../')
import src.optimization as optimization
import src.protocol_ansatz as protocol_ansatz


model = 'lmg'
model_parameters = dict(num_spins=50)
optimization_method = 'Powell'
protocol = protocol_ansatz.TripleBangProtocolAnsatz()

third_time = lambda t: t / 3.
twothirds_time = lambda t: 2 * t / 3.
initial_parameters = [[-1, 1]] * 3 + [third_time, twothirds_time]

parameters_constraints = [-2, 2]

# ------ build and check name for output file
additional_file_name_qualifiers = None
output_file_name = (model + '_' + str(protocol) +
                    '_' + optimization_method.replace('-', '').lower() +
                    '_bound' + str(parameters_constraints[1]))
if additional_file_name_qualifiers is not None:
    output_file_name += '_' + additional_file_name_qualifiers
filenum = 1