GithubHelp home page GithubHelp logo

Comments (2)

Cyeche avatar Cyeche commented on August 19, 2024

Summary: desitarget.test.test_cuts function test_single_cuts is incorrectly testing that QSO target selection does not depend upon deltaChi2 nor wise_snr. Fix that.

Background: originally cuts.isQSO allowed primary and objtype (psftype) to be optional parameters as a minor convenience for template generation so that it could focus on the fluxes and not have to also pass in arrays of primary=True and objtype='PSF'. A test confirmed that the selection would work with or without them.

Current problem: Since then, cuts.isQSO gained two more optional parameters deltaChi2 and wise_snr. The tests were expanded to include those as optional, but incorrectly is testing that they don't make any difference:

    qso1 = cuts.isQSO(gflux=gflux, rflux=rflux, zflux=zflux, w1flux=w1flux, w2flux=w2flux,
                      objtype=psftype, primary=primary, deltaChi2=deltaChi2, wise_snr=wise_snr)
    qso2 = cuts.isQSO(gflux=gflux, rflux=rflux, zflux=zflux, w1flux=w1flux, w2flux=w2flux,
                      objtype=None, primary=None, deltaChi2=None, wise_snr=None)
    self.assertTrue(np.all(qso1==qso2))

As the test the tests on deltaChi2 and wise_snr are not mandatory and as we just want to see the effect of requiring PSF type object, I would be in favor of just testing PSF (we can remove the primary object test because primary seems to be deprecated…) Therefore we just need:

qso2 = cuts.isQSO(gflux=gflux, rflux=rflux, zflux=zflux, w1flux=w1flux, w2flux=w2flux,
objtype=None, primary=primary, deltaChi2=deltaChi2, wise_snr=wise_snr)

This accidentally passes for some but not all of the test sweep files in test/t. It turns out that our tests use os.walk under the hood to grab the first sweep file it finds, and which file gets selected depends upon where the code is installed. I accidentally tripped over this yesterday when I found that the identical code installed on edison $SCRATCH failed tests while it worked when installed under $HOME... :(

Also note that cuts.isQSO uses wise_snr but cuts.isQSO_randomforest does not.

wise_snr is not used with random forest algorithm…

Christophe.

from desitarget.

moustakas avatar moustakas commented on August 19, 2024

The templates aren't properly using these cuts anyway since the QSO templates don't extend into the mid-IR (see desihub/desisim#152), but it seems like this issue could be resolved if we segregated the color-cuts (whether the "pure" color-cuts or those based on the Random Forest) from the other catalog-level cuts on morphology (aka deltaChi2) and wise_snr.

For example, the templates code could call an isQSO_colors() function whereas isQSO() could take the output Boolean array from isQSO_colors() and apply any additional catalog-level cuts. Doing this refactor (@Cyeche?) and fixing the tests should then be trivial. Thoughts?

from desitarget.

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.