Skip to content

Commit

Permalink
get rid of checkSymLink
Browse files Browse the repository at this point in the history
  • Loading branch information
tschaume committed May 22, 2015
1 parent 48019a1 commit ddfd993
Show file tree
Hide file tree
Showing 17 changed files with 15 additions and 49 deletions.
13 changes: 1 addition & 12 deletions ccsgp_get_started/__init__.py
Expand Up @@ -51,21 +51,10 @@
use it, uncomment the h5py requirement in ``requirements.txt`` and rerun ``$
pip install -r requirements.txt``.
4. If you intend to run the examples, clone the test data repository (somewhere
outside of ccsgp_get_started repository)::
4. If you intend to run the examples, clone the test data repository::
$ git clone http://gitlab.the-huck.com/github/ccsgp_get_started_data.git
and symlink *pyanaDir* to the *ccsgp_get_started_data* directory::
$ cd ccsgp_get_started/
$ ln -s <path/to/ccsgp_get_started_data> pyanaDir
`ccsgp_get_started.aux.utils.checkSymLink` checks for the *pyanaDir* symbolic link and
the code won't run without it. Hence you need to generate a symlink called
*pyanaDir* either to *ccsgp_get_started_data* or your own input/output
directory (preferably separated from the code repository).
Pull in public STAR dielectron data into a new branch to use gp_xfac and gp_panel::
$ cd <path/to/ccsgp_get_started_data>
Expand Down
2 changes: 0 additions & 2 deletions ccsgp_get_started/__main__.py
@@ -1,6 +1,5 @@
import string, logging, argparse, os
from itertools import permutations, chain
from examples.utils import checkSymLink
from examples.gp_datdir import gp_datdir
from examples.gp_lcltpt import gp_lcltpt
from examples.gp_panel import gp_panel
Expand Down Expand Up @@ -29,7 +28,6 @@ def inDirExists(plot, version):
return os.path.exists('%s/%s' % (getBaseDir(plot), version))

if __name__ == '__main__':
checkSymLink()
parser = argparse.ArgumentParser()
parser.add_argument("--log", help="show log output", action="store_true")
args = parser.parse_args()
Expand Down
3 changes: 1 addition & 2 deletions ccsgp_get_started/examples/gp_background.py
@@ -1,6 +1,6 @@
import logging, argparse, re, os, glob
import numpy as np
from .utils import getWorkDirs, checkSymLink, getEnergy4Key
from .utils import getWorkDirs, getEnergy4Key
from ..ccsgp.ccsgp import make_plot, make_panel
from ..ccsgp.config import default_colors
from collections import OrderedDict
Expand Down Expand Up @@ -300,7 +300,6 @@ def gp_acc():
)

if __name__ == '__main__':
checkSymLink()
parser = argparse.ArgumentParser()
parser.add_argument("--log", help="show log output", action="store_true")
args = parser.parse_args()
Expand Down
3 changes: 1 addition & 2 deletions ccsgp_get_started/examples/gp_ccX.py
@@ -1,5 +1,5 @@
import os, argparse, logging
from .utils import getWorkDirs, checkSymLink, getEnergy4Key, particleLabel4Key
from .utils import getWorkDirs, getEnergy4Key, particleLabel4Key
from collections import OrderedDict
from ..ccsgp.ccsgp import make_plot, make_panel
from ..ccsgp.config import default_colors
Expand Down Expand Up @@ -92,7 +92,6 @@ def gp_ccX():
)

if __name__ == '__main__':
checkSymLink()
parser = argparse.ArgumentParser()
parser.add_argument("--log", help="show log output", action="store_true")
args = parser.parse_args()
Expand Down
3 changes: 1 addition & 2 deletions ccsgp_get_started/examples/gp_datdir.py
Expand Up @@ -2,7 +2,7 @@
import numpy as np
from collections import OrderedDict
from ..ccsgp.ccsgp import make_plot
from .utils import getWorkDirs, checkSymLink
from .utils import getWorkDirs
from ..ccsgp.utils import getOpts

def gp_datdir(initial, topN):
Expand Down Expand Up @@ -78,7 +78,6 @@ def gp_datdir(initial, topN):
return 'done'

if __name__ == '__main__':
checkSymLink()
parser = argparse.ArgumentParser()
parser.add_argument("initial", help="country initial = input subdir with txt files")
parser.add_argument("topN", help="number of most populated countries to plot")
Expand Down
3 changes: 1 addition & 2 deletions ccsgp_get_started/examples/gp_effcorr.py
@@ -1,5 +1,5 @@
import os, argparse, logging, math
from .utils import getWorkDirs, checkSymLink, getEnergy4Key, particleLabel4Key
from .utils import getWorkDirs, getEnergy4Key, particleLabel4Key
from collections import OrderedDict
from ..ccsgp.ccsgp import make_plot, make_panel
from ..ccsgp.config import default_colors
Expand Down Expand Up @@ -290,7 +290,6 @@ def gp_phiv():
)

if __name__ == '__main__':
checkSymLink()
parser = argparse.ArgumentParser()
parser.add_argument("--log", help="show log output", action="store_true")
args = parser.parse_args()
Expand Down
3 changes: 1 addition & 2 deletions ccsgp_get_started/examples/gp_lcltpt.py
@@ -1,7 +1,7 @@
import os
import numpy as np
from ..ccsgp.ccsgp import make_plot
from .utils import getWorkDirs, checkSymLink
from .utils import getWorkDirs
from ..ccsgp.config import default_colors

def gp_lcltpt():
Expand Down Expand Up @@ -29,7 +29,6 @@ def gp_lcltpt():

if __name__ == '__main__':
import argparse
checkSymLink()
parser = argparse.ArgumentParser()
args = parser.parse_args()
print gp_lcltpt()
3 changes: 1 addition & 2 deletions ccsgp_get_started/examples/gp_panel.py
@@ -1,7 +1,7 @@
import logging, argparse, os, sys, re
import numpy as np
from collections import OrderedDict
from .utils import getWorkDirs, checkSymLink, getEnergy4Key
from .utils import getWorkDirs, getEnergy4Key
from ..ccsgp.ccsgp import make_panel
from ..ccsgp.utils import getOpts
from ..ccsgp.config import default_colors
Expand Down Expand Up @@ -100,7 +100,6 @@ def gp_panel(version, skip):
return 'done'

if __name__ == '__main__':
checkSymLink()
parser = argparse.ArgumentParser()
parser.add_argument("version", help="version = subdir name of input dir")
parser.add_argument("--skip", help="skip an energy", metavar="energy")
Expand Down
3 changes: 1 addition & 2 deletions ccsgp_get_started/examples/gp_ptspec.py
@@ -1,7 +1,7 @@
import logging, argparse, os, sys, re
import numpy as np
from collections import OrderedDict
from .utils import getWorkDirs, checkSymLink, getEnergy4Key
from .utils import getWorkDirs, getEnergy4Key
from ..ccsgp.ccsgp import make_panel, make_plot
from ..ccsgp.utils import getOpts
from ..ccsgp.config import default_colors
Expand Down Expand Up @@ -239,7 +239,6 @@ def gp_ptspec():
return 'done'

if __name__ == '__main__':
checkSymLink()
parser = argparse.ArgumentParser()
parser.add_argument("--log", help="show log output", action="store_true")
args = parser.parse_args()
Expand Down
3 changes: 1 addition & 2 deletions ccsgp_get_started/examples/gp_purity.py
@@ -1,5 +1,5 @@
import os, argparse, logging, math, glob
from .utils import getWorkDirs, checkSymLink, getEnergy4Key, particleLabel4Key
from .utils import getWorkDirs, getEnergy4Key, particleLabel4Key
from collections import OrderedDict
from ..ccsgp.ccsgp import make_panel
from ..ccsgp.config import default_colors
Expand Down Expand Up @@ -104,7 +104,6 @@ def gp_nsigmael():
)

if __name__ == '__main__':
checkSymLink()
parser = argparse.ArgumentParser()
parser.add_argument("--log", help="show log output", action="store_true")
args = parser.parse_args()
Expand Down
3 changes: 1 addition & 2 deletions ccsgp_get_started/examples/gp_rapp.py
Expand Up @@ -2,7 +2,7 @@
import numpy as np
from ..ccsgp.config import default_colors
from ..ccsgp.ccsgp import make_plot, make_panel
from .utils import getWorkDirs, checkSymLink, getMassRangesSums, getEnergy4Key
from .utils import getWorkDirs, getMassRangesSums, getEnergy4Key
from math import pi, log
from collections import OrderedDict

Expand Down Expand Up @@ -159,7 +159,6 @@ def gp_rapp_overview_panel():
)

if __name__ == '__main__':
checkSymLink()
parser = argparse.ArgumentParser()
parser.add_argument("--log", help="show log output", action="store_true")
args = parser.parse_args()
Expand Down
3 changes: 1 addition & 2 deletions ccsgp_get_started/examples/gp_rdiff.py
Expand Up @@ -2,7 +2,7 @@
import numpy as np
from fnmatch import fnmatch
from collections import OrderedDict
from .utils import getWorkDirs, checkSymLink, eRanges, getEnergy4Key
from .utils import getWorkDirs, eRanges, getEnergy4Key
from .utils import getUArray, getEdges, getCocktailSum, enumzipEdges, getMassRangesSums
from .utils import getErrorComponent
from ..ccsgp.ccsgp import make_plot
Expand Down Expand Up @@ -553,7 +553,6 @@ def gp_rdiff_merged(version, divdNdy):
return 'done'

if __name__ == '__main__':
checkSymLink()
parser = argparse.ArgumentParser()
parser.add_argument("version", help="version = subdir name of input dir")
parser.add_argument("--nomed", help="don't plot medium", action="store_true")
Expand Down
3 changes: 1 addition & 2 deletions ccsgp_get_started/examples/gp_sims.py
@@ -1,5 +1,5 @@
import os, argparse, logging
from .utils import getWorkDirs, checkSymLink, getEnergy4Key, particleLabel4Key
from .utils import getWorkDirs, getEnergy4Key, particleLabel4Key
from collections import OrderedDict
from ..ccsgp.ccsgp import make_plot, make_panel
from ..ccsgp.config import default_colors
Expand Down Expand Up @@ -161,7 +161,6 @@ def gp_sims_totalerrors_overlay(version):
)

if __name__ == '__main__':
checkSymLink()
parser = argparse.ArgumentParser()
parser.add_argument("version", help="version = subdir name of input dir")
parser.add_argument("--log", help="show log output", action="store_true")
Expand Down
3 changes: 1 addition & 2 deletions ccsgp_get_started/examples/gp_stack.py
Expand Up @@ -2,7 +2,7 @@
import numpy as np
from fnmatch import fnmatch
from collections import OrderedDict
from .utils import getWorkDirs, checkSymLink, getEnergy4Key
from .utils import getWorkDirs, getEnergy4Key
from .utils import particleLabel4Key, getMassRangesSums, getErrorComponent
from ..ccsgp.ccsgp import make_plot
from ..ccsgp.utils import getOpts
Expand Down Expand Up @@ -295,7 +295,6 @@ def gp_stack(version, energies, inclMed, inclFits):
return 'done'

if __name__ == '__main__':
checkSymLink()
parser = argparse.ArgumentParser()
parser.add_argument("version", help="version = subdir name of input dir")
parser.add_argument("--energies", nargs='*', help="list of energies to plot (for animation)")
Expand Down
3 changes: 1 addition & 2 deletions ccsgp_get_started/examples/gp_tbw.py
@@ -1,5 +1,5 @@
import os, argparse, logging, math
from .utils import getWorkDirs, checkSymLink, getEnergy4Key, particleLabel4Key
from .utils import getWorkDirs, getEnergy4Key, particleLabel4Key
from collections import OrderedDict
from ..ccsgp.ccsgp import make_plot, make_panel
from ..ccsgp.config import default_colors
Expand Down Expand Up @@ -68,7 +68,6 @@ def gp_tbw(shift = False):


if __name__ == '__main__':
checkSymLink()
parser = argparse.ArgumentParser()
parser.add_argument("--log", help="show log output", action="store_true")
args = parser.parse_args()
Expand Down
3 changes: 1 addition & 2 deletions ccsgp_get_started/examples/gp_xfac.py
Expand Up @@ -2,7 +2,7 @@
import numpy as np
from collections import OrderedDict
from ..ccsgp.ccsgp import make_plot
from .utils import getWorkDirs, checkSymLink
from .utils import getWorkDirs
from ..ccsgp.utils import getOpts

shift = {
Expand Down Expand Up @@ -62,7 +62,6 @@ def gp_xfac():
return 'done'

if __name__ == '__main__':
checkSymLink()
parser = argparse.ArgumentParser()
#parser.add_argument("initial", help="country initial = input subdir with txt files")
parser.add_argument("--log", help="show log output", action="store_true")
Expand Down
7 changes: 0 additions & 7 deletions ccsgp_get_started/examples/utils.py
Expand Up @@ -6,13 +6,6 @@
mass_titles = [ 'pi0', 'LMR', 'omphi', 'IMR' ]
eRanges = np.array([ Decimal(str(e)) for e in [ 0, 0.4, 0.75, 1.1, 3. ] ])

def checkSymLink():
"""check for symbolic link to input directory"""
link_name = __name__.split('.')[0] + 'Dir'
if not os.path.islink(link_name):
logging.critical('create symlink %s to continue!' % link_name)
sys.exit(1)

def getWorkDirs():
"""get input/output dirs (same input/output layout as for package)"""
# get caller module
Expand Down

0 comments on commit ddfd993

Please sign in to comment.