PHY220

A suite of codes written to create experiments and analyze data for the Physics 220 Class

View the Project on GitHub aaronkebede/PHY220

First Project

The Lab Setup

On the first project, we analyze simple RC circuits using a siglent oscilloscope, and a signal generator. We then use LabVIEW to automate some analyses and record data.

We then use our ouput to analyze the data and study circuit behavior at different frequencies. We have organized the data into CSV/XLSX files. Although the default output of the recorded data from LabVIEW is in the .xlsx format, we change the format to CSV inorder to make it easier to use it with numpy.

Code

The code for this project can be found on Github and is also mirrored on Gitlab. The visualizations we have are found on the directories /project-NUM, while NUM can be one, two etc.

Data

We have done multiple experiments and hence have multiple data outputs.
The data for each experiment can be found in the directory /project-one/*version*/Readings/

We have three version of the data:

Older versions of data recorded can be found on here: hand recorded data & V1

Latest Version

The data is organized into 4 files. Two of the files are Frequency vs Amplitude and Frequency vs Phase Shift. The other two are the same but with the lock-in amplifier included.

CSV root: /project-one/v2/Readings/CSV

XLSX: /project-one/v2/Readings/xlsx

Usage

Using the data is pretty straight forward. The outcome that we would like is to visualize the effect of frequency change on phase shift and amplitude. Here’s a sample visualization:

sample    = pd.read_csv("Readings/data.csv")
sample = np.array(sample)
sample_amp_diff   = sample[:,4]

#Plot Amplitude Difference Against Frequency  

plt.plot(sample_freq,sample_amp_diff, '--' ,lw=2, color='red')
plt.grid()
plt.title("Amplitude Difference vs Frequency")
plt.xlabel("Frequency (KHz)")
plt.ylabel("Amplitude Difference (V)")
plt.show()

#Plot Phase Shift Against Frequency  

plt.plot(sample_freq,sample_phase_diff, '--' , lw=2, c='chocolate')
plt.grid()
plt.title("Phase Shift vs Frequency")
plt.xlabel("Frequency (KHz)")
plt.ylabel("Phase Shift (degrees)")
plt.show()

This should be the Amplitude vs Frequency plot

This should be the Phase Shift vs Frequency plot For more visualizations and plots we used on our lab project, read Code

Questions?

If you have questions or want to make suggestions, the most ideal way would be to create an issue or a pull request on Github. You can also email me at aaron.kebede@lehigh.edu with questions.