# PhotoAcoustic.jl documentation

Welcome to the documentation of PhotoAcoustic.jl , a julia package for photoacoustic simulation and inversion integrable with Julia's AD ecosystem via ChainRules.

## Installation

PhotoAcoustic.jl is registered in the Julia General registry. To install PhotoAcoustic.jl, press the "]" and run

`pkg> add PhotoAcoustic`

or to clone a git repository for development:

`pkg> dev PhotoAcoustic`

## API

`PhotoAcoustic.TransducerGeometry`

— Typestruct TransducerGeometry G::Geometry r::Vector{Vector{T}} θ::Vector{Vector{T}} ϕ::Vector{Vector{T}} ψ::Vector{Vector{T}}

A geometry for transducer. Unlike generic point geometries, transducer have an angle and radius used to define a dirctional transducer for each point in the geometry.

This is an internal type used for the propagation and shouldn't be used directly

`PhotoAcoustic.judiInitialState`

— Method`judiInitialState(field)`

Construct an the initial pressure wavefield distributed across space for each experiments. This is a single-time intistate and assumes that the initial time derivative is zero to define the second time step of the second order wave equation.

**Arguments**

`source`

: a (Vector of) 2D-3D array with spatial distribution of photoacoustic sources

`PhotoAcoustic.judiInitialStateProjection`

— Type`judiInitialStateProjection(model)`

Construct the projection operator that sets the initial state into the wavefield for propagation. This operator is a No-op operation that will propagate a `judiInitialState`

if combined with a JUDI propagator.

`PhotoAcoustic.judiPhoto`

— Method`judiPhoto(F::judiPropagator, geometry::Geometry;)`

Constructs a photoacoustic linear operator solving the wave equation associated with F.model. The parametrizations currently supported through JUDI are isotropic acoustic (with or without density), acoustic anisotropic (TTI/VTI) and visco-acoustic.

**Arguments**

`F`

: The base JUDI propagator (judiModeling) `geometry`

: the receiver interpolation (judiProjection) for data measurment

`JUDI.setup_grid`

— Method`setup_grid(geometry::TransducerGeometry, n)`

Sets up the coordinate arrays for Devito. This is the main interface that translates the position of the transducer into a plane

Parameters:

`geometry`

: Geometry containing the coordinates`n`

: Domain size

For visualization ,in 2D, the point source is converted into:

```
Theta=0 points downward:
. . . . - - - . . . . . .
. . . . + + + . . . . . .
. . . . . . . . . . . . .
. . . . . . . . . . . . .
Theta=pi/2 points right:
. . . . - + . . . . . . .
. . . . - + . . . . . . .
. . . . - + . . . . . . .
. . . . . . . . . . . . .
```

`PhotoAcoustic.blackman_upscale`

— Method`p0_up_smooth, dx_up = blackman_upscale(p0, dx_orig, upsample_fact=1.25; pad_a=16)`

Upsamples and smooths a spatial distribution. Uses FFT for upsampling and then a blackman window filter for smoothing.

Parameters:

`p0`

: spatial distribution as array.`dx_orig`

: original discretization of spatial distribution`upsample_fact`

: factor to upsample by`pad_a`

: padding on array to avoid edge artifacts when doing FFT upsampling

Output:

`p0_up_smooth`

: smoothed and upsampled array`dx_up`

: discretization of new array

`PhotoAcoustic.circle_geometry`

— Method`xs, ys, theta = circle_geometry(center, rad, numpoints)`

Creates a set of coordinates in circle geometry. Used for making circular receiver geometries in photoacoustic simulations or circular source geometries in ultrasound simulations.

Parameters:

`center`

: coordinates of the circle center, tuple or vector`rad`

: r is the radius`numpoints`

: number of points on the circle to return

Output:

`coords`

: Coordinates of the points on the circle/sphere`angles`

: angles that locate each point on the circle as an array

`PhotoAcoustic.judiTransducerProjection`

— Method`judiTransducerProjection`

Transducer projection operator for sources/receivers to restrict to or inject data from a transducer

**Examples**

`F`

is a modeling operator of type `judiModeling`

and `q`

is a seismic source of type `judiVector`

: Pr = judiTransducerProjection(rec_geometry, radius, theta) Ps = judiTransducerProjection(q.geometry, radius, theta) dobs = Pr*F*Ps'*q qad = Ps*F'*Pr'*dobs

**Parameters**

`geometry`

: JUDI Geometry structure containing the positions and time axis parameters of the transducer`d`

: Grid spacing (single number). Used to choose the number of points defining the transducer.`radius`

: Radius for each transducer.`theta`

: Orientation for each transducer`phi`

: Orientation for each transducer`psi`

: Orientation for each transducer

The direction of the transducer (theta, phi, psi) is used to define the orientation of it's orthogonal plane. The roations are performed in order ZYX (psi, phi, theta)