Skip to content

Johny-Leo/phase-shift

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 

Repository files navigation

PhaseFinder

Installation and Setup:

S4 for Windows:

  • Install Miniconda or Anaconda here
  • Open the Anaconda Prompt and run where conda to find the path to conda (ex. C:\Users\USERNAME\Miniconda3\Scripts\conda.exe)
  • Add to PATH
    • Edit environmental variables
    • Put as first in the list to prevent potential conflicts
  • Open up Command Prompt and run the following:
    • conda init cmd.exe
    • conda config --add channels conda-forge
    • conda config --set ssl_verify no
    • conda upgrade conda
    • if you already have python installed, run conda create -n s4 python. otherwise, run conda create -n s4 python=3.7
    • conda activate s4
    • conda install -c paulgoulain s4 ### this no longer works
    • conda install -c marcus-o s4
  • Test the installation by running:
    • python
    • import S4 as S4 (capitalization matters)
    • if nothing happens it was installed right
    • Ctrl + Z to exit
  • Install necessary python packages by running pip install numpy matplotlib scipy tqdm

S4 MacOS* (Note: the python version of S4 doesn't work on M1 Macs yet):

  • Install Miniconda or Anaconda here
  • Open up Terminal and run the following:
    • conda config --add channels conda-forge
    • conda upgrade conda
    • if you already have python installed, run conda create -n s4 python. otherwise, run conda create -n s4 python=3.7
    • conda activate s4
    • conda install -c paulgoulain s4 #### this is no longer working
    • conda install -c marcus-o s4 #### use this package
  • Test the installation by running:
    • python
    • import S4 as S4 (capitalization matters)
    • if nothing happens it was installed right
    • ^Z to exit
  • Install necessary python packages by running pip3 install numpy matplotlib scipy tqdm

Usage

  • start by verifying that you are in the s4 environment (run conda activate s4)
  • run the program by typing python main.py (Windows) or python3 main.py (MacOS)
  • input requested information
  • if any information is incorrect, terminate the program and start over (Ctrl + C or ^C)
  • all data files will be saved to the specified data directory
    • data directory will be in the phase-shift directory
  • selected parameters will be saved in R_selected_parameters.txt or T_selected_parameters.txt in the data directory (R for reflection, T for transmission)
    • for reference, raw data will be in a separate folder inside the directory too (to reduce clutter)
  • simulation time for set intervals will be saved in time_logs.txt in the logs directory (for reference)
  • at the end of the program, the graphs of selected parameter values will be generated using matplotlib
    • each set of parameters will produce a separate graph
    • use Ctrl + W or Cmd + W to close current graph
    • next graph will automatically pop up once previous graph is closed

Folders and Files [not updated (yet)]:

  • archived: sample simulation files
  • logs: miscellaneous log files
    • time_logs.txt: records time taken for simulation (only most recent info is saved)
    • compare.py: simple python script that compares 2 txt files
  • data: contains data files generated from simulation code (directory name is customizable)

Misc Implementation Details:

  • Ereflected = EZ0 - Eincident
  • Phase Shift: atan2(ratioI, ratioR)
    • ratioI = (reference/reflected).imag (imaginary component)
    • ratioR = (reference/reflected).real (real component)
  • frequency = 1000/wavelength
  • np.linspace was used instead of something like np.arange to prevent some float precision errors

TODO:

  • add input details
  • progress bar
  • add alternate method: run from command line and use sys.argv
  • more detailed installation guide

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%