Forced PSF photometry on ZTF science images
Project description
ztforce
Forced PSF photometry on ZTF science images — measures flux at a fixed sky position in every available epoch, even below the detection threshold, producing a calibrated AB-magnitude lightcurve.
Installation
pip install ztforce
Python 3.10–3.13 is supported.
Credentials
ztforce downloads ZTF science images from IRSA and requires an IRSA account (free at irsa.ipac.caltech.edu). Set your credentials in one of three ways:
Environment variables (recommended for scripts/CI):
export ZTFORCE_IRSA_USER=your_username
export ZTFORCE_IRSA_PASS=your_password
Config file at ~/.ztforce/config.toml:
[credentials]
irsa_user = "your_username"
irsa_pass = "your_password"
Direct argument:
from ztforce import build_config
config = build_config(irsa_user="your_username", irsa_pass="your_password")
Quick start
from ztforce import run_forced_photometry
# Measure flux at a fixed position across all ZTF g- and r-band epochs.
# A tqdm progress bar tracks downloads and PSF fitting; results are cached
# on disk so repeated calls return instantly.
lcs = run_forced_photometry(ra=210.08, dec=-6.88, bands=["g", "r"])
lcs["g"].df # pandas DataFrame of all epochs
lcs["g"].stack() # inverse-variance weighted stack of detections
lcs["g"].save("my_source_g.ecsv") # save to ECSV
Batch processing
from astropy.coordinates import SkyCoord
from ztforce import run_forced_photometry_batch
targets = SkyCoord(ra=[210.08, 130.13], dec=[-6.88, 19.70], unit="deg")
# Processes targets in parallel; downloads are shared across all workers.
results = run_forced_photometry_batch(targets, bands=["g", "r"], n_workers=4)
results[0]["g"].stack() # stacked photometry for first target, g-band
Related services
Several official ZTF services offer complementary photometry — ztforce fills a gap none of them cover:
| Service | What it does | Why you'd use ztforce instead |
|---|---|---|
| ZTF Forced Photometry Service (ZFPS) (Masci et al. 2023) | Forced PSF photometry on ZTF difference images at user positions | Science-image photometry avoids subtraction artifacts; no account/queue required; runs locally |
| ZTF DR lightcurves (IRSA) | Catalog lightcurves for sources detected in ZTF data releases | Forced photometry works for transients and sub-threshold sources not in any catalog and at any arbitrary position |
| ZuberCal | Ubercalibrated PSF photometry catalog for PS1-matched ZTF sources | Only covers sources detected in PS1; ztforce works at any arbitrary position |
ztforce is designed for cases where the source may not appear in any existing catalog — supernovae, kilonova, flares, or any transient — and you need calibrated flux measurements at a fixed sky position across every available epoch, including non-detections.
Dev Guide - Getting Started
Before installing any dependencies or writing code, it's a great idea to create a
virtual environment. LINCC-Frameworks engineers primarily use conda to manage virtual
environments. If you have conda installed locally, you can run the following to
create and activate a new environment.
>> conda create -n <env_name> python=3.11
>> conda activate <env_name>
Once you have created a new environment, you can install this project for local development using the following commands:
>> ./.setup_dev.sh
>> conda install pandoc
Notes:
./.setup_dev.shwill initialize pre-commit for this local repository, so that a set of tests will be run prior to completing a local commit. For more information, see the Python Project Template documentation on pre-commit- Install
pandocallows you to verify that automatic rendering of Jupyter notebooks into documentation for ReadTheDocs works as expected. For more information, see the Python Project Template documentation on Sphinx and Python Notebooks
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ztforce-0.1.2.tar.gz.
File metadata
- Download URL: ztforce-0.1.2.tar.gz
- Upload date:
- Size: 86.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5e3ffc738604e84fc8fffb80e84cbc1d7ff814d076d5c994f1fe5f32c6f61d32
|
|
| MD5 |
47494c92b0d87c974c70307db243ea75
|
|
| BLAKE2b-256 |
e236cff397413297e00b2ebe313f4b67ea540f6e597ae2ebd62073209947c6a7
|
Provenance
The following attestation bundles were made for ztforce-0.1.2.tar.gz:
Publisher:
publish-to-pypi.yml on Adam-Boesky/ztforce
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ztforce-0.1.2.tar.gz -
Subject digest:
5e3ffc738604e84fc8fffb80e84cbc1d7ff814d076d5c994f1fe5f32c6f61d32 - Sigstore transparency entry: 1660306004
- Sigstore integration time:
-
Permalink:
Adam-Boesky/ztforce@09adb20329807580a27d1bedfa75ef5ce3838320 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/Adam-Boesky
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@09adb20329807580a27d1bedfa75ef5ce3838320 -
Trigger Event:
release
-
Statement type:
File details
Details for the file ztforce-0.1.2-py3-none-any.whl.
File metadata
- Download URL: ztforce-0.1.2-py3-none-any.whl
- Upload date:
- Size: 23.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1112b2afd9e60f9092c1d18fb0d6e02f987f067965b8608cb218c7109fe3283b
|
|
| MD5 |
f2f9668d0c9057ff38bfb60b12fd8a21
|
|
| BLAKE2b-256 |
d4d7f725948ad3f855e72896daf57c3a4ec2f6b0f71fa72226ff1fc28cc5fe4f
|
Provenance
The following attestation bundles were made for ztforce-0.1.2-py3-none-any.whl:
Publisher:
publish-to-pypi.yml on Adam-Boesky/ztforce
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ztforce-0.1.2-py3-none-any.whl -
Subject digest:
1112b2afd9e60f9092c1d18fb0d6e02f987f067965b8608cb218c7109fe3283b - Sigstore transparency entry: 1660306114
- Sigstore integration time:
-
Permalink:
Adam-Boesky/ztforce@09adb20329807580a27d1bedfa75ef5ce3838320 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/Adam-Boesky
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@09adb20329807580a27d1bedfa75ef5ce3838320 -
Trigger Event:
release
-
Statement type: