Difference between revisions of "Lab 2 Check"
Jump to navigation
Jump to search
Line 3: | Line 3: | ||
* In Spyder, open a new file (even if there is currently an empty file in the editor) | * In Spyder, open a new file (even if there is currently an empty file in the editor) | ||
* Select the comments that are automatically generated within it and delete them so you have a totally blank canvas | * Select the comments that are automatically generated within it and delete them so you have a totally blank canvas | ||
− | * Add the | + | * Add the following code: |
+ | <syntaxhighlight lang=python> | ||
+ | # %% Import modules | ||
+ | import numpy as np | ||
+ | import matplotlib.pyplot as plt | ||
+ | |||
+ | # %% Load and manipulate the data | ||
+ | # Load data from Cantilever.dat | ||
+ | beam_data = np.loadtxt("Cantilever.dat") | ||
+ | </syntaxhighlight> | ||
* Go to "Save As" in the File menu (top of the Spyder window for Windows, top of the screen for macOS); use the file navigator to get into your Box/EGR103F23/Lab02Files folder and save this script there as <code>run_can.py</code> | * Go to "Save As" in the File menu (top of the Spyder window for Windows, top of the screen for macOS); use the file navigator to get into your Box/EGR103F23/Lab02Files folder and save this script there as <code>run_can.py</code> | ||
* Hit the play button / F5 - this will run your script and should change the working directory to your Lab02Files folder | * Hit the play button / F5 - this will run your script and should change the working directory to your Lab02Files folder | ||
* In the top right quarter panel of Spyder, select the "Files" tab. You should now see at least four data files, a tex file, and a .py file. '''''If not, let the TAs know so they can come help!''''' | * In the top right quarter panel of Spyder, select the "Files" tab. You should now see at least four data files, a tex file, and a .py file. '''''If not, let the TAs know so they can come help!''''' |
Latest revision as of 19:03, 14 September 2023
This page contains instructions to check whether you have the right files in the right place!
- In Spyder, open a new file (even if there is currently an empty file in the editor)
- Select the comments that are automatically generated within it and delete them so you have a totally blank canvas
- Add the following code:
# %% Import modules
import numpy as np
import matplotlib.pyplot as plt
# %% Load and manipulate the data
# Load data from Cantilever.dat
beam_data = np.loadtxt("Cantilever.dat")
- Go to "Save As" in the File menu (top of the Spyder window for Windows, top of the screen for macOS); use the file navigator to get into your Box/EGR103F23/Lab02Files folder and save this script there as
run_can.py
- Hit the play button / F5 - this will run your script and should change the working directory to your Lab02Files folder
- In the top right quarter panel of Spyder, select the "Files" tab. You should now see at least four data files, a tex file, and a .py file. If not, let the TAs know so they can come help!