hats.io.summary_file#

Functions#

write_skymap_png(→ None)

Write a skymap.png pixel coverage map to the catalog directory.

write_partition_info_png(→ None)

Write a partition_info.png angular density map to the catalog directory.

generate_summary(→ str)

Generate summary content for any HATS catalog or collection.

write_catalog_summary_file(→ upath.UPath)

Write a summary readme file for any HATS catalog or collection.

Module Contents#

write_skymap_png(catalog_path: str | pathlib.Path | upath.UPath) None[source]#

Write a skymap.png pixel coverage map to the catalog directory.

Parameters:
catalog_pathstr | Path | UPath

Path to the catalog directory. The PNG will be written alongside the catalog’s other files.

write_partition_info_png(catalog_path: str | pathlib.Path | upath.UPath) None[source]#

Write a partition_info.png angular density map to the catalog directory.

Parameters:
catalog_pathstr | Path | UPath

Path to the catalog directory. The PNG will be written alongside the catalog’s other files.

generate_summary(catalog, *, fmt: Literal['markdown', 'html'] | None = None, name: str, description: str, uri: str | None, huggingface_metadata: bool, jinja2_template: str | None = None, extra_template_vars: dict | None = None) str[source]#

Generate summary content for any HATS catalog or collection.

Parameters:
catalogCatalog | CatalogCollection

The HATS catalog or collection to summarize.

fmtLiteral[“markdown”, “html”] | None

Output format. Use "markdown" or "html" to render the built-in template, or None to supply a fully custom jinja2_template.

namestr

Human-readable name rendered in the summary.

descriptionstr

Description rendered in the summary.

uristr | None

URI of the catalog used for hyperlinks and code-snippet examples. If None, a placeholder is used.

huggingface_metadatabool

Whether to include Hugging Face YAML frontmatter. Only valid when fmt="markdown".

jinja2_templatestr | None

Jinja2 template string or path to a .jinja2 file. If a file path is given, the file is read automatically. Overrides the built-in template when fmt is "markdown" or "html"; required when fmt=None.

extra_template_varsdict | None

Additional variables passed into template.render(). Useful for custom templates (e.g. VO registry XML fields) that reference variables HATS does not supply by default.

Returns:
str

Rendered summary content.

write_catalog_summary_file(catalog_path: str | pathlib.Path | upath.UPath, *, fmt: Literal['markdown', 'html'] | None, filename: str | None = None, output_dir: str | pathlib.Path | upath.UPath | None = None, name: str | None = None, description: str | None = None, uri: str | None = None, huggingface_metadata: bool = False, jinja2_template: str | None = None, extra_template_vars: dict | None = None) upath.UPath[source]#

Write a summary readme file for any HATS catalog or collection.

Parameters:
catalog_pathstr | Path | UPath

Path to the HATS catalog or collection directory.

fmtLiteral[“markdown”, “html”] | None

Output format. Use "markdown" (writes README.md) or "html" (writes index.html), or None to supply a fully custom jinja2_template and filename.

filenamestr | None

Output filename. Defaults to README.md for markdown and index.html for HTML. Required when fmt=None.

output_dirstr | Path | UPath | None

Directory to write the file to. Defaults to catalog_path.

namestr | None

Human-readable name. Inferred from catalog metadata if not provided.

descriptionstr | None

Description. Inferred from catalog metadata if not provided.

uristr | None

URI of the catalog used for hyperlinks and code-snippet examples. If None, a placeholder is used.

huggingface_metadatabool

Whether to include Hugging Face YAML frontmatter. Only valid when fmt="markdown".

jinja2_templatestr | None

Jinja2 template string or path to a .jinja2 file. If a file path is given, the file is read automatically. Overrides the built-in template when fmt is "markdown" or "html"; required when fmt=None.

extra_template_varsdict | None

Additional variables passed into template.render(). Useful for custom templates (e.g. VO registry XML fields) that reference variables HATS does not supply by default.

Returns:
UPath

Path to the written summary file.