---
include_toc: true
---

# postsynapse.md

Expansions and modulations:
  - is expanded and developed by: [D_BRANCH](d-branch.md)
  - is tuned by: [ORGANISM](../../organism.md), organs, modules
  - expands and tunes: [POST-AMPA](post_ampa.md)
  - develops: _posMod, _actMod

## POSTSYNAPSE

```Gen

POSTSYNAPSE

    type: comprehension
    
    include: post_ampa.md

    // ########################## Intrication ##########################
    
    
        // Scope
    !DAY: INTRICATE [ scope: &ORGANISM.!DAY ]
    !NIGHT: INTRICATE [ scope: &ORGANISM.!NIGHT ]

        // Context  
    *bAP: INTRICATE [ context: &SOMA.*bAP ]
    *TunPossible: INTRICATE [ context: &NEURON.*TunPossible ]
    
        // Tub
    _NT: INTRICATE [ tub: &ASTROSYNAPSE._NT ] 
    _Vpost: INTRICATE [ tub: ??._VPost ]
   
  // ########################## Instantiation ##########################
  
        // Context

        // Tub
    _Ca2: INSTANTIATE [ tub: local, full: 60x, act: 30x, empty: 0x ]
    _Na: INSTANTIATE [ tub: local, full: 60x, act: 30x, empty: 0x ]
    _Nox: INSTANTIATE [ tub: local, full: 100x, act: 20x, empty: 0x ] # Nitric Oxide (NO):  A gas that diffuses freely.
    _eCB: INSTANTIATE [ tub: local, full: 100x, act: 20x, empty: 0x ] # Endocannabinoids (e.g., 2-AG)
    
    _posMod: INSTANTIATE [ tub: local, full: None, act: ??, empty: 0x)  # riferimento a possible di BEH-PRE
    _actMod: INSTANTIATE [ tub: local, full: None, act: ??, empty: ??)  # riferimento a active di BEH-PRE

        // Container
    void: INSTANTIATE [ scope: !DAY, container: ACTION, context:  *bAP ]
    void: INSTANTIATE [ scope: !DAY, container: RECOVERY, context:  NOT *bAP,  *Spike_train ]
    void: INSTANTIATE [ scope: !DAY, container: PREPARE, context: * NOT Spike_train ]
    void: INSTANTIATE [ scope: !NIGHT, container: ACTION, context:  *Not_rem_1 ]
    void: INSTANTIATE [ scope: !NIGHT, container: RECOVERY, context:  *Not_rem_2 ]
    void: INSTANTIATE [ scope: !NIGHT, container: PREPARE, context:  *Rem ]

    // ########################## Expansion ##########################
    
    _@PostAmpaAll: INSTANTIATE [ tub: EXPAND [ comprehension: POST-AMPA ], full: 10x, active: 5x, empty: 2x ]

```

**Tubs:**

- **_Na**: Ioni entranti tramite AMPA receptors
- **_NT**: Neuro Trasmettitori
- **_Ca2**: Ioni entranti tramite NMDA
- **_VPost**: il voltage che viene sentito in DB
- **_eCB**:
- **_Nox**:?

## !DAY | ACTION | *bAP 

//### MAIN_POST: !DAY
```
MAIN_POST
  type: behaviour

  within_scope: !DAY

  snippet:
    *bAP
    @: ACCUMULATOR [ snippet: CaNDMAEnterMax, rf: active 2x ]
    @: ACCUMULATOR [ snippet: CaNDMAEnterMed, rf: active 4x ]

    NOT *bAP
    @: ACCUMULATOR [ snippet: CaNDMAEnterLow, rf: active 12x ]
    @: ACCUMULATOR [ snippet: CaNDMAEnterMedNotBap, rf: active 4x ]
    @: ACCUMULATOR [ snippet: CaClearance, rf: active 24x ]
    @: ACCUMULATOR [ snippet: VPostMax, rf: active 4x ]
    @: ACCUMULATOR [ snippet: VPostMed, rf: active 8x ]
    @: ACCUMULATOR [ snippet: VPostMin, rf: active 16x ]
    @: ACCUMULATOR [ snippet: VPostClearance, rf: active 18x ]
    @: ACCUMULATOR [ snippet: NaClearanceHigh, rf: active 4x ]
    @: ACCUMULATOR [ snippet: NaClearanceLow, rf: active 16x ]

```

//#### *bAP

![post-ltp-ltd.png](.attachments/post-ltp-ltd.png)


//##### CaNDMAEnterMax

```Gen
CaNDMAEnterMax
    type: accumulator

    in_context: *bAP
    
    hypothesis: NOT _Ca2 full AND
               ( _Na fullness OR _Na mediumness )
      action: [ _Ca2 increase ]
      trace: 
```

//##### CaNDMAEnterMed

```Gen
CaNDMAEnterMed
    type: accumulator

    in_context: *bAP
    
    hypothesis: NOT _Ca2 full AND _Na emptiness
      action: [ _Ca2 increase ]
      trace: 
```

## !DAY | RECOVERY | NOT *bAP, *Spike_train
//#### NOT *bAP

//##### CaNDMAEnterLow

```Gen
CaNDMAEnterLow
    type: accumulator

    in_context: NOT *bAP
    
    hypothesis: NOT _Ca2 full AND _Na mediumness
      action: [ _Ca2 increase ]
      trace: 
```

//##### CaNDMAEnterMedNotBap

```Gen
CaNDMAEnterMedNotBap
    type: accumulator

    in_context: NOT *bAP
    
    hypothesis: NOT _Ca2 full AND _Na fullness
      action: [ _Ca2 increase ]
      trace: 
```

//##### CaClearance

```Gen
CaClearance # Low
    type: accumulator

    in_context: NOT *bAP
    
    hypothesis: NOT _Ca2 empty
      action: [ _Ca2 decrease ]
      trace: None
```

//##### VPostMax
```Gen
VPostMa
    type: accumulator

    in_context: NOT *bAP
    
    hypothesis: _NA fullness
      action: [ _VPost increase ]
      trace: None
```

//##### VPostMed
```Gen
VPostMed
    type: accumulator

    in_context: NOT *bAP

    hypothesis: _NA mediumness
      action: [ _VPost increase ]
      trace: None
```

//##### VPostMin
```Gen
VPostMin
    type: accumulator

    in_context: NOT *bAP
    
    hypothesis: _NA emptiness
      action: [ _VPost increase ]
      trace: None
```

Il VPost clearance lo facciamo qui nel container dove creaiamo anche i VPost, perche' altrimenti, se lo facessimo in DB, perderemmo l'aspetto temporale della contribuzione dei singoli POST.
//##### VPostClearance
```Gen
VPostClearance
    type: accumulator

    in_context: NOT *bAP

    hypothesis: NOT _VPost empty
      action: [ _VPost decrease ]
      trace: None
```

Il NA clearance lo mettiamo qui come sniplet, perche' gli AMPA creano, e questi pompano fuori. Qui non e' un problema di perdere l'integrazione temporale, perche' gli AMPA sono tutti uguali nel loro behavior. Abbiamo messo gli AMPA come container perche' cosi' possiamo modularne la numerosita'.

//##### NaClearanceHigh
```Gen
NaClearanceHigh
    type: accumulator

    in_context: NOT *bAP 
  
    hypothesis: _Na mediumness OR _Na fullness
      action: [ _Na decrease ]
      trace: None
```

//##### NaClearanceLow
```Gen
NaClearanceLow
    type: accumulator

    in_context: NOT *bAP 
    
    hypothesis: NOT _Na empty
      action: [ _Na decrease ]
      trace: None
```

//### TUN-POST-AMPA: !DAY
```Gen
TUN-POST-AMPA
  type: behaviour
  
  activity_scope: !DAY
  
  snippet:
    # *TunPossible
    @: CONTEXTOR [ snippet: CheckTunPostAmpa, rf: active 60x ]

    # *TryTunUpPostAmpa
    @: ACCUMULATOR [ snippet: PossibleUpPostAmpaTun, rf: active 10x ]

    # *TryTunDownPostAmpa
    @: ACCUMULATOR [ snippet: PossibleDownPostAmpaTun, rf: active 10x ]
  
  
```
//#### *TunPossible

//##### CheckTunPostAmpa
```Gen
CheckTunPostAmpa
  type: contextor

  in_context: *TunPossible
    condition:   tbd1
    out_context: *TryTunUpPostAmpa

    condition:   tbd2
    out_context: *TryTunDownPostAmpa
```

//##### PossibleUpPostAmpaTun
```Gen
PossibleUpPostAmpaTun: ( active: 10x )
  type: accumulator

  in_context: TryTunUpPostAmpa
    hypothesis:  
      action: 
      trace: 
```

//##### PossibleDownPostAmpaTun
```Gen
PossibleDownPostAmpaTun
  type: accumulator

  in_context: *TryTunDownPostAmpa
    hypothesis:  
      action: 
      trace: 
```

## !DAY | PREPARE | NOT *Spike_train 

## !NIGHT | ACTION | *Not_rem_1

## !NIGHT | RECOVERY | *Not_rem_2

## !NIGHT | PREPARE | *Rem

