This is an attempt to demonstrate a virtual optical spectrum analyzer. Read more about optical spectrum analyzer.
The live version of the project can be found at: https://flask-osa.herokuapp.com/
To run the project locally, follow these steps:
- Clone the Project:
git clone https://github.com/ishpreet-singh/osa-flask
- Change your directory:
cd osa-flask
npm i yarn
- Install the dependencies:
yarn install
- Start the React Server:
yarn start
- Move to Flask directory:
cd api
- Create a virtual environment, Install the virtual environment if its not installed:
python3 -m venv venv
- Activate the environment:
source venv/bin/activate
- Install the requirements:
pip3 install -r requirements.txt
- Start the Flask Server:
flask run --no-debugger
- Head to
http://localhost:3000/
to see the result.
Command | Description |
---|---|
https://flask-osa.herokuapp.com/cmd | returns command prompt |
https://flask-osa.herokuapp.com/cmd | returns device identification string |
https://flask-osa.herokuapp.com/cmd/START | returns x-axis limits in m |
https://flask-osa.herokuapp.com/cmd/ECHO/string | Emulates query command and sends a string to API, will get the same string back |
https://flask-osa.herokuapp.com/cmd/PING | Returns PONG |
https://flask-osa.herokuapp.com/cmd/START | sets instrument state to continues acquisition |
https://flask-osa.herokuapp.com/cmd/STOP | sets instrument state to IDLE |
https://flask-osa.herokuapp.com/cmd/SINGLE | starts a single scan (blocking operation, single scan takes few seconds) |
https://flask-osa.herokuapp.com/cmd/STATE | returns instrument state |
https://flask-osa.herokuapp.com/cmd/TRACE | returns OSA trace in json format |
- START button initiates continuous (repetitive) acquisition with ~1Hz refresh rate
- STOP button stops acquisition
- SINGLE button retrieves a single trace from the virtual OSA
- TRACE are displaced within specified scan limits
- Users can send queries and access apis via REST
- Graphs can be zoomed, panned, read data values off the plot.
- The app is deployed on Heroku.