Skip to content

Commit

Permalink
Add custom polars filters
Browse files Browse the repository at this point in the history
  • Loading branch information
Bernardo Porto Veronese committed Jul 25, 2024
1 parent ff7ebbb commit a8ba699
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions gladeparser/expressions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import polars as pl


def filter_by_valid_redshifts(zmin: float = 0.0):
return (pl.col("z_cmb") > zmin, pl.col("z_cmb").is_not_null())


def filter_by_catalog_name(catalog_name: str):
return (pl.col(catalog_name).is_not_null(),)


PGC = filter_by_catalog_name("PGC no")
GWGC = filter_by_catalog_name("GWGC name")
WISExSCOS = filter_by_catalog_name("WISExSCOS name")
TWOMASS = filter_by_catalog_name("2MASS name")
HYPERLEDA = filter_by_catalog_name("HyperLEDA name")
SDSS_DR16Q = filter_by_catalog_name("SDSS-DR16Q name")

0 comments on commit a8ba699

Please sign in to comment.