LSSTDESC / rail_base

Base classes for RAIL
MIT License
0 stars 1 forks source link

Inconsistent import paths for sibling classes across rail* repos #23

Open aimalz opened 1 year ago

aimalz commented 1 year ago

Related to #19, there are inconsistencies among import locations for analogous functionality between the rail repositories. For example, rail_pzflow defines the FlowHandle in src/rail/tools/flow_handle.py but the other DataHandle subclasses in rail_base are in src/rail/core/data.py. This issue is for establishing consistent locations for analogous subclasses of the same parent class that will be present in the standalone repos, either the way we already do for src/rail/creation/engines and src/rail/estimation/algos (and the same for evaluation once #14 is completed) or another way that's compatible with the namespace setup.

eacharles commented 1 year ago

Do you have any other examples of this?

-e

On Jul 7, 2023, at 3:22 PM, Alex Malz @.***> wrote:

Related to #19 https://github.com/LSSTDESC/rail_base/issues/19, there are inconsistencies among import locations for analogous functionality between the rail repositories. For example, rail_pzflow defines the FlowHandle in src/rail/tools/flow_handle.py but the other DataHandle subclasses in rail_base are in src/rail/core/data.py. This issue is for establishing consistent locations for analogous subclasses of the same parent class that will be present in the standalone repos, either the way we already do for src/rail/creation/engines and src/rail/estimation/algos (and the same for evaluation once #14 https://github.com/LSSTDESC/rail_base/issues/14 is completed) or another way that's compatible with the namespace setup.

— Reply to this email directly, view it on GitHub https://github.com/LSSTDESC/rail_base/issues/23, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADRIGIURHTDH6A4PVYTDEG3XPCD3BANCNFSM6AAAAAA2CLDLJU. You are receiving this because you are subscribed to this thread.

aimalz commented 1 year ago
eacharles commented 1 year ago

On Jul 14, 2023, at 11:44 AM, Alex Malz @.***> wrote:

rail_astro_tools/src/rail/tools/utilPhotometry.py (whose contents I'd expect to find in src/rail/core/photometry_utils.py) Ok

rail_bpz/src/rail/bpz/utils.py (with actual content that may or may not belong in rail_bpz/src/rail/estimation/algos/_bpz_utils.py, although the self-import I don't understand is a hint that it's related to namespace magic and might not be subject to this issue at all)

It’s a trick to for the search path, it should probably stay where it is.

rail_fsps/src/rail/added_examples/sed_gen_fsps-demo.ipynb (which I think can straightforwardly be moved to rail/examples/creation_examples/sed_gen_fsps-demo.ipynb as per LSSTDESC/rail#48 https://github.com/LSSTDESC/rail/issues/48) Ok rail_fsps/src/rail/creation/sed_generation/generator.py (which is an analogue to Creator so would should be at the same level as rail_base/src/rail/creation/engine.py and suggests that the contents of rail_base/src/rail/creation/engine.py should be split into separate modules; also, it would be more consistent if the current generator.py were called sed_generator.py) I think the creation stuff is getting a bit confused at this point.
rail_fsps/src/rail/creation/sed_generator.py (which belongs in src/rail/engines; also, it would be more consistent if the current sed_generator.py were called fsps_gen.py or something like that) Ok, modulo sorting out the creation stuff

rail_pzflow/src/rail/tools/flow_handle.py (I'm not totally clear on why rail_base's ModelDict/ModelHandle aren't sufficient for this, but if we anticipate standalones to have to define their own DataHandles, we should group them in rail_base/src/rail/core/handles, starting with the current DataHandle subclasses in rail_base/src/rail/core/data.py.) This isn’t going to work. The handle needs to be able to read the data, hence the FlowHandle has to live here, or else the core stuff will depend on PZFlow.

— Reply to this email directly, view it on GitHub https://github.com/LSSTDESC/rail_base/issues/23#issuecomment-1636259098, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADRIGIVJ7BHT6OJMWC74D7TXQGHPDANCNFSM6AAAAAA2CLDLJU. You are receiving this because you commented.

eacharles commented 10 months ago

Ok, it looks like the this has all been address in other PRs.

aimalz commented 10 months ago

To recap, it looks like the status is as follows (and please correct me if I'm wrong here):

The remaining items are related to extensibility of the code to more underlying algos so their necessity largely depends on how likely we think it is that these will come up again as the railiverse expands.

eacharles commented 10 months ago

I'm sorry, but it looks to me like both of these changes would be highly disruptive and I'm not seeing that we would gain much. Perhaps someone else can weigh in.

eacharles commented 10 months ago

To wit, 1) I don't see a problem with having a number of rail_xxx/src/rail/xxx/utils.py files that set specific things for specific packages. 2) moving where the data handles live would break literally everything. It just doesn't seem worth it to me.

sschmidt23 commented 10 months ago

My two cents: -I haven't looked at the fps structure very much, so I can't say much on that one.

-Do we really see lots of custom data handles being a big issue? I did not expect a huge number of those, so the flow_handle thing seems a bit like overkill to me, particularly from a cost/benefit analysis standpoint.

-For the bpz_utils, I think this is fairly unique to BPZ, it was done this way because the existing code handled file I/O with paths relative to an environment variable base path, and doing it this way was minimally disruptive to that existing code. So, I think it will not be a common occurrence in the future, and we can just let this one instance sit as-is and not worry about it too much.

ztq1996 commented 4 months ago

I am moving this out of the v1 tracker since we have decided not to make this change before v1