Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pre-commit.ci] pre-commit autoupdate #204

Merged
merged 4 commits into from
Jul 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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}"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suspect this is a breaking change too and that this function isn't fully tested

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

checked. It's not breaking because RadMC3DSource.position is a list of floats, without explicit units.

)
fhandle.write("\n")

Expand Down