Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
labcode
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Model registry
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
CST
labcode
Commits
268076cc
Commit
268076cc
authored
6 months ago
by
Alexandros Asonitis
Browse files
Options
Downloads
Patches
Plain Diff
save data
parent
5066e2a6
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
hp4155/savedata.ipynb
+145
-0
145 additions, 0 deletions
hp4155/savedata.ipynb
with
145 additions
and
0 deletions
hp4155/savedata.ipynb
0 → 100644
+
145
−
0
View file @
268076cc
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"id": "d119393c-bc09-4646-a812-d17081d0d105",
"metadata": {},
"outputs": [],
"source": [
"import hp4155a"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "af3fb977-e43b-4120-9e76-8924c8e24d7c",
"metadata": {},
"outputs": [],
"source": [
"device = hp4155a.HP4155a('GPIB0::17::INSTR')"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "ed0d34d0-da93-4f68-8c71-159d47b32347",
"metadata": {},
"outputs": [],
"source": [
"time = device.return_values(\"@TIME\")"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "fa4ce64d-fb66-407b-bcfb-fe1faeca2df9",
"metadata": {},
"outputs": [],
"source": [
"R = device.return_values(\"R\")"
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "dbf0d611-d5a6-49f2-9fc4-e1df92c2a5c1",
"metadata": {},
"outputs": [],
"source": [
"data = {\"time(s)\":time,\"R(Ohm)\":R}"
]
},
{
"cell_type": "code",
"execution_count": 7,
"id": "25ba9dff-dfa6-4a2d-8a68-d39e36bd9651",
"metadata": {},
"outputs": [],
"source": [
"import pandas as pd"
]
},
{
"cell_type": "code",
"execution_count": 8,
"id": "977fab8d-7664-4f7d-817c-45f53b2544cc",
"metadata": {},
"outputs": [],
"source": [
"df = pd.DataFrame(data)"
]
},
{
"cell_type": "code",
"execution_count": 9,
"id": "81f38ff3-0d53-4730-ae4c-d187e23a5f58",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" time(s) R(Ohm)\n",
"0 0.0 2.514458e+07\n",
"1 60.0 3.031222e+07\n",
"2 120.0 3.103662e+07\n",
"3 180.0 3.669725e+07\n",
"4 240.0 3.880481e+07\n",
".. ... ...\n",
"846 50760.0 -5.347594e+08\n",
"847 50820.0 2.450980e+08\n",
"848 50880.0 -2.325581e+09\n",
"849 50940.0 -5.154639e+08\n",
"850 51000.0 -9.259259e+08\n",
"\n",
"[851 rows x 2 columns]\n"
]
}
],
"source": [
"print(df)"
]
},
{
"cell_type": "code",
"execution_count": 10,
"id": "af5de74d-307a-4530-8b63-3fc7f974c7dc",
"metadata": {},
"outputs": [],
"source": [
"with open('Retention data Bor-Han.txt',\"w\") as f:\n",
" f.write(df.to_string())"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "edfa472e-39d6-41cd-b771-a70904207528",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.4"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
%% Cell type:code id:d119393c-bc09-4646-a812-d17081d0d105 tags:
```
python
import
hp4155a
```
%% Cell type:code id:af3fb977-e43b-4120-9e76-8924c8e24d7c tags:
```
python
device
=
hp4155a
.
HP4155a
(
'
GPIB0::17::INSTR
'
)
```
%% Cell type:code id:ed0d34d0-da93-4f68-8c71-159d47b32347 tags:
```
python
time
=
device
.
return_values
(
"
@TIME
"
)
```
%% Cell type:code id:fa4ce64d-fb66-407b-bcfb-fe1faeca2df9 tags:
```
python
R
=
device
.
return_values
(
"
R
"
)
```
%% Cell type:code id:dbf0d611-d5a6-49f2-9fc4-e1df92c2a5c1 tags:
```
python
data
=
{
"
time(s)
"
:
time
,
"
R(Ohm)
"
:
R
}
```
%% Cell type:code id:25ba9dff-dfa6-4a2d-8a68-d39e36bd9651 tags:
```
python
import
pandas
as
pd
```
%% Cell type:code id:977fab8d-7664-4f7d-817c-45f53b2544cc tags:
```
python
df
=
pd
.
DataFrame
(
data
)
```
%% Cell type:code id:81f38ff3-0d53-4730-ae4c-d187e23a5f58 tags:
```
python
print
(
df
)
```
%% Output
time(s) R(Ohm)
0 0.0 2.514458e+07
1 60.0 3.031222e+07
2 120.0 3.103662e+07
3 180.0 3.669725e+07
4 240.0 3.880481e+07
.. ... ...
846 50760.0 -5.347594e+08
847 50820.0 2.450980e+08
848 50880.0 -2.325581e+09
849 50940.0 -5.154639e+08
850 51000.0 -9.259259e+08
[851 rows x 2 columns]
%% Cell type:code id:af5de74d-307a-4530-8b63-3fc7f974c7dc tags:
```
python
with
open
(
'
Retention data Bor-Han.txt
'
,
"
w
"
)
as
f
:
f
.
write
(
df
.
to_string
())
```
%% Cell type:code id:edfa472e-39d6-41cd-b771-a70904207528 tags:
```
python
```
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment