Skip to content

some small fixes and edits to work with modap#236

Open
bizarreboa wants to merge 25 commits into
mainfrom
modap_edits
Open

some small fixes and edits to work with modap#236
bizarreboa wants to merge 25 commits into
mainfrom
modap_edits

Conversation

@bizarreboa
Copy link
Copy Markdown
Collaborator

mostly added a way to change the cigale SED plot to be a png so that text can be added to it, and then several various fixes for small errors

@bizarreboa bizarreboa marked this pull request as ready for review May 6, 2026 00:04
@bizarreboa bizarreboa requested review from SunilSimha and profxj May 6, 2026 00:05
Copy link
Copy Markdown
Collaborator

@SunilSimha SunilSimha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requesting changes.

For whatever reason, GitHub is not allowing me to create more comments. So here are the remaining ones:

Line 314 of survey_utils

I'd make the table masked here and add good masks to individual columns. Then, it becomes easy to get the combined mask by getting the "OR" of the individual column masks. Also preserves more info if the user wishes for more granularity later.

e.g.

cat = Table(cat, masked=True)
has_good = np.zeros_like(tab, dtype=bool)

for col in mag_cols:
    tab[col].mask = np.isfinite(tab[col]) & tab[col]< 90 & (tab > 0)
    has_good |= tab[col].mask 

Line 273 of survey_utils

This doesn't make sense here. The combined cat for a large cone search should return several rows. Therefore, picking the best row should be a separate function implemented elsewhere. If MODaP needs this, then MODaP must implement it on whatever this function returns.

Comment thread frb/galaxies/cigale.py
os.system('mv {:s}/{:s}_SFH.fits {:s}'.format(host.name, host.name, sfh_file))
return

def add_text_SED(host, cigale_results, out_name=None):
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems a little hacky so are you certain there's no internal CIGALE plot argument that does this already? If not, feel free to just resolve this comment.

Comment thread frb/galaxies/photom.py
delta = np.trapezoid(throughput * source_flux *
10 ** (-0.4 * Alambda), x=wave) / np.trapezoid(
throughput * source_flux, x=wave)
if getattr(np, "trapz", None) is not None:
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe worth adding a deprecation warning here. I believe this is for Numpy < 2.0, and so I don't see a reason to support this long term.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alternatively, switching over to the scipy implementation if the naming there is a little more stable.

Comment thread frb/galaxies/photom.py
cut_photom[key] -= cut_photom['extinction_{}'.format(filt[-1])]
continue
print('Correcting filter {} for Galactic extinction'.format(filt))
# SDSS ### removing this because SDSS correction is sometimes different for very dusty sightlines, but TBD
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would trust SDSS extinction estimates more because I imagine they got their E(B-V) values at the location where they took their spectra as opposed to our method of using the nearest measurement within a few degrees. Worth looking into why they are different.

Comment thread frb/scripts/r_vs_dm.py
# Command line execution
if __name__ == '__main__':
r_vs_dm() No newline at end of file
r_vs_dm()
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you check that there's a corresponding entry in the new pyproject.toml to make sure this script is installable when pip installing the repo?

try:
in_match = np.isin(IDs, match_IDs)
except AttributeError:
# Older NumPy versions
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was under the impression that np.isin has always been available, even in v 1.26. If so, maybe we can get rid of this exception handling?

Comment thread frb/surveys/delve.py
photom = {}
photom['DELVE'] = {}
photom['DELVE']['DELVE_ID'] = 'quick_object_id'
# photom['DELVE']['DELVE_ID'] = 'coadd_object_id'
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like these comments are not changing the original functionality or documenting anything. I suggest getting rid of the comment blocks in this file.

Comment thread frb/surveys/galex.py
else:
query_fields = _DEFAULT_query_fields+query_fields

import astropy.units as u
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this import being used anywhere in the file? If not, please remove.

mag_cols = valid_filters

# require separation column already computed in arcmin/arcsec/whatever
sep = cat['separation']
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not guaranteed to be present for some surveys, I think.

I really need to make the survey catalogs and method inputs uniform. 😬

if len(cat) == 0:
return cat

if mag_cols is None:
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pretty sure there's a catalog_utils function called get_mag_cols or some such that just gives you the columns that are present in a table. This is being used for extenction correction I believe. Prevents you from running the if statement in the loop over columns below.

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

Successfully merging this pull request may close these issues.

2 participants