Metadata-Version: 2.1
Name: mdsthin
Version: 1.0
Summary: MDSplus Thin-Client implemented in pure python
Author-email: Stephen Lane-Walsh <slwalsh@psfc.mit.edu>
License: 
        Copyright (c) 2024, Massachusetts Institute of Technology All rights reserved.
        
        Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
        
Requires-Python: >=3.7
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy


# mdsthin - Python MDSplus Thin Client Implementation

## Installation

```sh
python3 -m pip install mdsthin
```

## Tests

```sh
python3 -m mdsthin.test [-v] [--server SERVER] [--cmod]
```

## Usage

```py
import mdsthin
c = mdsthin.Connection('server')


print(c.get('whoami()').data())
# username

print(c.tcl('show current test'))
# 123

print(c.get('4 + 5').data())
# 9


c.openTree('test', 123)


y = c.get('SIGNAL_NODE').data()
x = c.get('dim_of(SIGNAL_NODE)').data()


gm = c.getMany()
gm.append('y', 'SIGNAL_NODE')
gm.append('x', 'dim_of(SIGNAL_NODE)')
gm.execute()

y = gm.get('y').data()
x = gm.get('x').data()


print(c.getObject('ACTION_NODE').data())
# Action(...)


# Build_Signal(1000. * $VALUE, Word_Unsigned([1,2,3,4,5]), [0QU,10QU,20QU,30QU,40QU])
Signal(MULTIPLY(Float32(1000.0), dVALUE()), UInt16Array([1, 2, 3, 4, 5]), UInt64Array([0, 10, 20, 30, 40]))

```

## Examples

See the `examples/` folder.

## mdstcl

```
python3 -m mdsthin.mdstcl SERVER
Connectiong to: SERVER
TCL> show current test
123
TCL> exit
```

```py
import mdsthin
c = mdsthin.Connection('server')

c.mdstcl()
TCL> show current test
123
TCL> exit
```

## tdic

```
python3 -m mdsthin.tdic SERVER
Connectiong to: SERVER
TDI> 4 + 5
9L
TDI> exit
```

```py
import mdsthin
c = mdsthin.Connection('server')

c.tdic()
Connectiong to: SERVER
TDI> 4 + 5
9L
TDI> exit
```

## Compatability with full MDSplus python package

There is a subpackage called `MDSplus` that provides slightly better mappings with the full MDSplus python package.

```py
from mdsthin import MDSplus

c = MDSplus.Connection('server')

i = Uint32(42)

MDSplus.mdsExceptions.checkStatus(265388200)
```
