diff --git a/heracles/cli.py b/heracles/cli.py index 515ae9e..31c9a77 100644 --- a/heracles/cli.py +++ b/heracles/cli.py @@ -31,10 +31,10 @@ # valid option keys FIELD_TYPES = { - "positions": "heracles.maps:PositionMap", - "shears": "heracles.maps:ShearMap", - "visibility": "heracles.maps:VisibilityMap", - "weights": "heracles.maps:WeightMap", + "positions": "heracles.fields:Positions", + "shears": "heracles.fields:Shears", + "visibility": "heracles.fields:Visibility", + "weights": "heracles.fields:Weights", } @@ -152,8 +152,8 @@ def subsections(self, group: str) -> dict[str, str]: return {s.rpartition(":")[-1].strip(): s for s in sections} -def map_from_config(config, section): - """Construct a map instance from config.""" +def field_from_config(config, section): + """Construct a field instance from config.""" from pkgutil import resolve_name @@ -176,11 +176,11 @@ def map_from_config(config, section): return cls(nside, *columns) -def maps_from_config(config, group="fields"): - """Construct all map instances from config.""" +def fields_from_config(config, group="fields"): + """Construct all field instances from config.""" sections = config.subsections(group) return { - name: map_from_config(config, section) for name, section in sections.items() + name: field_from_config(config, section) for name, section in sections.items() } @@ -364,7 +364,7 @@ def map_all_selections( ) -> Iterator: """Iteratively map the catalogues defined in config.""" - from .maps import map_catalogs + from .fields import map_catalogs # turn groups into a deduplicated sequence if groups is None: @@ -374,13 +374,13 @@ def map_all_selections( else: groups = list(dict.fromkeys(groups)) - # load catalogues and maps to process + # load catalogues and fields to process catalogs = catalogs_from_config(config) - maps = {} + fields = {} for group in groups: - maps |= maps_from_config(config, group) + fields |= fields_from_config(config, group) - logger.info("mapping %s", ", ".join(map(repr, maps))) + logger.info("fields %s", ", ".join(map(repr, fields))) # process each catalogue separately into maps for key, catalog in catalogs.items(): @@ -393,7 +393,7 @@ def map_all_selections( # maps for single catalogue yield map_catalogs( - maps, + fields, {key: catalog}, parallel=True, # no effect but prettier log output progress=True, @@ -464,8 +464,8 @@ def alms( """ + from .fields import transform_maps from .io import AlmFits - from .maps import transform_maps # load the config file, this contains alms setting and maps definition logger.info("reading configuration from %s", files) diff --git a/pyproject.toml b/pyproject.toml index 3fd2743..b91ff3b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -116,3 +116,6 @@ all = true spaces_indent_inline_array = 4 trailing_comma_inline_array = true overrides."project.classifiers".inline_arrays = false + +[project.scripts] +heracles = "heracles.cli:main"