view aurora_demo_site_1_python.Rmd @ 1:5808dc52afe8 draft default tip

demo
author mingchen0919
date Mon, 12 Mar 2018 11:49:18 -0400
parents
children
line wrap: on
line source

---
title: 'Python script'
output: html_document
---

```{r setup, include=FALSE, warning=FALSE, message=FALSE}
knitr::opts_chunk$set(
  echo = TRUE, 
  error = TRUE
)
```

We first use Python code to generate a random data matrix and save the data into an output file.

```{python}
import numpy as np
import os

n_row = int(os.environ['X_r'])
n_col = int(os.environ['X_c'])
heatmap_data = np.power(10, np.random.randn(n_row, n_col))
np.savetxt(os.environ['X_O'], heatmap_data)
print(heatmap_data)
```