Skip to content

Commit

Permalink
Merge pull request #204 from yt-project/pre-commit-ci-update-config
Browse files Browse the repository at this point in the history
  • Loading branch information
neutrinoceros committed Jul 11, 2023
2 parents 04508f5 + 1de1116 commit 2006013
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 40 deletions.
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ repos:
- id: black

- repo: https://github.com/adamchainz/blacken-docs
rev: 1.13.0
rev: 1.14.0
hooks:
- id: blacken-docs
additional_dependencies: [black==23.1.0]

- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.0.260
rev: v0.0.275
hooks:
- id: ruff
args: [--fix]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,56 +57,34 @@ def _light_cone_projection(
these_field_cuts = field_cuts.copy()

if my_slice["box_depth_fraction"] < 1:
axis = ("x", "y", "z")[my_slice["projection_axis"]]
axis = "xyz"[my_slice["projection_axis"]]
depthLeft = (
my_slice["projection_center"][my_slice["projection_axis"]]
- 0.5 * my_slice["box_depth_fraction"]
)
).ndview
depthRight = (
my_slice["projection_center"][my_slice["projection_axis"]]
+ 0.5 * my_slice["box_depth_fraction"]
)
).ndview
if depthLeft < 0:
cut_mask = (
"((obj['index', '%s'] + 0.5*obj['index', 'd%s'] >= 0) & "
" (obj['index', '%s'] - 0.5*obj['index', 'd%s'] <= %f)) | "
"((obj['index', '%s'] + 0.5*obj['index', 'd%s'] >= %f) & "
" (obj['index', '%s'] - 0.5*obj['index', 'd%s'] <= 1))"
) % (
axis,
axis,
axis,
axis,
depthRight,
axis,
axis,
(depthLeft + 1),
axis,
axis,
f"((obj['index', {axis!r}] + 0.5*obj['index', 'd{axis}'] >= 0) & "
f" (obj['index', {axis!r}] - 0.5*obj['index', 'd{axis}'] <= {depthRight:f})) | "
f"((obj['index', {axis!r}] + 0.5*obj['index', 'd{axis}'] >= {depthLeft + 1:f}) & "
f" (obj['index', {axis!r}] - 0.5*obj['index', 'd{axis}'] <= 1))"
)
elif depthRight > 1:
cut_mask = (
"((obj['index', '%s'] + 0.5*obj['index', 'd%s'] >= 0) & "
"(obj['index', '%s'] - 0.5*obj['index', 'd%s'] <= %f)) | "
"((obj['index', '%s'] + 0.5*obj['index', 'd%s'] >= %f) & "
"(obj['index', '%s'] - 0.5*obj['index', 'd%s'] <= 1))"
) % (
axis,
axis,
axis,
axis,
(depthRight - 1),
axis,
axis,
depthLeft,
axis,
axis,
f"((obj['index', {axis!r}] + 0.5*obj['index', 'd{axis}'] >= 0) & "
f"(obj['index', {axis!r}] - 0.5*obj['index', 'd{axis}'] <= {depthRight - 1:f})) | "
f"((obj['index', {axis!r}] + 0.5*obj['index', 'd{axis}'] >= {depthLeft:f}) & "
f"(obj['index', {axis!r}] - 0.5*obj['index', 'd{axis}'] <= 1))"
)
else:
cut_mask = (
"(obj['index', '%s'] + 0.5*obj['index', 'd%s'] >= %f) & "
"(obj['index', '%s'] - 0.5*obj['index', '%s'] <= %f)"
) % (axis, axis, depthLeft, axis, axis, depthRight)
f"(obj['index', {axis!r}] + 0.5*obj['index', 'd{axis}'] >= {depthLeft:f}) & "
f"(obj['index', {axis!r}] - 0.5*obj['index', {axis!r}] <= {depthRight:f})"
)

these_field_cuts.append(cut_mask)

Expand Down
3 changes: 1 addition & 2 deletions yt_astro_analysis/radmc3d_export/RadMC3DInterface.py
Original file line number Diff line number Diff line change
Expand Up @@ -364,8 +364,7 @@ def write_source_files(self, sources, wavelengths):
fhandle.write(str(source.radius) + " ")
fhandle.write(str(source.mass) + " ")
fhandle.write(
"%f %f %f"
% (source.position[0], source.position[1], source.position[2])
f"{source.position[0]:f} {source.position[1]:f} {source.position[2]:f}"
)
fhandle.write("\n")

Expand Down

0 comments on commit 2006013

Please sign in to comment.