Skip to content

Commit

Permalink
Simplify readme, add a picture
Browse files Browse the repository at this point in the history
Added (temporary) installation guide
Move usage notice out of README
  • Loading branch information
jsnel committed Sep 28, 2024
1 parent d69cbfd commit 40df503
Show file tree
Hide file tree
Showing 5 changed files with 202 additions and 36 deletions.
198 changes: 176 additions & 22 deletions INSTALLATION.md
Original file line number Diff line number Diff line change
@@ -1,42 +1,196 @@
## Installation
# Installation Guide for pyglotaran

Prerequisites:
This guide provides step-by-step instructions for installing **pyglotaran** on Windows, macOS, and Linux systems. It starts with installing pyglotaran if you already have Python installed, ensuring the use of virtual environments to keep your system clean. If you don't have Python installed yet, we'll guide you through installing Python on your system.

- Python 3.10
- On Windows only 64bit is supported
## Prerequisites

Note for Windows Users: The easiest way to get python for Windows is via the Microsoft Store
Before installing pyglotaran, ensure you have:

### Stable Release
- **Python 3.10 or higher** installed on your system.
- Basic familiarity with command-line interfaces.

To install pyglotaran from [pypi](https://pypi.org/), run this command in your terminal:
### Check if Python is Installed

```console
Open your terminal or command prompt and run:

```shell
python --version
```

or

```
python3 --version
```

If Python is installed, this command will display the Python version number.

- If the version is 3.10 or higher, proceed to installing pyglotaran.
- If you see a lower version number or receive an error message, proceed to Installing Python on Your System.

## Installing pyglotaran

💡 _It is **recommended** to use a virtual environment to install pyglotaran into, to avoid possible conflicts with other Python packages and to keep your system Python environment clean._

### Step 1: Create a Project Directory

Create a new project folder. This could also be a folder downloaded from the [examples](https://github.com/glotaran/pyglotaran-examples).

### Step 2: Create a Virtual Environment

Create a virtual environment named venv.

For Windows:

```shell
python -m venv venv
```

<sub>(on MacOS/Linux) you may have to use `python3` instead of `python`.</sub>

### Step 3: Activate the Virtual Environment

Within your project folder run the following.

For Windows:

```shell
venv\Scripts\activate
```

For MacOS/Linux:

```shell
source venv/bin/activate
```

After activation, your command prompt should be prefixed with (venv).

### Step 4: Install pyglotaran

Install pyglotaran using pip

```shell
pip install pyglotaran
```

If you want to install it via conda, you can run the following command:
### Step 5: Verify the Installation

To verify that pyglotaran is installed correctly, run:

```console
conda install -c conda-forge pyglotaran
```shell
python -c "import pyglotaran; print(pyglotaran.__version__)"
```

To install pyglotaran together with [pyglotaran-extras](https://github.com/glotaran/pyglotaran-extras) which provides common plotting functionality you can run:
If the installation was successful, this command will print the version number of pyglotaran.

## Installing Python on Your System

If you don't have Python installed, follow the instructions below for your operating system.

### Windows

#### Option 1: Install Python via the Microsoft Store

1. Open the Microsoft Store app.
2. Search for Python and select the latest version (Python 3.10 or higher).
3. Click Get or Install.

**\*Note**: This method installs Python only for the current user and doesn't require administrative privileges.\*

#### Option 2: Install Python from python.org

```console
pip install pyglotaran[extras]
1. Go to the official Python website.
2. Download the latest Python installer (Python 3.10 or higher).
3. Run the installer:

- Check the box that says "Add Python to PATH".
- Choose "Install Now" for a default installation.

## macOS

#### Option 1: Install Python via Homebrew

1. Install Homebrew if you haven't already:

```bash
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
```

### From Source
2. Install Python:

```bash
brew install python
```

### Option 2: Install Python from python.org

1. Visit the official Python website.
2. Download the latest Python installer (Python 3.10 or higher).
3. Run the installer and follow the prompts.

## Linux

To install from source, e.g. for testing or development purposes, run these commands in your shell/terminal:
### Ubuntu/Debian

Update the package list:

```
sudo apt update
```

Install Python and pip:

```console
git clone https://github.com/glotaran/pyglotaran.git
cd pyglotaran
pip install .
```
sudo apt install python3 python3-venv python3-pip
```

### Other Distributions

Refer to your distribution's package manager documentation to install Python 3.10 or higher, python3-venv, and python3-pip.

# Next Steps

Now that you have Python and pyglotaran installed, you can start using pyglotaran for your data analysis.

## Using pyglotaran

pyglotaran is designed to be used within Python scripts or Jupyter Notebooks. It involves defining your analysis scheme, which includes:

- A model: Defines the kinetic scheme of your system.
- Parameters: Initial guesses and constraints for the model parameters.
- Experimental data: The data you want to fit.

You then use pyglotaran to optimize the model parameters to fit your data.

### Install Jupyter Notebook (Optional)

If you plan to use pyglotaran within Jupyter Notebooks, install Jupyter Notebook in your virtual environment:

```bash
pip install jupyterlab
```

Then, start the Jupyter Notebook server:

```bash
jupyter lab
```

This will open the Jupyter Notebook interface in your web browser.

## Examples and Tutorials

We have prepared comprehensive examples in the form of Jupyter Notebooks in the pyglotaran-examples repository. These examples illustrate how to use the framework for various use cases.

To get started:

1. Clone or [download](https://github.com/glotaran/pyglotaran-examples/archive/refs/heads/main.zip) the repository:

```bash
git clone https://github.com/glotaran/pyglotaran-examples.git
```

_**Note** (for Linux users): use pip3 instead of pip if Python2 is the system default Python installation._
2. Navigate to the example that best matches your use case.

_**Note** (for Anaconda users): please make sure to update your distribution prior to install since some packages managed by Anaconda cannot be updated by `pip`._
3. Run the Jupyter Notebook to see pyglotaran in action.
17 changes: 17 additions & 0 deletions NOTICE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Usage notice for scientists

## Disclaimer

This software package is made available as an early access release, to the advantage of the (scientific) community who wishes to make use of it before it has fully matured, but without any warranties.

Anyone using this package for serious work - scientists and academic users in particular - are cautioned, and treat it as any other instrument or tool that requires calibration or validation. Also be prepared for some refactoring of models or analysis specifications, sometime down the line.

## Scientific usage

That said, the pyglotaran package has been used in several peer-reviewed scientific publications, and it has been partially cross-validated against comparable software, such as the [R-package TIMP](https://dx.doi.org/10.18637/jss.v018.i03), and the TIM software described in [this publication](https://doi.org/10.1016/j.bbabio.2004.04.011) ([DOI: 10.1016/j.bbabio.2004.04.011](https://doi.org/10.1016/j.bbabio.2004.04.011)).

The examples used in this validation process can be obtained from the [pyglotaran-examples repository](https://github.com/glotaran/pyglotaran-examples).

Since the early access version `v0.6.0` it was used in scientific teaching by a number of students in the Photosynthesis and Energy course from 2022-2024 under the supervision of [dr. Ivo van Stokkum](https://www.nat.vu.nl/~ivo/) ([profile](https://research.vu.nl/en/persons/ihm-van-stokkum), github: [ism200](https://github.com/ism200/)). Course material can be found here: [ism200\PE2022](https://github.com/ism200/PE2022/)

## Quality Control
19 changes: 5 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,25 +19,16 @@ A scientific publication titled "pyglotaran: a lego-like Python framework for gl

## Usage of pyglotaran

<sub>**Warning**: This is an _early access_ release, please refer to the [usage notice](#usage-notice) down below prior to committing to use pyglotaran to avoid surprises down the line.</sub>
<sub>**Notice**: This is (still) an _early access_ release, please refer to the [usage notice](NOTICE.md#usage-notice) prior to committing to use pyglotaran to avoid surprises down the line.</sub>

A common use case for the framework is the analysis of time-resolved spectroscopy measurements in the study of energy transfer pathways in photosynthesis, or the characterization of energy transfer (in-)efficiencies in photovoltaics.

pyglotaran can be used from a Python script, or ideally Notebook, and involves specifying your desired analysis scheme consisting of a `model` and its `parameters` together with your `experiment_data`, and then letting it `optimize` this for you. This will fitting your data while optimizing for the residuals given the model you specified, the constraints you specified therein given the (free) parameters and its starting values you provided.
[in a nutshell] pyglotaran can be used from a Python script, or ideally Notebook, and involves specifying your desired analysis scheme consisting of a `model` and its `parameters` together with your `experiment_data`, and then letting it `optimize` this for you. This will fit your data while optimizing for the residuals given the model you specified, the constraints you specified therein, given the (free) parameters and its starting values you provided.

We have prepared a number of comprehensive examples in the form of python notebooks in the [pyglotaran-examples](https://github.com/glotaran/pyglotaran-examples) which illustrate how to use the frameowork. Download the example that best aligns with your use case, and give it go!
We have prepared a number of comprehensive examples in the form of python notebooks in the [pyglotaran-examples](https://github.com/glotaran/pyglotaran-examples) which illustrate how to use the framework. Download the example that best aligns with your use case, and give it go, and perhaps soon you will also be looking at a georgous breakdown of your data like this.

### Usage notice

This software package is made available as an early access release, to the advantage of the (scientific) community who wishes to make use of it before it has fully matured, but without any warranties.

Anyone using this package for serious work - scientists and academic users in particular - are cautioned, and treat it as any other instrument or tool that requires calibration or validation. Also be prepared for some refactoring of models or analysis specifications, sometime down the line.

That said, the pyglotaran package has been used in several peer-reviewed scientific publications, and it has been partially cross-validated against comparable software, such as the [R-package TIMP](https://dx.doi.org/10.18637/jss.v018.i03), and the TIM software described in [this publication](https://doi.org/10.1016/j.bbabio.2004.04.011) ([DOI: 10.1016/j.bbabio.2004.04.011](https://doi.org/10.1016/j.bbabio.2004.04.011)).

The examples used in this validation process can be obtained from the [pyglotaran-examples repository](https://github.com/glotaran/pyglotaran-examples).

Since the early access version `v0.6.0` it was used in scientific teaching by a number of students in the Photosynthesis and Energy course from 2022-2024 under the supervision of [dr. Ivo van Stokkum](https://www.nat.vu.nl/~ivo/) ([profile](https://research.vu.nl/en/persons/ihm-van-stokkum), github: [ism200](https://github.com/ism200/)). Course material can be found here: [ism200\PE2022](https://github.com/ism200/PE2022/)
![overview plot of the fluorescence case study from the pyglotaran-examples](docs/source/images/png/plot_overview_study_fluorescence.png)
The results of a target analysis of Photosystem I (see [study_florescence](https://github.com/glotaran/pyglotaran-examples/tree/main/pyglotaran_examples/study_fluorescence) in the [examples](https://github.com/glotaran/pyglotaran-examples/tree/main/pyglotaran_examples).)

## Glotaran legacy

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ extras =
pyglotaran-extras>=0.5.0
full =
pyglotaran[extras]
pyglotaran[notebook]
notebook =
ipykernel>=6.23.1
jupyterlab>=4.0.0

[aliases]
test = pytest
Expand Down

0 comments on commit 40df503

Please sign in to comment.