Latest Threat Research:SANDWORM_MODE: Shai-Hulud-Style npm Worm Hijacks CI Workflows and Poisons AI Toolchains.Details
Socket
Book a DemoInstallSign in
Socket

pyquac

Package Overview
Dependencies
Maintainers
1
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pyquac - npm Package Compare versions

Comparing version
1.1.7
to
1.1.9
+1
-1
PKG-INFO
Metadata-Version: 2.1
Name: pyquac
Version: 1.1.7
Version: 1.1.9
Summary: Useful tools for quantum computing experiments, provided for BMSTU FMN

@@ -5,0 +5,0 @@ Home-page: https://github.com/ikaryss/pyquac

Metadata-Version: 2.1
Name: pyquac
Version: 1.1.7
Version: 1.1.9
Summary: Useful tools for quantum computing experiments, provided for BMSTU FMN

@@ -5,0 +5,0 @@ Home-page: https://github.com/ikaryss/pyquac

@@ -199,2 +199,4 @@ # built-in libraries

self.active_state = True
def iter_setup(self, *, x_key: Union[float, int, Iterable] = None, y_key: Union[float, int, Iterable] = None,

@@ -423,3 +425,3 @@ x_min=None, x_max=None, y_min=None, y_max=None):

def approximate(self, resolving_zone: float = 0.1, *, fillna: bool = False, info=False,
plot: bool = False):
plot: bool = False, heat_sample=None, heat_sampe_tol=2):
"""

@@ -442,17 +444,29 @@ return dict object with keys:

glob_samp, glob_h_mi, glob_h_ma = self.__define_heat_sample_on(x_set, info=info, plot=plot, q_max=80, q_min=20)
if heat_sample is None:
glob_samp, glob_h_mi, glob_h_ma = self.__define_heat_sample_on(x_set, info=info, plot=plot, q_max=80, q_min=20)
self.glob_samp = glob_samp
self.glob_h_mi = glob_h_mi
self.glob_h_ma = glob_h_ma
self.glob_samp = glob_samp
self.glob_h_mi = glob_h_mi
self.glob_h_ma = glob_h_ma
for xxx in x_set:
heat_sample, heat_min, heat_max = self.__define_heat_sample_on(xxx, info=info, plot=plot)
for xxx in x_set:
heat_sample, heat_min, heat_max = self.__define_heat_sample_on(xxx, info=info, plot=plot)
self.heat_samples = np.append(self.heat_samples, heat_sample)
self.heat_mins = np.append(self.heat_mins, heat_min)
self.heat_maxs = np.append(self.heat_maxs, heat_max)
self.heat_samples = np.append(self.heat_samples, heat_sample)
self.heat_mins = np.append(self.heat_mins, heat_min)
self.heat_maxs = np.append(self.heat_maxs, heat_max)
self.__change_outlier_heatsamples() # change bad heat samples
self.__change_outlier_heatsamples() # change bad heat samples
pass
else:
self.glob_samp = heat_sample
self.glob_h_mi = heat_sample - heat_sampe_tol
self.glob_h_ma = heat_sample + heat_sampe_tol
for xxx in x_set:
self.heat_samples = np.append(self.heat_samples, self.glob_samp)
self.heat_mins = np.append(self.heat_mins, self.glob_h_mi)
self.heat_maxs = np.append(self.heat_maxs, self.glob_h_ma)
tuple_list = ()

@@ -862,4 +876,6 @@ ip = 0

def __find_min_max_y_on_(self, x, heat_sample, n_steps=10):
def __find_min_max_y_on_(self, x, heat_sample):
n_steps = int(0.04 * len(self.y_list))
if len(self.raw_frame[self.raw_frame.x_value == x].y_value) <= 0.7 * len(self.y_list):

@@ -882,4 +898,4 @@ smooth_heat = self.__smooth_list_gaussian(self.raw_frame[self.raw_frame.x_value == x

stdev = np.std(self.heat_samples)
print(stats.mode(self.heat_samples))
mode = stats.mode(self.heat_samples)[0][0]
#print(stats.mode(self.heat_samples))
mode = np.percentile(self.heat_samples, 50)

@@ -886,0 +902,0 @@ outliers_mask = np.abs(self.heat_samples - mode) > stdev

@@ -464,3 +464,3 @@ """

@classmethod
def configure_app(cls, data, fig, mode='inline', port=8051, interval=4e3, qubit_id=None):
def configure_app(cls, data, fig, mode='inline', port=8051, interval=4e3, qubit_id=None, chip_id=None):
cls.fig = fig

@@ -470,3 +470,4 @@ cls.mode = mode

cls.port = port
cls.qubit_number = qubit_id
cls.chip_id = chip_id
cls.qubit_id = qubit_id

@@ -532,28 +533,28 @@ disabled_btn = False

file_name = ('TTS_' + 'q' + str(cls.qubit_number) + str(datetime.now().strftime(
"_%H-%M-%S")) + '.csv' if cls.qubit_number is not None else 'TTS_' + 'q' + '_untitled_' + str(
file_name = ('TTS_' + 'q' + str(cls.qubit_id) + str(datetime.now().strftime(
"_%H-%M-%S")) + '.csv' if cls.qubit_id is not None else 'TTS_' + 'q' + '_untitled_' + str(
datetime.now().strftime("_%H-%M-%S")) + '.csv')
data.get_result().to_csv(_save_path(file_name, cls.qubit_number), index=False)
data.get_result().to_csv(_save_path(file_name, cls.chip_id), index=False)
elif 'btn-nclicks-2' in changed_id:
file_name = ('TTS_'+'q'+str(cls.qubit_number)+str(datetime.now().strftime(
"_%H-%M-%S"))+'.pdf' if cls.qubit_number is not None else 'TTS_'+'q'+'_untitled_'+str(
file_name = ('TTS_'+'q'+str(cls.qubit_id)+str(datetime.now().strftime(
"_%H-%M-%S"))+'.pdf' if cls.qubit_id is not None else 'TTS_'+'q'+'_untitled_'+str(
datetime.now().strftime("_%H-%M-%S"))+'.pdf')
fig.write_image(_save_path(file_name, cls.qubit_number))
fig.write_image(_save_path(file_name, cls.chip_id))
elif 'btn-nclicks-3' in changed_id:
file_name = ('TTS_' + 'q' + str(cls.qubit_number) + str(datetime.now().strftime(
"_%H-%M-%S")) + '.html' if cls.qubit_number is not None else 'TTS_' + 'q' + '_untitled_' + str(
file_name = ('TTS_' + 'q' + str(cls.qubit_id) + str(datetime.now().strftime(
"_%H-%M-%S")) + '.html' if cls.qubit_id is not None else 'TTS_' + 'q' + '_untitled_' + str(
datetime.now().strftime("_%H-%M-%S")) + '.html')
fig.write_html(_save_path(file_name, cls.qubit_number))
fig.write_html(_save_path(file_name, cls.chip_id))
elif 'btn-nclicks-5' in changed_id:
file_name = ('TTS_' + 'q' + str(cls.qubit_number) + str(datetime.now().strftime(
"_%H-%M-%S")) + '.svg' if cls.qubit_number is not None else 'TTS_' + 'q' + '_untitled_' + str(
file_name = ('TTS_' + 'q' + str(cls.qubit_id) + str(datetime.now().strftime(
"_%H-%M-%S")) + '.svg' if cls.qubit_id is not None else 'TTS_' + 'q' + '_untitled_' + str(
datetime.now().strftime("_%H-%M-%S")) + '.svg')
fig.write_image(_save_path(file_name, cls.qubit_number))
fig.write_image(_save_path(file_name, cls.chip_id))

@@ -565,2 +566,3 @@ elif 'btn-nclicks-4' in changed_id:

pass
if time_val:

@@ -574,1 +576,32 @@ cls.interval = time_val

return app.run_server(mode=cls.mode, port=cls.port)
@classmethod
def save_all(cls, data, fig,
*, csv=True, pdf=True, html=True, svg=True):
# CSV
file_name = ('TTS_' + 'q' + str(cls.qubit_id) + str(datetime.now().strftime(
"_%H-%M-%S")) + '.csv' if cls.qubit_id is not None else 'TTS_' + 'q' + '_untitled_' + str(
datetime.now().strftime("_%H-%M-%S")) + '.csv')
data.get_result().to_csv(_save_path(file_name, cls.chip_id), index=False)
# PDF
file_name = ('TTS_' + 'q' + str(cls.qubit_id) + str(datetime.now().strftime(
"_%H-%M-%S")) + '.pdf' if cls.qubit_id is not None else 'TTS_' + 'q' + '_untitled_' + str(
datetime.now().strftime("_%H-%M-%S")) + '.pdf')
fig.write_image(_save_path(file_name, cls.chip_id))
# HTML
file_name = ('TTS_' + 'q' + str(cls.qubit_id) + str(datetime.now().strftime(
"_%H-%M-%S")) + '.html' if cls.qubit_id is not None else 'TTS_' + 'q' + '_untitled_' + str(
datetime.now().strftime("_%H-%M-%S")) + '.html')
fig.write_html(_save_path(file_name, cls.chip_id))
# SVG
file_name = ('TTS_' + 'q' + str(cls.qubit_id) + str(datetime.now().strftime(
"_%H-%M-%S")) + '.svg' if cls.qubit_id is not None else 'TTS_' + 'q' + '_untitled_' + str(
datetime.now().strftime("_%H-%M-%S")) + '.svg')
fig.write_image(_save_path(file_name, cls.chip_id))

@@ -22,2 +22,3 @@ import zhinst

class Tts(TwoToneSpectroscopy):

@@ -34,3 +35,4 @@

LO_res_set_bandwidth: int = 20, LO_res_set_power: int = -10, LO_res_set_nop=101,
base_bandwidth=40, nx_points = None, x_step=None, y_step=None, ny_points=None
base_bandwidth=40, LO_res_set_averages=1, LO_res_meas_averages=1, nx_points=None, x_step=None,
y_step=None, ny_points=None
):

@@ -82,2 +84,5 @@ """

self.base_bandwidth = base_bandwidth
self.LO_res_set_averages = LO_res_set_averages
self.LO_res.set_averages(LO_res_set_averages)
self.LO_res_meas_averages = LO_res_meas_averages

@@ -98,2 +103,3 @@ pass

self.LO_res.set_freq_limits(self.fr_min, self.fr_max)
self.LO_res.set_averages(self.LO_res_set_averages)

@@ -134,2 +140,4 @@ # measure S21

pass
# measurement averages
self.LO_res.set_averages(self.LO_res_meas_averages)

@@ -150,1 +158,93 @@ self.hdawg.setDouble(self.hdawg_setDouble, self.load[i]) # Current write

pass
class Sts(TwoToneSpectroscopy):
def __init__(self,
*, x_min, x_max, y_min, y_max,
hdawg_port: str = '127.0.0.1', hdawg_port1: int = 8004, hdawg_port2: int = 6,
LO_res_port: str = 'TCPIP0::192.168.180.110::inst0::INSTR',
hdawg_channel: int = 5, hdawg_setDouble: str = '/dev8210/sigouts/5/offset',
LO_res_set_bandwidth: int = 20, LO_res_set_power: int = -10,
LO_res_set_averages=1,
nx_points=None, x_step=None, y_step=None, ny_points=None
):
"""
Class provides methods for working with live data for Two Tone Spectroscopy
:param x_min: x minimum value (int | float)
:param x_max: x maximum value (int | float)
:param nx_points: x count value (int)
:param y_min: y minimum value (int | float)
:param y_max: y maximum value (int | float)
:param ny_points: y count value (int)
:param hdawg_port: hdawg = zhinst.ziPython.ziDAQServer(hdawg_port, hdawg_port1, hdawg_port2)
:param hdawg_port1: hdawg = zhinst.ziPython.ziDAQServer(hdawg_port, hdawg_port1, hdawg_port2)
:param hdawg_port2: hdawg = zhinst.ziPython.ziDAQServer(hdawg_port, hdawg_port1, hdawg_port2)
:param LO_res_port: resonator LO_res = Znb(LO_res_port)
:param hdawg_channel: hdawg.setInt('/dev8210/sigouts/' + str(channel) + '/on', 1)
:param LO_res_set_bandwidth: bandwidth during resonator tuning
:param LO_res_set_power: base LO_res power (default -10)
"""
super().__init__(x_min=x_min, x_max=x_max, nx_points=nx_points, y_min=y_min, y_max=y_max, ny_points=ny_points,
x_step=x_step, y_step=y_step)
# HDAWG init
self.hdawg = zhinst.ziPython.ziDAQServer(hdawg_port, hdawg_port1, hdawg_port2)
self.hdawg_setDouble = hdawg_setDouble
# open HDAWG ZI
hdawgModule = self.hdawg.awgModule()
channel = hdawg_channel
self.hdawg.setInt('/dev8210/sigouts/' + str(channel) + '/on', 1)
# freq generator init
self.LO_res = Znb(LO_res_port) # resonator
self.LO_res_set_nop = LO_res_set_nop
self.LO_res_set_bandwidth = LO_res_set_bandwidth
self.LO_res_set_power = LO_res_set_power
self.LO_res_set_averages = LO_res_set_averages
self.LO_res.set_averages(LO_res_set_averages)
pass
def run_measurements(self, *, sleep=0.0007):
self.iter_setup(x_key=None, y_key=None,
x_min=None, x_max=None, y_min=None, y_max=None)
# Set power
self.LO_res.set_power(self.LO_res_set_power)
# Set parameters
self.LO_res.set_bandwidth(self.LO_res_set_bandwidth)
self.LO_res.set_nop(self.ny_points)
self.LO_res.set_freq_limits(self.y_min, self.y_max)
freqs = self.LO_res.get_freqpoints()
freq_len = len(self.y_list)
try:
for i in range(len(self.load)):
if (i == 0) or (self.load[i] != self.load[i - 1]):
self.hdawg.setDouble(self.hdawg_setDouble, self.load[i]) # Current write
self.LO_res.set_averages(self.LO_res_set_averages)
# measure S21
notch = notch_port(freqs, self.LO_res.measure()['S-parameter'])
notch.autofit(electric_delay=60e-9)
result = notch.fitresults['fr']
for j in range(freq_len):
self.write(x=self.load[i],
y=self.y_list[j],
heat=result[j]
)
timer.sleep(sleep)
except KeyboardInterrupt:
self.drop(x=self.x_raw[-1])
pass

@@ -11,3 +11,3 @@ from setuptools import setup, find_packages

name='pyquac',
version='1.1.7',
version='1.1.9',
description='Useful tools for quantum computing experiments, provided for BMSTU FMN',

@@ -14,0 +14,0 @@ long_description_content_type="text/markdown",