slypi 1.0.0__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.
slypi-1.0.0/LICENSE ADDED
@@ -0,0 +1,28 @@
1
+ The following license applies to the Slycat software:
2
+
3
+ Copyright 2013, 2018 National Technology & Engineering Solutions of
4
+ Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with NTESS,
5
+ the U.S. Government retains certain rights in this software.
6
+
7
+ Redistribution and use in source and binary forms, with or without
8
+ modification, are permitted provided that the following conditions are met:
9
+ * Redistributions of source code must retain the above copyright
10
+ notice, this list of conditions and the following disclaimer.
11
+ * Redistributions in binary form must reproduce the above copyright
12
+ notice, this list of conditions and the following disclaimer in the
13
+ documentation and/or other materials provided with the distribution.
14
+ * Neither the name of Sandia Corporation nor the
15
+ names of its contributors may be used to endorse or promote products
16
+ derived from this software without specific prior written permission.
17
+
18
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
19
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21
+ DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION BE LIABLE FOR ANY
22
+ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
+
slypi-1.0.0/PKG-INFO ADDED
@@ -0,0 +1,233 @@
1
+ Metadata-Version: 2.1
2
+ Name: slypi
3
+ Version: 1.0.0
4
+ Summary: Slycat python interface utilties for interacting with the Slycat data analysis and visualization server.
5
+ Home-page: https://github.com/sandialabs/slycat
6
+ Author: Shawn Martin
7
+ Author-email: smartin@sandia.gov
8
+ License: Sandia
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: Programming Language :: Python :: 3.11
11
+ Description-Content-Type: text/markdown
12
+ License-File: LICENSE
13
+ Requires-Dist: requests
14
+ Requires-Dist: requests-kerberos
15
+ Requires-Dist: numpy
16
+ Requires-Dist: scikit-learn
17
+ Requires-Dist: pandas
18
+ Requires-Dist: meshio
19
+ Requires-Dist: imageio[ffmpeg]
20
+ Requires-Dist: matplotlib
21
+ Requires-Dist: ipyparallel
22
+ Requires-Dist: torch
23
+ Requires-Dist: umap-learn
24
+ Requires-Dist: pymks
25
+
26
+ ## SlyPI
27
+ Python Interface for Slycat.
28
+
29
+ ## Description
30
+ Slycat is a web application for interactive visualization of ensemble data (see https://github.com/sandialabs/slycat and https://slycat.readthedocs.io/en/latest). The SlyPI project contains code that enables you to interact with the Slycat web server through a Python interface. You can query the Slycat server, create Slycat models, and use the code to integrate your own algorithms into the Slycat pipeline.
31
+
32
+ ## Documentation
33
+
34
+ Full documentation can be found in the docs folder and can be compiled using Sphinx using
35
+
36
+ ```sh
37
+ $ make html
38
+ ```
39
+
40
+ The resulting documention can be accessed under build from the file index.html.
41
+
42
+ ## Installation
43
+ This code is available at https://pypi.org/projects/slypi and can be installed using
44
+
45
+ ```sh
46
+ $ pip install slypi
47
+ ```
48
+
49
+ If you are working behind a proxy, you might also need, e.g.
50
+
51
+ ```sh
52
+ pip install slypi --proxy your-proxy:your-port
53
+ ```
54
+
55
+ If you are getting SSL certificate errors, you can use:
56
+
57
+ ```sh
58
+ pip install slypi --trusted-host pypi.org --trusted-host files.pythonhosted.org
59
+ ```
60
+
61
+ Be aware that the last option is insecure. The better approach is to
62
+ fix your SSL certificate and/or point Python to a copy of the certificate.
63
+ This can be done using:
64
+
65
+ ```sh
66
+ pip config set global.cert path-to-your-certificate
67
+ ```
68
+
69
+ You can also install locally from this repository using:
70
+
71
+ ```sh
72
+ pip install -e slypi .
73
+ ```
74
+
75
+ Note: that for SlyPI to work, you must have a Slycat server running.
76
+ See https://slycat.readthedocs.io/en/latest/ for details on setting up a server.
77
+
78
+ ## Basic Use
79
+
80
+ SlyPI can be imported from within a Python file using
81
+
82
+ import slypi
83
+
84
+ Some examples using SlyPI can be found in the SlyPI
85
+ source directory. These can be run using, e.g.
86
+
87
+ ```sh
88
+ $ python -m slypi.util.list_markings
89
+ ```
90
+
91
+ In addition, there are two main entry points defined, one for the Slycat Dial-A-Cluster model
92
+
93
+ ```sh
94
+ $ dac_upload_gen
95
+ ```
96
+ and one for the parameter space model
97
+
98
+ ```sh
99
+ $ ps_upload_csv
100
+ ```
101
+
102
+ ## Kerberos
103
+
104
+ The --kerberos option relies on a working Kerberos installation on your system. Sometimes
105
+ this will fail. If you get an error related to Kerberos credentials (e.g. "Couldn't find
106
+ Kerberos ticket," or "User not Kerberos authenticated"), try:
107
+
108
+ ```sh
109
+ $ kinit
110
+ ```
111
+
112
+ Then re-run the original command.
113
+
114
+ ## Proxies/Certificates
115
+
116
+ If you are separated from the Slycat server by a proxy, or have not set up a security
117
+ certificate, you will have to use the SlyPI proxy settings. The proxy
118
+ settings are available using the flags:
119
+
120
+ * --http-proxy
121
+ * --https-proxy
122
+ * --verify
123
+ * --no-verify
124
+
125
+ The proxy flags are by default set to "no proxy". If you have proxies set in the
126
+ environment variables, they will be ignored. The proxy flags are used as follows
127
+ (for example):
128
+
129
+ ```sh
130
+ $ python -m slypi.list_markings.py --http-proxy http://your.http.proxy --https-proxy https://your.https.proxy
131
+ ```
132
+
133
+ The verify flag can be used to pass a security certificate as a command line argument and
134
+ the --no-verify flag can be used to ignore the security certificates altogether.
135
+
136
+ ## General Utilities
137
+
138
+ The simplest examples of interacting with the Slycat server issue
139
+ requests for markings and projects, e.g.
140
+
141
+ ```sh
142
+ $ python -m slypi.util.list_markings.py
143
+ $ python -m slypi.util.list_projects.py
144
+ ```
145
+
146
+ To examine a particular model or project, use
147
+
148
+ ```sh
149
+ $ python -m slypi.util.get_model.py mid
150
+ $ python -m slypi.util.get_project.py pid
151
+ ```
152
+
153
+ where mid and pid are the hash identifiers for a Slycat model
154
+ or project residing on the Slycat server. These IDs can be extracted
155
+ from the URL in the Slycat web browser client, or by using
156
+ Info -> Model Details from the browser.
157
+
158
+ ## Creating Models
159
+
160
+ The SlyPI module provides a command line option for creating Slycat
161
+ models. For example, to create a sample CCA model using random data, use:
162
+
163
+ ```sh
164
+ $ python -m slypi.cca.upload_random.py
165
+ ```
166
+
167
+ To create a sample CCA model from a CSV file, use:
168
+
169
+ ```sh
170
+ $ python -m slypi.cca.upload_csv.py slycat-data/cars.csv --input Cylinders Displacement Weight Year --output MPG Horsepower Acceleration --project-name "CCA Models"
171
+ ```
172
+
173
+ where "slycat-data/cars.csv" is from the slycat-data git repository at
174
+ https://github.com/sandialabs/slycat-data.
175
+
176
+ Note that when a model is created, the URL is given in the console and
177
+ can be copied into a web browser to display the model. The model ID
178
+ can also be extracted from this URL (it is the hash at the end of the URL).
179
+
180
+ ## Parameter Space Models
181
+
182
+ SlyPI also provides a programmatic interface for creating models. To create
183
+ a Parameter Space model from a python script, use the SlyPI module as follows:
184
+
185
+ ```{python}
186
+ import slypi.ps.upload_csv as ps_upload_csv
187
+
188
+ # parameter space file
189
+ CARS_FILE = ['../slycat-data/cars.csv']
190
+
191
+ # input/output columns for cars data file
192
+ CARS_INPUT = ['--input-columns', 'Model', 'Cylinders', 'Displacement', 'Weight', 'Year']
193
+ CARS_OUTPUT = ['--output-columns', 'MPG', 'Horsepower', 'Acceleration']
194
+
195
+ # create PS model from cars file
196
+ ps_parser = ps_upload_csv.parser()
197
+ arguments = ps_parser.parse_args(CARS_FILE + CARS_INPUT + CARS_OUTPUT)
198
+ ps_upload_csv.create_model(arguments, ps_upload_csv.log)
199
+
200
+ ```
201
+
202
+ A Parameter Space model can also be created from .csv file using the
203
+ ps_csv script. From the command line, use:
204
+
205
+ ```sh
206
+ $ python -m slypi.ps.upload_csv slycat-data/cars.csv --input-columns Cylinders Displacement Weight Year --output-columns MPG Horsepower Acceleration --project-name "PS Models"
207
+ ```
208
+
209
+ ## Dial-A-Cluster (DAC) Models
210
+
211
+ Dial-A-Cluster models can be loaded using different formats. The first
212
+ format is the generic dial-a-cluster format, described more fully in
213
+ the Slycat user manual.
214
+
215
+ To upload a DAC generic .zip file, use
216
+
217
+ ```sh
218
+ $ dac_upload_gen slycat-data/dial-a-clsuter/weather-dac-gen.zip --project-name "DAC Models"
219
+ ```
220
+
221
+ This will create a model from a single .zip file containing the appropriate
222
+ folders with the pre-computed distance or PCA matrices.
223
+
224
+ ## Other Models
225
+
226
+ Currently, SlyPI supports Slycat CCA and Videoswarm models. The only Slycat model type
227
+ still unsupported is Time Series. For examples using CCA and Videoswarm, see the full documentation.
228
+
229
+ ## Contact
230
+ Shawn Martin -- smartin@sandia.gov
231
+
232
+ ## License
233
+ Distributed under the Sandia license. See LICENSE file for more information.
slypi-1.0.0/README.md ADDED
@@ -0,0 +1,208 @@
1
+ ## SlyPI
2
+ Python Interface for Slycat.
3
+
4
+ ## Description
5
+ Slycat is a web application for interactive visualization of ensemble data (see https://github.com/sandialabs/slycat and https://slycat.readthedocs.io/en/latest). The SlyPI project contains code that enables you to interact with the Slycat web server through a Python interface. You can query the Slycat server, create Slycat models, and use the code to integrate your own algorithms into the Slycat pipeline.
6
+
7
+ ## Documentation
8
+
9
+ Full documentation can be found in the docs folder and can be compiled using Sphinx using
10
+
11
+ ```sh
12
+ $ make html
13
+ ```
14
+
15
+ The resulting documention can be accessed under build from the file index.html.
16
+
17
+ ## Installation
18
+ This code is available at https://pypi.org/projects/slypi and can be installed using
19
+
20
+ ```sh
21
+ $ pip install slypi
22
+ ```
23
+
24
+ If you are working behind a proxy, you might also need, e.g.
25
+
26
+ ```sh
27
+ pip install slypi --proxy your-proxy:your-port
28
+ ```
29
+
30
+ If you are getting SSL certificate errors, you can use:
31
+
32
+ ```sh
33
+ pip install slypi --trusted-host pypi.org --trusted-host files.pythonhosted.org
34
+ ```
35
+
36
+ Be aware that the last option is insecure. The better approach is to
37
+ fix your SSL certificate and/or point Python to a copy of the certificate.
38
+ This can be done using:
39
+
40
+ ```sh
41
+ pip config set global.cert path-to-your-certificate
42
+ ```
43
+
44
+ You can also install locally from this repository using:
45
+
46
+ ```sh
47
+ pip install -e slypi .
48
+ ```
49
+
50
+ Note: that for SlyPI to work, you must have a Slycat server running.
51
+ See https://slycat.readthedocs.io/en/latest/ for details on setting up a server.
52
+
53
+ ## Basic Use
54
+
55
+ SlyPI can be imported from within a Python file using
56
+
57
+ import slypi
58
+
59
+ Some examples using SlyPI can be found in the SlyPI
60
+ source directory. These can be run using, e.g.
61
+
62
+ ```sh
63
+ $ python -m slypi.util.list_markings
64
+ ```
65
+
66
+ In addition, there are two main entry points defined, one for the Slycat Dial-A-Cluster model
67
+
68
+ ```sh
69
+ $ dac_upload_gen
70
+ ```
71
+ and one for the parameter space model
72
+
73
+ ```sh
74
+ $ ps_upload_csv
75
+ ```
76
+
77
+ ## Kerberos
78
+
79
+ The --kerberos option relies on a working Kerberos installation on your system. Sometimes
80
+ this will fail. If you get an error related to Kerberos credentials (e.g. "Couldn't find
81
+ Kerberos ticket," or "User not Kerberos authenticated"), try:
82
+
83
+ ```sh
84
+ $ kinit
85
+ ```
86
+
87
+ Then re-run the original command.
88
+
89
+ ## Proxies/Certificates
90
+
91
+ If you are separated from the Slycat server by a proxy, or have not set up a security
92
+ certificate, you will have to use the SlyPI proxy settings. The proxy
93
+ settings are available using the flags:
94
+
95
+ * --http-proxy
96
+ * --https-proxy
97
+ * --verify
98
+ * --no-verify
99
+
100
+ The proxy flags are by default set to "no proxy". If you have proxies set in the
101
+ environment variables, they will be ignored. The proxy flags are used as follows
102
+ (for example):
103
+
104
+ ```sh
105
+ $ python -m slypi.list_markings.py --http-proxy http://your.http.proxy --https-proxy https://your.https.proxy
106
+ ```
107
+
108
+ The verify flag can be used to pass a security certificate as a command line argument and
109
+ the --no-verify flag can be used to ignore the security certificates altogether.
110
+
111
+ ## General Utilities
112
+
113
+ The simplest examples of interacting with the Slycat server issue
114
+ requests for markings and projects, e.g.
115
+
116
+ ```sh
117
+ $ python -m slypi.util.list_markings.py
118
+ $ python -m slypi.util.list_projects.py
119
+ ```
120
+
121
+ To examine a particular model or project, use
122
+
123
+ ```sh
124
+ $ python -m slypi.util.get_model.py mid
125
+ $ python -m slypi.util.get_project.py pid
126
+ ```
127
+
128
+ where mid and pid are the hash identifiers for a Slycat model
129
+ or project residing on the Slycat server. These IDs can be extracted
130
+ from the URL in the Slycat web browser client, or by using
131
+ Info -> Model Details from the browser.
132
+
133
+ ## Creating Models
134
+
135
+ The SlyPI module provides a command line option for creating Slycat
136
+ models. For example, to create a sample CCA model using random data, use:
137
+
138
+ ```sh
139
+ $ python -m slypi.cca.upload_random.py
140
+ ```
141
+
142
+ To create a sample CCA model from a CSV file, use:
143
+
144
+ ```sh
145
+ $ python -m slypi.cca.upload_csv.py slycat-data/cars.csv --input Cylinders Displacement Weight Year --output MPG Horsepower Acceleration --project-name "CCA Models"
146
+ ```
147
+
148
+ where "slycat-data/cars.csv" is from the slycat-data git repository at
149
+ https://github.com/sandialabs/slycat-data.
150
+
151
+ Note that when a model is created, the URL is given in the console and
152
+ can be copied into a web browser to display the model. The model ID
153
+ can also be extracted from this URL (it is the hash at the end of the URL).
154
+
155
+ ## Parameter Space Models
156
+
157
+ SlyPI also provides a programmatic interface for creating models. To create
158
+ a Parameter Space model from a python script, use the SlyPI module as follows:
159
+
160
+ ```{python}
161
+ import slypi.ps.upload_csv as ps_upload_csv
162
+
163
+ # parameter space file
164
+ CARS_FILE = ['../slycat-data/cars.csv']
165
+
166
+ # input/output columns for cars data file
167
+ CARS_INPUT = ['--input-columns', 'Model', 'Cylinders', 'Displacement', 'Weight', 'Year']
168
+ CARS_OUTPUT = ['--output-columns', 'MPG', 'Horsepower', 'Acceleration']
169
+
170
+ # create PS model from cars file
171
+ ps_parser = ps_upload_csv.parser()
172
+ arguments = ps_parser.parse_args(CARS_FILE + CARS_INPUT + CARS_OUTPUT)
173
+ ps_upload_csv.create_model(arguments, ps_upload_csv.log)
174
+
175
+ ```
176
+
177
+ A Parameter Space model can also be created from .csv file using the
178
+ ps_csv script. From the command line, use:
179
+
180
+ ```sh
181
+ $ python -m slypi.ps.upload_csv slycat-data/cars.csv --input-columns Cylinders Displacement Weight Year --output-columns MPG Horsepower Acceleration --project-name "PS Models"
182
+ ```
183
+
184
+ ## Dial-A-Cluster (DAC) Models
185
+
186
+ Dial-A-Cluster models can be loaded using different formats. The first
187
+ format is the generic dial-a-cluster format, described more fully in
188
+ the Slycat user manual.
189
+
190
+ To upload a DAC generic .zip file, use
191
+
192
+ ```sh
193
+ $ dac_upload_gen slycat-data/dial-a-clsuter/weather-dac-gen.zip --project-name "DAC Models"
194
+ ```
195
+
196
+ This will create a model from a single .zip file containing the appropriate
197
+ folders with the pre-computed distance or PCA matrices.
198
+
199
+ ## Other Models
200
+
201
+ Currently, SlyPI supports Slycat CCA and Videoswarm models. The only Slycat model type
202
+ still unsupported is Time Series. For examples using CCA and Videoswarm, see the full documentation.
203
+
204
+ ## Contact
205
+ Shawn Martin -- smartin@sandia.gov
206
+
207
+ ## License
208
+ Distributed under the Sandia license. See LICENSE file for more information.
slypi-1.0.0/setup.cfg ADDED
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
slypi-1.0.0/setup.py ADDED
@@ -0,0 +1,94 @@
1
+ # Copyright (c) 2013, 2018 National Technology and Engineering Solutions of Sandia, LLC.
2
+ # Under the terms of Contract DE-NA0003525 with National Technology and Engineering
3
+ # Solutions of Sandia, LLC, the U.S. Government retains certain rights in this software.
4
+
5
+ # This script creates a Python distribution wheel for the Slycat python interface,
6
+ # now called slypi, formerly called slycat-web-client. When run, it copies the latest
7
+ # version of the slycat/web/client files (from the slycat repo) into slypi directory
8
+ # (see note below) before it constructs the pip installable module.
9
+ #
10
+ # NOTE: You need to have the slycat directory (from github) available as ../slycat
11
+ # in order to run the setup.py file (see additional note below).
12
+ #
13
+ # S. Martin
14
+ # 11/9/2023
15
+
16
+ # To publish to PyPi, perform the following steps:
17
+ #
18
+ # $ rm -rf dist
19
+ # $ python setup.py sdist bdist_wheel
20
+ # $ twine upload dist/*
21
+ #
22
+ # To publish to testpypi, use:
23
+ #
24
+ # $ twine upload --repository-url https://test.pypi.org/legacy/ dist/*
25
+ #
26
+ # The first step builds the distribution, and the second step
27
+ # uploads to PyPi. To install the package from another computer use:
28
+ #
29
+ # $ pip install slpyi
30
+ #
31
+ # To install from testpypi, use:
32
+ #
33
+ # $ pip install --extra-index-url https://testpypi.python.org/pypi slpyi
34
+ # --upgrade --trusted-host testpypi.python.org --proxy wwwproxy.sandia.gov:80
35
+ #
36
+ # To install locally, use (from this directory):
37
+ #
38
+ # $ pip install -e .
39
+
40
+ from shutil import copyfile
41
+
42
+ # copy slycat.darray and slycat csv parser code into slypi directory. This
43
+ # makes slypi a Python package without other Slycat dependencies.
44
+ copyfile('../slycat/packages/slycat/darray.py', 'slypi/darray.py')
45
+ copyfile('../slycat/packages/slycat/pandas_util.py', 'slypi/pandas_util.py')
46
+ copyfile('../slycat/web-server/plugins/slycat-video-swarm/vs-parse-files.py', 'slypi/vs/vs_parse_files.py')
47
+
48
+ import slypi
49
+ VERSION = slypi.__version__
50
+
51
+ # get README.md
52
+ import pathlib
53
+
54
+ # directory containing this file
55
+ HERE = pathlib.Path(__file__).parent
56
+
57
+ # text of the web-client-readme.txt file
58
+ README = (HERE / "README.md").read_text()
59
+
60
+ # create distribution
61
+ import setuptools
62
+
63
+ # create Python distribution wheel
64
+ from setuptools import setup
65
+
66
+ setup(
67
+ name="slypi",
68
+ version=VERSION,
69
+ description="Slycat python interface utilties for interacting with the Slycat " +
70
+ "data analysis and visualization server.",
71
+ long_description=README,
72
+ long_description_content_type="text/markdown",
73
+ url="https://github.com/sandialabs/slycat",
74
+ author="Shawn Martin",
75
+ author_email="smartin@sandia.gov",
76
+ license="Sandia",
77
+ classifiers=[
78
+ "Programming Language :: Python :: 3",
79
+ "Programming Language :: Python :: 3.11",
80
+ ],
81
+ packages=setuptools.find_packages(),
82
+ include_package_data=True,
83
+ install_requires=["requests", "requests-kerberos",
84
+ "numpy", "scikit-learn",
85
+ "pandas", "meshio", "imageio[ffmpeg]",
86
+ "matplotlib", "ipyparallel",
87
+ "torch", "umap-learn", "pymks"],
88
+ entry_points={
89
+ "console_scripts": [
90
+ "ps_upload_csv=slypi.ps.upload_csv:main",
91
+ "dac_upload_gen=slycat.dac.upload_gen:main"
92
+ ]
93
+ },
94
+ )