Skip to content

Commit

Permalink
refactoring BTC_01_PL
Browse files Browse the repository at this point in the history
  • Loading branch information
gonfeco committed Sep 13, 2023
1 parent ec6a450 commit eb317b2
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 286 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,4 @@ jobs:
python -c "import sys; print('\n'.join(sys.path)); import os; print(os.getcwd())"
- name: Test with pytest
run: |
PYTHONPATH=$(pwd) python -m pytest tests/test_btc_01_pl.py
PYTHONPATH=$(pwd) python -m pytest tests/test_btc_02_ae.py
PYTHONPATH=$(pwd) python -m pytest tests/test_btc_03_qpe.py
pytest
6 changes: 4 additions & 2 deletions tests/test_btc_01_pl.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,16 @@
import sys
import pandas as pd
import numpy as np

import re

folder = os.getcwd()
folder = re.sub(
r"WP3_Benchmark/(?=WP3_Benchmark/)*.*","WP3_Benchmark/", folder)

sys.path.append(folder+"/tnbs/BTC_01_PL")
from my_benchmark_execution import KERNEL_BENCHMARK as PL_CLASS
sys.path.append(folder)
from tnbs.BTC_01_PL.my_benchmark_execution import KERNEL_BENCHMARK as PL_CLASS
from tnbs.BTC_01_PL.PL import *


def create_folder(folder_name):
Expand Down
189 changes: 0 additions & 189 deletions tests/test_btc_02_ae.py

This file was deleted.

86 changes: 0 additions & 86 deletions tests/test_btc_03_qpe.py

This file was deleted.

5 changes: 2 additions & 3 deletions tnbs/BTC_01_PL/PL/data_loading.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,8 @@
import qat.lang.AQASM as qlm
from qat.lang.models import KPTree
from scipy.stats import norm
sys.path.append('../')
from PL.utils.utils import bitfield, left_conditional_probability, fwht
from PL.utils.data_extracting import get_results
from tnbs.BTC_01_PL.PL.utils.utils import bitfield, left_conditional_probability, fwht
from tnbs.BTC_01_PL.PL.utils.data_extracting import get_results


def mask(number_qubits, index):
Expand Down
10 changes: 8 additions & 2 deletions tnbs/BTC_01_PL/PL/load_probabilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,18 @@
"""

import sys
import os
import time
import numpy as np
import pandas as pd
from scipy.stats import entropy, chisquare, chi2
sys.path.append('../')
from PL.data_loading import get_theoric_probability, get_qlm_probability, \
import re

folder = os.getcwd()
folder = re.sub(
r"WP3_Benchmark/(?=WP3_Benchmark/)*.*","WP3_Benchmark/", folder)
sys.path.append(folder)
from tnbs.BTC_01_PL.PL.data_loading import get_theoric_probability, get_qlm_probability, \
get_qpu


Expand Down
10 changes: 9 additions & 1 deletion tnbs/BTC_01_PL/my_benchmark_execution.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,19 @@
"""

import sys
import os
import json
from datetime import datetime
from copy import deepcopy
import pandas as pd
import re

folder = os.getcwd()
folder = re.sub(
r"WP3_Benchmark/(?=WP3_Benchmark/)*.*","WP3_Benchmark/", folder)
sys.path.append(folder)

from tnbs.BTC_01_PL.PL.load_probabilities import LoadProbabilityDensity, get_qpu

def build_iterator(**kwargs):
"""
Expand Down Expand Up @@ -42,7 +51,6 @@ def run_code(iterator_step, repetitions, stage_bench, **kwargs):
Desired name for saving the results of the execution
"""
from PL.load_probabilities import LoadProbabilityDensity, get_qpu
#if n_qbits is None:
# raise ValueError("n_qbits CAN NOT BE None")

Expand Down

0 comments on commit eb317b2

Please sign in to comment.