Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DM-15857 Use correct aliases for old schemas #397

Merged
merged 3 commits into from Oct 4, 2018
Merged

Conversation

parejkoj
Copy link
Contributor

No description provided.

@@ -99,6 +102,7 @@ FitsSchemaInputMapper::FitsSchemaInputMapper(daf::base::PropertyList &metadata,
_impl->version = lsst::afw::table::Schema::VERSION;
}
_impl->version = metadata.get("AFW_TABLE_VERSION", _impl->version);
_impl->type = metadata.get("AFW_TYPE", _impl->type);
Copy link
Contributor Author

@parejkoj parejkoj Oct 1, 2018

Choose a reason for hiding this comment

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

Although it's no longer used directly, we might as well keep it around, I think?

// transform units to lowercase.
std::string units(item.tunit);
std::transform(units.begin(), units.end(), units.begin(), [](char c) { return std::tolower(c); } );
return includes(units, "count") || includes(units, "dn") || includes (units, "adu");
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh joy: we use all of these units? Have we standardized this yet, or do we need an RFC for it?

Copy link
Member

Choose a reason for hiding this comment

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

We certainly don't anymore. I'm pretty sure that at one point we used dn, but that may predate afw::table, and I'm not certain we ever used adu. I was just trying to be thorough.

// Replace the last n characters of a string with a new suffix string, returning the result as a new string
std::string replaceSuffix(std::string const &s, std::size_t n, std::string const &suffix) {
return s.substr(0, s.size() - n) + suffix;
bool hasInstFluxUnits(FitsSchemaItem const & item) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe name this isFluxField, since it's doing more than just checking the units?

Copy link
Member

Choose a reason for hiding this comment

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

How about isInstFluxField?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That works.

Copy link
Contributor Author

@parejkoj parejkoj left a comment

Choose a reason for hiding this comment

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

Clever solution to fall-through the v2 and v1 aliasing, so that the Sigma->Err happens first, then flux->fluxErr after.

Did you revert the ps1-refcat-v1.fits file to AFW_TYPE=SOURCE? We should do that, so it's consistent with most of our existing refcats.

I recommend deleting the existing sourceTable-v2.fits file and using the sourceCatalog-hsc file for all the v2 tests, since it's much less "fake". We should get a similar file for the v1 tests, since some of these problems could have been avoided if we had a "real" v1 file in here for testing. On the other hand, we probably won't care a year from now, so...

Given that your fix completely ignores the AFW_TYPE field for old data, I'm not sure it's worth keeping my script for updating refcats around.

@TallJimbo
Copy link
Member

Did you revert the ps1-refcat-v1.fits file to AFW_TYPE=SOURCE?

I did not (yet). Will do.

I recommend deleting the existing sourceTable-v2.fits file and using the sourceCatalog-hsc file for all the v2 tests, since it's much less "fake".

Sorry, I forgot to mention that I tried this, and ran into trouble in that sourceCatalog-hsc uses HsmSourceMoments for the shape slot, and that algorithm happens not to provide uncertainties. So I kept the old test data around instead of decreasing the test coverage.

We should get a similar file for the v1 tests, since some of these problems could have been avoided if we had a "real" v1 file in here for testing. On the other hand, we probably won't care a year from now, so.

Yeah, for that reason I don't think this is worth the effort.

@TallJimbo
Copy link
Member

@parejkoj do you want to put your script for converting refcats on a new branch so I can remove it from this one?

@parejkoj
Copy link
Contributor Author

parejkoj commented Oct 2, 2018

You can just delete it, I don't think it's worth saving.

parejkoj and others added 3 commits October 2, 2018 16:55
@TallJimbo TallJimbo force-pushed the tickets/DM-15857 branch 2 times, most recently from c8e93ae to fbb7a03 Compare October 3, 2018 00:07
@TallJimbo
Copy link
Member

The saga continues: the last fix broke a lot of packages downstream in Jenkins (at least daf_butler and meas_astrom), because it turns out that git-committed artificial test SourceCatalogs that use fields without units in what are now InstFlux slots are pretty common.

Rather than manually fix all that test data, I've added a bit more backwards compatbility to afw, in the slot mechanisms: if an InstFlux slot alias points at a field that does not exist, before throwing, we first check to see if a similar field ending in _flux does exist, and use it if it does.

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.

None yet

2 participants