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: $\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 https://iopscience.iop.org/article/10.3847/2515-5172/ae6257.
-
Please reference the relevant SPHEREx citations.
Metadata
Release files for xcavation 1.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| xcavation-1.1.0.tar.gz | 23.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| xcavation-1.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 45.3 kB
Release files / xcavation-1.1.0.tar.gz
| Download URL | xcavation-1.1.0.tar.gz |
|---|---|
| Size | 23.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0ce868cdf01f93ee3349835e1465c8ec50d04caccc74e3ff3bbbd5cf734951a0
|
|
BLAKE2b-256 checksum How to use checksums |
0d9f4068d35605e27c607e47bfb4cab9de1b379e556a11bea90aad9b75f51489
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.2
|
Release files / xcavation-1.1.0-py3-none-any.whl
| Download URL | xcavation-1.1.0-py3-none-any.whl |
|---|---|
| Size | 21.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
aede310bc516d041b7dcffc9292d74586a726557699d354abedeaa4e2331f730
|
|
BLAKE2b-256 checksum How to use checksums |
7dd1cdbb482dd870e77bd6a5cbbaa6b2a48d22766ee342631c92b4ee670e3c9f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.2
|