Exemple #1
0
    def __init__(self, exploration_rules, **kwargs):
        # print("Connected lattice __init__. kwargs: ", kwargs)
        super().__init__(exploration_rules=exploration_rules, **kwargs)
        self.lattice_dimension = 2
        self.initial_num_sites = 2
        self.lattice_connectivity_max_distance = 1
        self.lattice_connectivity_linear_only = True
        self.lattice_full_connectivity = False
        self.max_time_to_consider = 50
        self.num_probes = 25
        # self.min_param = 0.25 # for the sake of plots
        # self.max_param = 0.75
        self.min_param = 0.0  # normal
        self.max_param = 1.0

        self.true_model = 'pauliSet_xJx_1J2_d2PPpauliSet_yJy_1J2_d2'
        self.true_model = construct_models.alph(self.true_model)
        self.qhl_models = [self.true_model]
        self.base_terms = ['x', 'y', 'z']

        # fitness calculation parameters. fitness calculation inherited.
        self.latex_string_map_subroutine = qmla.shared_functionality.latex_model_names.pauli_set_latex_name
        self.num_top_models_to_build_on = 2
        self.model_generation_strictness = 0  # 1 #-1
        self.fitness_win_ratio_exponent = 3
        self.generation_DAG = 1
        self.max_num_sites = 4
        self.tree_completed_initially = False
        self.num_processes_to_parallelise_over = 10
        self.max_num_parameter_estimate = 9
        self.max_num_qubits = 4
        self.max_num_models_by_shape = {'other': 10}
        self.setup_exploration_class()
Exemple #2
0
    def model_from_lattice(
        self, 
        lattice
    ):
        connected_sites = lattice.get_connected_site_list()
        conn_list = [list(str(c) for c in conn) for conn in connected_sites]
        conn_string = '_'.join(['J'.join(c) for c in conn_list])
        lattice_dimension = lattice.num_sites()

        individual_operators = [
            'pauliLikewise_l{}_{}_d{}'.format(
                op, 
                conn_string, 
                lattice_dimension
            )
            for op in self.base_terms
        ]
        complete_model = '+'.join(individual_operators)

        if self.transverse_field is not None:
            transverse_string = (
                '_'.join(list(str(s) for s in range(1, lattice_dimension+1)))
            )
            transverse_term = 'pauliLikewise_l{}_{}_d{}'.format(
                self.transverse_field, 
                transverse_string, 
                lattice_dimension
            )
            complete_model += '+{}'.format(transverse_term)
        return construct_models.alph(complete_model)
Exemple #3
0
    def generate_models(self, model_list, **kwargs):
        if self.spawn_stage[-1] == 'Start':
            new_models = self.available_mods_by_generation[self.generation_DAG]
            # self.log_print(["Spawning initial models:", new_models])
            self.spawn_stage.append(None)

        else:
            # model_points = kwargs['branch_model_points']
            ranked_model_list = self.model_group_fitness_calculation(
                model_points=kwargs['branch_model_points'],
                generation=self.generation_DAG,
                subgeneration=self.sub_generation_idx)

            if self.num_top_models_to_build_on == 'all':
                models_to_build_on = ranked_model_list
            else:
                models_to_build_on = ranked_model_list[:self.
                                                       num_top_models_to_build_on]

            self.sub_generation_idx += 1
            self.generation_champs[self.generation_DAG][
                self.sub_generation_idx] = [
                    kwargs['model_names_ids'][models_to_build_on[0]]
                ]
            self.counter += 1
            new_models = []

            if self.spawn_stage[-1] == 'finish_generation':
                # increase generation idx; add site; get newly available terms;
                # add greedily as above
                self.new_generation()

            if self.spawn_stage[-1] is None:
                # new models given by models_to_build_on plus terms in
                # available_terms (greedy)
                new_models = self.add_terms_greedy(
                    models_to_build_on=models_to_build_on,
                    available_terms=self.available_mods_by_generation[
                        self.generation_DAG],
                    model_names_ids=kwargs['model_names_ids'],
                    # model_points=model_points
                )

        new_models = [
            construct_models.alph(mod) for mod in new_models
            # Final check whether this model is allowed
            if self.check_model_validity(mod)
        ]
        # store branch idx for new models

        registered_models = list(self.model_branches.keys())
        for model in new_models:
            if model not in registered_models:
                latex_model_name = self.latex_name(model)
                branch_id = (self.generation_DAG + len(
                    construct_models.get_constituent_names_from_name(model)))
                self.model_branches[latex_model_name] = branch_id

        return new_models
Exemple #4
0
    def __init__(self, exploration_rules, **kwargs):
        super().__init__(exploration_rules=exploration_rules, **kwargs)
        # keep these fixed to enforce 1d Ising chain up to 7 sites

        self.num_probes = 100
        self.lattice_dimension = 1
        self.initial_num_sites = 2
        self.lattice_connectivity_max_distance = 1
        self.max_num_sites = 8
        self.lattice_connectivity_linear_only = True
        self.lattice_full_connectivity = False
        self.min_param = 0
        self.max_param = 1
        # NOTE: turning off fixed parameters to test reducing champ in smaller param space.
        # TODO turn back on
        self.check_champion_reducibility = True
        self.gaussian_prior_means_and_widths = {
            # 'pauliSet_zJz_4J5_d5' : (0, 0.00001)
        }
        self.reduce_champ_bayes_factor_threshold = 10
        self.true_model_terms_params = {
            'pauliSet_zJz_1J2_d4': 0.61427723297770065,
            'pauliSet_zJz_2J3_d4': 0.12996320356092372,
            'pauliSet_zJz_3J4_d4': 0.18011186731750234,
            'pauliSet_zJz_1J2_d3': 0.16342878531289817,
            'pauliSet_zJz_2J3_d3': 0.3979280929069925,
        }
        # test heuristic -- force all times to be considered
        self.model_heuristic_subroutine = qmla.shared_functionality.experiment_design_heuristics.MixedMultiParticleLinspaceHeuristic
        # self.true_model = 'pauliSet_zJz_1J2_d2'
        self.true_model = 'pauliSet_zJz_1J2_d4PPPPpauliSet_zJz_2J3_d4PPPPpauliSet_zJz_3J4_d4'
        # self.true_model = 'pauliSet_zJz_1J2_d6PPPPPPpauliSet_zJz_2J3_d6PPPPPPpauliSet_zJz_3J4_d6PPPPPPpauliSet_zJz_4J5_d6PPPPPPpauliSet_zJz_5J6_d6'
        # self.true_model = 'pauliSet_zJz_1J2_d3PPPpauliSet_zJz_2J3_d3'
        # self.true_model = '1Dising_ix_d2'

        self.true_model = construct_models.alph(self.true_model)
        self.qhl_models = [self.true_model, 'pauliSet_zJz_1J2_d2']
        self.base_terms = ['z']

        self.setup_exploration_class()
        self.tree_completed_initially = True
        if self.tree_completed_initially == True:
            # to manually fix the models to be considered
            self.num_processes_to_parallelise_over = 5
            self.initial_models = [
                'pauliSet_zJz_1J2_d6PPPPPPpauliSet_zJz_2J3_d6PPPPPPpauliSet_zJz_3J4_d6PPPPPPpauliSet_zJz_4J5_d6PPPPPPpauliSet_zJz_5J6_d6',
                'pauliSet_zJz_1J2_d5PPPPPpauliSet_zJz_2J3_d5PPPPPpauliSet_zJz_3J4_d5PPPPPpauliSet_zJz_4J5_d5',
                'pauliSet_zJz_1J2_d4PPPPpauliSet_zJz_2J3_d4PPPPpauliSet_zJz_3J4_d4',
                'pauliSet_zJz_1J2_d3PPPpauliSet_zJz_2J3_d3',
                'pauliSet_zJz_1J2_d2',
                # 'pauliSet_zJz_1J2_d7PPPPPPPpauliSet_zJz_2J3_d7PPPPPPPpauliSet_zJz_3J4_d7PPPPPPPpauliSet_zJz_4J5_d7PPPPPPPpauliSet_zJz_5J6_d7PPPPPPPpauliSet_zJz_6J7_d7',
            ]
            self.qhl_models = self.initial_models

            if self.true_model not in self.initial_models:
                self.initial_models.append(self.true_model)

            self.max_num_models_by_shape = {4: 3, 5: 3, 'other': 0}
Exemple #5
0
 def __init__(self, exploration_rules, **kwargs):
     super().__init__(exploration_rules=exploration_rules, **kwargs)
     self.max_num_qubits = 5
     self.max_num_sites = 6
     self.fraction_particles_for_bf = 1e-4  # to ensure only ~5 particles used
     self.num_processes_to_parallelise_over = 2
     self.initial_models = [
         'pauliSet_zJz_1J2_d5PPPPPpauliSet_zJz_2J3_d5PPPPPpauliSet_zJz_3J4_d5PPPPPpauliSet_zJz_4J5_d5',
         'pauliSet_zJz_1J2_d5PPPPPpauliSet_zJz_4J5_d5',
     ]
     self.true_model = construct_models.alph(self.initial_models[0])
     self.max_num_models_by_shape = {5: 2, 'other': 0}
Exemple #6
0
    def __init__(self, exploration_rules, **kwargs):
        super().__init__(exploration_rules=exploration_rules, **kwargs)

        self.lattice_dimension = 1
        self.initial_num_sites = 2
        self.lattice_connectivity_max_distance = 1
        self.lattice_connectivity_linear_only = True
        self.lattice_full_connectivity = False
        self.max_num_probe_qubits = 10

        # self.true_model = 'pauliSet_zJz_1J2_d3PPPpauliSet_xJx_1J3_d3PPPpauliSet_zJz_2J3_d3PPPpauliSet_yJy_1J2_d3'
        self.true_model = 'pauliSet_zJz_1J2_d4PPPPpauliSet_zJz_2J3_d4PPPPpauliSet_zJz_3J4_d4'
        self.true_model = construct_models.alph(self.true_model)
        self.qhl_models = [self.true_model, 'pauliSet_zJz_1J2_d4']
        self.base_terms = [
            # 'x',
            # 'y',
            'z'
        ]
        # self.model_heuristic_subroutine = qmla.shared_functionality.experiment_design_heuristics.MixedMultiParticleLinspaceHeuristic
        self.max_time_to_consider = 50
        # fitness calculation parameters. fitness calculation inherited.
        # 'all' # at each generation Badassness parameter
        self.num_top_models_to_build_on = 'all'
        self.model_generation_strictness = -1  #0  # 1 #-1
        self.fitness_win_ratio_exponent = 1
        # self.max_time_to_consider = 20

        self.generation_DAG = 1
        self.tree_completed_initially = False
        self.num_processes_to_parallelise_over = 10

        self.true_model_terms_params = {
            'pauliSet_zJz_1J2_d4': 0.61427723297770065,
            'pauliSet_zJz_2J3_d4': 0.12996320356092372,
            'pauliSet_zJz_3J4_d4': 0.18011186731750234,
            'pauliSet_zJz_1J2_d3': 0.06342878531289817,
            'pauliSet_zJz_2J3_d3': 0.3979280929069925,
        }
        self.max_num_models_by_shape = {'other': 3}
        self.max_num_sites = 5

        self.gaussian_prior_means_and_widths = {
            # 'pauliSet_zJz_1J2_d3' : (2, 0.01),
            # 'pauliSet_zJz_2J3_d3' : (8, 0.1)
            # 'pauliSet_zJz_4J5_d5' : (0, 0.01)
        }

        self.tree_completed_initially = False
        self.setup_exploration_class(
        )  # from ConnectedLattice, using updated params
Exemple #7
0
    def setup_exploration_class(self):
        # for classes which use connected_lattice as super class
        # which may change attributes defined above, calculate
        # further attributes based on those, e.g. max num generations
        # based on max num sites, defined by the class inheriting.
        self.max_num_generations = (self.max_num_sites -
                                    self.initial_num_sites +
                                    self.generation_DAG)
        self.max_num_probe_qubits = self.max_num_sites
        self.topology = qmla.shared_functionality.topology.GridTopology(
            dimension=self.lattice_dimension,
            num_sites=self.initial_num_sites,
            # nearest neighbours only,
            maximum_connection_distance=self.lattice_connectivity_max_distance,
            linear_connections_only=self.lattice_connectivity_linear_only,
            all_sites_connected=self.lattice_full_connectivity,
        )
        self.initially_connected_sites = self.topology.get_connected_site_list(
        )

        self.true_model = construct_models.alph(self.true_model)
        self.model_fitness = {}
        self.models_rejected = {self.generation_DAG: []}
        self.models_accepted = {self.generation_DAG: []}

        self.available_mods_by_generation = {}
        self.available_mods_by_generation[
            self.generation_DAG] = self.generate_terms_from_new_site(
                connected_sites=self.initially_connected_sites,
                base_terms=self.base_terms,
                num_sites=self.topology.num_sites(),
                new_sites=range(1,
                                self.topology.num_sites() + 1),
            )
        self.spawn_stage = ['Start']
        if not self.tree_completed_initially:
            self.log_print(["Getting initial models from generate_models"])
            self.initial_models = self.generate_models(model_list=[''])

        self.site_connections_considered = self.initially_connected_sites
        self.max_num_sub_generations_per_generation = {
            self.generation_DAG:
            len(self.available_mods_by_generation[self.generation_DAG])
        }
        self.models_to_build_on = {self.generation_DAG: {}}
        self.generation_champs = {self.generation_DAG: {}}
        self.generation_fitnesses = {self.generation_DAG: {}}
        self.sub_generation_idx = 0
        self.counter = 0
Exemple #8
0
def check_model_in_dict(name, model_dict):
    """
    Check whether the new model, name, exists in all previously considered models,
        held in model_lists.
    [previously in construct_models]
    If name has not been previously considered, False is returned.
    """
    # Return true indicates it has not been considered and so can be added

    al_name = alph(name)
    n_qub = get_num_qubits(name)

    if al_name in model_dict[n_qub]:
        return True  # todo -- make clear if in legacy or running db
    else:
        return False
def full_model_string(operations):
    """
    operations must be a dict with elements:
    - 'dim' : number of qubits
    - 'terms' : list of lists of tuple of the form,
        e.g. [[ (1, 'x'), (2, 'y')]]
        i.e. tuples (qubit_id, pauli_operator)
        Each nested list gives a term, which are all added together for the full model
    Reconstructs unique model name for that Hamiltonian.
    """

    # Note TODO: this doesn't give an error when tuples are
    # given which aren't used. it should
    from qmla.construct_models import alph
    terms = operations['terms']
    num_qubits = operations['dim']
    num_terms = len(terms)
    all_terms = []
    for i in range(len(terms)):
        single_term = terms[i]
        single_term_dict = dict(single_term)

        model_name = ''

        t_str = ''
        for i in range(1, 1 + num_qubits):
            if i in single_term_dict:
                pauli = single_term_dict[i]
            else:
                pauli = 'i'
            t_str += 'T'
            if i == num_qubits:
                t_str = ''
            model_name += str(pauli + t_str)

        all_terms.append(model_name)

    all_terms = list(set(list(all_terms)))
    p_str = 'P'
    for i in range(num_qubits - 1):
        p_str += 'P'

    # full_model = p_str.join(all_terms)
    full_model = '+'.join(all_terms)
    full_model = alph(full_model)
    return full_model
Exemple #10
0
    def __init__(self, exploration_rules, **kwargs):
        # print("[Exploration Strategies] init nv_spin_experiment_full_tree")
        super().__init__(exploration_rules=exploration_rules, **kwargs)
        self.qinfer_resampler_threshold = 0.5
        self.max_time_to_consider = 100
        # edit time of experimentation
        self.model_heuristic_subroutine = qmla.shared_functionality.experiment_design_heuristics.MixedMultiParticleLinspaceHeuristic
        # self.qinfer_model_class = qmla.shared_functionality.qinfer_model_interface.QInferLiouvilleExperiment

        self.exclude_evaluation = True
        self.log_print(["initialising new GR"])
        self.latex_string_map_subroutine = liouville_latex
        self.expectation_value_subroutine = liouvillian_evolve_expectation

        qmla.construct_models.core_operator_dict['a'] = np.array([[0, 0],
                                                                  [0, 1]])
        qmla.construct_models.core_operator_dict['b'] = np.array(
            [[1, 0.3741966805226849], [0.41421356237309503, -1]], complex)
        qmla.construct_models.core_operator_dict['c'] = np.array(
            [[1, 0.3741966805226849], [0.41421356237309503, -1]], complex).T
        self.initial_models = [
            'LiouvillianHam_lx_1_d1+LiouvillianHam_la_1_d1+LiouvillianDiss_lb_1_d1+LiouvillianDiss_lc_1_d1'
        ]
        self.tree_completed_initially = True
        #self.qinfer_resampler_a = 0.98
        #self.qinfer_resampler_threshold = 0.5
        self.true_model = 'LiouvillianHam_lx_1_d1+LiouvillianHam_la_1_d1+LiouvillianDiss_lb_1_d1+LiouvillianDiss_lc_1_d1'
        #print(self.true_model)
        self.plot_probe_generation_function = plot_probe
        self.true_model = construct_models.alph(self.true_model)
        self.true_model_terms_params = {
            'LiouvillianHam_lx_1_d1': 0.66322,
            'LiouvillianHam_la_1_d1': 0.73424,
            'LiouvillianDiss_lb_1_d1': 0.01523,
            'LiouvillianDiss_lc_1_d1': 0.13678,
        }

        #qmla.construct_models.compute('LiouvillianHam_lx_1J2_d2+LiouvillianDiss_ls_1_2_d2')
        self.probe_generation_function = liouv_separable_probe_dict
Exemple #11
0
    def __init__(self, exploration_rules, **kwargs):
        # print("[Exploration Strategies] init nv_spin_experiment_full_tree")
        super().__init__(exploration_rules=exploration_rules, **kwargs)

        self.lattice_dimension = 2
        self.initial_num_sites = 4
        self.lattice_connectivity_max_distance = 1
        self.lattice_connectivity_linear_only = True
        self.lattice_full_connectivity = False
        self.max_num_sites = 4
        # self.system_probes_generation_subroutine = qmla.shared_functionality.probe_set_generation.pauli_eigenvector_based_probes

        self.three_site_chain_xxz = 'pauliSet_1J2_xJx_d3+pauliSet_2J3_zJz_d3'
        self.four_site_xxz_chain = 'pauliSet_1J2_xJx_d4+pauliSet_2J3_xJx_d4+pauliSet_2J3_zJz_d4+pauliSet_3J4_zJz_d4'
        self.four_site_xxz = 'pauliSet_1J2_xJx_d4+pauliSet_1J3_zJz_d4+pauliSet_2J4_xJx_d4+pauliSet_3J4_xJx_d4+pauliSet_3J4_zJz_d4'

        self.true_model = self.four_site_xxz_chain
        self.true_model = construct_models.alph(self.true_model)
        self.qhl_models = [
            self.true_model,
            'pauliSet_1J2_xJx_d4+pauliSet_1J3_xJx_d4+pauliSet_2J4_xJx_d4+pauliSet_3J4_xJx_d4+pauliSet_3J4_zJz_d4',
            'pauliSet_1J2_xJx_d4+pauliSet_1J3_xJx_d4+pauliSet_2J4_xJx_d4+pauliSet_3J4_zJz_d4',
            'pauliSet_1J2_xJx_d4+pauliSet_1J2_zJz_d4+pauliSet_1J3_xJx_d4+pauliSet_2J4_xJx_d4+pauliSet_3J4_zJz_d4',
            'pauliSet_1J2_xJx_d4+pauliSet_1J2_zJz_d4+pauliSet_1J3_xJx_d4+pauliSet_2J4_xJx_d4+pauliSet_2J4_zJz_d4+pauliSet_3J4_xJx_d4'
        ]
        self.base_terms = [
            'x',
            # 'y',
            'z'
        ]
        # self.num_probes = 50
        # self.max_time_to_consider = 50
        # fitness calculation parameters. fitness calculation inherited.
        # 'all' # 'all' # at each generation Badassness parameter

        self.num_top_models_to_build_on = 1  # to test strict generation to ensure sensible paths occuring
        # self.num_top_models_to_build_on =  'all'
        self.model_generation_strictness = 0  # 1 #-1
        self.fitness_win_ratio_exponent = 1
        self.fitness_minimum = 1
        self.fitness_maximum = 1.0
        self.check_champion_reducibility = True
        self.generation_DAG = 1
        # self.true_model_terms_params = {
        #     'pauliSet_1J2_xJx_d4': 0.27044671107574969,
        #     'pauliSet_1J3_zJz_d4': 1.1396665426731736,
        #     'pauliSet_2J4_xJx_d4': 0.38705331216054806,
        #     'pauliSet_3J4_xJx_d4': 0.46892509638460805,
        #     'pauliSet_3J4_zJz_d4': 0.45440765993845578
        # }

        self.tree_completed_initially = False
        self.num_processes_to_parallelise_over = 10
        self.max_num_models_by_shape = {
            # 1 : 0,
            # 2: 10,
            # 3: 10,
            2: 4,
            3: 4,
            # 4: 50,
            'other': 0
        }

        self.setup_exploration_class()
Exemple #12
0
    def __init__(self, arguments, **kwargs):
        self.log_file = os.path.abspath(arguments.log_file)

        # Mode of learning: QHL, mult-model-QHL; default QMLA (if all are
        # False)
        self.qhl_mode_multiple_models = bool(
            arguments.qhl_mode_multiple_models)
        self.qhl_mode = bool(arguments.qhl_mode)
        self.further_qhl = bool(arguments.further_qhl)

        # Get exploration strategy instances for true and alternative exploration strategies
        self.exploration_rules = arguments.exploration_strategy
        try:
            self.exploration_class = qmla.get_exploration_strategy.get_exploration_class(
                exploration_rules=self.exploration_rules,
                true_params_path=arguments.run_info_file,
                plot_probes_path=arguments.probes_plot_file,
                log_file=self.log_file,
                qmla_id=arguments.qmla_id,
            )
        except BaseException:
            raise
        self.exploration_class.get_true_parameters(
        )  # either retrieve or assign true parameters
        self.log_print([
            "ES set by controls has ID {} has true model {}".format(
                arguments.qmla_id, self.exploration_class.true_model)
        ])

        self.alternative_exploration_strategies = arguments.alternative_exploration_strategies
        self.unique_exploration_strategy_instances = {
            gen: qmla.get_exploration_strategy.get_exploration_class(
                exploration_rules=gen,
                log_file=self.log_file,
                qmla_id=arguments.qmla_id,
            )
            for gen in self.alternative_exploration_strategies
        }
        self.unique_exploration_strategy_instances[
            self.exploration_rules] = self.exploration_class

        # Get (or set) true parameters from parameter files shared among
        # instances within the same run.
        if arguments.run_info_file is None:
            try:
                true_params_info = qmla.set_shared_parameters(
                    exploration_class=self.exploration_class, )
            except BaseException:
                self.log_print(["Failed to set shared parameters"])
                raise
        else:
            true_params_info = pickle.load(open(arguments.run_info_file, 'rb'))

        # Attributes about true model
        self.true_model = construct_models.alph(
            self.exploration_class.true_model)
        self.true_model_name = self.true_model  # TODO remove redundancy
        self.true_model_class = construct_models.Operator(self.true_model_name)
        self.true_model_terms_matrices = self.true_model_class.constituents_operators
        self.run_info_file = arguments.run_info_file
        self.log_print(["Shared true params set for this instance."])

        # Store parameters which were passed as arguments to implement_qmla.py
        self.qmla_id = arguments.qmla_id
        self.use_rq = bool(arguments.use_rq)
        self.num_experiments = arguments.num_experiments
        self.num_particles = arguments.num_particles
        self.save_plots = bool(arguments.save_plots)
        self.debug_mode = bool(arguments.debug_mode)
        self.pickle_qmla_instance = bool(arguments.pickle_qmla_instance)
        self.rq_timeout = arguments.rq_timeout
        self.plot_level = arguments.plot_level
        self.figure_format = arguments.figure_format
        self.log_print(["Figure format:", self.figure_format])

        # Redis
        self.host_name = arguments.host_name
        self.port_number = arguments.port_number

        # Outputs
        self.results_directory = arguments.results_directory
        if not self.results_directory.endswith('/'):
            self.results_directory += '/'
        self.cumulative_csv = arguments.cumulative_csv

        self.system_measurements_file = arguments.system_measurements_file
        self.probes_plot_file = arguments.probes_plot_file

        # Create some new paths/parameters for storing results
        self.alt_log_file = os.path.join(
            self.results_directory, 'qmla_log_{}.log'.format(self.qmla_id))
        self.long_id = '{0:03d}'.format(self.qmla_id)
        self.plots_directory = os.path.join(self.results_directory,
                                            'instances',
                                            "qmla_{}".format(self.qmla_id))
        if not os.path.exists(self.results_directory):
            try:
                os.makedirs(self.results_directory)
            except FileExistsError:
                pass

        if not os.path.exists(self.plots_directory):
            try:
                os.makedirs(self.plots_directory)
            except FileExistsError:
                pass

        self.latex_mapping_file = arguments.latex_mapping_file
        if self.latex_mapping_file is None:
            self.latex_name_map_file_path = os.path.join(
                self.results_directory, 'LatexMapping.txt')

        if self.further_qhl:
            # further qhl model uses different results file names to
            # distinguish
            self.results_file = self.results_directory + 'further_qhl_results_' + \
                str(self.long_id) + '.p'
            self.class_pickle_file = self.results_directory + \
                'further_qhl_qml_class_' + str(self.long_id) + '.p'
        else:
            self.results_file = self.results_directory + 'results_' + \
                str(self.long_id) + '.p'
            self.class_pickle_file = self.results_directory + \
                'qmla_class_' + str(self.long_id) + '.p'