-
Notifications
You must be signed in to change notification settings - Fork 4
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
When loading tile file, check existance before looking in data folder #97
Comments
The intended usage if you want to force it to get a local copy is: tiles_data = desimodel.io.load_tiles(tilesfile='./tiles_skysub.fits', cache=False) In particular we don't want cases like tiles_data = desimodel.io.load_tiles(tilesfile='desi-tiles.fits', cache=False) to be ambiguous about whether a local copy is overriding the standard copy or not. i.e.
Would that meet your needs? |
I guess that behavior was quite surprising to me. The docstring says:
I passed in the name of a file to load and it raised an exception because it was looking in the package data directory. If this behavior is intended, then we should at least change the docstring, and I will do additional checks in fiberassign to warn the user what is happening if they pass the name of a tile file that exists in the current working directory. |
I think the docstring reflects the intended usage (which I agree is not what was actually implemented). A key detail is that without a path, I'm ok with falling back to checking for a local copy if a $DESIMODEL copy doesn't exist, but I don't think we want the reverse. |
I think I disagree with this statement. Presumably, all tile files kept in $DESIMODEL will have fixed names and a well-established provenance (and any missing files are presumably due to a borked installation of desi software, but if that happens then that's probably the least of the user's worries), and all file names can be generated via a small number of keywords (e.g., bright=True). Alternatively, anyone explicitly using the On the other hand, if $DESIMODEL will have N different official tile files (where N>>1) then perhaps my proposal is not a good one. My $0.02. |
At minimum we should expect $DESIMODEL to have tiles files for commissioning, sv, and the main survey. Beyond that, I'm not sure, but I would like to be able to retain the ability to specify a specific filename in $DESIMODEL without making special case options for each one, and without risking having a local file by the same name silently (and perhaps accidentally) override it. @moustakas did you have to do "trickery" beyond just "./my-tiles-files.fits" instead of "my-tiles-file.fits"? Having to add "./" doesn't seem so bad to me. Updating the code to match what the docstring says it does also seems good. But if some chain of code is stripping off the "./" and then borking io.load_tiles and causing you to resort to things like temporarily resetting $DESIMODEL, then that would indeed be bad. |
There needs to be some disambiguation between a file in the current working directory and a file with the same name in desimodel footprint. What about raising an exception in the case tilesfile="blah.fits" and blah.fits exists both locally and in desimodel. This would force the user to either move their local file out of the way (if they did not want to use it) or be more explicit by specifying "./blah.fits". |
I just pushed a change to the PR:
Does that sound reasonable? |
@tskisner sounds good. Thanks. |
implemented in #98. Closing. |
Currently loading a tile file in the current working directory fails, because it treats all bare filenames as relative to the package data directory:
Instead it should check if the path exists first. I have already fixed this in a branch. PR coming.
The text was updated successfully, but these errors were encountered: