Fixing `pycbc_pygrb_grb_info_table` typos
Standard information about the request
This is a bug fix.
This change affects PyGRB.
This change changes GRB info table script
Motivation
This change will avoid this error :
/home/thomas.jacquot/.conda/envs/test_workflow_sky_grid/lib/python3.12/site-packages/pykerr/qnm.py:2: UserWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html. The pkg_resources package is slated for removal as early as
import pkg_resources
/home/thomas.jacquot/.conda/envs/test_workflow_sky_grid/bin/pycbc_pygrb_grb_info_table:104: DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing th
data[0].append(f'{math.degrees(ra):.3f}')
/home/thomas.jacquot/.conda/envs/test_workflow_sky_grid/bin/pycbc_pygrb_grb_info_table:107: DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing th
data[0].append(f'{math.degrees(dec):.3f}')
Traceback (most recent call last):
File "/home/thomas.jacquot/.conda/envs/test_workflow_sky_grid/bin/pycbc_pygrb_grb_info_table", line 119, in <module>
factor = get_antenna_dist_factor(
^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/thomas.jacquot/.conda/envs/test_workflow_sky_grid/lib/python3.12/site-packages/pycbc/results/pygrb_postprocessing_utils.py", line 476, in get_antenna_dist_factor
fp, fc = antenna.antenna_pattern(ra, dec, 0, geocent_time)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/thomas.jacquot/.conda/envs/test_workflow_sky_grid/lib/python3.12/site-packages/pycbc/detector/ground.py", line 331, in antenna_pattern
gha = self.gmst_estimate(t_gps) - right_ascension
~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
TypeError: unsupported operand type(s) for -: 'float' and 'NoneType'
and this one too
/home/thomas.jacquot/.conda/envs/test_workflow_sky_grid/lib/python3.12/site-packages/pykerr/qnm.py:2: UserWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html. The pkg_resources package is slated for removal as early as
import pkg_resources
Traceback (most recent call last):
File "/home/thomas.jacquot/.conda/envs/test_workflow_sky_grid/bin/pycbc_pygrb_grb_info_table", line 93, in <module>
if opts.input_dist is not None:
^^^^^^^^^^^^^^^
AttributeError: 'Namespace' object has no attribute 'input_dist'
Contents
I corrected the name of the input distribution argument in order to be consistent with the other scripts, and changed the shape of ra and dec in the case of a given input distribution.
Testing performed
I ran a PyGRB workflow that showed the fix was working.
- [x] The author of this pull request confirms they will adhere to the code of conduct
@Thomas-JACQUOT looks like you have a conflict with the master branch for some reason. Please rebase.
Rebase done @titodalcanton
While you are at it, I suggest one more edit: replace
ra = input_dist.get_max_prob_point()[0]
dec = input_dist.get_max_prob_point()[1]
with
ra, dec = input_dist.get_max_prob_point()
Calling get_max_prob_point() twice is wasteful, and with this change you only call it once.