Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not able to run run_test_GJ436b.py code #3

Open
Sudip-Pramanik opened this issue Feb 22, 2023 · 6 comments
Open

Not able to run run_test_GJ436b.py code #3

Sudip-Pramanik opened this issue Feb 22, 2023 · 6 comments

Comments

@Sudip-Pramanik
Copy link

I modified the run_test.py code (which was given in the example) for the exoplanet " GJ436b " . The required data files were downloaded by the code from the MAST archive.
The code is given below :

import os

from urllib.request import urlretrieve

os.chdir(os.path.abspath(os.path.dirname(file)))

dataset_files = [
'ibwk51wqq_raw.fits',
'ibwk51wrq_raw.fits',
'ibwk51wsq_raw.fits',
'ibwk51wtq_raw.fits',
'ibwk51wuq_raw.fits',
'ibwk51wvq_raw.fits',
'ibwk51wwq_raw.fits',
'ibwk51wxq_raw.fits',
'ibwk51wyq_raw.fits',
'ibwk51wzq_raw.fits',
'ibwk51x0q_raw.fits',
'ibwk51x1q_raw.fits',
'ibwk51x2q_raw.fits',
'ibwk51x3q_raw.fits',
'ibwk51x4q_raw.fits',
'ibwk51x5q_raw.fits',
'ibwk51x6q_raw.fits',
'ibwk51x7q_raw.fits',
'ibwk51x8q_raw.fits',
'ibwk51x9q_raw.fits',
'ibwk51xaq_raw.fits',
'ibwk51xbq_raw.fits',
'ibwk51xcq_raw.fits',
'ibwk51xdq_raw.fits',
'ibwk51xeq_raw.fits',
'ibwk51xfq_raw.fits',
'ibwk51xgq_raw.fits',
'ibwk51xhq_raw.fits',
'ibwk51xiq_raw.fits',
'ibwk51xjq_raw.fits',
'ibwk51xkq_raw.fits',
'ibwk51xlq_raw.fits',
'ibwk51xmq_raw.fits',
'ibwk51xnq_raw.fits',
'ibwk51xoq_raw.fits',
'ibwk51xpq_raw.fits',
'ibwk51xqq_raw.fits',
'ibwk51xrq_raw.fits',
'ibwk51xsq_raw.fits',
'ibwk51xtq_raw.fits',
'ibwk51xuq_raw.fits',
'ibwk51xvq_raw.fits',
'ibwk51xwq_raw.fits',
'ibwk51xxq_raw.fits',
'ibwk51xyq_raw.fits',
'ibwk51xzq_raw.fits',
'ibwk51y0q_raw.fits',
'ibwk51y1q_raw.fits',
'ibwk51y2q_raw.fits',
'ibwk51y3q_raw.fits',
'ibwk51y4q_raw.fits',
'ibwk51y5q_raw.fits',
'ibwk51y6q_raw.fits',
'ibwk51y7q_raw.fits',
'ibwk51y8q_raw.fits',
'ibwk51y9q_raw.fits',
'ibwk51yaq_raw.fits',
'ibwk51ybq_raw.fits',
'ibwk51ycq_raw.fits',
'ibwk51ydq_raw.fits',
'ibwk51yeq_raw.fits',
'ibwk51yfq_raw.fits',
'ibwk51ygq_raw.fits',
'ibwk51yhq_raw.fits',
'ibwk51yiq_raw.fits',
'ibwk51yjq_raw.fits',
'ibwk51wpq_flt.fits',
'ibwk51ylq_raw.fits',
'ibwk51ymq_raw.fits',
'ibwk51ynq_raw.fits',
'ibwk51yoq_raw.fits',
'ibwk51ypq_raw.fits',
'ibwk51yqq_raw.fits',
'ibwk51yrq_raw.fits',
'ibwk51ysq_raw.fits',
]

destination = 'iraclis_test_dataset_GJ436b'

if not os.path.isdir(destination):
os.mkdir(destination)

if not os.path.isdir(os.path.join(destination, 'raw_data')):
for num, dataset_file in enumerate(dataset_files):
print('{0}/{1}: '.format(num + 1, len(dataset_files)), dataset_file)
if not os.path.isfile(os.path.join(destination, dataset_file)):
urlretrieve('https://mast.stsci.edu/portal/Download/file/HST/product/{0}'.format(
dataset_file), os.path.join(destination, dataset_file))

os.system('iraclis -p {0}'.format('iraclis_test_dataset_GJ436b_parameters.txt'))

After run this code in jupyter notebook the following thing was happened ...........................

Iraclis 1.5.1
Loading parameters file: iraclis_test_dataset_GJ436b_parameters.txt ...

Processing directory: iraclis_test_dataset_GJ436b
@: /home/sudip/Desktop/Mousam/jupyter_code

Loading raw images ...
Timing.........: 74 / 74 time left: 0:00:00 total time: 0:00:00
Bias...........: 74 / 74 time left: 0:00:00 total time: 0:00:00
Linearity......: 74 / 74 time left: 0:00:00 total time: 0:00:00
Dark...........: 74 / 74 time left: 0:00:00 total time: 0:00:00Dark...........: 11 / 74 time left: 0:00:00 total time: 0:00:00Dark...........: 22 / 74 time left: 0:00:00 total time: 0:00:00
Gain...........: 74 / 74 time left: 0:00:00 total time: 0:00:00Gain...........: 67 / 74 time left: 0:00:00 total time: 0:00:00
Sky............: 74 / 74 time left: 0:00:00 total time: 0:00:01


TypeError Traceback (most recent call last)
Input In [8], in <cell line: 1>()
----> 1 iraclis.process_visit(parameters_file='iraclis_test_dataset_GJ436b_parameters.txt')

File ~/anaconda3/lib/python3.9/site-packages/iraclis/pipeline.py:114, in process_visit(parameters_file, data_directory, procedure, par_string)
112 data_set = gain(data_set)
113 data_set = sky(data_set)
--> 114 data_set = calibration(data_set)
115 data_set = flat(data_set)
116 data_set = bpcr(data_set)

File ~/anaconda3/lib/python3.9/site-packages/iraclis/images2_calibration.py:442, in calibration(input_data, comparison_index_forward, comparison_index_reverse, target_x_offset, target_y_offset, use_standard_flat, splitting)
439 first_spectrum_scan.to_fits(comparison, value=diagnostics[8])
440 first_spectrum_direction.to_fits(comparison, value=diagnostics[9])
--> 442 x_star.to_fits(comparison, value=get_absolute_x_star(comparison, direct_image, target_x_offset.value))
443 y_star.to_fits(comparison, value=get_absolute_y_star(comparison, target_y_offset.value,
444 use_standard_flat.value))
446 comparisons[name]['x_star'] = x_star.value

File ~/anaconda3/lib/python3.9/site-packages/iraclis/images2_calibration.py:198, in get_absolute_x_star(fits, direct_image, target_x_offset)
186 reference_pixel = {'IR-FIX': 512.0, 'IR': 497.0, 'G102-REF': 497.0, 'G141-REF': 497.0, 'IRSUB64': 522.0,
187 'IRSUB128': 522.0, 'IRSUB256': 522.0, 'IRSUB512': 522.0, 'IRSUB64-FIX': 512.0,
188 'IRSUB128-FIX': 512.0, 'IRSUB256-FIX': 512.0, 'IRSUB512-FIX': 512.0, 'IR-UVIS-CENTER': 498.4,
189 'IR-UVIS': 490.9, 'IR-UVIS-FIX': 490.9, 'GRISM1024': 497.0, 'GRISM512': 505.0,
190 'GRISM256': 410.0, 'GRISM128': 410.0, 'GRISM64': 410.0}
192 scales = {'IR-FIX': 0.135437, 'IR': 0.135603, 'G102-REF': 0.135603, 'G141-REF': 0.135603, 'IRSUB64': 0.135470,
193 'IRSUB128': 0.135470, 'IRSUB256': 0.135470, 'IRSUB512': 0.135470, 'IRSUB64-FIX': 0.135437,
194 'IRSUB128-FIX': 0.135437, 'IRSUB256-FIX': 0.135437, 'IRSUB512-FIX': 0.135437,
195 'IR-UVIS-CENTER': 0.135357, 'IR-UVIS': 0.135666, 'IR-UVIS-FIX': 0.135666, 'GRISM1024': 0.135603,
196 'GRISM512': 0.135504, 'GRISM256': 0.135508, 'GRISM128': 0.135474, 'GRISM64': 0.135474}
--> 198 x0 = plc.find_single_star(direct_image[1].data,
199 predicted_x=reference_pixel_x.value + 0.5,
200 predicted_y=reference_pixel_y.value + 0.5,
201 star_std=5,
202 burn_limit=1000000)[0]
204 grism.from_fits(direct_image)
206 subarray_correction = 507 - len(direct_image[1].data[0]) / 2

TypeError: 'NoneType' object is not subscriptable

The code is perfectly run for data of HAT-P-26b exoplanet. I don't understand what is the problem.

@atsiaras
Copy link
Contributor

Hi, the direct image should be the _flt.fits product, not the _raw.fits

@Sudip-Pramanik
Copy link
Author

Yes , I know that. the direct image in _flt.fits format is downloaded.

@atsiaras
Copy link
Contributor

Ah sorry, It was towards the end.

But I cannot reproduce the problem. Are you using the latest version from Github? Because I remember there was an issue with bright stars in v1.5.1.

@atsiaras
Copy link
Contributor

Just replaced the old one on pip, so you can pip install again.

@Sudip-Pramanik
Copy link
Author

Yes , I am using the Iraclis v1.5.1. Ok let me check this code with new version of iraclis.

@Sudip-Pramanik
Copy link
Author

Thank you. The code is running now with the new version

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants