semvec/pypi-packages huggingface dataset:
ndx-fret 0.2.1
FRET

# ndx-fret
[![PyPI version](https://badge.fury.io/py/ndx-fret.svg)](https://badge.fury.io/py/ndx-fret)

NWB extension for storing Fluorescence Resonance Energy Transfer (FRET) experimental data.
A collaboration with [Jaeger Lab](https://scholarblogs.emory.edu/jaegerlab/), [Emory University](https://www.emory.edu/home/index.html) and [The Kavli Foundation](https://www.kavlifoundation.org/).

<p align="center">
<img src="media/FRET_schematic.png" width="400">
</p>

### Python Installation
```bash
pip install ndx-fret
```

### Python Usage
```python
from pynwb import NWBFile, NWBHDF5IO
from pynwb.device import Device
from pynwb.ophys import OpticalChannel
from ndx_fret import FRET, FRETSeries

from datetime import datetime
import numpy as np

nwb = NWBFile('session_description', 'identifier', datetime.now().astimezone())

# Create and add device
device = Device(name='Device')
nwb.add_device(device)

# Create optical channels
opt_ch_d = OpticalChannel(
    name='optical_channel',
    description='optical_channel_description',
    emission_lambda=529.
)
opt_ch_a = OpticalChannel(
    name='optical_channel',
    description='optical_channel_description',
    emission_lambda=633.
)

# Create FRET
fs_d = FRETSeries(
    name='donor',
    fluorophore='mCitrine',
    optical_channel=opt_ch_d,
    device=device,
    description='description of donor series',
    data=np.random.randn(100, 10, 10),
    rate=200.,
    unit='no unit'
)
fs_a = FRETSeries(
    name='acceptor',
    fluorophore='mKate2',
    optical_channel=opt_ch_a,
    device=device,
    description='description of acceptor series',
    data=np.random.randn(100, 10, 10),
    rate=200.,
    unit='no unit'
)

fret = FRET(
    name='FRET',
    excitation_lambda=482.,
    donor=fs_d,
    acceptor=fs_a
)
nwb.add_acquisition(fret)

# Write nwb file
with NWBHDF5IO('test_fret.nwb', 'w') as io:
    io.write(nwb)
    print('NWB file written')

# Read nwb file and check its content
with NWBHDF5IO('test_fret.nwb', 'r', load_namespaces=True) as io:
    nwb = io.read()
    print(nwb)
```
ansiblerunnerapi 0.0.2
Ansible Runner API package
Requires Python: >=3.6

# AnsibleRunner

拷貝自jumpserver項目

# install 

```
pip install ansible==2.8.8
```


## Runner

**Ansible Command Runner**

simple runner

```
runner = CommandRunner()
runner.execute('ls')
```

inventory hosts

```

host_data = [
    {
        "hostname": "demo-web1",
        "ip": "192.168.33.101",
        "port": 2222,
        "username": "root",
        "private_key": "/Users/maliao/.ssh/id_rsa",
    },
    {
        "hostname": "demo-web2",
        "ip": "192.168.33.102",
        "port": 2222,
        "username": "root",
        "private_key": "/Users/maliao/.ssh/id_rsa",
    },
    {
        "hostname": "demo-web3",
        "ip": "192.168.33.103",
        "port": 2222,
        "username": "root",
        "private_key": "/Users/maliao/.ssh/id_rsa",
    },
    {
        "hostname": "demo-web4",
        "ip": "192.168.33.104",
        "port": 2222,
        "username": "root",
        "private_key": "/Users/maliao/.ssh/id_rsa",
    },
]
runner = CommandRunner(inventory=host_data)
runner.execute('ls')
```


**Ansible Playbook Runner**

simple runner

```
runner = PlayBookRunner(hostname='maliao-web1',path='test.yml')
runner.run()
```


option 

```
runner1 = PlayBookRunner(hostname='maliao-web1', path='test.yml',options={'memory_mb': 1024, 'size_gb': 30,'num_cpus': 2})
runner1.run()
```

inventory hosts


```
hosts = [
    {
        "hostname": 'maliao-web1',
        "ip": '192.168.1.1',
        "port": '22',
        "username": "root",
        "private_key": "/Users/maliao/.ssh/id_rsa"
    },
    {
        "hostname": 'maliao-web1',
        "ip": '192.168.1.1',
        "port": '22',
        "username": "root",
        "private_key": "/Users/maliao/.ssh/id_rsa"
    },
]

runner2 = PlayBookRunner(hostname='maliao-web1', path='test.yml', inventory=hosts)
runner2.run()
```


## Callback

gather_result


任務開始
v2_playbook_on_play_start

任務成功
v2_runner_on_ok 

無法連接
v2_runner_on_unreachable 

任務失敗
v2_runner_on_failed