Skip to content

Commit bdc5ef3

Browse files
committed
Formatting and linting
1 parent e2081d9 commit bdc5ef3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+1641
-1120
lines changed

.devcontainer/devcontainer.json

+9-10
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
{
2-
"name": "gwpv",
3-
"context": "..",
4-
"dockerFile": "../containers/Dockerfile",
5-
"build": {
6-
"target": "dev",
7-
},
8-
"postCreateCommand": "pip install .",
9-
"settings": {
10-
},
11-
"extensions": []
2+
"name": "gwpv",
3+
"context": "..",
4+
"dockerFile": "../containers/Dockerfile",
5+
"build": {
6+
"target": "dev"
7+
},
8+
"postCreateCommand": "pip install .",
9+
"settings": {},
10+
"extensions": []
1211
}

.github/workflows/Tests.yaml

+14-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
name: Tests
32

43
on:
@@ -68,6 +67,19 @@ jobs:
6867
# run: >
6968
# gwrender waveform $GITHUB_WORKSPACE/Examples/Rainbow/Rainbow.yaml
7069
# --time-merger 5064 --mass 150 -o ./ -v
70+
lint:
71+
name: Formatting and linting
72+
runs-on: ubuntu-latest
73+
steps:
74+
- uses: actions/checkout@v3
75+
- name: Python code format
76+
uses: psf/black@stable
77+
- name: Imports ordering
78+
uses: isort/isort-action@master
79+
- uses: actionsx/prettier@v2
80+
with:
81+
args: --check .
82+
7183
docs:
7284
name: Deploy documentation
7385
needs: tests
@@ -76,7 +88,7 @@ jobs:
7688
- uses: actions/checkout@v3
7789
- uses: actions/setup-python@v4
7890
with:
79-
python-version: '3.10'
91+
python-version: "3.10"
8092
- name: Install Python dependencies
8193
run: |
8294
pip install -r docs/requirements.txt

Examples/Rainbow/Datasources.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
Replace:
32
Datasources:
43
Waveform:

Examples/Rainbow/Rainbow.yaml

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
Include:
32
- Datasources
43
- Background/Dark
@@ -22,7 +21,7 @@ TransferFunctions:
2221
TransferFunction:
2322
Peaks:
2423
Colormap: Rainbow Uniform
25-
NumPeaks: 7 # A rainbow has 7 colors. No more, no less.
24+
NumPeaks: 7 # A rainbow has 7 colors. No more, no less.
2625
FirstPeak:
2726
Position: 0.03
2827
Opacity: 0.1

Examples/Rainbow/Scenes.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
Scenes:
32
- Name: Rainbow
43
Composition:

Examples/Rainbow/Still.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
Base:
32
- Rainbow
43
- Resolutions/Medium

README.md

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
<p align="center" id="banner"><img src="https://raw.githubusercontent.com/nilsvu/gwpv/develop/docs/banner.png"></p>
32

43
# gwpv

docs/_static/style.css

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
img.sidebar-logo {
3-
border-radius: 6pt;
2+
border-radius: 6pt;
43
}

docs/conf.py

+13-13
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@
1717

1818
# -- Project information -----------------------------------------------------
1919

20-
project = 'gwpv'
21-
release = '0.3.0'
22-
copyright = '2022, Nils Vu'
23-
author = 'Nils Vu'
24-
repository = 'https://github.com/nilsvu/gwpv/'
20+
project = "gwpv"
21+
release = "0.3.0"
22+
copyright = "2022, Nils Vu"
23+
author = "Nils Vu"
24+
repository = "https://github.com/nilsvu/gwpv/"
2525

2626

2727
# -- General configuration ---------------------------------------------------
@@ -30,35 +30,35 @@
3030
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
3131
# ones.
3232
extensions = [
33-
'myst_parser',
34-
'sphinx_copybutton',
35-
'sphinx.ext.githubpages',
33+
"myst_parser",
34+
"sphinx_copybutton",
35+
"sphinx.ext.githubpages",
3636
# 'sphinx.ext.autodoc',
3737
# 'sphinx.ext.intersphinx',
3838
]
3939

4040
# Add any paths that contain templates here, relative to this directory.
41-
templates_path = ['_templates']
41+
templates_path = ["_templates"]
4242

4343
# List of patterns, relative to source directory, that match files and
4444
# directories to ignore when looking for source files.
4545
# This pattern also affects html_static_path and html_extra_path.
46-
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
46+
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
4747

4848

4949
# -- Options for HTML output -------------------------------------------------
5050

5151
# The theme to use for HTML and HTML Help pages. See the documentation for
5252
# a list of builtin themes.
5353
#
54-
html_theme = 'furo'
54+
html_theme = "furo"
5555

5656
# Add any paths that contain custom static files (such as style sheets) here,
5757
# relative to this directory. They are copied after the builtin static files,
5858
# so a file named "default.css" will overwrite the builtin "default.css".
59-
html_static_path = ['_static']
59+
html_static_path = ["_static"]
6060
html_css_files = [
61-
'style.css',
61+
"style.css",
6262
]
6363

6464
html_title = f"{project} v{release}"

docs/gallery.md

+6-3
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ detectors on April 12th, 2019 (GW190412).
2222
- Video:
2323

2424
[![GW190412 video](http://img.youtube.com/vi/5AkT4bPk-00/0.jpg)](http://www.youtube.com/watch?v=5AkT4bPk-00)
25+
2526
- Selected media coverage:
2627
- <https://www.nature.com/articles/d41586-020-01153-7>
2728
- <https://www.sciencenews.org/article/gravitational-waves-unevenly-sized-black-holes-ligo-virgo>
@@ -30,15 +31,17 @@ detectors on April 12th, 2019 (GW190412).
3031
- <https://www.ligo.caltech.edu/news/ligo20200420>
3132
- <https://www.spektrum.de/news/neuartiges-gravitationswellensignal/1725506>
3233
- Appearances in scientific publications:
33-
- *A Horizon Study for Cosmic Explorer: Science, Observatories, and Community*, [arXiv:2109.09882](https://arxiv.org/abs/2109.09882)
34-
- *The Next Generation Global Gravitational Wave Observatory: The Science Book*, [arXiv:2111.06990](https://arxiv.org/abs/2111.06990)
35-
- Lovelace, G. *Computational challenges in numerical relativity in the gravitational-wave era*, [Nat Comput Sci **1**, 450–452 (2021)](https://doi.org/10.1038/s43588-021-00102-2)
34+
- _A Horizon Study for Cosmic Explorer: Science, Observatories, and Community_, [arXiv:2109.09882](https://arxiv.org/abs/2109.09882)
35+
- _The Next Generation Global Gravitational Wave Observatory: The Science Book_, [arXiv:2111.06990](https://arxiv.org/abs/2111.06990)
36+
- Lovelace, G. _Computational challenges in numerical relativity in the gravitational-wave era_, [Nat Comput Sci **1**, 450–452 (2021)](https://doi.org/10.1038/s43588-021-00102-2)
3637
- Magazines:
38+
3739
- [Sky & Telescope June 2022 (cover)](https://shopatsky.com/products/sky-telescope-june-2022-magazine)
3840

3941
```{image} img/ST_cover_june2022.png
4042
:width: 250px
4143
```
44+
4245
- Prizes:
4346
- [Figure 1a scientific art exhibition 2021](https://figure1a.org/exhibitions)
4447

docs/gui.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ With the GUI plugins you can explore waveform data in the ParaView application:
1515
```
1616
You will now find the plugins provided by this repository in the ParaView GUI
1717
when you select 'Tools' > 'Manage Plugins'.
18-
3. Open a waveform data file in ParaView and select the _Waveform Data Reader_
18+
2. Open a waveform data file in ParaView and select the _Waveform Data Reader_
1919
to load it. Waveform data files in
2020
[SpEC](https://www.black-holes.org/code/SpEC.html)'s output format are
2121
currently supported.
22-
4. Add the _Waveform To Volume_ filter to the loaded data.
23-
5. Change the representation to _Volume_ and adjust the following properties:
22+
3. Add the _Waveform To Volume_ filter to the loaded data.
23+
4. Change the representation to _Volume_ and adjust the following properties:
2424
- Volume Rendering Mode (try _GPU Based_ and enable _Shade_)
2525
- Scalar Opacity Unit Distance (try a quarter of the domain size)
2626
- Transfer function (select _Edit color map_)

docs/index.md

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
![banner](banner.png)
32

43
# gwpv

docs/installation.md

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
# Installation
32

43
## Option 1: Pre-built Docker container
@@ -52,9 +51,11 @@ configuration files and data available in the container (see [Usage](usage)).
5251
3. Give ParaView access to the environment. If you have created the environment
5352
with Python 3's `venv` then copy the `scripts/activate_this.py` script to the
5453
environment:
54+
5555
```sh
5656
cp scripts/activate_this.py path/to/new/env/bin
5757
```
58+
5859
Note that environments created with the `virtualenv` package include this
5960
script automatically and you don't need to copy it. The script is used to
6061
activate the environment from within Python scripts. It allows ParaView's
@@ -64,14 +65,18 @@ configuration files and data available in the container (see [Usage](usage)).
6465
You may also want to add the ParaView executables such as `pvpython` to your
6566
`PATH` when the environment is activated for convenient access. To do so you
6667
can append the following line to `path/to/env/bin/activate` as well:
68+
6769
```sh
6870
export PATH="path/to/paraview/bin/:$PATH"
6971
```
72+
7073
On macOS you may also need to append this line to pick up the `paraview` GUI
7174
executable:
75+
7276
```sh
7377
export PATH="path/to/paraview/MacOS/:$PATH"
7478
```
79+
7580
4. Install the following packages in the environment, making sure to use
7681
ParaView's HDF5 when installing `h5py`:
7782
```sh
@@ -81,7 +86,7 @@ configuration files and data available in the container (see [Usage](usage)).
8186
```
8287
Note that the `HDF5_DIR` should have `include` and `lib` directories with
8388
ParaView's HDF5. On macOS it is typically
84-
`/Applications/ParaView-X.Y.Z.app/Contents/`. Add the `-e` flag when
89+
`/Applications/ParaView-X.Y.Z.app/Contents/`. Add the `-e` flag when
8590
installing this repository's Python package to install it in "editable" mode,
8691
i.e. symlink instead of copy it so changes to the repository are reflected in
8792
the installation.

gwpv/download_data.py

+19-13
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1+
import logging
12
import os
3+
24
import requests
35
import tqdm
4-
import logging
6+
57
from gwpv.scene_configuration import parse_as
68

79

@@ -13,21 +15,25 @@ def download_data(datasources):
1315
except ValueError:
1416
continue
1517
if os.path.exists(cached_filename):
16-
logger.debug("Found cached {} file '{}' for URL '{}'".format(
17-
datasource_name, cached_filename, url))
18+
logger.debug(
19+
f"Found cached {datasource_name} file '{cached_filename}' for"
20+
f" URL '{url}'"
21+
)
1822
continue
19-
logger.info("Downloading {} file at URL '{}' to cache '{}'...".format(
20-
datasource_name, url, cached_filename))
23+
logger.info(
24+
f"Downloading {datasource_name} file at URL '{url}' to cache"
25+
f" '{cached_filename}'..."
26+
)
2127
os.makedirs(os.path.dirname(cached_filename), exist_ok=True)
2228
url_response = requests.get(url, stream=True)
23-
file_size = int(url_response.headers.get('content-length', 0))
24-
cached_filename_tmp = cached_filename + '_tmp'
25-
with open(cached_filename_tmp, 'wb') as cached_file, tqdm.tqdm(
26-
desc="Downloading " + datasource_name,
27-
total=file_size,
28-
unit='iB',
29-
unit_scale=True,
30-
unit_divisor=1024,
29+
file_size = int(url_response.headers.get("content-length", 0))
30+
cached_filename_tmp = cached_filename + "_tmp"
31+
with open(cached_filename_tmp, "wb") as cached_file, tqdm.tqdm(
32+
desc="Downloading " + datasource_name,
33+
total=file_size,
34+
unit="iB",
35+
unit_scale=True,
36+
unit_divisor=1024,
3137
) as progress:
3238
for data in url_response.iter_content(chunk_size=1024):
3339
progress.update(cached_file.write(data))

0 commit comments

Comments
 (0)