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-43905: Add (modelfit_)parameters to lsst_distrib #12

Merged
merged 5 commits into from
May 29, 2024
Merged

Conversation

taranu
Copy link
Collaborator

@taranu taranu commented Apr 18, 2024

No description provided.

Copy link
Member

@kfindeisen kfindeisen left a comment

Choose a reason for hiding this comment

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

No major objections to the rename, but given my comments about namespaces and header paths on lsst/modelfit_parameters#11, I expect much of this PR will need to be redone. I've commented on a few other things that are iffy, but more in scope of DM-43906.

include/param_defs.h Outdated Show resolved Hide resolved
include/parameters.h Outdated Show resolved Hide resolved
@@ -40,7 +40,7 @@ struct SizeYParameter : public SizeParameter {
};

template <typename T>
using Param = parameters::Parameter<double, T>;
using Param = modelfit_parameters::Parameter<double, T>;
Copy link
Member

Choose a reason for hiding this comment

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

While it's not actually forbidden, are you intending to expose gauss2d::fit::Param<T> as part of the library API? If not, I recommend dropping it and using explicit names for the base classes.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Is the concern that users might reference gauss2d::fit::Param instead of modelfit_parameters::Parameter<double, T>? But even for a CRTP base, this is a type alias and they'd be equivalent, no?

Copy link
Member

Choose a reason for hiding this comment

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

No, the concern is that some other code that uses Param and happens to include this file might suddenly (and surprisingly) get a collision. As you say, the namespace mitigates the risk, but it still seems iffy to expose names that aren't intended for use.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ok, my conclusion is that I'll renamed to Param to ParameterD in line with stack naming conventions (and current use in multiprofit). I suppose I could do this in modelfit_parameters but slightly prefer to do it here and not impose that nomenclature on other hypothetical modelfit_parameters users.

meson.build Outdated
@@ -26,13 +26,13 @@ if use_eups
include_directories: gauss2d_eupsdir + '/build-release/include',
)

parameters_eupsdir = run_command('eups', 'list', '-d', 'parameters', check: true).stdout().strip()
parameters_eupsdir = run_command('eups', 'list', '-d', 'modelfit_parameters', check: true).stdout().strip()
Copy link
Member

Choose a reason for hiding this comment

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

I don't think this will actually work in general -- eups list -d lists all installed versions of a given package, regardless of tag. I'd recommend relying on MODELFIT_PARAMETERS_DIR instead; I don't think there's any expectation that a package is buildable if it is not set up.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Part of the reason I did it this way is that Meson is very opinionated about not providing access to environment variables. However, it turns you can use run_command('sh', '-c', '...') and reference environment variables in the command, which I'm not happy about but seems to be the easiest solution at the moment.

The alternative is to write a (Python) eups module for Meson, which is possible but not nearly as trivial as I'd hope.

python/gauss2d/fit/parameters.cc Outdated Show resolved Hide resolved
#include "parameters/transform.h"

#include <modelfit_parameters/limits.h>
#include <modelfit_parameters/transform.h>
Copy link
Member

Choose a reason for hiding this comment

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

In addition to my earlier comment about <>, please include dependencies before local includes.

Copy link
Collaborator Author

@taranu taranu Apr 29, 2024

Choose a reason for hiding this comment

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

You mean:

#include "lsst/modelfit/parameters.h"

#include "gauss2d/fit/parameters.h"

... separating them because the latter file is part of this package, though I still need to include it by the full namespace?

@taranu taranu force-pushed the tickets/DM-43905 branch 3 times, most recently from 1bd43ba to ce5df2e Compare May 1, 2024 18:03
@taranu taranu force-pushed the tickets/DM-43905 branch 2 times, most recently from c9e6e62 to 4d68703 Compare May 10, 2024 22:15
#include "parameters/parameter.h"
#include "lsst/modelfit/parameters.h"

namespace parameters = lsst::modelfit::parameters;
Copy link
Member

Choose a reason for hiding this comment

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

This will cause any source file that (directly or indirectly) includes this header to define parameters. Potential namespace collision if it's also using some other parameters?

Comment on lines 83 to 85
* @note See https://ned.ipac.caltech.edu/level5/March05/Graham/Graham2.html
* for a useful summary of various properties of the Sersic profile.
* (Graham & Driver 2005) for a useful summary of various properties
* of the Sersic profile.
Copy link
Member

Choose a reason for hiding this comment

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

Prefer inline links:

Suggested change
* @note See https://ned.ipac.caltech.edu/level5/March05/Graham/Graham2.html
* for a useful summary of various properties of the Sersic profile.
* (Graham & Driver 2005) for a useful summary of various properties
* of the Sersic profile.
* @note See [Graham & Driver 2005](https://ned.ipac.caltech.edu/level5/March05/Graham/Graham2.html)
* for a useful summary of various properties
* of the Sersic profile.

include/model.h Outdated
Copy link
Member

Choose a reason for hiding this comment

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

In the future, please do clang-format runs in a separate commit.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think I've finally managed to get clang-format on save working everywhere I need it, so hopefully that will obviate the need for manual runs.

Copy link
Member

Choose a reason for hiding this comment

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

It's auto-formatting that tends to be the problem, because reformats of unrelated code get mixed in with the written-as-formatted changes.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Right, but there shouldn't be any unrelated changes once everything is formatted unless the format rules are changed or someone commits non-compliant changes, in which case sure, I'll do a separate format step first.

@taranu taranu force-pushed the tickets/DM-43905 branch from 1531fa4 to f477c3a Compare May 29, 2024 01:53
@taranu taranu merged commit a42ec00 into main May 29, 2024
1 check passed
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