From: Yaroslav Halchenko Date: Tue, 7 Jun 2011 13:24:51 +0000 (-0400) Subject: RF+ENH: move commonly useful dict with what entries were added into common.py X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=f257e5f1159ef524263859f8bd611ebe52c92e6f;p=neurodebian.git RF+ENH: move commonly useful dict with what entries were added into common.py --- diff --git a/survey/common.py b/survey/common.py new file mode 100755 index 0000000..09596b1 --- /dev/null +++ b/survey/common.py @@ -0,0 +1,131 @@ +#!/usr/bin/python +#emacs: -*- mode: python-mode; py-indent-offset: 4; tab-width: 4; indent-tabs-mode: nil -*- +#ex: set sts=4 ts=4 sw=4 noet: +#------------------------- =+- Python script -+= ------------------------- +""" + @file common.py + @date Tue Jun 7 09:22:57 2011 + @brief + + + Yaroslav Halchenko Dartmouth + web: http://www.onerussian.com College + e-mail: yoh@onerussian.com ICQ#: 60653192 + + DESCRIPTION (NOTES): + + COPYRIGHT: Yaroslav Halchenko 2011 + + LICENSE: MIT + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. +""" +#-----------------\____________________________________/------------------ + +__author__ = 'Yaroslav Halchenko' +__copyright__ = 'Copyright (c) 2011 Yaroslav Halchenko' +__license__ = 'MIT' + +# Each tuple here is a (regular expression for "Others", either it was newly added while survey was on already) +entries_to_refresh = dict( + sw_other_name=dict( + sw_electro=dict( + brainsuite=('brainsuite', True), # EARLYIN + cedspike=('ced *spike2*', True), # NEW: http://www.ced.co.uk/pru.shtml?spk4wglu.htm + datariver=('exp control: datariver', True), # NEW: http://sccn.ucsd.edu/wiki/DataSuite + eeglab=('(eeglab|http://sccn.ucsd.edu/eeglab/)', False), + emse=('emse', True), # REFRESH EARLYIN + erplab=('erplab', True), # NEW: ERPLAB + klusters=('klusters.*', True), # REFRESH + netstation=('egi net station', True), # NEW: EGI Net Station + neuroscan=('(curry|neuroscan(| curry))', True), # REFRESH + neuroscope=('.*neuroscope', True), # REFRESH + nutmeg=('.*nutmeg', True), # NEW + ndmanager=('ndmanager', True), # EARLYIN + fmatoolbox=('FMAToolbox', True), # EARLYIN + ), + sw_img=dict( + mricron=('mricrogl', False), + afni=('afni for bci', False), + dtistudio=('dti-*studio', True), # NEW: or MRIStudio? + brainsight=('brainsight', True), # NEW: BrainSight + nordicice=('nordic ice', True), # NEW: NordicICE -- just 1 + trackvis=('trackvis', False), + xmedcon=('xmedcon', True), # NEW + ), + sw_general=dict( + lua=('lua', True), # NEW + stata=('stata', True), # NEW + statistica=('statistica', True), # NEW + java=('java', True), # REFRESH + fortran=('fortran', True), # EARLYIN + ), + sw_neusys=dict( + ecanse=('ecanse', True), # EARLYIN + emergent=('emergent', True), # EARLYIN + nengo=('nengo', True), # EARLYIN + neuroml=('neuroml', True), # NEW: NeuroML -- more of a framework/standard than software + neurosolutions=('neurosolutions', True), # EARLYIN + peltarion=('peltarion', True), # EARLYIN + snnap=('snnap', True), # EARLYIN + snns=('snns', True), # EARLYIN + xnbc=('xnbc', True), # EARLYIN + xpp=('xpp(|y|aut)', True), # REFRESH: XPP/XPPAUT and Python interface + ), + sw_psychphys=dict( + asf=('asf', True), # NEW: ASF http://code.google.com/p/asf/ + cogent=('cogent(|2000)', True), # REFRESH + crsvsg=('crs toolbox.*', True), # NEW: CRS VSG Toolbox http://www.crsltd.com/catalog/vsgtoolbox/ + mindware=('mind-ware', True), # NEW: MindWare + nordicaktiva=('nordic aktiva', True), # NEW: NordicActiva -- just 1 http://www.nordicneurolab.com/Products_and_Solutions/Clinical_Software_Solutions/nordicActiva.aspx http://www.nordicneurolab.com/Products_and_Solutions/Clinical_Software_Solutions/nordicAktiva.aspx + superlab=('superlab', True), # REFRESH + psignifit=('psignifit(|3)', True), # NEW + ), + ignore=dict(ignore=( + '(zsh vim mutt git' + # just ignore + '|my overall time.*|separate work.*|60% windows' + '|.*my own .*software' + # Different generic visualization solutions + '|gnupot|.*gnu plot.*xmgrace|mayavi|matplotlib' + '|trackvis' + '|opengl|itk|vtk' + '|paraview' + # Really cool one for graphs + '|gephi' + # Generic DBs + '|mysql|postgresql' + # DB with imaging data (Italy?) but just once + '|loris multi-site database system' + # More languages/platforms? + '|.net|haskel|gsl|cuda' + # Python lovers + '|theano|pygame|numpy|mdp|joblib|scipy|pytables|sympy' + # ML toolboxes + '|scikits-learn|probid .*' + # Reference managers + '|mendeley|jabref' + # Python IDE?? quite nice btw + '|spyder' + # Move into survey? + '|.*magnetic source locator.*' # Some kind of MEG inverse solver -- publications but no public project + ')', True) + ), + ), + ) diff --git a/survey/postprocdata b/survey/postprocdata index 4cc3724..abd834f 100755 --- a/survey/postprocdata +++ b/survey/postprocdata @@ -48,6 +48,8 @@ __license__ = 'GPL' import os, sys, glob, json, re, shutil from copy import copy from mvpa.base import verbose +from common import * + verbose.level = 2 datain = 'data' dataout = 'dataout' @@ -56,80 +58,6 @@ dataorig = 'dataorig' blacklist = ['1305808539.9.json', '1305808540.1.json', '1305808541.03.json', # persistent and curious mind-ware guy from Israel ] -all_subs = dict( - sw_other_name=dict( - sw_electro=dict( - cedspike='ced *spike2*', # NEW: http://www.ced.co.uk/pru.shtml?spk4wglu.htm - datariver='exp control: datariver', # NEW: http://sccn.ucsd.edu/wiki/DataSuite - eeglab='(eeglab|http://sccn.ucsd.edu/eeglab/)', - emse='emse', # REFRESH - erplab='erplab', # NEW: ERPLAB - klusters='klusters.*', # REFRESH - netstation='egi net station', # NEW: EGI Net Station - neuroscan='(curry|neuroscan(| curry))', # REFRESH - neuroscope='.*neuroscope', # REFRESH - nutmeg='.*nutmeg', # NEW - ), - sw_img=dict( - mricron='mricrogl', - afni='afni for bci', - dtistudio='dti-*studio', # NEW: or MRIStudio? - brainsight='brainsight', # NEW: BrainSight - nordicice='nordic ice', # NEW: NordicICE -- just 1 - trackvis='trackvis', - xmedcon='xmedcon', # NEW - ), - sw_general=dict( - lua='lua', # NEW - stata='stata', # NEW - statistica='statistica', # NEW - java='java', # REFRESH - ), - sw_neusys=dict( - neuroml='neuroml', # NEW: NeuroML -- more of a framework/standard than software - xpp='xpp(|y|aut)', # REFRESH: XPP/XPPAUT and Python interface - ), - sw_psychphys=dict( - asf='asf', # NEW: ASF http://code.google.com/p/asf/ - cogent='cogent(|2000)', # REFRESH - crsvsg='crs toolbox.*', # NEW: CRS VSG Toolbox http://www.crsltd.com/catalog/vsgtoolbox/ - mindware='mind-ware', # NEW: MindWare - nordicaktiva='nordic aktiva', # NEW: NordicActiva -- just 1 http://www.nordicneurolab.com/Products_and_Solutions/Clinical_Software_Solutions/nordicActiva.aspx http://www.nordicneurolab.com/Products_and_Solutions/Clinical_Software_Solutions/nordicAktiva.aspx - superlab='superlab', # REFRESH - psignifit='psignifit(|3)', # NEW - ), - ignore=dict(ignore= - '(zsh vim mutt git' - # just ignore - '|my overall time.*|separate work.*|60% windows' - '|.*my own .*software' - # Different generic visualization solutions - '|gnupot|.*gnu plot.*xmgrace|mayavi|matplotlib' - '|trackvis' - '|opengl|itk|vtk' - '|paraview' - # Really cool one for graphs - '|gephi' - # Generic DBs - '|mysql|postgresql' - # DB with imaging data (Italy?) but just once - '|loris multi-site database system' - # More languages/platforms? - '|.net|haskel|gsl|cuda' - # Python lovers - '|theano|pygame|numpy|mdp|joblib|scipy|pytables|sympy' - # ML toolboxes - '|scikits-learn|probid .*' - # Reference managers - '|mendeley|jabref' - # Python IDE?? quite nice btw - '|spyder' - # Move into survey? - '|.*magnetic source locator.*' # Some kind of MEG inverse solver -- publications but no public project - ')' - ), - ), - ) for d in dataout, dataorig: if os.path.exists(d): @@ -182,7 +110,7 @@ for f in infiles: ips[(ip, agent)] = previous_entries + [j] json.dump(j, open(os.path.join(dataorig, fname), 'w'), indent=2) - for ofield, osubs in all_subs.iteritems(): + for ofield, osubs in entries_to_refresh.iteritems(): if not (ofield in j and j[ofield]): continue csv = j[ofield] @@ -193,7 +121,7 @@ for f in infiles: for sfield, ssubs in osubs.iteritems(): srecord = copy(j.get(sfield, [])) old_srecord = j.get(sfield, []) - for name, regex in ssubs.iteritems(): + for name, (regex, isnew) in ssubs.iteritems(): for i, v in enumerate(values): if v is not None and re.match(regex, v): # Found a match -- need to adjust the record