casaconfig 0.0.69__tar.gz → 0.0.71__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {casaconfig-0.0.69/casaconfig.egg-info → casaconfig-0.0.71}/PKG-INFO +34 -36
- {casaconfig-0.0.69 → casaconfig-0.0.71}/README.md +33 -35
- {casaconfig-0.0.69 → casaconfig-0.0.71}/casaconfig/__main__.py +2 -2
- {casaconfig-0.0.69 → casaconfig-0.0.71}/casaconfig/config.py +4 -4
- {casaconfig-0.0.69 → casaconfig-0.0.71}/casaconfig/private/config_defaults_static.py +5 -21
- {casaconfig-0.0.69 → casaconfig-0.0.71}/casaconfig/private/data_update.py +12 -11
- {casaconfig-0.0.69 → casaconfig-0.0.71}/casaconfig/private/do_pull_data.py +31 -29
- casaconfig-0.0.71/casaconfig/private/get_config.py +20 -0
- {casaconfig-0.0.69 → casaconfig-0.0.71}/casaconfig/private/get_data_info.py +5 -5
- {casaconfig-0.0.69 → casaconfig-0.0.71}/casaconfig/private/measures_update.py +20 -12
- {casaconfig-0.0.69 → casaconfig-0.0.71}/casaconfig/private/pull_data.py +5 -5
- {casaconfig-0.0.69 → casaconfig-0.0.71/casaconfig.egg-info}/PKG-INFO +34 -36
- {casaconfig-0.0.69 → casaconfig-0.0.71}/setup.py +1 -1
- casaconfig-0.0.69/casaconfig/private/get_config.py +0 -20
- {casaconfig-0.0.69 → casaconfig-0.0.71}/LICENSE +0 -0
- {casaconfig-0.0.69 → casaconfig-0.0.71}/MANIFEST.in +0 -0
- {casaconfig-0.0.69 → casaconfig-0.0.71}/casaconfig/__init__.py +0 -0
- {casaconfig-0.0.69 → casaconfig-0.0.71}/casaconfig/private/__init__.py +0 -0
- {casaconfig-0.0.69 → casaconfig-0.0.71}/casaconfig/private/casasiteconfig.py +0 -0
- {casaconfig-0.0.69 → casaconfig-0.0.71}/casaconfig/private/config_defaults.py +0 -0
- {casaconfig-0.0.69 → casaconfig-0.0.71}/casaconfig/private/data_available.py +0 -0
- {casaconfig-0.0.69 → casaconfig-0.0.71}/casaconfig/private/get_argparser.py +0 -0
- {casaconfig-0.0.69 → casaconfig-0.0.71}/casaconfig/private/get_data_lock.py +0 -0
- {casaconfig-0.0.69 → casaconfig-0.0.71}/casaconfig/private/io_redirect.py +0 -0
- {casaconfig-0.0.69 → casaconfig-0.0.71}/casaconfig/private/measures_available.py +0 -0
- {casaconfig-0.0.69 → casaconfig-0.0.71}/casaconfig/private/print_log_messages.py +0 -0
- {casaconfig-0.0.69 → casaconfig-0.0.71}/casaconfig/private/set_casacore_path.py +0 -0
- {casaconfig-0.0.69 → casaconfig-0.0.71}/casaconfig/private/update_all.py +0 -0
- {casaconfig-0.0.69 → casaconfig-0.0.71}/casaconfig.egg-info/SOURCES.txt +0 -0
- {casaconfig-0.0.69 → casaconfig-0.0.71}/casaconfig.egg-info/dependency_links.txt +0 -0
- {casaconfig-0.0.69 → casaconfig-0.0.71}/casaconfig.egg-info/requires.txt +0 -0
- {casaconfig-0.0.69 → casaconfig-0.0.71}/casaconfig.egg-info/top_level.txt +0 -0
- {casaconfig-0.0.69 → casaconfig-0.0.71}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: casaconfig
|
3
|
-
Version: 0.0.
|
3
|
+
Version: 0.0.71
|
4
4
|
Summary: CASA Operational Configuration Package
|
5
5
|
Home-page: https://github.com/casangi/casaconfig
|
6
6
|
Author: National Radio Astronomy Observatory
|
@@ -27,9 +27,9 @@ Description: # casaconfig
|
|
27
27
|
|
28
28
|
## Usage
|
29
29
|
|
30
|
-
|
31
|
-
|
32
|
-
|
30
|
+
CASA (modular and monolithic) does not come with any data. It must be populated
|
31
|
+
by calling ```pull_data()``` to download the tables. The default location is
|
32
|
+
```~/.casa/data```. The ```path``` argument can be used to populate a different location.
|
33
33
|
|
34
34
|
```python
|
35
35
|
from casaconfig import pull_data
|
@@ -37,37 +37,53 @@ Description: # casaconfig
|
|
37
37
|
```
|
38
38
|
|
39
39
|
Within this folder is a stale version of the IERS measures tables needed for accurate measurement.
|
40
|
-
Generally users will want to update to the latest measures data and keep current each day.
|
40
|
+
Generally users will want to update to the latest measures data and keep current each day.
|
41
41
|
|
42
42
|
```python
|
43
43
|
from casaconfig import measures_update
|
44
44
|
measures_update()
|
45
45
|
```
|
46
46
|
|
47
|
-
|
48
|
-
own local copy with any desired modifications.
|
47
|
+
The update_all function updates or installs the data and the latest measures tables.
|
49
48
|
|
50
49
|
```python
|
51
|
-
from casaconfig import
|
52
|
-
|
50
|
+
from casaconfig import update_all
|
51
|
+
update_all()
|
53
52
|
```
|
54
53
|
|
54
|
+
A default config.py necessary for CASA operation is included in this package. Users
|
55
|
+
provide their own config.py (default at ~/.casa/config.py) if they want to change
|
56
|
+
any of the default values (only the values they want to change need be provided in
|
57
|
+
that file).
|
58
|
+
|
59
|
+
The default config values are shown here (path's are expanded using expanduser and abspath).
|
60
|
+
|
55
61
|
```
|
56
62
|
$: cat ~/.casa/config.py
|
57
63
|
|
58
64
|
import os, time, pkg_resources
|
59
65
|
|
60
|
-
#
|
61
|
-
|
66
|
+
# location of geodetic and ephemera data, default path for casaconfig data functions
|
67
|
+
measurespath = "~/.casa/data"
|
68
|
+
|
69
|
+
# search path for measurement sets and images to load, when empty then [measurespath] is used
|
70
|
+
datapath = [ ]
|
62
71
|
|
63
|
-
#
|
64
|
-
|
72
|
+
# automatically update measures data if not current (measurespath must be owned by the user)
|
73
|
+
# when data_auto_update is True then measures_auto_update MUST also be True
|
74
|
+
measures_auto_update = True
|
65
75
|
|
66
|
-
# automatically update measures data if not current (measurespath must be user
|
67
|
-
|
76
|
+
# automatically update casarundata and measures data if not current (measurespath must be owned by the user)
|
77
|
+
data_auto_update = True
|
78
|
+
|
79
|
+
# location of the optional user's startup.py
|
80
|
+
startupfile = '~/.casa/startup.py'
|
81
|
+
|
82
|
+
# location of the cachedir
|
83
|
+
cachedir = '~/.casa'
|
68
84
|
|
69
85
|
# log file path/name
|
70
|
-
logfile='
|
86
|
+
logfile='casa-%s.log' % time.strftime("%Y-%m-%d", time.gmtime())
|
71
87
|
|
72
88
|
# do not create a log file when True, If True, then any logfile value is ignored and there is no log file
|
73
89
|
nologfile = False
|
@@ -83,7 +99,7 @@ Description: # casaconfig
|
|
83
99
|
|
84
100
|
# the IPython prompt color scheme. Must be one of "Neutral", "NoColor", "Linux" or "LightBG", default "Neutral"
|
85
101
|
# if an invalid color is given a warning message is printed and logged but CASA continues using the default color
|
86
|
-
colors = "
|
102
|
+
colors = "Neutral"
|
87
103
|
|
88
104
|
# startup without a graphical backend if True
|
89
105
|
agg = False
|
@@ -96,25 +112,7 @@ Description: # casaconfig
|
|
96
112
|
iplog = True
|
97
113
|
|
98
114
|
# IPython log path/name used when iplog is True
|
99
|
-
iplogfile = 'ipython-%s.log' % time.strftime("%Y-%m-%d", time.
|
100
|
-
|
101
|
-
# allow anonymous usage reporting
|
102
|
-
telemetry_enabled = True
|
103
|
-
|
104
|
-
# location to place telemetry data prior to reporting
|
105
|
-
telemetry_log_directory = os.path.expanduser("~/.casa/telemetry")
|
106
|
-
|
107
|
-
# maximum size of telemetry recording
|
108
|
-
telemetry_log_limit = 1650
|
109
|
-
|
110
|
-
# telemetry recording size that triggers a report
|
111
|
-
telemetry_log_size_interval = 30
|
112
|
-
|
113
|
-
# telemetry recording report frequency
|
114
|
-
telemetry_submit_interval = 20
|
115
|
-
|
116
|
-
# allow anonymous crash reporting
|
117
|
-
crashreporter_enabled = True
|
115
|
+
iplogfile = 'ipython-%s.log' % time.strftime("%Y-%m-%d", time.gmtime())
|
118
116
|
|
119
117
|
# include the users local site-packages in the python path if True.
|
120
118
|
# normally these are excluded to avoid any conflicts with CASA modules
|
@@ -19,9 +19,9 @@ $: pip install casaconfig
|
|
19
19
|
|
20
20
|
## Usage
|
21
21
|
|
22
|
-
|
23
|
-
|
24
|
-
|
22
|
+
CASA (modular and monolithic) does not come with any data. It must be populated
|
23
|
+
by calling ```pull_data()``` to download the tables. The default location is
|
24
|
+
```~/.casa/data```. The ```path``` argument can be used to populate a different location.
|
25
25
|
|
26
26
|
```python
|
27
27
|
from casaconfig import pull_data
|
@@ -29,37 +29,53 @@ pull_data()
|
|
29
29
|
```
|
30
30
|
|
31
31
|
Within this folder is a stale version of the IERS measures tables needed for accurate measurement.
|
32
|
-
Generally users will want to update to the latest measures data and keep current each day.
|
32
|
+
Generally users will want to update to the latest measures data and keep current each day.
|
33
33
|
|
34
34
|
```python
|
35
35
|
from casaconfig import measures_update
|
36
36
|
measures_update()
|
37
37
|
```
|
38
38
|
|
39
|
-
|
40
|
-
own local copy with any desired modifications.
|
39
|
+
The update_all function updates or installs the data and the latest measures tables.
|
41
40
|
|
42
41
|
```python
|
43
|
-
from casaconfig import
|
44
|
-
|
42
|
+
from casaconfig import update_all
|
43
|
+
update_all()
|
45
44
|
```
|
46
45
|
|
46
|
+
A default config.py necessary for CASA operation is included in this package. Users
|
47
|
+
provide their own config.py (default at ~/.casa/config.py) if they want to change
|
48
|
+
any of the default values (only the values they want to change need be provided in
|
49
|
+
that file).
|
50
|
+
|
51
|
+
The default config values are shown here (path's are expanded using expanduser and abspath).
|
52
|
+
|
47
53
|
```
|
48
54
|
$: cat ~/.casa/config.py
|
49
55
|
|
50
56
|
import os, time, pkg_resources
|
51
57
|
|
52
|
-
#
|
53
|
-
|
58
|
+
# location of geodetic and ephemera data, default path for casaconfig data functions
|
59
|
+
measurespath = "~/.casa/data"
|
60
|
+
|
61
|
+
# search path for measurement sets and images to load, when empty then [measurespath] is used
|
62
|
+
datapath = [ ]
|
54
63
|
|
55
|
-
#
|
56
|
-
|
64
|
+
# automatically update measures data if not current (measurespath must be owned by the user)
|
65
|
+
# when data_auto_update is True then measures_auto_update MUST also be True
|
66
|
+
measures_auto_update = True
|
57
67
|
|
58
|
-
# automatically update measures data if not current (measurespath must be user
|
59
|
-
|
68
|
+
# automatically update casarundata and measures data if not current (measurespath must be owned by the user)
|
69
|
+
data_auto_update = True
|
70
|
+
|
71
|
+
# location of the optional user's startup.py
|
72
|
+
startupfile = '~/.casa/startup.py'
|
73
|
+
|
74
|
+
# location of the cachedir
|
75
|
+
cachedir = '~/.casa'
|
60
76
|
|
61
77
|
# log file path/name
|
62
|
-
logfile='
|
78
|
+
logfile='casa-%s.log' % time.strftime("%Y-%m-%d", time.gmtime())
|
63
79
|
|
64
80
|
# do not create a log file when True, If True, then any logfile value is ignored and there is no log file
|
65
81
|
nologfile = False
|
@@ -75,7 +91,7 @@ nogui = False
|
|
75
91
|
|
76
92
|
# the IPython prompt color scheme. Must be one of "Neutral", "NoColor", "Linux" or "LightBG", default "Neutral"
|
77
93
|
# if an invalid color is given a warning message is printed and logged but CASA continues using the default color
|
78
|
-
colors = "
|
94
|
+
colors = "Neutral"
|
79
95
|
|
80
96
|
# startup without a graphical backend if True
|
81
97
|
agg = False
|
@@ -88,25 +104,7 @@ pipeline = False
|
|
88
104
|
iplog = True
|
89
105
|
|
90
106
|
# IPython log path/name used when iplog is True
|
91
|
-
iplogfile = 'ipython-%s.log' % time.strftime("%Y-%m-%d", time.
|
92
|
-
|
93
|
-
# allow anonymous usage reporting
|
94
|
-
telemetry_enabled = True
|
95
|
-
|
96
|
-
# location to place telemetry data prior to reporting
|
97
|
-
telemetry_log_directory = os.path.expanduser("~/.casa/telemetry")
|
98
|
-
|
99
|
-
# maximum size of telemetry recording
|
100
|
-
telemetry_log_limit = 1650
|
101
|
-
|
102
|
-
# telemetry recording size that triggers a report
|
103
|
-
telemetry_log_size_interval = 30
|
104
|
-
|
105
|
-
# telemetry recording report frequency
|
106
|
-
telemetry_submit_interval = 20
|
107
|
-
|
108
|
-
# allow anonymous crash reporting
|
109
|
-
crashreporter_enabled = True
|
107
|
+
iplogfile = 'ipython-%s.log' % time.strftime("%Y-%m-%d", time.gmtime())
|
110
108
|
|
111
109
|
# include the users local site-packages in the python path if True.
|
112
110
|
# normally these are excluded to avoid any conflicts with CASA modules
|
@@ -18,9 +18,9 @@ parser.add_argument( "--data-update", dest='dataupdate', action='store_const', c
|
|
18
18
|
parser.add_argument( "--measures-update", dest='measuresupdate', action='store_const', const=True, default=False,
|
19
19
|
help="invoke measures_update() to update measurespath to the latest measures data")
|
20
20
|
parser.add_argument( "--update-all", dest='updateall', action='store_const', const=True, default=False,
|
21
|
-
help="
|
21
|
+
help="invoke update_all() to populate (update) measurespath with the latest casarundata and measures data")
|
22
22
|
parser.add_argument( "--reference-testing", action='store_const', const=True, dest='referencetesting', default=False,
|
23
|
-
help="set measurespath to the casarundata when this version
|
23
|
+
help="set measurespath to the casarundata when this version was produced, used for testing purposes")
|
24
24
|
parser.add_argument( "--current-data", dest='currentdata', action='store_const', const=True, default=False,
|
25
25
|
help="print out a summary of the current casarundata and measures data installed in measurespath and then exit")
|
26
26
|
|
@@ -97,16 +97,16 @@ if len(_config_defaults.datapath) == 0:
|
|
97
97
|
_config_defaults.datapath = [ _config_defaults.measurespath ]
|
98
98
|
|
99
99
|
# the names of config values that are path that need to be expanded here
|
100
|
-
__path_names = ["cachedir","datapath","measurespath","logfile","iplogfile","startupfile"
|
100
|
+
__path_names = ["cachedir","datapath","measurespath","logfile","iplogfile","startupfile"]
|
101
101
|
|
102
102
|
for __v in __defaults:
|
103
103
|
globals()[__v] = getattr(_config_defaults,__v,None)
|
104
104
|
if (__v in __path_names) :
|
105
105
|
# expand ~ or ~user constructs and make sure they are absolute paths
|
106
106
|
if (type(globals()[__v]) is list) :
|
107
|
-
|
108
|
-
|
109
|
-
globals()[__v] =
|
107
|
+
__vlist = list(map(__os.path.expanduser, globals()[__v]))
|
108
|
+
__vlist = list(map(__os.path.abspath,__vlist))
|
109
|
+
globals()[__v] = __vlist
|
110
110
|
else:
|
111
111
|
globals()[__v] = __os.path.abspath(__os.path.expanduser(globals()[__v]))
|
112
112
|
|
@@ -1,7 +1,7 @@
|
|
1
|
-
#
|
1
|
+
# lsit of paths where CASA should search for data subdirectories. Default [measurespath].
|
2
2
|
datapath = [ ]
|
3
3
|
|
4
|
-
# location of
|
4
|
+
# location of required measures data, takes precedence over any measures data also present in datapath.
|
5
5
|
measurespath = "~/.casa/data"
|
6
6
|
|
7
7
|
# automatically update measures data if not current (measurespath must be owned by the user)
|
@@ -26,19 +26,21 @@ nologfile = False
|
|
26
26
|
# print log output to terminal when True (in addition to any logfile and CASA logger)
|
27
27
|
log2term = False
|
28
28
|
|
29
|
-
# do not start the CASA logger when True
|
29
|
+
# do not start the CASA logger GUI when True
|
30
30
|
nologger = False
|
31
31
|
|
32
32
|
# avoid starting GUI tools when True. If True then the CASA logger is not started even if nologger is False
|
33
33
|
nogui = False
|
34
34
|
|
35
35
|
# the IPython prompt color scheme. Must be one of "Neutral", "NoColor", "Linux" or "LightBG", default "Neutral"
|
36
|
+
# if an invalid color is given a warning message is printed and logged but CASA continues using the default color
|
36
37
|
colors = "Neutral"
|
37
38
|
|
38
39
|
# startup without a graphical backend if True
|
39
40
|
agg = False
|
40
41
|
|
41
42
|
# attempt to load the pipeline modules and set other options appropriate for pipeline use if True
|
43
|
+
# when pipeline is True then agg will be assumed to be true even if agg is set to False here or on the command line
|
42
44
|
pipeline = False
|
43
45
|
|
44
46
|
# create and use an IPython log using the iplogfile path
|
@@ -47,23 +49,5 @@ iplog = False
|
|
47
49
|
# the IPython log file path name to be used when iplog is True
|
48
50
|
iplogfile='ipython-%s.log' % _time.strftime("%Y%m%d-%H%M%S", _time.gmtime())
|
49
51
|
|
50
|
-
# allow anonymous usage reporting
|
51
|
-
telemetry_enabled = True
|
52
|
-
|
53
|
-
# location to place telemetry data prior to reporting
|
54
|
-
telemetry_log_directory = '~/.casa/telemetry'
|
55
|
-
|
56
|
-
# maximum size of telemetry recording
|
57
|
-
telemetry_log_limit = 20480
|
58
|
-
|
59
|
-
# telemetry recording size that triggers a report
|
60
|
-
telemetry_log_size_interval = 60
|
61
|
-
|
62
|
-
# telemetry recording report frequency
|
63
|
-
telemetry_submit_interval = 604800
|
64
|
-
|
65
|
-
# allow anonymous crash reporting
|
66
|
-
crashreporter_enabled = True
|
67
|
-
|
68
52
|
# include the user's local site-packages in the python path if True. May conflict with CASA modules
|
69
53
|
user_site = False
|
@@ -15,7 +15,7 @@
|
|
15
15
|
this module will be included in the api
|
16
16
|
"""
|
17
17
|
|
18
|
-
def data_update(path=None,
|
18
|
+
def data_update(path=None, version=None, force=False, logger=None, auto_update_rules):
|
19
19
|
"""
|
20
20
|
Check for updates to the installed casarundata and install the update or change to
|
21
21
|
the requested version when appropriate.
|
@@ -25,25 +25,26 @@ def data_update(path=None, auto_update_rules=False, version=None, force=False, l
|
|
25
25
|
must already exist in path in order to use this function. Use pull_data to install
|
26
26
|
casarundata into a new location.
|
27
27
|
|
28
|
-
If path is None then config.measurespath
|
28
|
+
If path is None then config.measurespath is used.
|
29
29
|
|
30
30
|
If the version is None (the default) then the most recent version returned by
|
31
31
|
data_available is used.
|
32
32
|
|
33
|
-
If the version requested matches the one in
|
33
|
+
If the version requested matches the one in the readme.txt file at path then this function does
|
34
34
|
nothing unless force is True.
|
35
35
|
|
36
|
-
If a specific version is not requested (the default) and the date in
|
37
|
-
is today, then this function does nothing unless force is True even if there is a more
|
36
|
+
If a specific version is not requested (the default) and the date in the readme.txt file
|
37
|
+
at path is today, then this function does nothing unless force is True even if there is a more
|
38
38
|
recent version available from the CASA server.
|
39
39
|
|
40
40
|
When auto_update_rules is True then path must be owned by the user, force must be
|
41
|
-
False and the version must be None. This is used
|
42
|
-
data_auto_update is True.
|
41
|
+
False and the version must be None. This is used during casatools initialization when
|
42
|
+
data_auto_update is True. Automatic updating happens during casatools initialization
|
43
|
+
so that the updated casarundata and measures are in place before any tool needs to use them.
|
43
44
|
|
44
45
|
If an update is to be installed the previously installed files, as listed in the
|
45
|
-
readme.txt file
|
46
|
-
being installed
|
46
|
+
readme.txt file at path, are removed before the contents of the version
|
47
|
+
being installed are unpacked. This includes the set of measures tables
|
47
48
|
that are part of that casarundata version. A data update is typically followed by a
|
48
49
|
measures_update to ensure that the most recent measures data are installed.
|
49
50
|
|
@@ -72,14 +73,14 @@ def data_update(path=None, auto_update_rules=False, version=None, force=False, l
|
|
72
73
|
write permissions there). The version must then also be None and the force option must be False.
|
73
74
|
|
74
75
|
**Note:** the most recent casarundata may not include the most recent measures data. A data_update
|
75
|
-
is typically followed by a
|
76
|
+
is typically followed by a measures_update.
|
76
77
|
|
77
78
|
Parameters
|
78
79
|
- path (str) - Folder path to update. Must contain a valid readme.txt. If not set then config.measurespath is used.
|
79
|
-
- auto_update_rules (bool=False) - If True then the user must be the owner of path, version must be None, and force must be False.
|
80
80
|
- version (str=None) - Version of casarundata to retrieve (usually in the form of casarundata-x.y.z.tar.gz, see data_available()). Default None retrieves the latest.
|
81
81
|
- force (bool=False) - If True, always re-download the casarundata. Default False will not download casarundata if already updated today unless the version parameter is specified and different from what was last downloaded.
|
82
82
|
- logger (casatools.logsink=None) - Instance of the casalogger to use for writing messages. Default None writes messages to the terminal.
|
83
|
+
- auto_update_rules (bool=False) - If True then the user must be the owner of path, version must be None, and force must be False.
|
83
84
|
|
84
85
|
Returns
|
85
86
|
None
|
@@ -90,36 +90,38 @@ def do_pull_data(path, version, installed_files, logger):
|
|
90
90
|
# also log it
|
91
91
|
if logger is not None: logger.post('downloading casarundata contents to %s ...' % path, 'INFO')
|
92
92
|
tar.extractall(path=path)
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
93
|
+
|
94
|
+
print("done", file=sys.stdout)
|
95
|
+
|
96
|
+
# the tarball has been extracted to path/version
|
97
|
+
# get the instaled files of files to be written to the readme file
|
98
|
+
versdir = os.path.join(path,version[:version.index('.tar')])
|
99
|
+
installed_files = []
|
100
|
+
wgen = os.walk(versdir)
|
101
|
+
for (dirpath, dirnames, filenames) in wgen:
|
102
|
+
for f in filenames:
|
103
|
+
installed_files.append(os.path.relpath(os.path.join(dirpath,f),versdir))
|
102
104
|
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
105
|
+
# move everything in version up a level to path
|
106
|
+
for f in os.listdir(versdir):
|
107
|
+
srcPath = os.path.join(versdir,f)
|
108
|
+
if os.path.isdir(srcPath):
|
109
|
+
# directories are first copied, then removed
|
110
|
+
# existing directories are reused, existing files are overwritten
|
111
|
+
# things in path that do not exist in srcPath are not changed
|
112
|
+
shutil.copytree(srcPath,os.path.join(path,f),dirs_exist_ok=True)
|
113
|
+
shutil.rmtree(srcPath)
|
114
|
+
else:
|
115
|
+
# assume it's a simple file, these can be moved directly, overwriting anything already there
|
116
|
+
os.rename(srcPath,os.path.join(path,f))
|
115
117
|
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
118
|
+
# safe to remove versdir, it would be a surprise if it's not empty
|
119
|
+
os.rmdir(versdir)
|
120
|
+
# update the readme.txt file
|
121
|
+
with open(readme_path,'w') as fid:
|
122
|
+
fid.write("# casarundata populated by casaconfig.pull_data\nversion : %s\ndate : %s" % (version, datetime.today().strftime('%Y-%m-%d')))
|
123
|
+
fid.write("\n#\n# manifest")
|
124
|
+
for f in installed_files:
|
125
|
+
fid.write("\n%s" % f)
|
124
126
|
|
125
127
|
print_log_messages('casarundata installed %s at %s' % (version, path), logger)
|
@@ -0,0 +1,20 @@
|
|
1
|
+
def get_config( default=False ):
|
2
|
+
"""
|
3
|
+
Get configuration values as a list of strings which can be logged, stored, or evaluated.
|
4
|
+
|
5
|
+
The default values (returned when default is True) are the configuration values after all config files have been evaluated but before the path values have been expanded using os.path.expanduser and os.path.abspath. Modules that use the command line to change config values may also not update the default values. User actions in a CASA session will also typically not change the default values.
|
6
|
+
|
7
|
+
Parameters
|
8
|
+
default (bool=False) - If True, return the default values.
|
9
|
+
|
10
|
+
Returns
|
11
|
+
list[str] - list of configuration strings
|
12
|
+
"""
|
13
|
+
|
14
|
+
from .. import config as _config
|
15
|
+
if not default :
|
16
|
+
valsObj = _config
|
17
|
+
else:
|
18
|
+
valsObj = _config._config_defaults
|
19
|
+
|
20
|
+
return list( map( lambda name: f'{name} = {repr(getattr(valsObj,name))}', _config.__defaults ) )
|
@@ -33,8 +33,8 @@ def get_data_info(path=None, logger=None):
|
|
33
33
|
into place when a modular CASA is built. It is the release.txt for the
|
34
34
|
data appropriate for that module CASA release and it used by the "--reference-testing"
|
35
35
|
command line option for casaconfig. That allows casaconfig to install that
|
36
|
-
casarundata version for testing purposes. The release information
|
37
|
-
|
36
|
+
casarundata version for testing purposes. The release information does not depend
|
37
|
+
on the path argument.
|
38
38
|
|
39
39
|
If path is empty or does not exist then the return value for the 'casarundata' and
|
40
40
|
'measures' types is None.
|
@@ -49,9 +49,9 @@ def get_data_info(path=None, logger=None):
|
|
49
49
|
and ephemeris directories are present in path then the version returned for 'measures' is
|
50
50
|
'unknown' and the date is an empty string. The path location may contain measures data from
|
51
51
|
a legacy installation of CASA data. CASA may be able to use any measures tables at this
|
52
|
-
location by they
|
52
|
+
location by they can not be maintained by casaconfig.
|
53
53
|
|
54
|
-
If
|
54
|
+
If no casadata release information is found the returned
|
55
55
|
value for 'release' is None and the "--reference-testing" option will not do anything
|
56
56
|
for this installation of casaconfig. This will be the case for a modular installation.
|
57
57
|
|
@@ -63,7 +63,7 @@ def get_data_info(path=None, logger=None):
|
|
63
63
|
- logger (casatools.logsink=None) - Instance of the casalogger to use for writing messages. Default None writes messages to the the terminal.
|
64
64
|
|
65
65
|
Returns
|
66
|
-
dict - a dictionary by type, 'casarundata', 'measures', 'release' where each type is a dictionary 'version'
|
66
|
+
dict - a dictionary by type, 'casarundata', 'measures', 'release' where each type is a dictionary containing 'version' and 'date'. A return value of None indicates path is unset. A value of None for that type means no information could be found about that type.
|
67
67
|
"""
|
68
68
|
|
69
69
|
# when None is returned, path wasn't set
|
@@ -15,7 +15,7 @@
|
|
15
15
|
this module will be included in the api
|
16
16
|
"""
|
17
17
|
|
18
|
-
def measures_update(path=None,
|
18
|
+
def measures_update(path=None, version=None, force=False, logger=None, auto_update_rules=False):
|
19
19
|
"""
|
20
20
|
Retrieve IERS data used for measures calculations from ASTRON server
|
21
21
|
|
@@ -27,7 +27,7 @@ def measures_update(path=None, auto_update_rules=False, version=None, force=Fals
|
|
27
27
|
A text file (readme.txt in the geodetic directory in path) records the version string
|
28
28
|
and the date when that version was installed in path.
|
29
29
|
|
30
|
-
If path is None then config.measurespath
|
30
|
+
If path is None then config.measurespath is used.
|
31
31
|
|
32
32
|
If the version requested matches the one in that text file then this function does
|
33
33
|
nothing unless force is True.
|
@@ -36,18 +36,26 @@ def measures_update(path=None, auto_update_rules=False, version=None, force=Fals
|
|
36
36
|
is today, then this function does nothing unless force is True even if there is a more
|
37
37
|
recent version available from the ASTRON server.
|
38
38
|
|
39
|
-
|
40
|
-
|
41
|
-
|
39
|
+
When auto_update_rules is True then path must be owned by the user, force must be False,
|
40
|
+
and the version must be None. This is used during casatools initialization when
|
41
|
+
measures_auto_update is True. Automatic updating happens during casatools initialization
|
42
|
+
so that the updated measures are in place before any tool needs to use them.
|
42
43
|
|
43
44
|
Using measures_update after casatools has started should always be followed by exiting
|
44
45
|
and restarting casa (or the casatools module if modular casa components are being used).
|
45
46
|
|
46
|
-
A file lock is used to prevent more that one
|
47
|
-
|
48
|
-
in path)
|
49
|
-
gets the lock it
|
50
|
-
to make sure that an update is still necessary (if force is True an update
|
47
|
+
A file lock is used to prevent more that one data update (pull_data, measures_update,
|
48
|
+
or data_update) from updating any files in path at the same time. When locked, the
|
49
|
+
lock file (data_update.lock in path) contains information about the process that
|
50
|
+
has the lock. When measures_update gets the lock it checks the readme.txt file in path
|
51
|
+
to make sure that an update is still necessary (if force is True then an update
|
52
|
+
always happens). If the lock file is not empty then a previous update of path (pull_data,
|
53
|
+
data_update, or measures_update) did not exit as expected and the contents of path are
|
54
|
+
suspect. In that case, an error will be reported and nothing will be updated. The lock
|
55
|
+
file can be checked to see the details of when that file was locked. The lock file can be
|
56
|
+
removed and measures_update can be tried again. It may be safest in that case to remove path
|
57
|
+
completely or use a different path and use pull_data to install a fresh copy of the
|
58
|
+
desired version.
|
51
59
|
|
52
60
|
Care should be used when using measures_update outside of the normal automatic
|
53
61
|
update that other casa sessions are not using the same measures at the same time,
|
@@ -72,10 +80,10 @@ def measures_update(path=None, auto_update_rules=False, version=None, force=Fals
|
|
72
80
|
|
73
81
|
Parameters
|
74
82
|
- path (str) - Folder path to place updated measures data. Must contain a valid geodetic/readme.txt. If not set then config.measurespath is used.
|
75
|
-
- auto_update_rules (bool=False) - If True then the user must be the owner of path, version must be None, and force must be False.
|
76
83
|
- version (str=None) - Version of measures data to retrieve (usually in the form of yyyymmdd-160001.ztar, see measures_available()). Default None retrieves the latest.
|
77
84
|
- force (bool=False) - If True, always re-download the measures data. Default False will not download measures data if already updated today unless the version parameter is specified and different from what was last downloaded.
|
78
85
|
- logger (casatools.logsink=None) - Instance of the casalogger to use for writing messages. Default None writes messages to the terminal
|
86
|
+
- auto_update_rules (bool=False) - If True then the user must be the owner of path, version must be None, and force must be False.
|
79
87
|
|
80
88
|
Returns
|
81
89
|
None
|
@@ -214,7 +222,7 @@ def measures_update(path=None, auto_update_rules=False, version=None, force=Fals
|
|
214
222
|
print_log_messages('measures_update downloading %s from ASTRON server to %s ...' % (target, path), logger)
|
215
223
|
ftp.retrbinary('RETR ' + target, fid.write)
|
216
224
|
|
217
|
-
|
225
|
+
ftp.close()
|
218
226
|
|
219
227
|
# extract from the fetched tarfile
|
220
228
|
with tarfile.open(os.path.join(path,'measures.ztar'),mode='r:gz') as ztar:
|
@@ -17,9 +17,9 @@ this module will be included in the api
|
|
17
17
|
|
18
18
|
def pull_data(path=None, version=None, force=False, logger=None):
|
19
19
|
"""
|
20
|
-
Pull the
|
20
|
+
Pull the casarundata contents from the CASA host and install it in path.
|
21
21
|
|
22
|
-
The path must either contain a previously installed version of
|
22
|
+
The path must either contain a previously installed version of casarundata
|
23
23
|
or it must not exist or be empty.
|
24
24
|
|
25
25
|
If path is None then config.measurespath will be used.
|
@@ -36,7 +36,7 @@ def pull_data(path=None, version=None, force=False, logger=None):
|
|
36
36
|
version already matches what was previously installed (no installation is then
|
37
37
|
necessary unless force is True).
|
38
38
|
|
39
|
-
The measures tables included in
|
39
|
+
The measures tables included in casarundata will typically
|
40
40
|
not be the most recent version. To get the most recent measures data, measures_update
|
41
41
|
should be used after pull_data.
|
42
42
|
|
@@ -53,12 +53,12 @@ def pull_data(path=None, version=None, force=False, logger=None):
|
|
53
53
|
did not exit as expected and the contents of path are suspect. In that case, pull_data
|
54
54
|
will report that as an error and nothing will be updated. The lock file can be checked
|
55
55
|
to see the details of when that file was locked. The lock file can be removed and
|
56
|
-
pull_data can
|
56
|
+
pull_data can then be used to install the desired version. It may be safest in that case
|
57
57
|
to remove path completely or use a different path and run pull_data to install
|
58
58
|
a fresh copy of the desired version.
|
59
59
|
|
60
60
|
Some of the tables installed by pull_data are only read when casatools starts. Use of
|
61
|
-
pull_data
|
61
|
+
pull_data should typically be followed of CASA by a restart so that
|
62
62
|
any changes are seen by the tools and tasks that use this data.
|
63
63
|
|
64
64
|
Parameters
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: casaconfig
|
3
|
-
Version: 0.0.
|
3
|
+
Version: 0.0.71
|
4
4
|
Summary: CASA Operational Configuration Package
|
5
5
|
Home-page: https://github.com/casangi/casaconfig
|
6
6
|
Author: National Radio Astronomy Observatory
|
@@ -27,9 +27,9 @@ Description: # casaconfig
|
|
27
27
|
|
28
28
|
## Usage
|
29
29
|
|
30
|
-
|
31
|
-
|
32
|
-
|
30
|
+
CASA (modular and monolithic) does not come with any data. It must be populated
|
31
|
+
by calling ```pull_data()``` to download the tables. The default location is
|
32
|
+
```~/.casa/data```. The ```path``` argument can be used to populate a different location.
|
33
33
|
|
34
34
|
```python
|
35
35
|
from casaconfig import pull_data
|
@@ -37,37 +37,53 @@ Description: # casaconfig
|
|
37
37
|
```
|
38
38
|
|
39
39
|
Within this folder is a stale version of the IERS measures tables needed for accurate measurement.
|
40
|
-
Generally users will want to update to the latest measures data and keep current each day.
|
40
|
+
Generally users will want to update to the latest measures data and keep current each day.
|
41
41
|
|
42
42
|
```python
|
43
43
|
from casaconfig import measures_update
|
44
44
|
measures_update()
|
45
45
|
```
|
46
46
|
|
47
|
-
|
48
|
-
own local copy with any desired modifications.
|
47
|
+
The update_all function updates or installs the data and the latest measures tables.
|
49
48
|
|
50
49
|
```python
|
51
|
-
from casaconfig import
|
52
|
-
|
50
|
+
from casaconfig import update_all
|
51
|
+
update_all()
|
53
52
|
```
|
54
53
|
|
54
|
+
A default config.py necessary for CASA operation is included in this package. Users
|
55
|
+
provide their own config.py (default at ~/.casa/config.py) if they want to change
|
56
|
+
any of the default values (only the values they want to change need be provided in
|
57
|
+
that file).
|
58
|
+
|
59
|
+
The default config values are shown here (path's are expanded using expanduser and abspath).
|
60
|
+
|
55
61
|
```
|
56
62
|
$: cat ~/.casa/config.py
|
57
63
|
|
58
64
|
import os, time, pkg_resources
|
59
65
|
|
60
|
-
#
|
61
|
-
|
66
|
+
# location of geodetic and ephemera data, default path for casaconfig data functions
|
67
|
+
measurespath = "~/.casa/data"
|
68
|
+
|
69
|
+
# search path for measurement sets and images to load, when empty then [measurespath] is used
|
70
|
+
datapath = [ ]
|
62
71
|
|
63
|
-
#
|
64
|
-
|
72
|
+
# automatically update measures data if not current (measurespath must be owned by the user)
|
73
|
+
# when data_auto_update is True then measures_auto_update MUST also be True
|
74
|
+
measures_auto_update = True
|
65
75
|
|
66
|
-
# automatically update measures data if not current (measurespath must be user
|
67
|
-
|
76
|
+
# automatically update casarundata and measures data if not current (measurespath must be owned by the user)
|
77
|
+
data_auto_update = True
|
78
|
+
|
79
|
+
# location of the optional user's startup.py
|
80
|
+
startupfile = '~/.casa/startup.py'
|
81
|
+
|
82
|
+
# location of the cachedir
|
83
|
+
cachedir = '~/.casa'
|
68
84
|
|
69
85
|
# log file path/name
|
70
|
-
logfile='
|
86
|
+
logfile='casa-%s.log' % time.strftime("%Y-%m-%d", time.gmtime())
|
71
87
|
|
72
88
|
# do not create a log file when True, If True, then any logfile value is ignored and there is no log file
|
73
89
|
nologfile = False
|
@@ -83,7 +99,7 @@ Description: # casaconfig
|
|
83
99
|
|
84
100
|
# the IPython prompt color scheme. Must be one of "Neutral", "NoColor", "Linux" or "LightBG", default "Neutral"
|
85
101
|
# if an invalid color is given a warning message is printed and logged but CASA continues using the default color
|
86
|
-
colors = "
|
102
|
+
colors = "Neutral"
|
87
103
|
|
88
104
|
# startup without a graphical backend if True
|
89
105
|
agg = False
|
@@ -96,25 +112,7 @@ Description: # casaconfig
|
|
96
112
|
iplog = True
|
97
113
|
|
98
114
|
# IPython log path/name used when iplog is True
|
99
|
-
iplogfile = 'ipython-%s.log' % time.strftime("%Y-%m-%d", time.
|
100
|
-
|
101
|
-
# allow anonymous usage reporting
|
102
|
-
telemetry_enabled = True
|
103
|
-
|
104
|
-
# location to place telemetry data prior to reporting
|
105
|
-
telemetry_log_directory = os.path.expanduser("~/.casa/telemetry")
|
106
|
-
|
107
|
-
# maximum size of telemetry recording
|
108
|
-
telemetry_log_limit = 1650
|
109
|
-
|
110
|
-
# telemetry recording size that triggers a report
|
111
|
-
telemetry_log_size_interval = 30
|
112
|
-
|
113
|
-
# telemetry recording report frequency
|
114
|
-
telemetry_submit_interval = 20
|
115
|
-
|
116
|
-
# allow anonymous crash reporting
|
117
|
-
crashreporter_enabled = True
|
115
|
+
iplogfile = 'ipython-%s.log' % time.strftime("%Y-%m-%d", time.gmtime())
|
118
116
|
|
119
117
|
# include the users local site-packages in the python path if True.
|
120
118
|
# normally these are excluded to avoid any conflicts with CASA modules
|
@@ -6,7 +6,7 @@ with open('README.md', "r") as fid: #encoding='utf-8'
|
|
6
6
|
|
7
7
|
setup(
|
8
8
|
name='casaconfig',
|
9
|
-
version='0.0.
|
9
|
+
version='0.0.71',
|
10
10
|
description='CASA Operational Configuration Package',
|
11
11
|
long_description=long_description,
|
12
12
|
long_description_content_type="text/markdown",
|
@@ -1,20 +0,0 @@
|
|
1
|
-
def get_config( default=False ):
|
2
|
-
"""
|
3
|
-
Get configuration values as strings which can be logged, stored or evaluated.
|
4
|
-
|
5
|
-
The default values (returned with default is True) are the config values after all config files have been evaluated but before the path values have been expanded using os.path.expanduser and os.path.abspath. Modules that use the command line to change config values may also not update the default values. User actions in a CASA session will also typically not change the default values.
|
6
|
-
|
7
|
-
Parameters
|
8
|
-
default (bool=False) - If True, return the default values.
|
9
|
-
|
10
|
-
Returns
|
11
|
-
list[str] - list of configuration strings
|
12
|
-
"""
|
13
|
-
|
14
|
-
from .. import config as _config
|
15
|
-
if not default :
|
16
|
-
valsObj = _config
|
17
|
-
else:
|
18
|
-
valsObj = _config._config_defaults
|
19
|
-
|
20
|
-
return list( map( lambda name: f'{name} = {repr(getattr(valsObj,name))}', _config.__defaults ) )
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|