Giter Club home page Giter Club logo

Comments (3)

oliche avatar oliche commented on June 26, 2024

From @k1o0

def query_criterion(subject, status, from_status=None, one=None):
    """
​
    Parameters
    ----------
    subject : str
        The subject name.
    status : str
        The training status to query for.
    from_status : str, optional
        Count number of sessions and days from reaching `from_status` to `status`.
    one : one.api.OneAlyx, optional
        An instance of ONE.
​
    Returns
    -------
    str
        The eID of the first session where this training status was reached.
    int
        The number of sessions it took to reach `status` (optionally from reaching `from_status`).
    int
        The number of days it tool to reach `status` (optionally from reaching `from_status`).
    """
    one = one or ONE()
    subject_json = one.alyx.rest('subjects', 'read', id=subject)['json']
    if not (criteria := subject_json.get('criteria')) or status not in criteria:
        return None, None, None
    to_date = criteria[status]
    from_date = criteria.get(from_status)
    eids, det = one.search(subject=subject, date_range=[from_date, to_date], details=True)
    date_range = list(map(datetime.date.fromisoformat, (det[0], det[-1])))
    return eids[-1], len(eids), (date_range[1] - date_range[0]).days

from ibllib.

oliche avatar oliche commented on June 26, 2024
  • compute from trial table (although it needs input from the task parameters)
  • update the extraction task to update JSON field
  • (create the queries if non-obvious)

from ibllib.

GaelleChapuis avatar GaelleChapuis commented on June 26, 2024

Documentation ; query

from ibllib.

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.