From 11c44333665f99f45d3b1f3c773ed3099deda72e Mon Sep 17 00:00:00 2001 From: Tom Marsh Date: Tue, 16 Mar 2021 09:48:01 +0000 Subject: [PATCH] Environment variable HIPERCAM_DEFAULT_SOURCE introduced This is to allow the reset value of "source", the data source use by multiple routines to be set by the environment. The idea is that on the drpcs one really wants this to point to the servers, not to a local file. i.e.on the ULTRACAM and ULTRASPEC drpcs, set HIPERCAM_DEFAULT_SOURCE to ot "us", but on the HiPERCAM drpc, set it to "hs". Other users need not set this usually. --- hipercam/scripts/averun.py | 9 +++++++-- hipercam/scripts/ftargets.py | 9 +++++++-- hipercam/scripts/grab.py | 11 ++++++++++- hipercam/scripts/makebias.py | 10 +++++++++- hipercam/scripts/makedark.py | 10 +++++++++- hipercam/scripts/makeflat.py | 9 +++++++-- hipercam/scripts/reduce.py | 9 +++++++-- hipercam/scripts/rtplot.py | 9 +++++++-- 8 files changed, 63 insertions(+), 13 deletions(-) diff --git a/hipercam/scripts/averun.py b/hipercam/scripts/averun.py index cf471c91..886a8670 100644 --- a/hipercam/scripts/averun.py +++ b/hipercam/scripts/averun.py @@ -41,7 +41,11 @@ def averun(args=None): | 'hf' : list of HiPERCAM hcm FITS-format files 'hf' is used to look at sets of frames generated by 'grab' or - converted from foreign data formats. + converted from foreign data formats. The standard start-off + default for ``source'' can be set using the environment variable + HIPERCAM_DEFAULT_SOURCE. e.g. in bash :code:`export HIPERCAM_DEFAULT_SOURCE="us"` + would ensure it always started with the ULTRACAM server by default. If + unspecified, it defaults to 'hl'. run : string [if source ends 's' or 'l'] run number to access, e.g. 'run034' @@ -132,10 +136,11 @@ def averun(args=None): cl.register("output", Cline.LOCAL, Cline.PROMPT) # get inputs + default_source = os.environ.get('HIPERCAM_DEFAULT_SOURCE','hl') source = cl.get_value( "source", "data source [hs, hl, us, ul, hf]", - "hl", + default_source, lvals=("hs", "hl", "us", "ul", "hf"), ) diff --git a/hipercam/scripts/ftargets.py b/hipercam/scripts/ftargets.py index 3159567c..afe0b3ed 100644 --- a/hipercam/scripts/ftargets.py +++ b/hipercam/scripts/ftargets.py @@ -66,7 +66,11 @@ def ftargets(args=None): | 'hf' : list of HiPERCAM hcm FITS-format files 'hf' is used to look at sets of frames generated by 'grab' or - converted from foreign data formats. + converted from foreign data formats. The standard start-off + default for ``source'' can be set using the environment variable + HIPERCAM_DEFAULT_SOURCE. e.g. in bash :code:`export HIPERCAM_DEFAULT_SOURCE="us"` + would ensure it always started with the ULTRACAM server by default. If + unspecified, it defaults to 'hl'. device : string [hidden] Plot device. PGPLOT is used so this should be a PGPLOT-style name, @@ -248,10 +252,11 @@ def ftargets(args=None): cl.register("yhi", Cline.GLOBAL, Cline.PROMPT) # get inputs + default_source = os.environ.get('HIPERCAM_DEFAULT_SOURCE','hl') source = cl.get_value( "source", "data source [hs, hl, us, ul, hf]", - "hl", + default_source, lvals=("hs", "hl", "us", "ul", "hf"), ) diff --git a/hipercam/scripts/grab.py b/hipercam/scripts/grab.py index 6af4a93c..12228146 100644 --- a/hipercam/scripts/grab.py +++ b/hipercam/scripts/grab.py @@ -40,6 +40,13 @@ def grab(args=None): | 'us' : ULTRACAM server | 'ul' : local ULTRACAM .xml/.dat files + The standard start-off default for ``source'' can be set + using the environment variable + HIPERCAM_DEFAULT_SOURCE. e.g. in bash :code:`export + HIPERCAM_DEFAULT_SOURCE="us"` would ensure it always + started with the ULTRACAM server by default. If + unspecified, it defaults to 'hl'. + run : string run name to access @@ -101,6 +108,7 @@ def grab(args=None): |grab| is used by several other scripts such as |averun| so take great care when changing anything to do with its input parameters. + """ command, args = utils.script_args(args) @@ -124,10 +132,11 @@ def grab(args=None): cl.register("dtype", Cline.LOCAL, Cline.HIDE) # get inputs + default_source = os.environ.get('HIPERCAM_DEFAULT_SOURCE','hl') source = cl.get_value( "source", "data source [hs, hl, us, ul]", - "hl", + default_source, lvals=("hs", "hl", "us", "ul"), ) diff --git a/hipercam/scripts/makebias.py b/hipercam/scripts/makebias.py index 842db070..bd3f6905 100644 --- a/hipercam/scripts/makebias.py +++ b/hipercam/scripts/makebias.py @@ -41,6 +41,13 @@ def makebias(args=None): | 'us' : ULTRACAM server | 'ul' : local ULTRACAM .xml/.dat files + The standard start-off default for ``source'' can be set + using the environment variable + HIPERCAM_DEFAULT_SOURCE. e.g. in bash :code:`export + HIPERCAM_DEFAULT_SOURCE="us"` would ensure it always + started with the ULTRACAM server by default. If + unspecified, it defaults to 'hl'. + run : string run name to access @@ -97,10 +104,11 @@ def makebias(args=None): cl.register("output", Cline.GLOBAL, Cline.PROMPT) # get inputs + default_source = os.environ.get('HIPERCAM_DEFAULT_SOURCE','hl') source = cl.get_value( "source", "data source [hs, hl, us, ul]", - "hl", + default_source, lvals=("hs", "hl", "us", "ul"), ) diff --git a/hipercam/scripts/makedark.py b/hipercam/scripts/makedark.py index b6968652..e250eac7 100644 --- a/hipercam/scripts/makedark.py +++ b/hipercam/scripts/makedark.py @@ -42,6 +42,13 @@ def makedark(args=None): | 'us' : ULTRACAM server | 'ul' : local ULTRACAM .xml/.dat files + The standard start-off default for ``source'' can be set + using the environment variable + HIPERCAM_DEFAULT_SOURCE. e.g. in bash :code:`export + HIPERCAM_DEFAULT_SOURCE="us"` would ensure it always + started with the ULTRACAM server by default. If + unspecified, it defaults to 'hl'. + run : string run name to access @@ -98,10 +105,11 @@ def makedark(args=None): cl.register("output", Cline.GLOBAL, Cline.PROMPT) # get inputs + default_source = os.environ.get('HIPERCAM_DEFAULT_SOURCE','hl') source = cl.get_value( "source", "data source [hs, hl, us, ul]", - "hl", + default_source, lvals=("hs", "hl", "us", "ul"), ) diff --git a/hipercam/scripts/makeflat.py b/hipercam/scripts/makeflat.py index 3bb25fc3..a57fb452 100644 --- a/hipercam/scripts/makeflat.py +++ b/hipercam/scripts/makeflat.py @@ -84,7 +84,11 @@ def makeflat(args=None): | 'hf' : list of HiPERCAM hcm FITS-format files 'hf' is used to look at sets of frames generated by 'grab' or - converted from foreign data formats. + converted from foreign data formats. The standard start-off + default for ``source'' can be set using the environment variable + HIPERCAM_DEFAULT_SOURCE. e.g. in bash :code:`export HIPERCAM_DEFAULT_SOURCE="us"` + would ensure it always started with the ULTRACAM server by default. If + unspecified, it defaults to 'hl'. run : str [if source ends 's' or 'l'] run number to access, e.g. 'run034' @@ -171,10 +175,11 @@ def makeflat(args=None): cl.register("output", Cline.LOCAL, Cline.PROMPT) # get inputs + default_source = os.environ.get('HIPERCAM_DEFAULT_SOURCE','hl') source = cl.get_value( "source", "data source [hs, hl, us, ul, hf]", - "hl", + default_source, lvals=("hs", "hl", "us", "ul", "hf"), ) diff --git a/hipercam/scripts/reduce.py b/hipercam/scripts/reduce.py index 10d93bc0..ba7608f8 100644 --- a/hipercam/scripts/reduce.py +++ b/hipercam/scripts/reduce.py @@ -75,7 +75,11 @@ def reduce(args=None): | 'hf': list of HiPERCAM hcm FITS-format files 'hf' is used to look at sets of frames generated by 'grab' or - converted from foreign data formats. + converted from foreign data formats. The standard start-off + default for ``source'' can be set using the environment variable + HIPERCAM_DEFAULT_SOURCE. e.g. in bash :code:`export HIPERCAM_DEFAULT_SOURCE="us"` + would ensure it always started with the ULTRACAM server by default. If + unspecified, it defaults to 'hl'. run : str [if source ends 's' or 'l'] run number to access, e.g. 'run034' or a file list. If a run, @@ -226,10 +230,11 @@ def reduce(args=None): cl.register("yhi", Cline.GLOBAL, Cline.PROMPT) # get inputs + default_source = os.environ.get('HIPERCAM_DEFAULT_SOURCE','hl') source = cl.get_value( "source", "data source [hs, hl, us, ul, hf]", - "hl", + default_source, lvals=("hs", "hl", "us", "ul", "hf"), ) diff --git a/hipercam/scripts/rtplot.py b/hipercam/scripts/rtplot.py index 323a1850..57ecbbf6 100644 --- a/hipercam/scripts/rtplot.py +++ b/hipercam/scripts/rtplot.py @@ -61,7 +61,11 @@ def rtplot(args=None): | 'hf' : list of HiPERCAM hcm FITS-format files 'hf' is used to look at sets of frames generated by 'grab' or - converted from foreign data formats. + converted from foreign data formats. The standard start-off + default for ``source'' can be set using the environment variable + HIPERCAM_DEFAULT_SOURCE. e.g. in bash :code:`export HIPERCAM_DEFAULT_SOURCE="us"` + would ensure it always started with the ULTRACAM server by default. If + unspecified, it defaults to 'hl'. device : string [hidden] Plot device. PGPLOT is used so this should be a PGPLOT-style name, @@ -323,10 +327,11 @@ def rtplot(args=None): cl.register("thresh", Cline.LOCAL, Cline.HIDE) # get inputs + default_source = os.environ.get('HIPERCAM_DEFAULT_SOURCE','hl') source = cl.get_value( "source", "data source [hs, hl, us, ul, hf]", - "hl", + default_source, lvals=("hs", "hl", "us", "ul", "hf"), )