Skip to content

Cinema Debye Scherrer

Daniel Savage edited this page Jun 4, 2023 · 6 revisions

This tutorial is an introduction to Cinema: Debye-Scherrer.

Step 1 - Cinema default example

Launching Cinema

If you haven't already, go to the git repository for Cinema: Debye-Scherrer and clone to your favorite directory.

To get the example packaged with cinema running, navigate to the installation directory, open a terminal and serve a http server.

python -m http.server

With the server running open a internet browser tab and enter: """http://localhost:8000/main.html""". Note that the correct port is displayed when launching the python http server.

image

You should see something like the following in the browser: image

Cinema database configuration

The cinema database formating is a csv file collecting file references (to pngs) and metadata (strings, ints, floats). Each column is a key which shows up in the parallel plot.

image

The database tabs are configured in the cinema installation preference database.json. The json points to the folder containing the data.csv and allows options like filtering out certain keys from being displayed in the parallel plot by default.

[
        {
                "name" : "Example (Test Highlight)",
                "directory" : "data/example.cdb",
                "picked" : [1, 3],
                "smoothLines" : true,
                "lineOpacity" : 1.0
        },
        {
                "name" : "Example (Test Filter and Logscale)",
                "directory" : "data/example.cdb",
                "filter" : "BaBrCl|File|FILE",
                "logscale" : "Temp \\[C\\]",
                "smoothLines" : true,
                "lineOpacity" : 1.0
        },
        {
                "name" : "Example (Test Expression)",
                "directory" : "data/example.cdb",
                "filter" : "^((?!CHISQ|PF6).)*$",
                "smoothLines" : true,
                "lineOpacity" : 1.0
        },
        {
                "name" : "Example (Display All)",
                "directory" : "data/example.cdb",
                "smoothLines" : true,
                "lineOpacity" : 1.0
        }
]

Step 2 - Serving the MILK data.csv

After you have set CINEMA_PATH to your installation of the CINEMA: Debye Scherrer using milk-config, you can use the MILK conda environment to serve any data.csv file by calling

milk-cinema

from the folder containing the data.csv. There are a number of options which can be displayed with milk-cinema -h.

% milk-cinema -h
usage: milk-cinema [-h] [-cinema_path CINEMA_PATH] [-data_path DATA_PATH] [-serve_path SERVE_PATH] [-port PORT] [-ip IP]
                   [-databases_index DATABASES_INDEX] [-databases_name DATABASES_NAME] [-run_server RUN_SERVER]
                   [-open_browser OPEN_BROWSER] [-local_cinema LOCAL_CINEMA]

Launch CINEMA viewing session.

optional arguments:
  -h, --help            show this help message and exit
  -cinema_path CINEMA_PATH
                        Installation path of Cinema:debye-scherrer.
  -data_path DATA_PATH  Directory containing data.csv.
  -serve_path SERVE_PATH
                        Both cinema and data path must be a child of serve_path.
  -port PORT            Port number to serve on.
  -ip IP                IP to serve on.
  -databases_index DATABASES_INDEX
                        Specifies database index in databases.json that will have its directory overwritten.
  -databases_name DATABASES_NAME
                        Name in CINEMA databases.json.
  -run_server RUN_SERVER
                        Run server at end of script.
  -open_browser OPEN_BROWSER
                        Open url in browser.
  -local_cinema LOCAL_CINEMA
                        Run cinema from data_path.

By default milk-cinema will copy the cinema installation to the data.csv parent directory and serve a http server from that directory to avoid accidentally serving your entire user directory over http (security issue!). If you structure your installation right, you can use the -local_cinema option to avoid the copy.

MILK automatically configures the database and launches the browser by default.

For the XRD-Sequential-Multiphase-Tutorial you should see in the browser something like image

Tips and Tricks

If you change the key sets in the data.csv you may need to clear the cinema cache in the browser for them to load. On Mac Safari you can clear the cache with option+cmd+e and reload with cmd+r. When in doubt why your cinema isn't working as expect, clear the cache.

The cool thing with http is that anybody on your network can access the server and interact with the Rietveld data. This also means, be careful what you serve over http. The simple http server is not meant to be a production server. The local call to cinema will only serve the data.csv directory and its subdirectories e.g. image

Clone this wiki locally