Package: slycat-web-client
Slycat Web ClientThe Slycat web client provides a Python package for interacting with the Slycat web server.Slycat is a web based data analysis and visualization platform created at Sandia
National Labs.  You can read about it athttps://slycat.readthedocs.io/en/latest/.
Slycat is open source and can be downloaded fromhttps://github.com/sandialabs/slycat.The Slycat web client provides a Python package which can be used
to interact with the Slycat web server.  The web client provides Python routines
to query the Slycat server and create Slycat data analysis models.Installationpipinstallslycat-web-clientIf you are working behind a proxy, you might also need, e.g.pipinstallslycat-web-client--proxyyour-proxy:your-portIf you are getting SSL certificate errors, you can use:pipinstallslycat-web-client--trusted-hostpypi.org--trusted-hostfiles.pythonhosted.orgBe aware that the last option is insecure.  The better approach is to
fix your SSL certificate and/or point Python to a copy of the certificate.
This can be done using:pipconfigsetglobal.certpath-to-your-certificateNote: that for the Slycat web client to work, you must have a Slycat server running.Seehttps://slycat.readthedocs.io/en/latest/for details on setting up a server.Basic UseThe Slycat web client can be imported from within a Python file usingimport slycat.web.clientSome examples using the web client can be found in the slycat/web/client
source directory.  These can be run using, e.g.$pythonlist_markings.pyor$python-mslycat.web.client.list_markingsIn addition, there are two main entry points defined for the Slycat Dial-A-Cluster plugin$dac_tdmsand$dac_genThese are described in greater detail below.User AuthenticationThe Slycat server requires user authentication.  The slycat.web.client
module provides the options for the authentication process.For example, to use standard password authentication for a Slycat
server running onhttps://localhost:9000without a security certificate,
use:$python-mslycat.web.client.list_markings.py--userslycat--port9000--no-verifyOr, to access a Kerberos authenticated server running at slycat.sandia.gov,
use:$python-mslycat.web.client.list_markings.py--hosthttps://slycat.sandia.gov--kerberosKerberosThe --kerberos option relies on a working Kerberos installation on your system.  Sometimes
this will fail.  If you get an error related to Kerberos credentials (e.g. "Couldn't find
Kerberos ticket," or "User not Kerberos authenticated"), try:$kinitThen re-run the original command.Proxies/CertificatesIf you are separated from the Slycat server by a proxy, or have not set up a security
certificate, you will have to use the slycat.web.client proxy settings.  The proxy
settings are available using the flags:--http-proxy--https-proxy--verify--no-verifyThe proxy flags are by default set to "no proxy".  If you have proxies set in the
environment variables, they will be ignored.  The proxy flags are used as follows
(for example):$python-mslycat.web.client.list_markings.py--http-proxyhttp://your.http.proxy--https-proxyhttps://your.https.proxyThe verify flag can be used to pass a security certificate as a command line argument and
the --no-verify flag can be used to ignore the security certificates altogether.General UtilitiesThe simplest examples of interacting with the Slycat server issue
requests for markings and projects, e.g.$python-mslycat.web.client.list_markings.py
$python-mslcyat.web.client.list_projects.pyTo examine a particular model or project, use$python-mslycat.web.client.get_model.pymid
$python-mslycat.web.client.get_project.pypidwhere mid and pid are the hash identifiers for a Slycat model
or project residing on the Slycat server.  These IDs can be extracted
from the URL in the Slycat web browser client, or by using
Info -> Model Details from the browser.Creating ModelsThe slycat.web.client provides a command line option for creating Slycat
models.  For example, to create a sample CCA model using random data, use:$python-mslycat.web.client.cca_random.pyTo create a sample CCA model from a CSV file, use:$python-mslycat.web.client.cca_csv.pyslycat-data/cars.csv--inputCylindersDisplacementWeightYear--outputMPGHorsepowerAccelerationwhere "slycat-data/cars.csv" is from the slycat-data git repository athttps://github.com/sandialabs/slycat-data.Note that when a model is created, the URL is given in the console and
can be copied into a web browser to display the model.  The model ID
can also be extracted from this URL (it is the hash at the end of the URL).Dial-A-Cluster (DAC) ModelsDial-A-Cluster models can be loaded using different formats.  The first
format is the generic dial-a-cluster format, described more fully in
the Slycat user manual.To upload a DAC generic .zip file, use$dac_gendac-gen.zipThis will create a model from a single .zip file containing the appropriate
folders with the pre-computed distance or PCA matrices.Dial-A-Cluster TDMS ModelsTo upload a DAC TDMS model, use$dac_tdmsdata-file.TDMThis will create a model from a single .TDM file.  You can also use .TDMS
files and .zip archives containing .tdms files.  The options available
for the creation of the models are the same as the options available using
the DAC model creation wizard in the browser.  To see the options use
the "--help" flag when calling the script.In addition, there are two methods for uploading batches of multiple DAC
TDMS models.  The first method uses the dac_tdms_batch script.  This script
takes as input a part-num match (see also dac_run_chart) and creates
the corresponding batches.  For example,$dac_tdms_batchroot-data-directorypart-numThe second method uses the dac_tdms_batch_file script.  To use this script,
you must first create a file containing the options for each model.  The file
has the following format.Line 1 contains the authentication information for the Slycat server that
you would pass to the dac_tdms script, but separated by commas.
For example,--user,user-name,--kerberosIf authentication information is unnecessary, just leave the line blank.Line 2 contains the project information for the project that will contain
the DAC models to be created, e.g.--project-name,Batch TDMS ModelsLine 2 can also be left blank.  It will default to "Batch TDMS Models".
Lines 3 and beyond contain the model information for each model, such asmodel-data-file-1.tdms,--model-name,Model 1,--project-name,Batch TDMS Models
model-data-file-2.tdms,--model-name,Model 2,--project-name,Batch TDMS ModelsNote that you must supply a model file (or multiple files) in accordance
with the dac_tdms script for each model.  Also note that if
you want to put models into different projects, you can override the
original project given in line 2, by using the "--project-name" flag
again, e.g.model-data-file-n.tdms,--model-name,Model n,--project-name,Special ProjectAfter the batch file has been created, you can call the TDMS batch
processor to create your models using:$dac_tdms_batchtdms-batch-file.txtwhere tdms-batch-file.txt is the .txt file containing the lines just
described.Depending on how many models are being created, it is helpful to
use the "--log_file" flag to specify a log file for recording any
errors in the upload process.Dial-A-Cluster Run Chart ModelsTo create Dial-A-Cluster run chart model, use the dac_run_chart.py script.
From the command line:$python-mslycat.web.client.dac_run_chartroot-data-directorypart-numrun-charts.zipwhere root-data-directory is the root directory containing the data directories
indexed by part number, and part-num is the prefix for the data directories and
associated structure of sub directories.  By specifying the (mandatory) output zip file you
get a .zip file that can be loaded into dial-a-cluster through the wizard (or the dac_gen
script).  You can later delete this file if it is not needed.Parameter Space ModelsA Paraneter Space model can be created from .csv file using the
ps_csv script.  From the command line, use:$python-mslycat.web.client.ps_csvslycat-data/cars.csv--input-columnsCylindersDisplacementWeightYear--output-columnsMPGHorsepowerAccelerationTo push up a .csv file from a python script, use the slycat-web-client
module.  For example:import slycat.web.client.ps_csv as ps_csv

# parameter space file
CARS_FILE = ['../../slycat-data/cars.csv']

# input/output columns for cars data file
CARS_INPUT = ['--input-columns', 'Model', 'Cylinders', 'Displacement', 'Weight', 'Year']
CARS_OUTPUT = ['--output-columns', 'MPG', 'Horsepower', 'Acceleration']

# create PS model from cars file
ps_parser = ps_csv.parser()
arguments = ps_parser.parse_args(CARS_FILE + CARS_INPUT + CARS_OUTPUT)
ps_csv.create_model(arguments, ps_csv.log)APIYou should be able to find the API for slycat.web.client athttps://slycat.readthedocs.io/en/latest/.ContactShawn Martin --smartin@sandia.govDistributed under the Sandia license. See LICENSE file for more information.