Skip to content

Commit 9e65045

Browse files
authored
Merge branch 'main' into pre-commit-ci-update-config
2 parents 4b8a3c8 + 5872062 commit 9e65045

164 files changed

Lines changed: 9896 additions & 3380 deletions

File tree

Some content is hidden

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

.github/pull_request_template.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
# Description
22

3-
Please include a summary of the changes and the related issue. Please also include relevant motivation and context. List any dependencies that are required for this change.
3+
<!--
4+
Please include a summary of the changes and the related issue. Please also include relevant motivation and context. List any dependencies that are required for this change. -->
45

56
Fixes # (issue)
67

78
## Type of change
89

9-
Please delete options that are not relevant.
10+
<!-- Please delete options that are not relevant. -->
1011

1112
- [ ] Bug fix (non-breaking change which fixes an issue)
1213
- [ ] New feature (non-breaking change which adds functionality)
@@ -15,6 +16,8 @@ Please delete options that are not relevant.
1516

1617
# Checklist:
1718

19+
<!-- If you are unable to check all the boxes, your pull request may not be eligible for review. -->
20+
1821
- [ ] My code follows the style guidelines of this project
1922
- [ ] I have performed a self-review of my code
2023
- [ ] I have commented my code, particularly in hard-to-understand areas

.github/workflows/draft-pdf.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Draft PDF
2+
on:
3+
push:
4+
paths:
5+
- joss_paper/**
6+
- .github/workflows/draft-pdf.yml
7+
8+
9+
jobs:
10+
paper:
11+
runs-on: ubuntu-latest
12+
name: Paper Draft
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v4
16+
- name: Build draft PDF
17+
uses: openjournals/openjournals-draft-action@master
18+
with:
19+
journal: joss
20+
paper-path: joss_paper/paper.md
21+
- name: Upload
22+
uses: actions/upload-artifact@v4
23+
with:
24+
name: paper
25+
path: joss_paper/paper.pdf

.gitignore

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,3 +161,17 @@ cython_debug/
161161
# and can be added to the global gitignore or merged into this file. For a more nuclear
162162
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
163163
#.idea/
164+
165+
#data files.
166+
.pt
167+
.png
168+
.jpg
169+
.pdf
170+
.json
171+
.csv
172+
.vscode/settings.json
173+
examples/paint_plots/data/
174+
examples/paint_plots/plots/
175+
176+
# Local config files.
177+
**/config.local.json

.pre-commit-config.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ repos:
44
rev: v1.18.2 # Use the sha / tag you want to point at
55
hooks:
66
- id: mypy
7+
additional_dependencies:
8+
- types-PyYAML
79
- repo: https://github.com/pre-commit/pre-commit-hooks
810
rev: v6.0.0
911
hooks:

artist/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22

33
import os
44

5-
from . import core, data_loader, field, scenario, scene, util
5+
from . import core, data_parser, field, scenario, scene, util
66

77
ARTIST_ROOT = f"{os.sep}".join(__file__.split(os.sep)[:-2])
8-
"""Reference to the root directory of ARTIST."""
8+
"""Reference to the root directory of ``ARTIST``."""
99

1010
__all__ = [
1111
"core",
12-
"data_loader",
12+
"data_parser",
1313
"field",
1414
"scenario",
1515
"scene",

artist/core/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
"""Bundle all classes responsible for the core functions in ARTIST."""
1+
"""Bundle all classes responsible for the core functions in ``ARTIST``."""
22

33
from artist.core.heliostat_ray_tracer import (
44
DistortionsDataset,
55
HeliostatRayTracer,
66
RestrictedDistributedSampler,
77
)
8-
from artist.core.kinematic_calibrator import KinematicCalibrator
8+
from artist.core.kinematic_reconstructor import KinematicReconstructor
99
from artist.core.motor_position_optimizer import MotorPositionsOptimizer
1010
from artist.core.surface_reconstructor import SurfaceReconstructor
1111

1212
__all__ = [
1313
"HeliostatRayTracer",
1414
"DistortionsDataset",
1515
"RestrictedDistributedSampler",
16-
"KinematicCalibrator",
16+
"KinematicReconstructor",
1717
"SurfaceReconstructor",
1818
"MotorPositionsOptimizer",
1919
]

artist/core/core_utils.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ def per_heliostat_reduction(
1111
"""
1212
Compute mean losses for each heliostat with multiple samples.
1313
14-
If the active heliostats of one group have different amounts of samples to train on, i.e.
14+
If the active heliostats of one group have different amounts of samples to train on, i.e.,
1515
one heliostat is trained with more samples than another, this function makes sure that
1616
each heliostat still contributes equally to the overall loss of the group. This function
1717
computes the mean loss for each heliostat.
@@ -20,13 +20,13 @@ def per_heliostat_reduction(
2020
----------
2121
per_sample_values : torch.Tensor
2222
The per sample values to be reduced.
23-
Tensor of shape [number_of_samples]
23+
Tensor of shape [number_of_samples].
2424
active_heliostats_mask : torch.Tensor
2525
A mask defining which heliostats are activated.
2626
Tensor of shape [number_of_heliostats].
2727
device : torch.device | None
2828
The device on which to perform computations or load tensors and models (default is None).
29-
If None, ARTIST will automatically select the most appropriate
29+
If None, ``ARTIST`` will automatically select the most appropriate
3030
device (CUDA or CPU) based on availability and OS.
3131
3232
Returns
@@ -48,7 +48,7 @@ def per_heliostat_reduction(
4848
0, heliostat_ids, per_sample_values
4949
)
5050

51-
# Compute mean MSE per heliostat on each rank.
51+
# Compute MSE loss per heliostat on each rank.
5252
number_of_samples_per_heliostat = torch.zeros(
5353
len(active_heliostats_mask), device=device
5454
)
@@ -76,7 +76,7 @@ def scale_loss(
7676
loss : torch.Tensor
7777
The loss to be scaled.
7878
Tensor of shape [1].
79-
reference_loss : torch.Tensor
79+
reference : torch.Tensor
8080
The reference loss.
8181
Tensor of shape [1].
8282
weight : float
@@ -90,4 +90,9 @@ def scale_loss(
9090
"""
9191
epsilon = 1e-12
9292
scale = (reference * weight) / (loss + epsilon)
93-
return loss * scale
93+
scaled_loss = loss * scale
94+
95+
inf_mask = torch.isinf(loss)
96+
scaled_loss[inf_mask] = loss[inf_mask]
97+
98+
return scaled_loss

0 commit comments

Comments
 (0)