From d9313df63ea1f9584d159140fcf90ddaa714a373 Mon Sep 17 00:00:00 2001 From: Phoebe Pearce Date: Tue, 15 Mar 2022 17:19:14 +1100 Subject: [PATCH 01/11] make example in documentation same as in examples folder --- .../Examples/custom_materials_example.rst | 23 +++++++------------ examples/custom_materials_example.py | 4 ++++ 2 files changed, 12 insertions(+), 15 deletions(-) diff --git a/docs/source/Examples/custom_materials_example.rst b/docs/source/Examples/custom_materials_example.rst index b2340b37..5e60becb 100644 --- a/docs/source/Examples/custom_materials_example.rst +++ b/docs/source/Examples/custom_materials_example.rst @@ -18,21 +18,10 @@ Setting up the options for and defining custom materials import numpy as np import os - # first we need to tell Solcore some things about where to put custom materials. for this, - # we use the add_source function from config_tools, although we could also manually edit - # the solcore configuration file (which should be in your home directory). - # You need to add two things to the config file: where to put the n and k data for new - # materials added to the database, and where to put the other parameters (these can all - # go in the same file). - - home_folder = os.path.expanduser('~') - custom_nk_path = os.path.join(home_folder, 'Solcore/custommats') - nk_db_path = os.path.join(home_folder, 'Solcore/NK.db') - param_path = os.path.join(home_folder, 'Solcore/custom_params.txt') - - add_source('Others', 'custom_mats', custom_nk_path) - add_source('Others', 'nk', nk_db_path) - add_source('Parameters', 'custom', param_path) + # When adding custom materials - or getting the refractive index database - the + # information will be stored in the Solcore's users folder. These can be setup by setting + # the SOLCORE_USER_DATA environmental variable to your prefered location or, by default, + # it will be in your home directory, in a directory called .solcore. # EXAMPLE 1 @@ -43,6 +32,10 @@ Setting up the options for and defining custom materials # the parameters in SiGeSn_params.txt have been copied directly from Ge. create_new_material('SiGeSn', 'SiGeSn_n.txt', 'SiGeSn_k.txt', 'SiGeSn_params.txt') + # Note that the final argument, the parameter file, is optional - if you do not + # provide it, a material will be added with optical constants only, so it can be + # used for optical calculations. + # can now create an instance of it like any Solcore material SiGeSn = material('SiGeSn')() diff --git a/examples/custom_materials_example.py b/examples/custom_materials_example.py index 57456986..f58b85e8 100755 --- a/examples/custom_materials_example.py +++ b/examples/custom_materials_example.py @@ -24,6 +24,10 @@ create_new_material('SiGeSn', 'data/SiGeSn_n.txt', 'data/SiGeSn_k.txt', 'data/SiGeSn_params.txt') +# Note that the final argument, the parameter file, is optional - if you do not +# provide it, a material will be added with optical constants only, so it can be +# used for optical calculations. + # can now create an instance of it like any Solcore material SiGeSn = material('SiGeSn')() From b516dbaa964896342d473690a6d89c16555d57d7 Mon Sep 17 00:00:00 2001 From: Phoebe Pearce Date: Thu, 17 Mar 2022 16:14:25 +1100 Subject: [PATCH 02/11] :memo: update/clarify installation instructions --- .DS_Store | Bin 6148 -> 6148 bytes docs/source/Examples/example_RAT_of_ARC.rst | 2 +- docs/source/Examples/example_substrate.rst | 2 +- .../source/Installation/Solcore_on_Windows.md | 97 ++++++++++-------- docs/source/Installation/installation.rst | 8 +- docs/source/Installation/s4_installation.md | 12 +++ 6 files changed, 77 insertions(+), 44 deletions(-) create mode 100644 docs/source/Installation/s4_installation.md diff --git a/.DS_Store b/.DS_Store index 0c6649fdd90b29547a2fa20ad1252ff06ffaa3b3..9014231627315353a5a334c9e69f0e4078ca5a65 100644 GIT binary patch delta 314 zcmZoMXfc=&$(fQ;oSc)CpP#c?k$EL!JqH5=11m!kLn%WhLkyGsc7e7*ZMX7|I}0xdjYBp!6d~ z6iC74a`RnWl5+BsfMOipmN{MZpAR{r%BSF!FUSB{3o%>G^8!#S3~b)R?9DQcuy?k diff --git a/docs/source/Examples/example_RAT_of_ARC.rst b/docs/source/Examples/example_RAT_of_ARC.rst index d3b0e141..ea2eb9ff 100755 --- a/docs/source/Examples/example_RAT_of_ARC.rst +++ b/docs/source/Examples/example_RAT_of_ARC.rst @@ -1,4 +1,4 @@ -Using the TMM solver to calculate the reflextion of a multilayered ARC +Using the TMM solver to calculate the reflection of a multilayered ARC ====================================================================== .. image:: RAT_of_ARC.png diff --git a/docs/source/Examples/example_substrate.rst b/docs/source/Examples/example_substrate.rst index eb3688b5..5bd5c673 100644 --- a/docs/source/Examples/example_substrate.rst +++ b/docs/source/Examples/example_substrate.rst @@ -33,7 +33,7 @@ Looking at the effect of substrate and the no_back_reflection option in the TMM # Thin solar cell, no substrate - will get significant absorption enhancement from reflection at the GaAs/air interface at the back # MUST specify no_back_reflection = False, so that Solcore does not automatically suppress reflections from the back - # (currently, the default setting in solcore is to suppress reflections from the back, so no_back_reflection = True + # (currently, the default setting in solcore is to suppress reflections from the back, so no_back_reflection = True) solar_cell_solver(thin_GaAs, 'optics', user_options={'wavelength': wl, 'optics_method': 'TMM', 'no_back_reflection': False}) z_pos = np.linspace(0, thin_GaAs.width, 201) profiles_thin = thin_GaAs[0].absorbed(z_pos) diff --git a/docs/source/Installation/Solcore_on_Windows.md b/docs/source/Installation/Solcore_on_Windows.md index ac941f6b..33847a72 100755 --- a/docs/source/Installation/Solcore_on_Windows.md +++ b/docs/source/Installation/Solcore_on_Windows.md @@ -1,12 +1,27 @@ Solcore on Windows 10 ===================== -The Python part of Solcore, which is the majority, should work under Windows with no problems. However, we have found a lot trouble trying to make the parts and complements that require compilation to work properly (the PDD solver, S4, SMARTS and SPICE). For those who need to use those tools, please follow the instructions below. +The Python part of Solcore, which is the majority, should work under Windows with no problems. However, we have had some +trouble trying to make the parts and complements that require compilation to work properly (the PDD solver, S4, SMARTS +and SPICE). For those who need to use those tools and encounter issues on Windows, please follow the instructions below. + +Note that in principle, out of the packages listed above (the PDD solver, S4, SMARTS and SPICE), all can be +installed on Windows **except S4**, which to date we have not been able to produce Windows installation instructions for. +To compile the PDD, you need to do [a few extra steps](compilation.md) to get a suitable compiler working. +S4 is only required to use the rigorous coupled-wave analysis (RCWA) functionality in Solcore, used to calculate diffration +from periodic structures (e.g. diffraction gratings, photonic crystals). Thus, if you do not need this functionality, you +can stick with Windows. Installing Solcore ------------------ -(thanks Phoebe!) -After a lot of effort, we have Solcore fully up and running in Windows 10... more or less, using the Ubuntu shell that comes with Windows 10. To install Solcore there, follow this steps: +It is possible to run all the parts of Solcore from a Windows 10 environment without using a virtual machine or dual-booting a UNIX operating +system (e.g. Ubuntu). This can be done by using the Ubuntu shell that comes with Windows 10. **It should be noted that the Windows +Subsystem on Linux (WSL) does not support graphical applications, so it is purely a command line environment.** This can be +inconvenient for actually writing code and viewing results, so please bear this in mind before continuing with the instructions below. +If you are having problems on Windows (or want to use the RCWA functionality/S4) and do not want to be limited to a command-line only +environment, we recommend installing Ubuntu either as a virtual machine, or as a dual boot alongside Windows 10. + +If you do want to install Solcore on WSL, follow these steps: All steps on fresh install of Ubuntu (using the Ubuntu terminal on Windows 10 distributed by Canonical Group, Ubuntu 16.04.3 LTS, Codename: @@ -14,68 +29,70 @@ xenial) - Install git if not done already - Install python 3.x if not already done -- Install pip3 (for installing Python3 packages; you may need to update the package list first: sudo apt-get update):: - -```bash -sudo apt install python3-pip -``` -- You need LAPACK and BLAS libraries linked to the -llapack and -lblas library flags – these are used for scipy and S4. The developers of S4 recommend OpenBLAS (you can find installation instructions by Googling), but this also works and is simpler: +- Install pip3 (for installing Python3 packages; you may need to update the package list first: `sudo apt-get update`): -```bash -sudo apt-get install libblas-dev liblapack-dev -``` + ```bash + sudo apt install python3-pip + ``` - Install matplotlib (and tk, otherwise get an error later): -```bash -pip3 install matplotlib -sudo apt-get install python3-tk -``` + ```bash + pip3 install matplotlib + sudo apt-get install python3-tk + ``` -- Other dependencies install automatically & successfully when - installing Solcore5... hopefully. +- Other dependencies install automatically & successfully when installing Solcore5... hopefully. - Now, we actually Install Solcore:: -```bash -git clone https://github.com/dalonsoa/solcore5.git -cd solcore5 -sudo python3 setup.py install -``` + ```bash + git clone https://github.com/dalonsoa/solcore5.git + cd solcore5 + sudo python3 setup.py install + ``` Installing S4 ------------- -- The “make” command must be available: +- The “make” command must be available: -```bash -sudo apt install make -``` + ```bash + sudo apt install make + ``` + +- You need LAPACK, BOOST and BLAS libraries to compile S4. The developers of S4 recommend OpenBLAS (you can find installation + instructions by Googling), but this also works and is simpler: + + ```bash + sudo apt install libopenblas-dev libfftw3-dev libsuitesparse-dev libboost-all-dev + ``` -- You must use the fork of S4 at https://github.com/phoebe-p/S4; the + (if you have any issues, more detailed installation instructions can be found [here](https://github.com/phoebe-p/S4). +- You must use the fork of S4 at [https://github.com/phoebe-p/S4](https://github.com/phoebe-p/S4); the main branch is not compatible with Python 3.x: -```bash -git clone https://github.com/phoebe-p/S4.git -cd S4 -make S4_pyext -``` + ```bash + git clone https://github.com/phoebe-p/S4.git + cd S4 + make S4_pyext + ``` Checking if everything works -------------------------- - To see if the PDD is working: -```bash -python3 ->>> import solcore.solar_cell_solver -``` + ```bash + python3 + >>> import solcore.solar_cell_solver + ``` - Run tests: -```bash -sudo python3 setup.py test -``` + ```bash + sudo python3 setup.py test + ``` This might result in an error saying that quantum mechanics failed because 5\ :sup:`th` decimal place of result doesn’t match. Simply, ignore it. diff --git a/docs/source/Installation/installation.rst b/docs/source/Installation/installation.rst index 95d0c345..e05e6ede 100755 --- a/docs/source/Installation/installation.rst +++ b/docs/source/Installation/installation.rst @@ -16,12 +16,16 @@ Once you are ready to install it in your own machine, go to the next section. Installing Solcore ^^^^^^^^^^^^^^^^^^ -Solcore is written mostly in Python, but the Poisson-Drift-diffusion (PDD) solver is written in Fortran to make it more efficient. The following instructions are expected to work in most systems, but check the sections below for OS specific instructions and caveats. In order to install Solcore in your computer, you will need the following: +Solcore is written mostly in Python, but the Poisson-Drift-diffusion (PDD) solver is written in Fortran to make it more efficient, +and the RCWA (rigorous coupled-wave analysis) solver uses the package S4 which is written in C++. +The following instructions are expected to work in most systems, but check the sections below for OS specific instructions and caveats. +In order to install Solcore in your computer, you will need the following: - Python >3.7 - pip - setuptools - :doc:`a suitable Fortran compiler (only needed for the PDD solver) ` +- :doc:`the S4 package ` (only needed for RCWA functionality) *Pip* is normally part of the standard Python installation, but you might need to install *setuptools* manually with:: @@ -126,7 +130,7 @@ Problems with the installation There are several things that can go wrong in the above description, specially in Windows. -1. **The tests associated with the Poisson-Drift-Diffusion solver fail**: This is usually the result of not having a Fortran compiler installed in your system, not being correctly configured or having a temperamental F2PY version, the tool - included in numpy - that makes Fotran code accesible from Python. Please, make sure you follow all the steps indicated in the :doc:`Fortran compiler section ` and above to have the PDD solver up and running. +1. **The tests associated with the Poisson-Drift-Diffusion solver fail**: This is usually the result of not having a Fortran compiler installed in your system, not being correctly configured or having a temperamental F2PY version, the tool - included in numpy - that makes Fortran code accesible from Python. Please, make sure you follow all the steps indicated in the :doc:`Fortran compiler section ` and above to have the PDD solver up and running. 2. **Some of the dependencies fail to install**: That is rarely the case, as all dependencies are in the main Python repositories. However, there might be issues with Numpy, Matplotlib and Scipy. Depending on your Python distribution, some of these packages might need to be compiled and it is often easy to get them as a scientific bundle. You can check `Anaconda `_ which provides all these packages together already configured for the correct OS. diff --git a/docs/source/Installation/s4_installation.md b/docs/source/Installation/s4_installation.md new file mode 100644 index 00000000..291809cf --- /dev/null +++ b/docs/source/Installation/s4_installation.md @@ -0,0 +1,12 @@ +Installing S4 +-------------- + +Installing S4 is only necessary if you would like to use Solcore's rigorous coupled-wave analysis (RCWA) functionality. +This is a wave optical method for solving Maxwell's equations in a periodic structure, and can be used for structures which +contain e.g. a diffraction grating or other photonic structures. S4 is written in C++ and must be compiled on your system +before you are able to import it as a Python package. Up-to-date instructions on how to do this in MacOS +and Ubuntu are maintained [here](https://github.com/phoebe-p/S4) (scroll down to the README section). We do not currently have +installation instructions for other Linux distributions, but it should be possible to compile S4 on any UNIX operating system +as long as the relevant packages are installed first (see the link above for requirements). Unfortunately, +there are currently no instructions available for installing S4 on Windows; if you want to use the RCWA functionality from +a Windows machine there are [a few options](Solcore_on_Windows.md). From 10048657aed4e7d9c5f8109cb7218bca50d1bd6e Mon Sep 17 00:00:00 2001 From: Phoebe Pearce Date: Fri, 18 Mar 2022 14:49:34 +1100 Subject: [PATCH 03/11] :memo: fix some outdated examples, update docs further --- .../source/Installation/Solcore_on_Windows.md | 35 ++++++++----------- docs/source/Installation/installation.rst | 8 ++--- .../MJ_solar_cell_tutorial.ipynb | 4 +-- .../MJ_solar_cell_tutorial.py | 2 +- setup.py | 2 +- 5 files changed, 22 insertions(+), 29 deletions(-) diff --git a/docs/source/Installation/Solcore_on_Windows.md b/docs/source/Installation/Solcore_on_Windows.md index 33847a72..45d6913c 100755 --- a/docs/source/Installation/Solcore_on_Windows.md +++ b/docs/source/Installation/Solcore_on_Windows.md @@ -7,7 +7,7 @@ and SPICE). For those who need to use those tools and encounter issues on Window Note that in principle, out of the packages listed above (the PDD solver, S4, SMARTS and SPICE), all can be installed on Windows **except S4**, which to date we have not been able to produce Windows installation instructions for. To compile the PDD, you need to do [a few extra steps](compilation.md) to get a suitable compiler working. -S4 is only required to use the rigorous coupled-wave analysis (RCWA) functionality in Solcore, used to calculate diffration +S4 is only required to use the rigorous coupled-wave analysis (RCWA) functionality in Solcore, used to calculate diffraction from periodic structures (e.g. diffraction gratings, photonic crystals). Thus, if you do not need this functionality, you can stick with Windows. @@ -15,42 +15,34 @@ Installing Solcore ------------------ It is possible to run all the parts of Solcore from a Windows 10 environment without using a virtual machine or dual-booting a UNIX operating -system (e.g. Ubuntu). This can be done by using the Ubuntu shell that comes with Windows 10. **It should be noted that the Windows +system (e.g. Ubuntu). This can be done by using the Ubuntu shell that comes with Windows 10. **It should be noted that this Windows Subsystem on Linux (WSL) does not support graphical applications, so it is purely a command line environment.** This can be inconvenient for actually writing code and viewing results, so please bear this in mind before continuing with the instructions below. If you are having problems on Windows (or want to use the RCWA functionality/S4) and do not want to be limited to a command-line only -environment, we recommend installing Ubuntu either as a virtual machine, or as a dual boot alongside Windows 10. - -If you do want to install Solcore on WSL, follow these steps: +environment, we recommend installing Ubuntu either as a virtual machine, or as a dual boot alongside Windows 10. If you do want to +install Solcore on WSL, follow these steps: All steps on fresh install of Ubuntu (using the Ubuntu terminal on Windows 10 distributed by Canonical Group, Ubuntu 16.04.3 LTS, Codename: xenial) -- Install git if not done already -- Install python 3.x if not already done -- Install pip3 (for installing Python3 packages; you may need to update the package list first: `sudo apt-get update`): +- Install git if not done already +- Install python 3.x if not already done +- Install pip3 (for installing Python3 packages; you may need to update the package list first: `sudo apt-get update`): ```bash sudo apt install python3-pip ``` -- Install matplotlib (and tk, otherwise get an error later): +- Install matplotlib (and tk, otherwise get an error later): ```bash pip3 install matplotlib sudo apt-get install python3-tk ``` -- Other dependencies install automatically & successfully when installing Solcore5... hopefully. - -- Now, we actually Install Solcore:: +- Install Solcore5, which can be done according to the [standard instructions](installation.rst). - ```bash - git clone https://github.com/dalonsoa/solcore5.git - cd solcore5 - sudo python3 setup.py install - ``` Installing S4 ------------- @@ -61,7 +53,7 @@ Installing S4 sudo apt install make ``` -- You need LAPACK, BOOST and BLAS libraries to compile S4. The developers of S4 recommend OpenBLAS (you can find installation +- You need LAPACK, BOOST, FFT and BLAS libraries to compile S4. The developers of S4 recommend OpenBLAS (you can find installation instructions by Googling), but this also works and is simpler: ```bash @@ -69,8 +61,8 @@ Installing S4 ``` (if you have any issues, more detailed installation instructions can be found [here](https://github.com/phoebe-p/S4). -- You must use the fork of S4 at [https://github.com/phoebe-p/S4](https://github.com/phoebe-p/S4); the - main branch is not compatible with Python 3.x: +- You must use the fork of S4 at [https://github.com/phoebe-p/S4](https://github.com/phoebe-p/S4), as the + main branch is not compatible with Python 3: ```bash git clone https://github.com/phoebe-p/S4.git @@ -94,7 +86,8 @@ Checking if everything works sudo python3 setup.py test ``` -This might result in an error saying that quantum mechanics failed because 5\ :sup:`th` decimal place of result doesn’t match. Simply, ignore it. +This might result in an error saying that quantum mechanics failed because 5\ :sup:`th` decimal place of result doesn’t match. +You can simply ignore this error. - Other information: - gcc/g++/gfortran versions used here: gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.6) diff --git a/docs/source/Installation/installation.rst b/docs/source/Installation/installation.rst index e05e6ede..13fdecdc 100755 --- a/docs/source/Installation/installation.rst +++ b/docs/source/Installation/installation.rst @@ -74,11 +74,11 @@ Install in development mode If you are planning to develop Solcore further, you would want to have all the files in an accessible place but still being able to use the package from other places and examples, behaving as if it were truly installed. For this, install Solcore in development mode. `Download the source from the Solcore GitHub repository `_ as above and then:: - pip install -e .[dev] + pip install -e .'[dev]' or:: - pip install -e .[dev] --install-option="--with_pdd" + pip install -e .'[dev]' --install-option="--with_pdd" Solcore uses *pre-commit* to do a few things before commiting the changes (for example, clearing the output of Jupyter Notebooks). The *pre-commit* package is installed automatically with the above commands, but each user needs to be initialise it before it can work. This can be done with:: @@ -101,7 +101,7 @@ After installing Solcore (or even without installing it), there are a few things from solcore import config print(config) -You can find all the functionality of the :code:`config` object in `The config_tools`_ +You can find all the functionality of the :code:`config` object in `The config_tools`_. 2. **Check Solcore examples:** This is the fastest way of getting started. These examples include all the scripts used in the main Solcore paper in the `Journal of Computational Electronics (2018) `_ and a few others to explore other functionality. We hope to increase the number and usefulness of these examples over time. You can try directly the examples using `MyBinder.org `_. @@ -115,7 +115,7 @@ You can find all the functionality of the :code:`config` object in `The config_t config.smarts('/path/to/the/SMARTS/folder') -4. **Installing S4:** The rigorous-coupled wave analysis (RCWA) solver S4, created by the Stanford University, needs to be installed separately using `the fork by Phoebe Pearce `_. The original version **do not work** with Python 3.x, only with Python 2. You can find more information about the solver in the `project webpage `_. An example of its use with Solcore is included in the examples folder, *Figure9.py*. +4. **Installing S4:** The rigorous-coupled wave analysis (RCWA) solver S4, created by the Stanford University, needs to be installed separately using `the fork by Phoebe Pearce `_. The original version **does not work** with Python 3.x, only with Python 2. You can find more information about the solver in the `project webpage `_. An example of its use with Solcore is included in the examples folder :doc:`here `. 5. **Getting specific information about Solcore:** Even though the documentation "should" be more complete, you can get information about any object in python (including any Solcore function, module and package) using the :code:`help` built-in function, for example:: diff --git a/examples/advanced_examples/MJ_solar_cell_tutorial.ipynb b/examples/advanced_examples/MJ_solar_cell_tutorial.ipynb index 9f4b6531..c1d5ed89 100644 --- a/examples/advanced_examples/MJ_solar_cell_tutorial.ipynb +++ b/examples/advanced_examples/MJ_solar_cell_tutorial.ipynb @@ -351,7 +351,7 @@ "source": [ "fig3, axIV = plt.subplots(1, 1, figsize=(6, 4))\n", "for c in con:\n", - " light_source.options[\"concentration\"] = c\n", + " light_source.concentration = c\n", " solar_cell_solver(\n", " my_solar_cell,\n", " \"iv\",\n", @@ -580,4 +580,4 @@ }, "nbformat": 4, "nbformat_minor": 2 -} +} \ No newline at end of file diff --git a/examples/advanced_examples/MJ_solar_cell_tutorial.py b/examples/advanced_examples/MJ_solar_cell_tutorial.py index 508b8172..0616b897 100755 --- a/examples/advanced_examples/MJ_solar_cell_tutorial.py +++ b/examples/advanced_examples/MJ_solar_cell_tutorial.py @@ -153,7 +153,7 @@ fig3, axIV = plt.subplots(1, 1, figsize=(6, 4)) for c in con: - light_source.options["concentration"] = c + light_source.concentration = c solar_cell_solver( my_solar_cell, diff --git a/setup.py b/setup.py index 6935b9f1..f274b794 100755 --- a/setup.py +++ b/setup.py @@ -147,4 +147,4 @@ def gen_data_files(*dirs): install_requires=install_requires, tests_require=tests_require, extras_require=extras_require, -) +) \ No newline at end of file From 553ad4195c98249384286f3502777c47e2c8217e Mon Sep 17 00:00:00 2001 From: Phoebe Pearce Date: Fri, 18 Mar 2022 20:36:01 +1100 Subject: [PATCH 04/11] :memo: update .gitignore, installation instructions --- .DS_Store | Bin 6148 -> 6148 bytes .gitignore | 5 ++++- docs/source/Installation/installation.rst | 4 ++-- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.DS_Store b/.DS_Store index 9014231627315353a5a334c9e69f0e4078ca5a65..d630630ab8dd78925d5677347d6a385c1254c5de 100644 GIT binary patch delta 86 zcmZoMXfc@JFT%;dz`)4BAi%(ol2V+Ula!yI!?<}P^9n`@kPItB5<@9NCPNOA>||x8 Z$BYb<*_pLCU^+I-F`r}E%+B$b9{`DA7WV)E delta 79 zcmZoMXfc@JFU-Nfz`)4BAi%(ol2V+Ula!yIv-u+PN=6Bg1S>-lLn%WhLk>ccVX`vQ ZV@Afw?95u5eVBK%Ol*+e%+B$b9{>hj6#)PM diff --git a/.gitignore b/.gitignore index a1f906ed..1812b5b0 100644 --- a/.gitignore +++ b/.gitignore @@ -127,4 +127,7 @@ dmypy.json .idea/ # VS Code -.vscode/ \ No newline at end of file +.vscode/ + +# macOS +.DS_Store \ No newline at end of file diff --git a/docs/source/Installation/installation.rst b/docs/source/Installation/installation.rst index 13fdecdc..15ef663b 100755 --- a/docs/source/Installation/installation.rst +++ b/docs/source/Installation/installation.rst @@ -74,11 +74,11 @@ Install in development mode If you are planning to develop Solcore further, you would want to have all the files in an accessible place but still being able to use the package from other places and examples, behaving as if it were truly installed. For this, install Solcore in development mode. `Download the source from the Solcore GitHub repository `_ as above and then:: - pip install -e .'[dev]' + pip install -e ".[dev]" or:: - pip install -e .'[dev]' --install-option="--with_pdd" + pip install -e ".[dev]" --install-option="--with_pdd" Solcore uses *pre-commit* to do a few things before commiting the changes (for example, clearing the output of Jupyter Notebooks). The *pre-commit* package is installed automatically with the above commands, but each user needs to be initialise it before it can work. This can be done with:: From 566920058b86966f462417bd720752805afee146 Mon Sep 17 00:00:00 2001 From: Phoebe Pearce Date: Fri, 18 Mar 2022 20:39:32 +1100 Subject: [PATCH 05/11] delete .DS_Store --- .DS_Store | Bin 6148 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 .DS_Store diff --git a/.DS_Store b/.DS_Store deleted file mode 100644 index d630630ab8dd78925d5677347d6a385c1254c5de..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHK!D<^Z5FI&AEfWGhw6sS-uZFIj5D2+!UH8;mw#p|?U>0f1;tk_JEx033(b!~r3<}V<+lCk>kb;Jl?^lKd4D=w6r};3}CdSks@ldDvI0$Y< zX{)^btRgFNN1jKQW*UvV<4NA?j!vod2{%E!sCVPzv_I|Cp1(8MxSMAEktL)_A5+dw z(kwC4mYHNpZn=@`kX2dj)LzbJ&BMBCG#m4}njJQSy4v46n9r;7#p^dmA3IlikeRPe zYO&aMyZ5C3hVA8Y7JHO(mccL4DAOjpz!(iufgIPaarFj9&|gqCbm@ym)H8!2jRx08 z!8&=OX7jA3h7r?&)gl*iCx;ShV!grg!ls_;(?;piAwJ}>lGICOLn zc4i#M&n)~4McCOfu53Dp&>@$s04uPnz?N&)=>C8I_xJxQiCe4yEAXTg5ao8%ZsC&r z-MY3ox@#5sXLK^kD;zE Date: Mon, 21 Mar 2022 14:32:45 +1100 Subject: [PATCH 06/11] :memo: fix minor issues in examples (in examples folder and in docs). --- .../Examples/example_3J_with_DA_solver.rst | 3 +-- .../Examples/example_optics_comparison.rst | 2 +- docs/source/Examples/tutorial.rst | 20 +--------------- docs/source/Installation/compilation.md | 4 ++++ docs/source/Installation/installation.rst | 5 ++++ examples/MJ_solar_cell_using_DA.py | 23 ++++++------------- solcore/light_source/smarts.py | 1 + 7 files changed, 20 insertions(+), 38 deletions(-) diff --git a/docs/source/Examples/example_3J_with_DA_solver.rst b/docs/source/Examples/example_3J_with_DA_solver.rst index 7b00c0e4..52a6201f 100755 --- a/docs/source/Examples/example_3J_with_DA_solver.rst +++ b/docs/source/Examples/example_3J_with_DA_solver.rst @@ -14,7 +14,6 @@ Example of a 3J solar cell calculated with the DA solver .. code-block:: Python - import os import numpy as np import matplotlib.pyplot as plt @@ -28,7 +27,7 @@ Example of a 3J solar cell calculated with the DA solver def this_dir_file(f): - return os.path.join(os.path.split(__file__)[0], f) + return "data/" + f # We need to build the solar cell layer by layer. diff --git a/docs/source/Examples/example_optics_comparison.rst b/docs/source/Examples/example_optics_comparison.rst index 809ca409..01470978 100644 --- a/docs/source/Examples/example_optics_comparison.rst +++ b/docs/source/Examples/example_optics_comparison.rst @@ -38,7 +38,7 @@ due to diffraction effects. from solcore.solar_cell_solver import solar_cell_solver, default_options from solcore.light_source import LightSource from solcore.constants import vacuum_permittivity - from solcore.optics import RCWASolverError + from solcore.absorption_calculator import RCWASolverError # user options T = 298 diff --git a/docs/source/Examples/tutorial.rst b/docs/source/Examples/tutorial.rst index 7589d7da..9c13abcf 100755 --- a/docs/source/Examples/tutorial.rst +++ b/docs/source/Examples/tutorial.rst @@ -169,14 +169,6 @@ of the window and BSF layers, and (2) the missing layers are added outside the Junction object when creating the full solar cell in order to consider their optical properties (see below). -**TRICK:** The TMM solver work best with "thin" layers therefore, if the -results of optical calculations look strange, try dividing thick layers -(> 2-3 µm) into thinner ones (~500 nm). The reason is that the waves -propagating forwards and backwards, leading to interference are -ultimately complex exponentials that increase (or decrease) quite fast -away from the interfaces, resulting in a loss of numerical accuracy when -they trying to interact far from the interfaces. - The only tunnel junction of this solar cell will be defined according to the parametric model and we will assume it is made of GaInP layers, 40 nm-thick in total, that will block part of the light reaching the bottom @@ -246,6 +238,7 @@ code that defines the spectrum to use and lunch the calculation will be: solar_cell_solver(my_solar_cell, 'qe', user_options={'light_source': light_source, 'wavelength': wl, 'optics_method': 'TMM'}) + The calculation will proceed in several stages: (1) The structure is processed and discretized, (2) the problem is solved under equilibrium, (2) the problem is solved under short circuit conditions increasing in @@ -256,17 +249,6 @@ densities at equilibrium (dashed line) and at short circuit (continuous line), as well as the EQE of the two junctions and the total absorption in the layers. -.. code:: python - - from solcore.solar_cell_solver import solar_cell_solver - from solcore.light_source import LightSource - - light_source = LightSource(source_type='standard', version='AM1.5g', x=wl, - output_units='photon_flux_per_m', concentration=1) - - solar_cell_solver(my_solar_cell, 'qe', - user_options={'light_source': light_source, 'wavelength': wl, 'optics_method': 'TMM'}) - .. figure:: qe.jpg :alt: Quantum efficiency diff --git a/docs/source/Installation/compilation.md b/docs/source/Installation/compilation.md index e1155ecc..88d29d64 100755 --- a/docs/source/Installation/compilation.md +++ b/docs/source/Installation/compilation.md @@ -14,6 +14,10 @@ For Mac OS X we have used the *gfortran* compiler installed together with GCC us Other package managers like [MacPorts](https://www.macports.org) or [Fink](http://www.finkproject.org) might also work, but we have not tried. +There is currently a known issue involving the compilation of the PDD solver on new Macs with M1/ARM/Apple silicon chips. +The homebrew version of gfortran (installed above alongside gcc as indicated above) does not work. For a workaround please +see [here](https://github.com/qpv-research-group/solcore5/issues/209). + ## Windows To get a Fortran compiler properly working under Windows with F2Py, we have followed the [detailed instructions written by Michael Hirsch](https://www.scivision.co/f2py-running-fortran-code-in-python-on-windows/). Read Michael Hirsch's instructions in full for a complete picture, but the important bits are: diff --git a/docs/source/Installation/installation.rst b/docs/source/Installation/installation.rst index 15ef663b..d6945fd6 100755 --- a/docs/source/Installation/installation.rst +++ b/docs/source/Installation/installation.rst @@ -134,6 +134,11 @@ There are several things that can go wrong in the above description, specially i 2. **Some of the dependencies fail to install**: That is rarely the case, as all dependencies are in the main Python repositories. However, there might be issues with Numpy, Matplotlib and Scipy. Depending on your Python distribution, some of these packages might need to be compiled and it is often easy to get them as a scientific bundle. You can check `Anaconda `_ which provides all these packages together already configured for the correct OS. +3. **The PDD solver throws an error, even though I installed it and the installation appeared to be successful**: + This can happen if you are trying to call PDD functions when the solcore5 directory (downloaded from GitHub) is + the current working directory. Try calling the functions from a different working directory (by e.g. copying the file you + are trying to run to a different directory) and seeing if the error persists. + The config_tools ^^^^^^^^^^^^^^^^ diff --git a/examples/MJ_solar_cell_using_DA.py b/examples/MJ_solar_cell_using_DA.py index 186f9ff5..424434cf 100755 --- a/examples/MJ_solar_cell_using_DA.py +++ b/examples/MJ_solar_cell_using_DA.py @@ -1,4 +1,3 @@ -import os import numpy as np import matplotlib.pyplot as plt @@ -10,11 +9,9 @@ all_materials = [] - def this_dir_file(f): return "data/" + f - # We need to build the solar cell layer by layer. # We start from the AR coating. In this case, we load it from an an external file refl_nm = np.loadtxt(this_dir_file("MgF-ZnS_AR.csv"), unpack=True, delimiter=",") @@ -49,11 +46,7 @@ def this_dir_file(f): all_materials.append(mid_cell_p_material) # BOTTOM CELL - Ge -# We add manually the absorption coefficient of Ge since the one contained in the database doesn't cover -# enough range. Ge = material("Ge") -Ge_alpha = np.loadtxt(this_dir_file("Ge-Palik.csv"), unpack=True, delimiter=",") -Ge.alpha = interp1d(x=1240e-9 / Ge_alpha[0][::-1], y=Ge_alpha[1][::-1], bounds_error=False, fill_value=0) bot_cell_n_material = Ge(Nd=siUnits(2e18, "cm-3"), hole_diffusion_length=si("800nm")) bot_cell_p_material = Ge(Na=siUnits(1e17, "cm-3"), electron_diffusion_length=si("50um")) @@ -81,10 +74,9 @@ def this_dir_file(f): Junction([Layer(si("200nm"), material=mid_cell_n_material, role='emitter'), Layer(si("3000nm"), material=mid_cell_p_material, role='base'), ], sn=1, sp=1, kind='DA'), - # Uncomment the following to add the Ge junction. The calculation will be MUCH longer. - # Junction([Layer(si("400nm"), material=bot_cell_n_material, role='emitter'), - # Layer(si("100um"), material=bot_cell_p_material, role='base'), - # ], sn=1, sp=1, kind='DA'), + Junction([Layer(si("400nm"), material=bot_cell_n_material, role='emitter'), + Layer(si("100um"), material=bot_cell_p_material, role='base'), + ], sn=1, sp=1, kind='DA'), ], reflectivity=ref, shading=0.08, cell_area=0.7 * 0.7 / 1e4) wl = np.linspace(300, 1800, 700) * 1e-9 @@ -93,13 +85,13 @@ def this_dir_file(f): plt.figure(1) plt.plot(wl * 1e9, solar_cell[0].eqe(wl) * 100, 'b', label='GaInP') plt.plot(wl * 1e9, solar_cell[1].eqe(wl) * 100, 'g', label='InGaAs') -# Uncomment to plot the Ge junction -# plt.plot(wl * 1e9, solar_cell[2].eqe(wl) * 100, 'r', label='Ge') +plt.plot(wl * 1e9, solar_cell[2].eqe(wl) * 100, 'r', label='Ge') plt.legend() plt.ylim(0, 100) plt.ylabel('EQE (%)') plt.xlabel('Wavelength (nm)') +plt.show() V = np.linspace(0, 3, 300) solar_cell_solver(solar_cell, 'iv', user_options={'voltages': V, 'light_iv': True, 'wavelength': wl}) @@ -108,11 +100,10 @@ def this_dir_file(f): plt.plot(V, solar_cell.iv['IV'][1], 'k', linewidth=3, label='Total') plt.plot(V, -solar_cell[0].iv(V), 'b', label='GaInP') plt.plot(V, -solar_cell[1].iv(V), 'g', label='InGaAs') -# Uncomment to plot the Ge junction -# plt.plot(V, -solar_cell[2].iv(V), 'r', label='Ge') +plt.plot(V, -solar_cell[2].iv(V), 'r', label='Ge') plt.legend() -plt.ylim(0, 200) +plt.ylim(0, 230) plt.xlim(0, 3) plt.ylabel('Current (A/m$^2$)') plt.xlabel('Voltage (V)') diff --git a/solcore/light_source/smarts.py b/solcore/light_source/smarts.py index 24283035..c6927020 100755 --- a/solcore/light_source/smarts.py +++ b/solcore/light_source/smarts.py @@ -62,6 +62,7 @@ def calculate_spectrum_smarts(smarts_file_contents=None, filename='smarts295', t if target_directory is not None: target_directory = target_directory.rstrip('\/') + print(target_directory) assert os.access(target_directory, os.W_OK), 'ERROR: Target folder for smarts output does not exists ' \ 'or is not writable.' From c876ad108e5ee92e4a0d4a8ef3438dcb0641ae05 Mon Sep 17 00:00:00 2001 From: Phoebe Pearce Date: Mon, 21 Mar 2022 14:43:37 +1100 Subject: [PATCH 07/11] remove print statement used to debug --- solcore/light_source/smarts.py | 1 - 1 file changed, 1 deletion(-) diff --git a/solcore/light_source/smarts.py b/solcore/light_source/smarts.py index c6927020..24283035 100755 --- a/solcore/light_source/smarts.py +++ b/solcore/light_source/smarts.py @@ -62,7 +62,6 @@ def calculate_spectrum_smarts(smarts_file_contents=None, filename='smarts295', t if target_directory is not None: target_directory = target_directory.rstrip('\/') - print(target_directory) assert os.access(target_directory, os.W_OK), 'ERROR: Target folder for smarts output does not exists ' \ 'or is not writable.' From 44fd0cc940f9d3637a2a7331530c78e5b44b201c Mon Sep 17 00:00:00 2001 From: Phoebe Pearce Date: Tue, 22 Mar 2022 11:26:04 +1100 Subject: [PATCH 08/11] Update docs/source/Installation/installation.rst MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Diego Alonso Álvarez --- docs/source/Installation/installation.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/source/Installation/installation.rst b/docs/source/Installation/installation.rst index d6945fd6..2c327ec2 100755 --- a/docs/source/Installation/installation.rst +++ b/docs/source/Installation/installation.rst @@ -25,7 +25,7 @@ In order to install Solcore in your computer, you will need the following: - pip - setuptools - :doc:`a suitable Fortran compiler (only needed for the PDD solver) ` -- :doc:`the S4 package ` (only needed for RCWA functionality) +- :doc:`the S4 package (only needed for RCWA functionality) ` *Pip* is normally part of the standard Python installation, but you might need to install *setuptools* manually with:: From 286b17c02792d17f6ef44220c375183a6cd65db4 Mon Sep 17 00:00:00 2001 From: Phoebe Pearce Date: Tue, 22 Mar 2022 11:26:42 +1100 Subject: [PATCH 09/11] Update docs/source/Examples/example_3J_with_DA_solver.rst MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Diego Alonso Álvarez --- docs/source/Examples/example_3J_with_DA_solver.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/source/Examples/example_3J_with_DA_solver.rst b/docs/source/Examples/example_3J_with_DA_solver.rst index 52a6201f..9661dd84 100755 --- a/docs/source/Examples/example_3J_with_DA_solver.rst +++ b/docs/source/Examples/example_3J_with_DA_solver.rst @@ -27,7 +27,8 @@ Example of a 3J solar cell calculated with the DA solver def this_dir_file(f): - return "data/" + f + from pathlib import Path + return str(Path(__file__).parent / "data" / f) # We need to build the solar cell layer by layer. From 90a526dde830915e0e0de4ccb7ae7bc34b935193 Mon Sep 17 00:00:00 2001 From: Phoebe Pearce Date: Wed, 23 Mar 2022 15:02:56 +1100 Subject: [PATCH 10/11] :memo: update instructions for WSL --- docs/source/Installation/Solcore_on_MacOSX.md | 2 +- .../source/Installation/Solcore_on_Windows.md | 74 ++++++++----------- docs/source/Installation/compilation.md | 2 +- docs/source/Installation/installation.rst | 5 +- solcore/light_source/smarts.py | 3 +- 5 files changed, 35 insertions(+), 51 deletions(-) diff --git a/docs/source/Installation/Solcore_on_MacOSX.md b/docs/source/Installation/Solcore_on_MacOSX.md index d6a5cdc9..6f354f67 100755 --- a/docs/source/Installation/Solcore_on_MacOSX.md +++ b/docs/source/Installation/Solcore_on_MacOSX.md @@ -1,7 +1,7 @@ Solcore on Mac OS X ===================== -Solcore has been heavely tested under Mac OS X, so there should be no problems. However, using NGSPICE requires some details, as shown below. +Solcore has been heavily tested under Mac OS X, so there should be no problems. However, using NGSPICE requires some details, as shown below. Installing NGSpice on MacOSX ---------------------------- diff --git a/docs/source/Installation/Solcore_on_Windows.md b/docs/source/Installation/Solcore_on_Windows.md index 45d6913c..89649970 100755 --- a/docs/source/Installation/Solcore_on_Windows.md +++ b/docs/source/Installation/Solcore_on_Windows.md @@ -6,7 +6,8 @@ and SPICE). For those who need to use those tools and encounter issues on Window Note that in principle, out of the packages listed above (the PDD solver, S4, SMARTS and SPICE), all can be installed on Windows **except S4**, which to date we have not been able to produce Windows installation instructions for. -To compile the PDD, you need to do [a few extra steps](compilation.md) to get a suitable compiler working. +To compile the PDD, you need to do [a few extra steps](compilation.md) to get a suitable compiler working. Steps +for (optionally) installing SMARTS are given below. S4 is only required to use the rigorous coupled-wave analysis (RCWA) functionality in Solcore, used to calculate diffraction from periodic structures (e.g. diffraction gratings, photonic crystals). Thus, if you do not need this functionality, you can stick with Windows. @@ -15,42 +16,35 @@ Installing Solcore ------------------ It is possible to run all the parts of Solcore from a Windows 10 environment without using a virtual machine or dual-booting a UNIX operating -system (e.g. Ubuntu). This can be done by using the Ubuntu shell that comes with Windows 10. **It should be noted that this Windows -Subsystem on Linux (WSL) does not support graphical applications, so it is purely a command line environment.** This can be -inconvenient for actually writing code and viewing results, so please bear this in mind before continuing with the instructions below. -If you are having problems on Windows (or want to use the RCWA functionality/S4) and do not want to be limited to a command-line only -environment, we recommend installing Ubuntu either as a virtual machine, or as a dual boot alongside Windows 10. If you do want to -install Solcore on WSL, follow these steps: - -All steps on fresh install of Ubuntu (using the Ubuntu terminal on -Windows 10 distributed by Canonical Group, Ubuntu 16.04.3 LTS, Codename: -xenial) - -- Install git if not done already -- Install python 3.x if not already done -- Install pip3 (for installing Python3 packages; you may need to update the package list first: `sudo apt-get update`): - - ```bash - sudo apt install python3-pip - ``` - -- Install matplotlib (and tk, otherwise get an error later): - - ```bash - pip3 install matplotlib - sudo apt-get install python3-tk - ``` - -- Install Solcore5, which can be done according to the [standard instructions](installation.rst). - +system (e.g. Ubuntu). This can be done by using the Windows Subsystem for Linux (WSL) which can be installed on Windows 10. +By itself, +the WSL does not support graphical applications, but it is possible to use Python installed in the WSL from a development +environment running in Windows (such as VSCode), including plotting capabilities. Step-by-step instructions for +setting up the WSL and accessing it from VSCode are given [here](https://code.visualstudio.com/docs/remote/wsl-tutorial). +Note that to be able to see plots generated during code execution you can right-click on the Python file you want to execute +in VSCode and select 'Run Current File in Python Interactive window'. This has been tested on the Ubuntu20.04 version of the +WSL (using [WSL 2](https://docs.microsoft.com/en-us/windows/wsl/install#upgrade-version-from-wsl-1-to-wsl-2)); both S4 +and the PDD install and run without issues. + +If you would like to use a different development environment, you will have to check if it supports accessing Python from +the WSL from a Windows application; it +is possible in [PyCharm](https://www.jetbrains.com/help/pycharm/using-wsl-as-a-remote-interpreter.html). + +However, depending on your preferences you may still want to use a virtual machine or dual boot your computer to run a +complete Linux operating system. Whichever option you choose, you should be able to install Solcore in your preferred way +using the normal installation +instructions; instructions for installing S4 on Ubuntu, if you want to use it, are given below. Installing S4 ------------- -- The “make” command must be available: +These are the steps for installing S4 in an Ubuntu WSL environment (through the WSL command line environment). These steps +should be the same for any Ubuntu environment. + +- The “make” and “git“ commands must be available: ```bash - sudo apt install make + sudo apt install make git ``` - You need LAPACK, BOOST, FFT and BLAS libraries to compile S4. The developers of S4 recommend OpenBLAS (you can find installation @@ -60,7 +54,7 @@ Installing S4 sudo apt install libopenblas-dev libfftw3-dev libsuitesparse-dev libboost-all-dev ``` - (if you have any issues, more detailed installation instructions can be found [here](https://github.com/phoebe-p/S4). + (if you have any issues, more detailed installation instructions can be found [here](https://github.com/phoebe-p/S4).) - You must use the fork of S4 at [https://github.com/phoebe-p/S4](https://github.com/phoebe-p/S4), as the main branch is not compatible with Python 3: @@ -87,19 +81,9 @@ Checking if everything works ``` This might result in an error saying that quantum mechanics failed because 5\ :sup:`th` decimal place of result doesn’t match. -You can simply ignore this error. - -- Other information: - - gcc/g++/gfortran versions used here: gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.6) - - - If everything is working correctly, should be able to import - solcore.solar_cell_solver without getting warnings about the RCWA - solver or PDD. - - - Sometimes, an issue arises with the SOPRA database (and occasionally - importing solar_cell_solver?) where the permissions are set such that - you cannot access the database – running sudo python3, or sudo - [whatever python editor you’re using] fixes this. +You can simply ignore this error. If everything is working correctly, should be able to `import solcore.solar_cell_solver` +without getting warnings about the RCWA solver or PDD. + Installing SMARTS Windows10/Ubuntu Shell ---------------------------------------- diff --git a/docs/source/Installation/compilation.md b/docs/source/Installation/compilation.md index 88d29d64..93bf76d9 100755 --- a/docs/source/Installation/compilation.md +++ b/docs/source/Installation/compilation.md @@ -4,7 +4,7 @@ In order to use the Poisson-Drift-diffusion solver, it will be necessary to have ## Linux -Most linux systems have a Fortran compiler already installed, typically part of GCC, the GNU compiler collection. If not, you will need to check how to install it for your particular linux distribution. +Most Linux systems have a Fortran compiler already installed, typically part of GCC, the GNU compiler collection. If not, you will need to check how to install it for your particular linux distribution. ## Mac OS X diff --git a/docs/source/Installation/installation.rst b/docs/source/Installation/installation.rst index d6945fd6..0c678f06 100755 --- a/docs/source/Installation/installation.rst +++ b/docs/source/Installation/installation.rst @@ -27,9 +27,10 @@ In order to install Solcore in your computer, you will need the following: - :doc:`a suitable Fortran compiler (only needed for the PDD solver) ` - :doc:`the S4 package ` (only needed for RCWA functionality) -*Pip* is normally part of the standard Python installation, but you might need to install *setuptools* manually with:: +*Pip* is normally part of the standard Python installation, but you might need to install it. You also need to make sure +the *setuptools* and *wheel* packages are available. To make sure these packages are installed and up to date, run:: - pip install setuptools + pip install -U pip setuptools wheel Now, installing Solcore should be as easy as writing in the terminal:: diff --git a/solcore/light_source/smarts.py b/solcore/light_source/smarts.py index c6927020..6bce2545 100755 --- a/solcore/light_source/smarts.py +++ b/solcore/light_source/smarts.py @@ -62,7 +62,6 @@ def calculate_spectrum_smarts(smarts_file_contents=None, filename='smarts295', t if target_directory is not None: target_directory = target_directory.rstrip('\/') - print(target_directory) assert os.access(target_directory, os.W_OK), 'ERROR: Target folder for smarts output does not exists ' \ 'or is not writable.' @@ -367,4 +366,4 @@ def get_default_smarts_object(): plt.plot(data[0], data[2]) plt.plot(data[0], data[3]) plt.plot(data[0], data[4]) - plt.show() + plt.show() \ No newline at end of file From 502e635c3f7196855c5d930fc2c3ac657a4b1166 Mon Sep 17 00:00:00 2001 From: Phoebe Pearce Date: Wed, 23 Mar 2022 15:24:28 +1100 Subject: [PATCH 11/11] :memo: typos, initial pip and setuptools instructions --- docs/source/Installation/Solcore_on_Windows.md | 5 +++-- docs/source/Installation/installation.rst | 10 +++++----- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/docs/source/Installation/Solcore_on_Windows.md b/docs/source/Installation/Solcore_on_Windows.md index 89649970..e531f0ad 100755 --- a/docs/source/Installation/Solcore_on_Windows.md +++ b/docs/source/Installation/Solcore_on_Windows.md @@ -22,7 +22,8 @@ the WSL does not support graphical applications, but it is possible to use Pytho environment running in Windows (such as VSCode), including plotting capabilities. Step-by-step instructions for setting up the WSL and accessing it from VSCode are given [here](https://code.visualstudio.com/docs/remote/wsl-tutorial). Note that to be able to see plots generated during code execution you can right-click on the Python file you want to execute -in VSCode and select 'Run Current File in Python Interactive window'. This has been tested on the Ubuntu20.04 version of the +in VSCode and select 'Run Current File in Python Interactive window'. This has been tested on 64-bit Windows 10 using +the Ubuntu20.04 version of the WSL (using [WSL 2](https://docs.microsoft.com/en-us/windows/wsl/install#upgrade-version-from-wsl-1-to-wsl-2)); both S4 and the PDD install and run without issues. @@ -80,7 +81,7 @@ Checking if everything works sudo python3 setup.py test ``` -This might result in an error saying that quantum mechanics failed because 5\ :sup:`th` decimal place of result doesn’t match. +This might result in an error saying that quantum mechanics failed because the 5th decimal place of result doesn’t match. You can simply ignore this error. If everything is working correctly, should be able to `import solcore.solar_cell_solver` without getting warnings about the RCWA solver or PDD. diff --git a/docs/source/Installation/installation.rst b/docs/source/Installation/installation.rst index f9dfc6c8..679fc696 100755 --- a/docs/source/Installation/installation.rst +++ b/docs/source/Installation/installation.rst @@ -43,7 +43,7 @@ This will download Solcore form the Pypi repository and install the package with **NOTE**: Pip passes the --install-option to all the dependencies of the package and therefore the installation will fail since those dependencies do not have the option "--with_pdd". That is the reason why, for now, Solcore needs to be installed twice: the first one to install Solcore normally with all the dependencies and the second one re-installs Solcore with PDD support. -And that's all!! Solcore should be available to be used as with any Python package:: +And that's all! Solcore should be available to be used as with any Python package:: >>> import solcore @@ -81,7 +81,7 @@ or:: pip install -e ".[dev]" --install-option="--with_pdd" -Solcore uses *pre-commit* to do a few things before commiting the changes (for example, clearing the output of Jupyter Notebooks). The *pre-commit* package is installed automatically with the above commands, but each user needs to be initialise it before it can work. This can be done with:: +Solcore uses *pre-commit* to do a few things before committing the changes (for example, clearing the output of Jupyter Notebooks). The *pre-commit* package is installed automatically with the above commands, but each user needs to be initialise it before it can work. This can be done with:: pre-commit install @@ -90,7 +90,7 @@ Check the `pre-commit webpage ` - :doc:`Mac OS X ` @@ -104,9 +104,9 @@ After installing Solcore (or even without installing it), there are a few things You can find all the functionality of the :code:`config` object in `The config_tools`_. -2. **Check Solcore examples:** This is the fastest way of getting started. These examples include all the scripts used in the main Solcore paper in the `Journal of Computational Electronics (2018) `_ and a few others to explore other functionality. We hope to increase the number and usefulness of these examples over time. You can try directly the examples using `MyBinder.org `_. +2. **Check Solcore examples:** This is the fastest way of getting started. These examples include all the scripts used in the main Solcore paper in the `Journal of Computational Electronics (2018) `_ and a few others to explore other functionality. We hope to increase the number and usefulness of these examples over time. You can try the examples directly using `MyBinder.org `_. -3. **Set the location of a SPICE executable and the SMARTS folder:** You will need to do this eventually in order to use those tools:: +3. **Set the location of a SPICE executable and the SMARTS folder:** You will need to do this if you want to use those tools:: .. code:: python