GithubHelp home page GithubHelp logo

Comments (9)

sbailey avatar sbailey commented on July 21, 2024

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.

  • no path = get it from $DESIMODEL/data/footprint
  • with path = get it from the location specified by the path

Would that meet your needs?

from desimodel.

tskisner avatar tskisner commented on July 21, 2024

I guess that behavior was quite surprising to me. The docstring says:

tilesfile : (str)
        Name of tiles file to load; or None for default.
        Without path, look in $DESIMODEL/data/footprint, otherwise load file.

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.

from desimodel.

sbailey avatar sbailey commented on July 21, 2024

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, $DESIMODEL/data/footprint/filename.fits still trumps local ./filename.fits. I think PR #98 does the opposite of that (local copy trumps $DESIMODEL copy).

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.

from desimodel.

moustakas avatar moustakas commented on July 21, 2024

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 tilesfile argument presumably wants to use that specific file, whether it's a local copy (without the absolute path) or a non-standard file in a non-standard location. (I explicitly ran into this issue working on survey simulations for the SV data challenge, using a non-standard and not-final tile file, and had to do some trickery to get everything working with "my" file.)

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.

from desimodel.

sbailey avatar sbailey commented on July 21, 2024

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.

from desimodel.

tskisner avatar tskisner commented on July 21, 2024

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".

from desimodel.

tskisner avatar tskisner commented on July 21, 2024

I just pushed a change to the PR:

  • Check if the local file exists
  • Check if the file in $DESIMODEL/data exits
  • If neither exists, raise an exception
  • If one exists, read it
  • If both exist, print a warning and choose the one from $DESIMODEL

Does that sound reasonable?

from desimodel.

sbailey avatar sbailey commented on July 21, 2024

@tskisner sounds good. Thanks.

from desimodel.

sbailey avatar sbailey commented on July 21, 2024

implemented in #98. Closing.

from desimodel.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.