Utilities

Contains various utilities that expand and suplement the results module functionality and make it easier to work with.

lfd.results.utils.from_file(path)[source]

Read a detecttrails formatted CSV file into a database.

lfd.results.utils.create_test_sample()[source]

Creates a test sample of mock Events for testing, demonstration and learning purposes.

lfd.results.utils.session_scope()[source]

Provide a transactional scope around a series of operations.

lfd.results.utils.pprint(objlist, *args, **kwargs)[source]

Pretty-prints a list of Frame or Event objects in a table-like format.

Parameters:
  • short (bool) –

    True by default. The shortened format corresponds to:

    run camcol filter field time x1 y1 x2 y2
    

    if short is false, the long table format is printed:

    run camcol filter field time x1 y1 x2 y2 cx1 cy1 cx2 cy2
    
  • digits (int) – 2 by default. Controls the number of printed significant digits,
lfd.results.utils.deep_expunge(item, session)[source]

For a given item, expunges all first order sql relationships from given session.

Parameters:
  • item (object) – any OO mapped sqlalchemy ORM object to be expunged completely (Event, Frame etc..)
  • session (sql.Session()) – active session from which we want to expunge the item from
lfd.results.utils.deep_expunge_all(items, session)[source]

For a given list of items, expunges all first order sql relationships from given session.

Parameters:
  • items (list(object) or tuple(object)) – set of OO mapped sqlalchemy ORM object to be expunged completely (Event, Frame etc..)
  • session (sql.Session()) – active session from which we want to expunge the items from