/PySME-GUI

GUI for PySME with Electron

Primary LanguageTypeScriptMIT LicenseMIT

CI

PySME-GUI continues development here: https://github.com/MingjieJian/PySME-GUI

PySME-GUI

This is a GUI for PySME. It can be used to look at and modify SME structures, and will eventually also be able to monitor a run of PySME.

Installation

Precompiled binaries for common systems are available under Releases. Those can be installed directly on your system. The GUI is not completely independent but requires PySME to be installed for some operations. Make sure it is working in the same virtual environment!

How To Use

Once the programm is open, you should be presented with an almost empty window. Start off by reading a SME file by clicking the "Load File" button. The spectrum should then be plotted in the central window. To switch between segments, use the slider on the bottom. To zoom in use the mouse.

Changing the mask

To change the mask, select the "box select" tool in the upper right corner of the plot and use the buttons bellow the plot to select what values to change the mask to. Then select the desired region in the plot. The changes should be visible immediately.

Saving the file

Save the SME file by clicking the "Save File" button.

Running PySME

EXPERIMENTAL

To run PySME directly from the GUI use the "Synthesize" and "Fit" buttons. At the moment this will fit "teff", "logg", and "monh". Do not close the GUI once it is running, or you will probably loose all progress. If you still do, the output file is in the tmp directory of your system.

FAQ

If things don't work, try the following steps:

  • Use the GitHub version (as described in Build)
  • make sure you are running in the same virtual environment as your PySME installation
  • upgrade to the latest version of PySME (using the GitHub repository if necessary)
  • upgrade all PySME requirements, using the PySME requirements.txt pip install --upgrade -r requirements.txt
  • make a clean install by deleting node_modules and running npm clean-install
  • make sure that "python" calls a python version > 3.6 (i.e. what is compatible with pysme)

If it still doesn't work, open a pull request, or send me an email.

Settings

At the first execution, the GUI will create a settings file in your "~/.sme" directory called "gui-config.json". At the moment this only allows you to change the default python call. For example if your default pyhon calls python 2, and you want the PySME GUI to use python3 instead.

Build

This is only required if you want to modify the source code of the GUI or install it on a system that is not supported by default.

To clone and run this repository you'll need Git and Node.js (which comes with npm) installed on your computer. From your command line:

# Clone this repository
git clone https://github.com/AWehrhahn/PySME-GUI
# Go into the repository
cd pysme-gui
# Install dependencies
npm install
# Compile SCSS to CSS
npm install -g sass
npm run sass
# Run the app
npm start

Note: If you're using Linux Bash for Windows, see this guide or use node from the command prompt.

How it works

The GUI itself is written using Electron, that means most of the code is in javascript. For the parts that need a python script, they all follow the same principle. We save the input parameters to a file, then we spawn a new python process with the filename as a parameter. When the process finishes we load the data from an output file. If there is a log, that is is also written to a file that javascript watches for changes. Basically everything is done via the file system.

The HTML/CSS is mostly Bootstrap 4 with some changes from the SB Admin 2 Template. The CSS is compiled from the SCSS files in the scss folder using SASS. All color definitions etc should be done there. The HTML has the actual location of most objects, although some are created in scripts.

Each "card" in the GUI is controlled by one typescript file in src. Also there is one file for the process in general (renderer.ts) and one to create the window in the first place (main.ts). All typescript definitions are in interfaces.ts. The code has to be compiled by typescript into javascript files.

The main plot is done using plotly, this includes the tools to manipulate the plot. The linelist table is done usongh DataTables. The citation module uses citation.js.

Miscellaneous data files are stored in the data folder. So far those are only used for the citation module.