Skip to content

Commit

Permalink
Fix for polars 1.7.0 by disabling projection_pushdown (#237)
Browse files Browse the repository at this point in the history
  • Loading branch information
lukeshingles authored Sep 12, 2024
1 parent e1eb457 commit 5984ff8
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
2 changes: 2 additions & 0 deletions artistools/lightcurve/plotlightcurve.py
Original file line number Diff line number Diff line change
Expand Up @@ -1620,7 +1620,9 @@ def main(args: argparse.Namespace | None = None, argsraw: Sequence[str] | None =
if not isinstance(args.modelpath, Iterable):
args.modelpath = [args.modelpath]

assert isinstance(args.modelpath, list)
args.modelpath = at.flatten_list(args.modelpath)

# flatten the list
modelpaths = []
for elem in args.modelpath:
Expand Down
2 changes: 1 addition & 1 deletion artistools/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -1137,7 +1137,7 @@ def get_linelist_pldf(modelpath: Path | str, get_ion_str: bool = False) -> pl.La
.with_columns(pl.col(pl.Int64).cast(pl.Int32))
)

if "ionstage" in linelist_lazy.columns:
if "ionstage" in linelist_lazy.collect_schema().names():
linelist_lazy = linelist_lazy.rename({"ionstage": "ion_stage"})

if get_ion_str:
Expand Down
2 changes: 1 addition & 1 deletion artistools/plotspherical.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ def plot_spherical(
.join(dfpackets, how="left", on=["costhetabin", "phibin"], coalesce=True)
.fill_null(0)
.sort(["costhetabin", "phibin"])
).collect()
).collect(projection_pushdown=False) # projection_pushdown broke in polars 1.17.0

print(f'packets plotted: {alldirbins.select("count").sum().item(0, 0):.1e}')

Expand Down
4 changes: 2 additions & 2 deletions artistools/spectra/spectra.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ def get_from_packets(
print("Applying filter to ARTIS spectrum")
dfbinned_lazy = dfbinned_lazy.with_columns(cs.starts_with("f_lambda_").map_batches(fluxfilterfunc))

dfbinned = dfbinned_lazy.collect()
dfbinned = dfbinned_lazy.collect(projection_pushdown=False) # projection_pushdown broke in polars 1.17.0
assert isinstance(dfbinned, pl.DataFrame)

dfdict = {}
Expand Down Expand Up @@ -979,7 +979,7 @@ def get_flux_contributions_from_packets(
if directionbin != -1:
cols |= {"costhetabin", "phibin", "dirbin"}

dfpackets = lzdfpackets.select([col for col in cols if col in lzdfpackets.columns]).collect()
dfpackets = lzdfpackets.select([col for col in cols if col in lzdfpackets.collect_schema().names()]).collect()

emissiongroups = (
{
Expand Down

0 comments on commit 5984ff8

Please sign in to comment.