Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
phoebe-p committed Sep 30, 2022
1 parent f87451e commit 1c6fb8e
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 43 deletions.
7 changes: 5 additions & 2 deletions docs/Installation/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ Downloading and installing S4 (start from the directory in which you want to dow
Here we download my fork of S4 (modified to be compatible with Python3), move to the downloaded directory, and then we make the Python extension.
If you activated the virtual environment before running this, S4 should automatically install into that virtual environment.

**Note for users of new Mac devices with Apple M1/ARM chips:** You can install packages using Homebrew as described above,
but instead of :literal:`make S4_pyext`, you should run :literal:`make S4_pyext --file="Makefile.m1"`.

.. _install:

Installing RayFlare
Expand Down Expand Up @@ -128,8 +131,8 @@ things like 'pip install' will point to the right place.

As an alternative to the venv method above, PyCharm also has built-in support for making a new virtualenv environment
based on one of your 'system interpreters' (these are the versions of Python installed -- if you followed the
instructions above and are on Ubuntu 18, these are probably Python2.7, Python3.6 and the newly-installed
Python3.8). You can create one of those environments by going to Project Interpreter in the same way, adding a new
instructions above and are on Ubuntu 20, these are probably Python2.7, Python3.8 and possibly the newly-installed
Python3.10). You can create one of those environments by going to Project Interpreter in the same way, adding a new
environment and selecting 'Virtualenv environment' with the relevant base interpreter.

Installing S4 on Windows
Expand Down
54 changes: 34 additions & 20 deletions docs/Installation/python_install.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
========================================
Python versions and installing Python3.8
========================================
==========================================
Python versions and installing Python3.10
==========================================

Ubuntu
-------

On Ubuntu, Python is an integral part of the operating system, so there will already be a version
(likely more than one version, usually a version of Python2 and a version of Python3) installed
Expand All @@ -10,39 +13,50 @@ working in a virtual environment. This also avoids having to use 'sudo' to insta
There are various packages for creating virtual environments, all with confusingly similar names -- I use
venv (not to be confused with virtualenv or pipenv...).

Currently, Ubuntu18 does not come with Python3.8 (the latest stable Python version), by default, but you can
install it pretty easily. From a terminal window (command line):
On Ubuntu20, Python3.8 is the default Python3. You can install the ability to make venvs with:

.. code-block:: console
sudo apt install software-properties-common
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt install python3.8 python3.8-dev python3.8-venv
This installs Python3.8, and also the ability to make virtual environments with python3.8-venv.
You can now use your new version of Python3.8 by just typing 'python3.8' on the command line.
sudo apt install python3-dev python3-venv
Now make the venv:
And make and activate the venv:

.. code-block:: console
python3.8 -m venv mainenv
python3 -m venv mainenv
source mainenv/bin/activate
This makes a virtual environment called 'mainenv' (first line) and then activates it (second line). If you close the terminal and open it again you would have to reactivate the virtual environment to make
sure you are using the virtual environment version of Python3.8.
This makes a virtual environment called 'mainenv' (first line) and then activates it (second line). If you close the
terminal and open it again you would have to reactivate the virtual environment to make
sure you are using the virtual environment version of Python3.10.

On Ubuntu20, Python3.8 is the default Python3. You can install the ability to make venvs with:
Ubuntu20 comes with Python 3.8 by default. Python 3.8 is sufficient for running RayFlare and necessary supporting packages,
but if you want to update to a more recent Python version (3.10), this is easy:

.. code-block:: console
sudo apt install python3-dev python3-venv
sudo apt install software-properties-common
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt install python3.10 python3.10-dev python3.10-venv
And make and activate the venv:
This installs Python3.10, and also the ability to make virtual environments with python3.10-venv.
You can now use your new version of Python3.10 by just typing 'python3.10' on the command line.

Now make the venv:

.. code-block:: console
python3 -m venv mainenv
python3.10 -m venv mainenv
source mainenv/bin/activate
On MacOS, Homebrew Python (default version Python3.8) also comes with the venv ability.
MacOS
-------


On MacOS, Homebrew Python (current default version Python3.10) also comes with the venv ability. This can be installed
with:

.. code-block:: console
brew install python
3 changes: 2 additions & 1 deletion rayflare/matrix_formalism/multiply_matrices.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,6 @@ def matrix_multiplication(bulk_mats, bulk_thick, options, layer_names, calc_prof

len_calcs = np.array([len(x) if x is not None else 0 for x in calc_prof_list])


if np.any(len_calcs > 0) or options.bulk_profile:

a = [[] for _ in range(n_interfaces)]
Expand Down Expand Up @@ -420,6 +419,8 @@ def matrix_multiplication(bulk_mats, bulk_thick, options, layer_names, calc_prof

else:

print("b")

a = [[] for _ in range(n_interfaces)]
vr = [[] for _ in range(n_bulks)]
vt = [[] for _ in range(n_bulks)]
Expand Down
4 changes: 4 additions & 0 deletions rayflare/transfer_matrix_method/tmm.py
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,10 @@ def calculate_profile(layers):
output['A'] = 1 - out['R'] - out['T']
output['T'] = out['T']
output['A_per_layer'] = A_per_layer[1:-1]
output['vw_list'] = out['vw_list']
output['kz_list'] = out['kz_list']
output['th_list'] = out['th_list']

else:
out = tmm.inc_tmm(pol, stack.get_indices(wavelength), stack.get_widths(), coherency_list, angle, wavelength)
A_per_layer = np.array(tmm.inc_absorp_in_each_layer(out))
Expand Down
20 changes: 0 additions & 20 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,26 +24,6 @@ def gen_data_files(*dirs):
config = ConfigParser()
config.read([default_config])

# Option for updating the manifest
if "update_manifest" in sys.argv:
# Update the MANIFEST.in file with all the data from within solcore
include = "rayflare"
exclude = ["__pycache__", "egg", "darwin", "cpython"]
with open("MANIFEST.in", "w", encoding="utf-8") as f:
for root, dirs, files in os.walk("."):
if not any(sub in root for sub in exclude) and root[2:9] == include:
try:
files.remove(".DS_Store")
except ValueError:
pass
for file in files:
if any(sub in file for sub in exclude):
continue
include_line = "include " + os.path.join(root[2:], file) + "\n"
f.write(include_line)

sys.exit()

# Get the long description from the README file
with open(os.path.join(here, "README.md"), encoding="utf-8") as f:
long_description = f.read()
Expand Down

0 comments on commit 1c6fb8e

Please sign in to comment.