Skip to content

Julia scripts I used to process my data in the PHYS3152 course in 2025Spring

License

Notifications You must be signed in to change notification settings

R3G3N3R4T0R/2025Spring-PHYS3152-Analysis-Code

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HKUST 2025Spring PHYS3152 Methods of Experimental Physics I

To preface this. This repository contains code I used to hack up data in this course. This is not anything provided nor endorsed by the faculty, any error in the code is my own, but utilization of the code is on the user yourself, the code should not do anything weird but as they say UB can time travel and kill your dog, nothing is absolute.

These are codes I have used to analyze data obtained in the experiments, after the course, E1-E3 are left mostly unchanged. E4 is updated so you can use it as a generic library for analysis.

Since this course mainly rely on oscilloscope screenshots, there is little code for actual analysis unlike PHYS3153 Optics lab. You will mostly use this for ad hoc calculations and measurement propagation, the E4 code is minimal and should be used for analysis from E4 to E6.

I have also included a bash script convertoscope that use imagemagick to create higher constrast inverted grayscale oscilloscope images as the software provided by Keysight handled this poorly.

Installation

For best compatibility, use Julia 1.11, the specific versions are recorded in the Manifest.toml. I recommend getting julia from juliaup and use juliaup add 1.11

Afterwards you can git clone this repository and navigate to the code directory. Then you can setup the project by executing julia --project=., and typing ]instantiate in the REPL. For details see Pkg.jl docs on instantiate.

Subsequent invocation of the environment can be done by executing the supplied startup.jl script directly, this will make unqualified import of most packages and enable multithreading. Revise.jl is also imported in manual mode if found.

If there is a README file there it should prime you with things you should know using that project.

To remove the projects, rename the directory and type ]gc in a julia session.

Windows

The startup.jl script is a POSIX shell script and Windows cannot run it natively as it cannot read shebang nor does powershell have POSIX compatibility mode, you may have to run it inside WSL. Alternatively you may try this one liner in pwsh:

julia +1.11 -t auto --project=. -L .\\startup.jl

for normal invocation in the code directory, change the paths if you have to. If you are in the folder containing code, you would use code instead of ..

In E3 and E4, the shebang also handles sysimage loading, you need to use -J .\\sysimg.so to load the sysimage yourself. Building the sysimage is handled by julia so you only have to invoke julia with the extra argument. at worst you have to modify the extension in the script to use .dll instead of *nix .so.

Toolings

I made prolific use of DataFrames.jl and GLMakie.jl so it is a good idea to familiarize yourself with them, Beautiful Makie contains examples you can draw inspirations from.

Revise.jl is also a convenient tool for reloading functions from source files so you write more functions and less REPL.

Directory Structure

All code is contained in the code directory of each experiment code. The module of the experiment code contains common computation in the experiment. The gen module contains analysis specific to my own dataset, usually written generically but you may still need to adapt to your own needs.

Other directories may contain my own dataset that you may compare with your own. obs files are plaintext records of my observations, CSV files are handwritten for functions in the respective gen module. instr are plaintext instructions much more direct than reading the manual. In fact you should do a lot of pre-lab as the manual is a bit cryptic on what you need to gather.

About

Julia scripts I used to process my data in the PHYS3152 course in 2025Spring

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published