Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
BenWinchester committed Dec 13, 2022
2 parents 7643e97 + b661b9b commit f29b876
Show file tree
Hide file tree
Showing 9 changed files with 329 additions and 32 deletions.
4 changes: 4 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Set line endings to be LF rather than CRLF.
*.py text eol=lf
*.txt text eol=lf
*.yaml text eol=lf
18 changes: 18 additions & 0 deletions CITATION.cff
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
cff-version: 1.2.0
message: "If you use this software, please cite it as below."
authors:
- family-names: Winchester
given-names: Benedict
orcid: https://orcid.org/0000-0002-2880-1243
- family-names: Huang
given-names: Gan
- family-names: Nelson
given-names: Jenny
orcid: https://orcid.org/0000-0003-1048-1330
- family-names: Markides
given-names: Christos N.
orcid: https://orcid.org/0000-0002-4219-1867
title: HEATPanel
version: v1.1
date-released: 2022-09-13
url: "https://github.com/BenWinchester/PVTModel"
128 changes: 128 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
# Contributor Covenant Code of Conduct

## Our Pledge

We as members, contributors, and leaders pledge to make participation in our
community a harassment-free experience for everyone, regardless of age, body
size, visible or invisible disability, ethnicity, sex characteristics, gender
identity and expression, level of experience, education, socio-economic status,
nationality, personal appearance, race, religion, or sexual identity
and orientation.

We pledge to act and interact in ways that contribute to an open, welcoming,
diverse, inclusive, and healthy community.

## Our Standards

Examples of behavior that contributes to a positive environment for our
community include:

* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
* Focusing on what is best not just for us as individuals, but for the
overall community

Examples of unacceptable behavior include:

* The use of sexualized language or imagery, and sexual attention or
advances of any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email
address, without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting

## Enforcement Responsibilities

Community leaders are responsible for clarifying and enforcing our standards of
acceptable behavior and will take appropriate and fair corrective action in
response to any behavior that they deem inappropriate, threatening, offensive,
or harmful.

Community leaders have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions that are
not aligned to this Code of Conduct, and will communicate reasons for moderation
decisions when appropriate.

## Scope

This Code of Conduct applies within all community spaces, and also applies when
an individual is officially representing the community in public spaces.
Examples of representing our community include using an official e-mail address,
posting via an official social media account, or acting as an appointed
representative at an online or offline event.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement by containg the
developers directly.
All complaints will be reviewed and investigated promptly and fairly.

All community leaders are obligated to respect the privacy and security of the
reporter of any incident.

## Enforcement Guidelines

Community leaders will follow these Community Impact Guidelines in determining
the consequences for any action they deem in violation of this Code of Conduct:

### 1. Correction

**Community Impact**: Use of inappropriate language or other behavior deemed
unprofessional or unwelcome in the community.

**Consequence**: A private, written warning from community leaders, providing
clarity around the nature of the violation and an explanation of why the
behavior was inappropriate. A public apology may be requested.

### 2. Warning

**Community Impact**: A violation through a single incident or series
of actions.

**Consequence**: A warning with consequences for continued behavior. No
interaction with the people involved, including unsolicited interaction with
those enforcing the Code of Conduct, for a specified period of time. This
includes avoiding interactions in community spaces as well as external channels
like social media. Violating these terms may lead to a temporary or
permanent ban.

### 3. Temporary Ban

**Community Impact**: A serious violation of community standards, including
sustained inappropriate behavior.

**Consequence**: A temporary ban from any sort of interaction or public
communication with the community for a specified period of time. No public or
private interaction with the people involved, including unsolicited interaction
with those enforcing the Code of Conduct, is allowed during this period.
Violating these terms may lead to a permanent ban.

### 4. Permanent Ban

**Community Impact**: Demonstrating a pattern of violation of community
standards, including sustained inappropriate behavior, harassment of an
individual, or aggression toward or disparagement of classes of individuals.

**Consequence**: A permanent ban from any sort of public interaction within
the community.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 2.0, available at
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.

Community Impact Guidelines were inspired by [Mozilla's code of conduct
enforcement ladder](https://github.com/mozilla/diversity).

[homepage]: https://www.contributor-covenant.org

For answers to common questions about this code of conduct, see the FAQ at
https://www.contributor-covenant.org/faq. Translations are available at
https://www.contributor-covenant.org/translations.
134 changes: 134 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
# Contributing to PVTModel

:+1::tada: First off, thanks for taking the time to contribute! :tada::+1:

The following is a set of guidelines for contributing to PVTModel, the repository associated with the `heat-panel` Python package. These guidelines are hosted on GitHub and are maintained, so ensure you have the latest version via a `git pull`. These are mostly guidelines, not rules. Use your best judgment, and feel free to propose changes to this document in a pull request.

#### Table Of Contents

[Code of Conduct](#code-of-conduct)

[What should I know before I get started?](#what-should-i-know-before-i-get-started)
* [What is PVTModel for?](#what-is-pvtmodel-for)
* [What is PVTModel not for?](#what-is-pvtmodel-not-for)

[How to contribute to PVTModel](#how-to-contribute-to-PVTModel)
* [Reporting bugs](#reporting-bugs)
* [Merging patches](#merging-patches)
* [Cosmetic patches](#cosmetic-patches)
* [Questions](#questions)

[Styleguides](#styleguides)
* [Git commit messages](#git-commit-messages)
* [Python styleguide](#python-styleguide)
* [YAML styleguide](#yaml-styleguide)
* [Changing styleguides](#changing-styleguides)


### Code of Conduct

This project and everyone participating in it is governed by the [PVTModel Code of Conduct](CODE_OF_CONDUCT.md). By participating, you are expected to uphold this code. Please report unacceptable behavior to @BenWinchester.

### What should I know before I get started?

PVTModel was developed at Imperial College London as a means of simulating the electrical and thermal characteristics of hybrid photovoltaic-thermal collectors. The name, `HEATPanel`, refers to this: Hybrid Electricity And Thermal Panel. Primarilly, sheet-and-tube collectors have been investigated, and default data for these panels is provided which can be adjusted by the user.

PVTModel has the capability to model these panels in a great level of detail, considering layer- and element-wise thermal and electrical characteristics. These are then aggregated to provide overall performance features which are useful when considering these types of collectors.

#### What is PVTModel for?

PVTModel is a software tool for simulating the electrical and thermal characteristics of hybrid PV-T collectors, specifically sheet-and-tube collectors, though support for more collectors is being developed as part of the ongoing process of expanding the functionality of the software package. These collectors can be considered as part of a wider hot-water demand system, including storage tanks and heat exchangers, or as standalone collectors under test conditions. 2D temperature maps of each layer can be generated for vieweing the collectors' thermal properties.

#### What is PVTModel not for?

Fundamentally, PVTModel is a matrix solver with bells and whistles added to ensure a user-friendly process for seamlessly adjusting parameters without having to recreate a matrix equation manually for each calculation that a user could wish to solve. With this in mind, chosing parameters that are outside a standard scope of a matrix solver may lead to divergent solutions.

PVTModel is also currently only developed for sheet-and-tube PV-T collectors. This is a great limitation in terms of the available market of PV-T collectors which currently exist, and the multitude of designs in development. However, sheet-and-tube collectors are currently the most widely implemented.

## How to contribute to PVTModel

### Reporting bugs

**Did you find a bug?** Bugs make it into the code from time to time. If you spot a bug, report it as follows:

* **Ensure the bug was not already reported** by searching on GitHub under [Issues](https://github.com/BenWinchester/PVTModel/issues).

* If you're unable to find an open issue addressing the problem, [open a new one](https://github.com/BenWinchester/PVTModel/issues/new/choose). Be sure to include a **title and clear description**, as much relevant information as possible, and a **code sample** or an **executable test case** demonstrating the expected behavior that is not occurring.

* If the issue is a **bug**, use the [Bug report](BenWinchester/PVTModel/issues/new?assignees=&labels=bug&template=bug_report.md&title=) template,

* If the issue is a **feature** request for something new that you would like to see introduced into PVTModel, use the [Feature request](BenWinchester/PVTModel/issues/new?assignees=&labels=bug&template=feature_request.md&title=) template.

### Merging patches

**Did you write a patch that fixes a bug?** If you have coded a solution for a bug that you have found or for an open issue, open a pull request for it as follows:

* Open a new GitHub pull request with the patch.

* Ensure the PR description clearly describes the problem and solution:

* Include the relevant issue number if applicable,

* Follow the template information presented, filling in all the fields requested which are relevant to your patch.

* Ensure that you include at least one administrator reviewer for your pull request. Without an appropriate review, you will be unable to merge your pull request.

#### Cosmetic patches

**Did you fix whitespace, format code, or make a purely cosmetic patch?** Changes that are cosmetic in nature and do not add anything substantial to the stability, functionality, or testability of PVTModel will generally not be accepted. Contact the developers directly, or save your cosmetic changes until you are able to merge them as part of a feature or bug issue.

### Questions

**Do you have questions about the source code?** Ask any question about how to use PVTModel on the [Discussions](https://github.com/BenWinchester/PVTModel/discussions) page.

## Styleguides

### Git commit messages

* Git Commit Messages
* Use the present tense ("Add feature" not "Added feature")
* Use the imperative mood ("Move cursor to..." not "Moves cursor to...")
* Limit the first line to 72 characters or less
* Reference issues and pull requests liberally after the first line
* When only changing documentation, include [ci skip] in the commit title
* Consider starting the commit message with an applicable emoji:
* 🎉 `:tada` when adding an initial commit or solving a difficult problem
* 🎨 `:art:` when improving the format/structure of the code
* 🐎 `:racehorse:` when improving performance
* 📝 `:memo:` when writing docs
* 🐧 `:penguin:` when fixing something on Linux
*`:sparkles:` when adding a new feature
* 🚧 `:construction:` when part-way through working on code
* 🍎 `:apple:` when fixing something on macOS
* 🏁 `:checkered_flag:` when fixing something on Windows
*`:rewind:` when backing out a commit or changes
* 🐛 `:bug:` when fixing a bug
* 🔥 `:fire:` when removing code or files
* 💚 `:green_heart:` when fixing the CI build
* 👕 `:shirt:` when removing linter warnings
*`:white_check_mark:` when adding tests
* 🔒 `:lock:` when dealing with security
* ⬆️ `:arrow_up:` when upgrading dependencies
* ⬇️ `:arrow_down:` when downgrading dependencies
* 🚀 `:rocket:` when deploying code

### Python styleguide

All `Python` code must conform to [mypy](https://github.com/python/mypy) and [pylint](https://github.com/PyCQA/pylint) coding standards and must be formatted with the [black](https://github.com/psf/black) formatter:
* A `mypy.ini` file within the root of the repository sets out the requirements that must be met by any code. Use `python -m mypy src/` to ensure that your code complies with the guidelines.
* A `.pylintrc` file within the root of the repository sets out the linting requirements. Use `python -m pylint src/` to ensure that your code complies with the guidelines.
* All code must be formatted with `black`.

These tests must pass for any pull request to be successfully approved and merged. You can run these tests from the root of the repository with `./bin/test-clover.sh`.

### YAML styleguide

All `.yaml` files which are modified are linted with [yamllint](https://github.com/adrienverge/yamllint). You can use `yamllint -c .yamllint-config.yaml` to run `yamllint` over any `.yaml` files that you have modified.

### Changing styleguides

If you have any changes for the styleguides, make these **very clear** within your pull request message. It is unusual to have to change the styleguides to make your code pass the required tests.

Thanks! :heart: :heart: :heart:

PVTModel Team
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# FirstPVTModel
# HEATPanel
2D model for a PVT system.

## Model basics.
Expand Down
40 changes: 40 additions & 0 deletions bin/hpc_pvt_machine_learning.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/bin/bash
########################################################################################
# hpc_pvt_machine_learning.sh.py - Runs the machine-learning fitting on the HPC. #
# #
# Author(s): Ben Winchester #
# Copyright: Ben Winchester, 2022 #
# Date created: 30/09/2022 #
# License: Open source #
# Most recent update: 30/09/2022 #
# #
# For more information, please email: #
# [email protected] #
########################################################################################

#PBS -lwalltime=72:00:00
#PBS -lselect=1:ncpus=8:mem=11800Mb

echo -e "HPC script executed."
# Depending on the environmental variable, run the appropriate HPC job.

module load anaconda3/personal
source activate py37

OUTPUT_DIR="$PBS_O_WORKDIR"
CURRENT_DIR=$(pwd)
cd $PBS_O_WORKDIR

INPUT_FILE="combined_data.json"
OUTPUT_DIR="machine_learning_outputs"

echo -e "Running machine-learning python program."

python3.7 -u -m src.pvt_model.analysis.machine_learning_fit -cv \
-df $INPUT_FILE -f -np 14

cd $CURRENT_DIR

echo -e "Script exectued."

exit 0
26 changes: 0 additions & 26 deletions foo.csv

This file was deleted.

Binary file removed foo.xlsx
Binary file not shown.
9 changes: 4 additions & 5 deletions src/pvt_model/analysis/machine_learning_fit.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,24 +121,24 @@

# Number of estimators:
# Number of trees in random forest
N_ESTIMATORS = [int(x) for x in np.linspace(start=5, stop=200, num=40)]
N_ESTIMATORS = [int(x) for x in np.linspace(start=5, stop=1000, num=200)]

# Max features:
# Number of features to consider at every split
MAX_FEATURES: List[str] = ["auto", "sqrt"]

# Max depth:
# Maximum number of levels in tree
MAX_DEPTH: List[Optional[int]] = [int(x) for x in np.linspace(1, 15, num=15)]
MAX_DEPTH: List[Optional[int]] = [int(x) for x in np.linspace(1, 40, num=40)]
MAX_DEPTH.append(None)

# Min samples spllit:
# Minimum number of samples required to split a node
MIN_SAMPLES_SPLIT: List[int] = [2, 5, 10, 15, 20, 40]
MIN_SAMPLES_SPLIT: List[int] = [int(x) for x in np.linspace(5, 100, num=10)]

# Min samples leaf:
# Minimum number of samples required at each leaf node
MIN_SAMPLES_LEAF: List[int] = [1, 2, 4, 8, 15, 30]
MIN_SAMPLES_LEAF: List[int] = [int(x) for x in np.linspace(1, 100, num=20)]

# Bootstrap:
# Method of selecting samples for training each tree
Expand Down Expand Up @@ -387,7 +387,6 @@ def _train_trees_and_forest(
pickle.dump(best_thermal_forest, f)



def analyse(
cv_search: bool, data_file_name: str, forest: bool, num_pipes_correction: int, use_existing_fits: bool
) -> None:
Expand Down

0 comments on commit f29b876

Please sign in to comment.