140 likes | 358 Views
Data analysis by querying. … and more Lorentz center, Wednesday, 16 November 2005. Python queries. Seamless integration of database and data reduction DB backend independent Search for raw and reduced calibration and science objects Attributes satisfying certain criteria
E N D
Data analysis by querying … and more Lorentz center, Wednesday, 16 November 2005
Python queries • Seamless integration of database and data reduction • DB backend independent • Search for raw and reduced calibration and science objects • Attributes satisfying certain criteria • Dependencies satisfying certain criteria • Sometimes SQL is better suited • Grouping • Finding objects on which others depend
examples f = (Filter.name == '#841')[0] m = MasterFlatFrame.filter == f ReducedScienceFrame.flat == m[41]
SQL • Oracle 10g • Syntax • Standards compliant • Oracle specific extra's • PL/SQL • Function and procedures • Methods
Astro-Wise • Persistent Python objects • User-defined TYPEs and REFerences • ObjectTABLEs and VIEWs • Python class User-defined TYPE • Python object Object TABLE • len(RawScienceFrame.imstat.stdev < 10.0)SELECT COUNT(*)FROM AWOPER."RawScienceFrame" TWHERE T."imstat"."stdev" < 10.0;
examples • Pythonlen(RawScienceFrame.imstat.stdev < 10.0) • Oracle SQLSELECT COUNT(*)FROM AWOPER."RawScienceFrame" TWHERE T."imstat"."stdev" < 10.0; • SELECT T."imstat"."stdev" x , T."flat"."imstat"."stdev" yFROM AWOPER."ReducedScienceFrame" TWHERE T."chip"."name"='ccd53' AND T."filter"."name"='#843' • Start with dbview.astro-wise.org
Context • Handling large amounts of data • Work together • Work in a consistent way • Experiment with source code • Know what data and code was used • Keep data private • Make data public • Throw away data
Context • Organize in Projects, that have • A name and description • Users • Default privileges • Responsible - privileged – users • New objects are automatically part of the currently active context • Tools to safely delete or publish data • Be aware of dependencies for history tracking
Context • User – Project – Astro-Wise … • Setting a project can make more data visible to a user • Setting an instrument can make less data visible to a user • Queries are more suited for some uses of context • Make it easy to query on user and project from awe
examples from astro.database.Context import context context.set_project('WORKSHOP2005') context.set_project('OCAM ILT') context.get_projects() context.get_current_project().name CALL AWOPER.AWSECURITY.SET_PROJECT('OCAM ILT')
Federation • Goal • Distribute data • Distribute queries • Avoid copying data • Available database technology • Non-existent • Oracle technology • Streams • Advanced Replication • Datapump
Federation • Short time-scale – this year • Datapump, low frequency, 1/day • Medium time-scale – Q2 next year • Advanced Replication • Streams • Long time-scale - > Q2 next year • Streams • Distributed data and querying
Code versions • Tag code and objects • Difficult to know with which code a number was exactly calculated • Set version tags strategically • Objects get version from the module in which their class is defined • Might be sufficient in many cases
Finally … … be creative