A tool to mask information unrelated to a specific proposal ID in pfsConfig
.
The following values are masked as follows when a fiber is assigned for a SCIENCE
object, i.e., targetType == 1
, proposalId != "N/A"
and proposalId
is not the specific proposal under processed.
Keyword | Datatype | Mask value |
---|---|---|
tract |
int | -1 |
patch |
str | -1,-1 |
ra |
float | -99 |
dec |
float | -99 |
catId |
int | 9000 |
objId |
int64 | -fiberId |
targetType |
int | 12 |
pmRa |
float | 0.0 |
pmDec |
float | 0.0 |
parallax |
float | 1.0e-7 |
proposalId |
str | masked |
obCode |
str | masked |
pfiNominal |
(float, float) | (NaN, NaN) |
pfiCenter |
(float, float) | (NaN, NaN) |
{fiber,psf,total}Flux |
list of float | list of NaN |
{fiber,psf,total}FluxErr |
list of float | list of NaN |
filterNames |
list of str | list of none |
Note: It is highly recommended to use a virtual environment to avoid conflicts with system packages.
git clone https://github.com/Subaru-SciOp/pfsconfig_redaction.git
cd pfsconfig_redaction
# Create and activate virtual environment (recommended)
python3 -m venv .venv
source .venv/bin/activate
# Install the package
pip install .
For development purposes, install in editable mode:
git clone https://github.com/Subaru-SciOp/pfsconfig_redaction.git
cd pfsconfig_redaction
# Create and activate virtual environment
python3 -m venv .venv
source .venv/bin/activate
# Install in editable mode
pip install -e .
If you have uv installed (automatically manages virtual environments):
git clone https://github.com/Subaru-SciOp/pfsconfig_redaction.git
cd pfsconfig_redaction
uv sync
For environments requiring explicit requirements.txt:
git clone https://github.com/Subaru-SciOp/pfsconfig_redaction.git
cd pfsconfig_redaction
pip install -r requirements.txt
pip install .
from pathlib import Path
from pfs.datamodel import PfsConfig
import pfsconfig_redaction
indir = Path("tmp")
outdir = Path("tmp")
input_file = "PFSF12361000.fits"
pfs_config = PfsConfig.readFits(indir / input_file)
redacted_pfsconfigs = pfsconfig_redaction.redact(pfs_config)
for i, redacted_pfsconfig in enumerate(redacted_pfsconfigs):
# Skip if proposal_id is "N/A"
if redacted_pfsconfig.proposal_id == "N/A":
continue
proposal_id = redacted_pfsconfig.proposal_id
# Save the redacted PfsConfig to a FITS file
redacted_pfsconfig.pfs_config.writeFits(
outdir / f"redacted_PFSF12361000_{proposal_id}.fits"
)
The returned redacted_pfsconfigs
is a list of RedactedPfsConfig
objects, which has proposal_id
and pfs_config
attributes. The proposal_id
attribute is the proposal_id to be delivered. The pfs_config
attribute is a PfsConfig
object with the information masked.