# Analog of ctypeslib.as\_array?

**URL:** https://discourse.julialang.org/t/analog-of-ctypeslib-as-array/7002
**Category:** General Usage
**Tags:** pycall, python
**Created:** [November 11, 2017, 2:19am UTC](https://discourse.julialang.org/t/analog-of-ctypeslib-as-array/7002 "2017-11-11T02:19:20Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![gideonsimpson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gideonsimpson/32/1928_2.png) [@gideonsimpson](https://discourse.julialang.org/u/gideonsimpson)
#### Post date: [November 11, 2017, 2:19am UTC](https://discourse.julialang.org/t/analog-of-ctypeslib-as-array/7002/1 "2017-11-11T02:19:20Z")

</div>

The LAMMPS library has a python interface that I am trying to use in Julia via PyCall. One of the things that can be obtained is a pointer to an array for the positions of the atoms. Within Python, I could call:

```julia
X = numpy.ctypeslib.as_array(lmp.extract_atom("x",3).contents,shape=(natoms,3))

```

and I would have a numpy array wrapped around the underlying data. In Julia, I can successfully call

```julia
xptr= lmp[:extract_atom]("x",3)

```

which gives a structure of type

```julia
PyObject <lammps.LP_LP_c_double object at 0x11e4a1f28>

```

and I can index the elements as `xptr[1][2]`. But is there a way to wrap a structure around this so that I can treat this as an array within Julia which can be manipulated in the “standard” way? In other wrods, is there an analog of `numpy.ctypeslib.as_array`?
