-
-
Notifications
You must be signed in to change notification settings - Fork 405
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into pr/wkerzendorf/2697
- Loading branch information
Showing
25 changed files
with
5,144 additions
and
611 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: "Setup environment" | ||
description: "Sets up environment for tardis and caches it" | ||
|
||
inputs: | ||
os-label: | ||
description: "os label for lock file, default linux" | ||
required: true | ||
default: "linux" | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Download Lock File | ||
run: wget -q https://raw.githubusercontent.com/tardis-sn/tardis/master/conda-${{ inputs.os-label }}.lock | ||
if: matrix.pip == true | ||
shell: bash | ||
|
||
- name: Generate Cache Key | ||
run: | | ||
file_hash=$(cat conda-${{ inputs.os-label }}.lock | shasum -a 256 | cut -d' ' -f1) | ||
echo "file_hash=$file_hash" >> "${GITHUB_OUTPUT}" | ||
id: cache-environment-key | ||
shell: bash | ||
|
||
- uses: mamba-org/setup-micromamba@v1 | ||
with: | ||
environment-file: conda-${{ inputs.os-label }}.lock | ||
cache-environment-key: ${{ steps.cache-environment-key.outputs.file_hash }} | ||
cache-downloads-key: ${{ steps.cache-environment-key.outputs.file_hash }} | ||
environment-name: tardis | ||
cache-environment: true | ||
cache-downloads: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
from asv_runner.benchmarks.mark import parameterize | ||
|
||
import tardis.transport.frame_transformations as frame_transformations | ||
import tardis.transport.geometry.calculate_distances as calculate_distances | ||
from benchmarks.benchmark_base import BenchmarkBase | ||
|
||
|
||
class BenchmarkTransportGeometryCalculateDistances(BenchmarkBase): | ||
""" | ||
Class to benchmark the calculate distances function. | ||
""" | ||
|
||
@property | ||
def model(self): | ||
return 5.2e7 | ||
|
||
def time_calculate_distance_boundary(self): | ||
mu = 0.3 | ||
r = 7.5e14 | ||
|
||
calculate_distances.calculate_distance_boundary( | ||
r, mu, self.geometry.r_inner[0], self.geometry.r_outer[0] | ||
) | ||
|
||
@parameterize( | ||
{ | ||
"Parameters": [ | ||
{ | ||
"packet": { | ||
"nu_line": 0.1, | ||
"is_last_line": True | ||
}, | ||
"enable_full_relativity": True, | ||
}, | ||
{ | ||
"packet": { | ||
"nu_line": 0.2, | ||
"is_last_line": False | ||
}, | ||
"enable_full_relativity": True, | ||
} | ||
] | ||
} | ||
) | ||
def time_calculate_distance_line(self, parameters): | ||
packet_params = parameters["packet"] | ||
nu_line = packet_params["nu_line"] | ||
is_last_line = packet_params["is_last_line"] | ||
enable_full_relativity = parameters["enable_full_relativity"] | ||
|
||
time_explosion = self.model | ||
|
||
doppler_factor = frame_transformations.get_doppler_factor( | ||
self.static_packet.r, | ||
self.static_packet.mu, | ||
time_explosion, | ||
enable_full_relativity | ||
) | ||
comov_nu = self.static_packet.nu * doppler_factor | ||
|
||
calculate_distances.calculate_distance_line( | ||
self.static_packet, | ||
comov_nu, | ||
is_last_line, | ||
nu_line, | ||
time_explosion, | ||
enable_full_relativity | ||
) |
Oops, something went wrong.