Skip to content

Commit a9610a2

Browse files
committed
Hopefully found a workaround for region instances no longer being hashable, also add __pycache__ to the git ignore
1 parent 4e3533f commit a9610a2

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@
33
.coverage
44
.pytest_cache
55
xga_output
6-
.ipynb_checkpoints
6+
.ipynb_checkpoints
7+
*__pycache__

xga/sources/extended.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -302,10 +302,14 @@ def dist_from_source(reg):
302302
rad = Quantity(src_reg_obj.height.to('deg').value/2, 'deg')
303303
within_height = self.regions_within_radii(Quantity(0, 'deg'), rad, centre, new_anti_results[obs])
304304
within_height = [reg for reg in within_height if reg.visual['edgecolor'] == 'green']
305-
305+
306306
# This finds which regions are present in both lists and makes sure if they are in both
307-
# then they are NOT removed from the analysis
308-
intersect_regions = list(set(within_width) & set(within_height))
307+
# then they are NOT removed from the analysis - AS OF regions v0.9 THIS NO LONGER WORKS AS
308+
# REGIONS ARE NOT HASHABLE - THE LIST COMPREHENSION BELOW IS A QUICK FIX BUT LESS EFFICIENT
309+
# intersect_regions = list(set(within_width) & set(within_height))
310+
311+
# This should do what the above set intersection did, but slower
312+
intersect_regions = [r for r in within_height if r in within_width]
309313
for inter_reg in intersect_regions:
310314
inter_reg_ind = new_anti_results[obs].index(inter_reg)
311315
new_anti_results[obs].pop(inter_reg_ind)

0 commit comments

Comments
 (0)