Skip to content

Commit f9a3574

Browse files
needed to parse the correct amount of 0s to the inner radii argument
1 parent c82d188 commit f9a3574

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

xga/generate/sas/spec.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,19 @@ def parse_custom_bkg_sas(region: Union[CircleSkyRegion, EllipseSkyRegion], withi
3232
outer_radius = region.radius if not within_radii else region.radius*1.5
3333
central_coord = Quantity([region.center.ra.deg, region.center.dec.deg], 'deg')
3434
rot_angle = Quantity(0, 'deg') # No rotation for circular regions
35+
inner_radius = Quantity(0, 'deg')
3536

3637
elif isinstance(region, EllipseSkyRegion):
3738
outer_radius = Quantity([region.height / 2, region.width / 2]) if not within_radii \
3839
else Quantity((region.height/2)*1.5)
3940
central_coord = Quantity([region.center.ra.deg, region.center.dec.deg], 'deg')
4041
rot_angle = Quantity(region.angle.to('deg').value, 'deg')
42+
inner_radius = Quantity([0, 0], 'deg')
4143

4244
else:
4345
raise TypeError(f"Unsupported region type: {type(region)}")
4446

45-
return outer_radius, central_coord, rot_angle
47+
return inner_radius, outer_radius, central_coord, rot_angle
4648

4749

4850

@@ -79,8 +81,6 @@ def _spec_cmds(sources: Union[BaseSource, BaseSample], outer_radius: Union[str,
7981
:param bool force_gen: This boolean flag will force the regeneration of spectra, even if they already exist.
8082
:param Union[CircleSkyRegion, EllipseSkyRegion] custom_bkg: A region to extract the background spectrum from.
8183
"""
82-
print('custom_bkg')
83-
print(custom_bkg)
8484
# We check to see whether there is an XMM entry in the 'telescopes' property. If sources is a Source object, then
8585
# that property contains the telescopes associated with that source, and if it is a Sample object then
8686
# 'telescopes' contains the list of unique telescopes that are associated with at least one member source.
@@ -213,7 +213,7 @@ def _spec_cmds(sources: Union[BaseSource, BaseSample], outer_radius: Union[str,
213213
outer_radii[s_ind] * source.background_radius_factors[1],
214214
'xmm', source.default_coord)
215215
else:
216-
bkg_outr, bkg_coord, _ = parse_custom_bkg_sas(custom_bkg, True)
216+
_, bkg_outr, bkg_coord, _ = parse_custom_bkg_sas(custom_bkg, True)
217217
back_inter_reg = source.regions_within_radii(Quantity(0, 'deg'), bkg_outr, 'xmm',
218218
bkg_coord)
219219
src_inn_rad_str = inner_radii[s_ind].value
@@ -268,12 +268,10 @@ def _spec_cmds(sources: Union[BaseSource, BaseSample], outer_radius: Union[str,
268268
inst, interloper_regions=back_inter_reg,
269269
central_coord=source.default_coord)
270270
else:
271-
print('in here')
272-
bkg_outr, bkg_coord, _ = parse_custom_bkg_sas(custom_bkg, True)
271+
_, bkg_outr, bkg_coord, _ = parse_custom_bkg_sas(custom_bkg, True)
273272
back_inter_reg = source.regions_within_radii(Quantity(0, 'deg'), bkg_outr, 'xmm',
274273
bkg_coord)
275-
bkg_outr, bkg_coord, bkg_rot_angle = parse_custom_bkg_sas(custom_bkg)
276-
bkg_innr = Quantity(0, 'deg')
274+
bkg_innr, bkg_outr, bkg_coord, bkg_rot_angle = parse_custom_bkg_sas(custom_bkg)
277275
b_reg = source.get_annular_sas_region(bkg_innr, bkg_outr, obs_id=obs_id, inst=inst,
278276
interloper_regions=back_inter_reg,
279277
central_coord=bkg_coord,

0 commit comments

Comments
 (0)