From 8160c117220c6bca5901cf23bda79328801c1965 Mon Sep 17 00:00:00 2001
From: JupyterHub User <1myhisij@jupyter.rwth-aachen.de>
Date: Tue, 29 Aug 2023 09:44:26 +0000
Subject: [PATCH] implemented function for stress+sampling measurement(no
 parameters yet)

---
 hp4155/first_goal_new.ipynb                   |  4 +-
 hp4155/measurements.py                        | 72 ++++++++++++++++++-
 .../pandas-checkpoint.ipynb                   |  0
 hp4155/{ => working_examples}/pandas.ipynb    |  6 +-
 4 files changed, 77 insertions(+), 5 deletions(-)
 rename hp4155/{ => working_examples}/.ipynb_checkpoints/pandas-checkpoint.ipynb (100%)
 rename hp4155/{ => working_examples}/pandas.ipynb (99%)

diff --git a/hp4155/first_goal_new.ipynb b/hp4155/first_goal_new.ipynb
index ea6bb0c..e233ad0 100644
--- a/hp4155/first_goal_new.ipynb
+++ b/hp4155/first_goal_new.ipynb
@@ -17,7 +17,9 @@
    "id": "d7dc3262-50c8-44db-9809-560d747fade3",
    "metadata": {},
    "outputs": [],
-   "source": []
+   "source": [
+    "stress_samping()"
+   ]
   }
  ],
  "metadata": {
diff --git a/hp4155/measurements.py b/hp4155/measurements.py
index 8f63184..0722472 100644
--- a/hp4155/measurements.py
+++ b/hp4155/measurements.py
@@ -60,4 +60,74 @@ def I_V_Measurement(start,stop,step):
     file_name = 'results_'+date+'.csv'
     df.to_csv(file_name)
     
-    del device
\ No newline at end of file
+    del device
+
+def stress_sampling():
+    
+    #connect to device
+    device = module.HP4155a('GPIB0::17::INSTR')
+    device.reset()
+    
+    device.stress_page()
+    
+    #define smus to numbers in mode and values for stress 
+
+    #mode
+    device.smu_mode(1,'COMM')
+    device.smu_mode(2,'V')
+    device.smu_mode(3,'V')
+    device.smu_mode(4,'COMM')
+    device.sync(4,0)
+
+    #values
+    device.smu_value(2,10)
+    device.smu_value(3,-3)
+    #time
+    zeit=device.stress_time(30)
+    
+    device.start_stress()
+    while device.operation_completed() == False:
+        pass
+    
+    #start with sampling measurement
+    device.measurement_mode('SAMP')
+
+    #set the mode of smus for sampling
+    device.smu_mode_meas(1,'COMM')
+    device.smu_mode_meas(2,'V')
+    device.smu_mode_meas(3,'V')
+    device.smu_mode_meas(4,'COMM')
+
+
+    #set the values of smu for sampling
+    device.constant_smu_sampling(2,10)
+    device.constant_smu_sampling(3,2)
+    
+    
+    #time log10
+    device.sampling_mode('L10')
+
+    #minimum initial interval
+    #device.initial_interval('MIN')
+
+    device.number_of_points(21)
+    device.integration_time('SHOR')
+    
+    device.single_measurement()
+    while device.operation_completed() == False:
+        pass
+
+    time_values = device.return_data('@TIME')
+    I3_values = device.return_data('I3')
+    I2_values = device.return_data('I2')
+    
+    fig = plt.figure()
+    plt.plot(time_values,I2_values)
+    plt.show()
+    
+    fig = plt.figure()
+    plt.plot(time_values,I3_values)
+    plt.show()
+    
+    
+    
\ No newline at end of file
diff --git a/hp4155/.ipynb_checkpoints/pandas-checkpoint.ipynb b/hp4155/working_examples/.ipynb_checkpoints/pandas-checkpoint.ipynb
similarity index 100%
rename from hp4155/.ipynb_checkpoints/pandas-checkpoint.ipynb
rename to hp4155/working_examples/.ipynb_checkpoints/pandas-checkpoint.ipynb
diff --git a/hp4155/pandas.ipynb b/hp4155/working_examples/pandas.ipynb
similarity index 99%
rename from hp4155/pandas.ipynb
rename to hp4155/working_examples/pandas.ipynb
index fb1d428..8558948 100644
--- a/hp4155/pandas.ipynb
+++ b/hp4155/working_examples/pandas.ipynb
@@ -119,8 +119,8 @@
    "source": [
     "#exporting the data frame in an excel file\n",
     "\n",
-    "file_name = 'results '+date+'.xlsx'\n",
-    "df.to_excel(file_name)\n",
+    "#file_name = 'results '+date+'.xlsx'\n",
+    "#df.to_excel(file_name)\n",
     "\n",
     "file_name = 'results '+date+'.csv'\n",
     "df.to_csv(file_name)"
@@ -151,7 +151,7 @@
    "name": "python",
    "nbconvert_exporter": "python",
    "pygments_lexer": "ipython3",
-   "version": "3.11.4"
+   "version": "3.9.7"
   }
  },
  "nbformat": 4,
-- 
GitLab