Differences between revisions 9 and 11 (spanning 2 versions)
Revision 9 as of 2010-03-31 21:58:26
Size: 3933
Editor: root
Comment:
Revision 11 as of 2010-03-31 22:06:00
Size: 4749
Editor: root
Comment:
Deletions are marked like this. Additions are marked like this.
Line 3: Line 3:
emen2client.py serves two functions.

1. Contains a number of classes that are useful in building EMEN2 client applications. It is used by other programs, such as EMDash. See [[EMEN2/API]] and [[EMEN2/API/emen2client.py]] for details.

2. Provides a simple command-line interface for bulk upload and download from the database.

This page documents how to use emen2client.py for upload and download.
Line 4: Line 12:
Line 9: Line 16:

emen2client.py --help
Line 18: Line 23:
emen2client.py download --help == Download Usage ==
Line 44: Line 49:
Example:

{{{
[irees@mbp ~/data]$ emen2client.py download 123456

Username: ianrees
Password:

1 of 1: 404229
 Checking for items to download
 Found 92 items in 93 records

 1 of 92: 2009110400033
  Downloading frame1.dm3.gz -> frame1.dm3...

 2 of 92: 2009110400032
  Downloading frame2.dm3.gz -> frame2.dm3...

 3 of 92: 2009110400031
  Downloading frame3.dm3.gz -> frame3.dm3...

.... snip ....
 
}}}

== Upload Usage ==
Line 49: Line 81:
  Record type can be any valid database protocol.
  Some record types have special, application-specific handlers, e.g.:
  
  ccd CCD Frames
  scan Scanned micrographs
   stack Tomograms
 Record type can be any valid database protocol.
 Some record types have special, application-specific handlers, e.g.:
 
  ccd CCD Frames
  scan Scanned micrographs
  stack Tomograms
Line 56: Line 88:
  Other values, e.g. "volume", will create child records of that type, with 1 file per child record.  Other values, e.g. "volume", will create child records of that type, with 1 file per child record.
Line 58: Line 90:
  Alternatively, you can use "none" for record type and the files will be attached directly to the specified record ID.
  
 Alternatively, you can use "none" for record type and the files will be attached directly to the specified record ID.
 
Line 82: Line 114:
[irees@mbp ~/data]$ emen2client.py upload ccd 410082 *.dm3 [irees@mbp ~/data]$ emen2client.py upload ccd 123456 *.dm3

emen2client.py

emen2client.py serves two functions.

1. Contains a number of classes that are useful in building EMEN2 client applications. It is used by other programs, such as EMDash. See EMEN2/API and EMEN2/API/emen2client.py for details.

2. Provides a simple command-line interface for bulk upload and download from the database.

This page documents how to use emen2client.py for upload and download.

Download

* emen2client.py

Usage

./emen2client.py <action>
Actions available: upload, download
For detailed help: ./emen2client.py <action> --help

Download Usage

Usage: emen2client.py download [options] <recid> [filename-pattern]

Options:
  -h, --help            show this help message and exit
  -U USERNAME, --username=USERNAME
                        Username
  -P PASSWORD, --password=PASSWORD
                        Password (Note: specifying passwords in shell commands
                        is not secure)
  -H HOST, --host=HOST  Host endpoint URI
  -C CTXID, --ctxid=CTXID
                        Valid Context ID
  --recurse=RECURSE     Recursion level
  -o, --overwrite       Overwrite existing files (default is to skip)
  -r, --rename          If a file already exists, save with format
                        'duplicate.recid:original_filename.dm3'
  -s, --sidecar         Include sidecar file with EMEN2 metadata in JSON
                        format
  --gzip                Decompress gzip'd files. Requires gzip in path
                        (default)
  --no-gzip             Do not decompress gzip'd files.

Example:

[irees@mbp ~/data]$ emen2client.py download 123456

Username: ianrees
Password: 

1 of 1: 404229
        Checking for items to download
        Found 92 items in 93 records

        1 of 92: 2009110400033
                Downloading frame1.dm3.gz -> frame1.dm3...

        2 of 92: 2009110400032
                Downloading frame2.dm3.gz -> frame2.dm3...

        3 of 92: 2009110400031
                Downloading frame3.dm3.gz -> frame3.dm3...

.... snip ....

Upload Usage

emen2client.py upload --help

Usage: emen2client.py upload [options] <record type> <recid> <files to upload>

        Record type can be any valid database protocol.
        Some record types have special, application-specific handlers, e.g.:
        
                ccd                     CCD Frames
                scan            Scanned micrographs
                stack           Tomograms

        Other values, e.g. "volume", will create child records of that type, with 1 file per child record.

        Alternatively, you can use "none" for record type and the files will be attached directly to the specified record ID.
        
                

Options:
  -h, --help            show this help message and exit
  -U USERNAME, --username=USERNAME
                        Username
  -P PASSWORD, --password=PASSWORD
                        Password (Note: specifying passwords in shell commands
                        is not secure)
  -H HOST, --host=HOST  Host endpoint URI
  -C CTXID, --ctxid=CTXID
                        Valid Context ID
  -q, --noninteractive  Do not prompt for parameter values
  -s, --sidecar         Write sidecar file after upload
  -f, --force           Force re-upload even if a sidecar is found
  --metafile            Attempt to read JAMES/JADAS metadata files (default)
  --no-metafile         Ignore metadata files

Example:

[irees@mbp ~/data]$ emen2client.py upload ccd 123456 *.dm3

Username: ianrees
Password: 

3 Files to upload:
        1.dm3
        2.dm3
        3.dm3

----- tem_magnification_set -----
        Description: Magnification set on microscope
        Units: K

        Common values:
                0) 60.0
                1) 50.0
                2) 40.0
                3) 20.0
                4) 80.0
                5) 100.0
                6) 15.0
                7) 60000.0
                8) 30.0
                9) 25.0

                10) None or N/A
                11) Enter a different not listed above

        Selection (0-11): 0

----- ctf_defocus_set -----
        Description: Intended defocus while imaging, underfocus positive
        Units: um

        Common values:
                0) 1.0
                1) -2.0
                2) 2.0
                3) 1.5
                4) 3.0
                5) 2.5
                6) -3.0
                7) -1.5
                8) -2.5
                9) 0.8

                10) None or N/A
                11) Enter a different not listed above

        Selection (0-11): 0


... snip: additional prompts ommitted for clarity ...


1 of 3: 1.dm3
        Preparing for upload
        Checking and committing records

        1.dm3
                Done. Uploaded 1.dm3 to record 417171 @ 15210.92 kb/sec

2 of 3: 2.dm3
        Preparing for upload
        Checking and committing records

        2.dm3
                Done. Uploaded 2.dm3 to record 417172 @ 15080.45 kb/sec

3 of 3: 3.dm3
        Preparing for upload
        Checking and committing records

        3.dm3
                Done. Uploaded 3.dm3 to record 417173 @ 14253.12 kb/sec

EMEN2/emen2client.py (last edited 2011-05-20 15:58:47 by IanRees)