Python in Physics
OSU logo
The content of this page is undergoing revision and will be moved to another site soon.
PH411 Programs

Table of Contents

Plotting Data Acquired From The Oscilloscope by Scan.py or from Simulate.py

  • Use the latest version(12 Jan. 14:00) of response_plot.py to plot files individually or overlayed on the same graph. Note that you must download the following modules: response_plot_files.py, and response_plot_base.py The following data files created by scan.py are used in the examples: lp_filter.csv, hp_filter.csv. The following simulation files created by simulate.py are used in examples: lp_rcrc_filter.dat, lrhp_ideal_followed_by_rchp.csv. Try running the code at the bottom of the program and then create your own section. This program can plot an experimental data file and a simulation file on the same graph. In fact, it should be able to plot the data from any set of csv files of the form x, y1, y2, ..., yn. The x axis can be presented linearly or as log10. The y axis can be graphed linearly, in dB, as log10, or divided by pi. The x and y axis labels will be automatically generated. Titles can be automatically generated, provided by the user, or not used at all. The symbols used for the data of each file can be individually specified. A legend can be included if data from more than one file is overlayed on one graph.

Simulation of Simple RLC and Ideal Op Amp Circuits

  • The latest (12 Jan. 14:20) version of simulate.py performs frequency-domain response simulations of user-definable circuits of resistors, capacitors and inductors. It also simulates the response of inverting and non-inverting ideal op amp circuits. Data from a simulation can be saved as a csv file (comma-separated values). The graphs generated by simulate.py can be saved in eps, pdf, svg and png formats. The csv files can also be graphed using response_plot.py.