SPHEREx Data Retrieval and Photometry Toolkit
Project description
Xcavation is a Python package for rapid forced-photometry calculations of SPHEREx QR2 spectral data. It uses ASQL PyVo to access SPHEREx images through the IRSA API. Aperture photometry are supported and include multi-threading for improved deeper analysis.
🔍 Example 🔎
The example notebook is provided through Google Colab, as it has excellent internet speed for the image API. Additionally, there is an example notebook provided on the GitHub repository.
🛠️ Installation 🛠️
- Download Python: Visit here to install Python
- Download pip: Visit here to install pip
- Run Install Command: Run the command in terminal:
pip install xcavation
🏗️ How to Use xcavation 🏗️
genspec is the primary function for generating a forced-photometry spectrum, providing a full spectrum in a single line of code. User controlled options are provided to aid in problems such as: proper motion, background subtraction, masking, plotting, etc. Multi-threading for efficient processing of large datasets is provided to speed the process further. We recommend starting with genspec rather than calling internal functions directly. genspec returns a dictionary containing all relevant information from the SPHEREx calibrated images; further information on outputted data is provided below.
How to Use genspec
- After Xcavation is installed, verify the installation by running the following command:
from xcavation.genspec import *. If you encounter any issues during installation, please reach out to Hunter Brooks for assistance. - Assign the relavent variables as described below.
- Execute the command:
genspec(ra, dec). These are the minimum required parameters for Xcavation to run. You can include optional variables if needed.
Relavent Variables For genspec
-
Required Variables:
-
ra: Right Accension in Degrees: float:
- example:
131.123
- example:
-
dec: Declination in Degrees: float:
- example:
-12.31254
- example:
-
-
User Configuration:
Relavent Variables For genspec
-
Required Variables:
-
ra: Right Accension in Degrees: float:
- example:
131.123
- example:
-
dec: Declination in Degrees: float:
- example:
-12.31254
- example:
-
-
User Configuration:
- r_fwhm: The Number Multiplied by the Image FWHM to Get The Aperture Radius: float
- example:
2.5, default=2
- example:
- r_annulus_in: The Number Multiplied by the Image FWHM to Get the Inner Annulus Radius: float
- example:
5, default=3.5
- example:
- r_annulus_out: The Number Multiplied by the Image FWHM to Get the Outer Annulus Radius: float
- example:
10, default=10
- example:
- pmra: Proper Motion in Right Accension (in arcsec/year): float
- example:
-0.981, default=0
- example:
- pmdec: Proper Motion in Declination (in arcsec/year): float
- example:
0.123, default=0
- example:
- mjd_epoch: Modified Julian Date of Epoch Position: float
- example:
57500, default=61000
- example:
- mjd_query: Modified Julian Date of Query Position: float
- example:
61500, default=Time(datetime.now()).mjd
- example:
- mjd: Modified Julian Date of inputed R.A. and Decl. from Above: float
- example:
57170, default=61000
- example:
- save_data: Save Q.A. Finder Chart, Spectrum, and ASCII Table if True: boolean
- example:
True, default=False
- example:
- output_path: Saved Path (not including extention) for Q.A. Finder Chart, Spectrum, and ASCII Table if
save_datais True: string- example:
/content/drive/MyDrive/Research/example_object, default=xcavation_save
- example:
- threads: Number of Threads for Multi-Threading: int
- example:
2, default=1
- example:
- enable_print: Enable
xcavation.genspecProgress Printing: boolean- example:
False, default=True
- example:
- ram_download: Enable
xcavation.apertureDownloading Image Data on RAM Instead of Local Harddrive (best for computers with small amounts of storage): boolean- example:
True, default=False
- example:
- retry_count: The Number of HTML 504 Retries Before xcavation.genspec Crashes: int
- example:
1, default=10
- example:
- clean_type: The Type of Flagged Pixel Cleaning Done to the Calibrated image: string
- options:
none,mask,median_mask,interp_mask,lacosmic - example:
mask, default=none
- options:
- bad_bits: Masks Out Flags Seen in SPHEREx Documentation and Performs Laplace Transforms Using the
astroscrappy.detect_cosmicsto Replace These Pixels: list- options: Go to Section 6 of HERE for each flag type.
- example:
[0, 1, 5, 6, 10, 11], default=[0, 1, 10, 11]
- background_type: How the Background Field is Calculated: string
- options:
mean,median,mode - example:
mode, default=mean
- options:
- cutout_size: The Size of the Cutout in Arcsec: int
- example:
500, default=150
- example:
- zodi_subtract: Whether or not the Zodiacal light is subtracted: bool
- example:
False, default=True
- example:
- sigclip_sigma: Background Annulus Astropy.SigmaClip Sigma Variable: float
- example:
3, default=5
- example:
- sigclip_maxiters: Background Annulus Astropy.SigmaClip Max Iterations Variable: float
- example:
10, default=5
- example:
- r_fwhm: The Number Multiplied by the Image FWHM to Get The Aperture Radius: float
Output Variables:
wavelength: Wavelength of a queried position: $\mu m$:floatdelta_lambda: The resolving power solution ($\Delta \lambda = \frac{\lambda}{R}$) from Table 2 of Akeson et al. (2025): $\mu m$:floatflux: Flux from the given aperture photometry: $\mu Jy$:floatflux_err: Flux error from the given aperture photometry: $\mu Jy$:floatflag_count: Dictionary of every bit measured in the apertureSNR: Signal-to-Noise Ratio ($\frac{F}{\sigma_{F}}$):floatflux_cutout: The cutout flux image in $\mu Jy$:numpy arrayflag_cutout: The cutout flag image in bits:numpy arrayaperture: The aperture array in cutout size in booleans:numpy arrayannulus: The annulus array in cutout size in booleans:numpy arrayx_loc: The x_loc of the centeroid in the flux cutout:floaty_loc: The y_loc of the centeroid in the flux cutout:floatap_radius: The radius of the aperture: 2.5 $\times$ FWHM: $arcsec$:floatinner_annulus: The inner radius of the annulus: $arcsec$:floatouter_annulus: The outer radius of the annulus: $arcsec$:floaturl: The IPAC IRSA SPHEREx API url:stringmjd: The Modified Julian Date of the given SPHEREx image:float
Example
from xcavation.genspec import *
# Required Variables
ra = 12.7955492
dec = -15.7382839
# User Configuration
user_config = genspec_profile(pmra = 0, pmdec = 0,
mjd_epoch = 61000, mjd_query = 61500,
r_fwhm = 2, r_annulus_in = 5, r_annulus_out = 10,
save_data = True, output_path = 'test',
threads = 10,
enable_print = True, ram_download = False,
retry_count = 10,
clean_type = 'mask', bad_bits = [0, 1, 10, 11],
background_type = 'mean',
cutout_size = 150,
zodi_subtract = True,
sigclip_sigma = 5, sigclip_maxiters = 5)
# Call function with test input parameters
df = genspec(ra, dec, config = user_config)
📞 Support Team 📞
- Mr. Hunter Brooks
- hbrooks8 (at) rockets.utoledo.edu
- Dr. Michael Cushing
📖 Acknowledgments 📖
-
If you intend to publish any calculations done by xcavation, please reference Brooks et al. (in prep.).
-
Please reference the relevant SPHEREx citations.
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 xcavation-1.0.2.tar.gz.
File metadata
- Download URL: xcavation-1.0.2.tar.gz
- Upload date:
- Size: 23.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6888ef2fa02e16c325f5d7546ca6e62f3ed3bc49418b2b2cf9340517750a7ca5
|
|
| MD5 |
81b86f4c72c663e4b3739c6f483a6887
|
|
| BLAKE2b-256 |
2927d943c48eb8ee4b877947f99c7a2fcbd05e139be6bfc4e942baa06c7094db
|
File details
Details for the file xcavation-1.0.2-py3-none-any.whl.
File metadata
- Download URL: xcavation-1.0.2-py3-none-any.whl
- Upload date:
- Size: 22.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
def929f925b033c7dad343340f8166714f96a830baaf078c32d390609cb1298d
|
|
| MD5 |
411227e9137634a32148930d4ba40d8a
|
|
| BLAKE2b-256 |
3a26dc484395e7e226d28973f9e8fa3e6cf538993bc510ebf3d9e0b5b4e15f74
|