Open turchis opened 2 years ago
Oooooh! I think this may be a simple one to solve. The code does run with BANZAI data...... but it is expecting that data to be in .fits.fz format rather than just fits (this is the LCO default). The solution is just to incorporate this I think..... although the error you've got up the top says that it cannot find the fits files (which is more likely to be that they are not in that directory?) --- either way, perhaps could you send the data you are trying to use to psyfitz@gmail.com and I will take a look?
Hi Michael, thank you very much for your answer. It seems unlikely to me that the problem is that the files are in the fits format instead the fits.fz format. Indeed, when I try to run astrosource on some 2022 LCO fits data (extracted using the same command 'funpack' used to uncompress STELLA data) with the command: "astrosource --ra 136.7046 --dec -21.3724 --indir /export/work/marcotu/COBIPULSE-South/LCO/2022A/J0906/gfilter/ --format fits --full --lowcounts 1000 --hicounts 50000 --thresholdcounts 1000000 --closerejectd 5.0"
I get the following error message:
"Inspecting input files
Traceback (most recent call last):
File "/home/gudrun/marcotu/python-envs/astrosource/bin/astrosource", line 8, in
that doesn't make sense to me since in the script identify.py I find the following rows: "def rename_data_file(prihdr, bjd=False):
prihdrkeys = prihdr.keys()
if any("OBJECT" in s for s in prihdrkeys):
objectTemp=prihdr['OBJECT'].replace('-','d').replace('+','p').replace('.','d').replace(' ','').replace('_','').replace('=','e').replace('(','').replace(')','').replace('<','').replace('>','').replace('/','')
else:
objectTemp="UNKNOWN"
if 'FILTER' in prihdr:
filterOne=(prihdr['FILTER'])
else:
filters = []
filters.append(prihdr['FILTER1'])
filters.append(prihdr['FILTER2'])
filters.append(prihdr['FILTER3'])
filter =list(set(filters))
filter.remove('air')
filterOne = filter[0]
" and filter keyword for 2022 LCO data is FILTER2, that should be identified by the script.
So running astrosource on 2022 LCO data, it seems to find some fits files in the directory, in contrast to what happens with STELLA data.
Thanks again, I just sent to your email the two datasets on which I'm trying to run astrosource, respectively STELLA data and 2022 LCO data.
Hello,
I'm trying to run inside a directory with already reduced and SEP embedded data (acquired from STELLA telescope) the following command: 'astrosource --ra 330.210 --dec 7.060 --indir /export/work/marcotu/COBIPULSE-North/STELLA/DATA/reduced/J2212/gfilter/ --format fits --full --lowcounts 1000 --hicounts 50000 --thresholdcounts 1000000 --closerejectd 5.0' but I get the error message: 'CRITICAL | No files of type ".fits" found in /export/work/marcotu/COBIPULSE-North/STELLA/DATA/reduced/J2212/gfilter/'
Since this dataset was already reduced, before running astrosource I didn't run the entire BANZAI pipeline, but just the commands for performing the source extraction and append the catalogue of detected sources in all the images. These commands are found in the script photometry.py of the BANZAI package https://github.com/LCOGT/banzai, and I just readjusted these in the following script: 'import logging from urllib.parse import urljoin
import numpy as np from astropy.table import Table from astropy.io import fits from astropy.utils.data import get_pkg_data_filename import sep from requests import HTTPError
from banzai.utils import stats, array_utils from banzai.utils.photometry_utils import get_reference_sources, match_catalogs, to_magnitude, fit_photometry from banzai.data import DataTable
from skimage import measure
sep.set_sub_object_limit(int(1e6))
def radius_of_contour(contour, source): x = contour[:, 1] y = contour[:, 0] x_center = (source['xmax'] - source['xmin'] + 1) / 2.0 - 0.5 y_center = (source['ymax'] - source['ymin'] + 1) / 2.0 - 0.5
def photometry(image,image_file,threshold,min_area):
image_file = get_pkg_data_filename('lsc1m009-fl03-20151120-0184-e90.fits')
image = fits.open('lsc1m009-fl03-20151120-0184-e90.fits')
photometry(image,image_file=image_file,threshold=1.5,min_area=9)
import os path = '.' images = [f for f in os.listdir(path) if f.endswith('.fits')]
for i in range(0,(len(images))): image_file = get_pkg_data_filename(images[i])
image = fits.open(images[i]) photometry(image,image_file=image_file,threshold=1.5,min_area=9) print(i) image.close()'
Could you please help me to understand why astrosource doesn't recognize the fits files? Thanks a lot.