Open Gauri0002 opened 2 years ago
Hi @Gauri0002, thanks for raising this issue! Indeed the assumption was distinct sources have different positions and this is not good for bulge+disk fits. I think optionally passing the seed index to find_overlaps
is a good solution. You might be able to do something a little simpler (and that works for N>2 components), as
if seed_index:
overlaps = (metric < 1) & (metric >= 0) & (kinds != seed_index)
else:
overlaps = (metric < 1) & (metric > 0)
then seed_index
should default to None
or -1
, and the calls to find_overlaps
in grow_scene
and grow_source
shoufl pass in seed_index
. If you agree I can add this to the code, or I'm happy to take a PR.
I'd also note that for your use case you can probably get away with
region, active, fixed = sceneDB.checkout_region(seed_index=-1)
active = sceneDB.sourcecat.copy()
that is, just overwrite the checked out active source catalog (which erroneously has only 1 source) with the entire source catalog (which probably only has two sources, the bulge and the disk)
@Gauri0002 I have pushed what I think is a fix for this in d01fccd but it would be nice to have a unit test.
@bd-j Thank you for the prompt response! And I apologise for a late one.
I ran the changed superscene.py code for the bulge+disk decomposition fits and it is working just fine!
I have a question regarding line 706 in the superscene.py code,
overlaps = (metric < 1) & (metric >= 0) & (kinds != seed_index)
seed_index by default is set to -1 and since it can only be an integer, the possibility of (kinds != seed_index)
being False
can occur only for cases in which there is one source right?
So unless any user decides to pass a seed_index=0 for the find_overlaps function (seems highly unlikely), overlaps
should return a True
value and the active source should be registered.
Great, glad it's working. I'm not sure I totally understand your question; In grow_source
we pass the seed index to find_overlaps()
so then kinds != seed_index
will be an array of booleans that has a value of False for the initial source - the point is to find every overlapping source that is not the input source. However, find_overlaps
is also used elsewhere in the code to find all overlapping sources even when the input coordinates do not necessarily correspond to a particular source, in which case we want kinds != seed_index
to always be True. hope that helps
And just to be clear, overlaps
is an array and all elements where it is True will be chosen by grow_scene()
and grow_source()
as sources to include in addition to the initial seed source.
oh wait, now I see what you mean, that's a bug.
ok, just pushed a fix.
I am trying to perform Bulge-Disk Decomposition on generated galaxy images and was trying to use the color_fit.py and color_plot_together.py (from demo_color) on them.
I assumed that the galaxy only has 2 components, the bulge and the disk, and both the components have the same position while generating the image. I ran into a problem with forcepho when instead of detecting 2 active sources, only one active source was being detected (either the disk or the bulge).
I traced this issue back to the grow_scene and find_overlaps functions in the superscene.py file. I made a temporary fix in the the find_overlaps function which I have mentioned below,
The "if- code" I wrote works only for a maximum of 2 sources. I believe it will fail if there are 2 sources at the centre and any other source at another position.
Is there another way of accepting active sources at the centre?