# How to use the Siemens Star calibration Target to obtain the MTF of an optical system

In [6]:

```
import numpy as np
import pyfits
import matplotlib.pyplot as plt
import skimage
from skimage.feature import blob_dog, blob_doh, blob_log, canny
from skimage.color import rgb2gray
from skimage.feature import corner_harris, corner_subpix, corner_peaks
from skimage.segmentation import slic
from skimage.filters import sobel
from scipy.signal import convolve2d
from scipy.ndimage import gaussian_filter
from skimage import measure
from scipy.optimize import curve_fit
import matplotlib.ticker as mtick
from scipy.signal import savgol_filter
```

In [7]:

```
path = '/home/fatima/Desktop/solar_orbiter_project/codes/targets/MTF/'
```

In [15]:

```
star = pyfits.getdata(path+'solo_L0_1805230011_20180523T121104.fits')
dark = pyfits.getdata(path+'solo_L0_1805230009_20180523T094103.fits')
data = star/20. -dark/20.
```

In [16]:

```
fig = plt.figure(figsize=(18,12))
plt.imshow(data,origin='lower',cmap='gray')
```

Out[16]:

## How to compute the contrast modulation?¶

In [13]:

```
## this function will get the values along each circle. We start by defining a range of angles, computing the
#coordinates and then finding the values at the nearest pixel position.
def get_line(star,theta,radius,x_c,y_c):
#theta = np.linspace(0,2*np.pi,N_theta)
x = x_c + radius*np.cos(theta)
y = y_c + radius*np.sin(theta)
x = np.round(x)
y = np.round(y)
x = x.astype(int)
y = y.astype(int)
I = star[y,x]
return I,x,y
```

In [11]:

```
## a function to compute the frequecy for a certain radius
def get_radius(freq):
N_p = 36
r = N_p/(2*np.pi*freq)
return r
## a function to compute the radius for a certain frequency
def get_freq(radius):
N_p = 36
freq = N_p/(2*np.pi*radius)
return freq
```

#### Now let's draw these circles around the center¶

In [29]:

```
shape = data.shape[0]
R_max = 1000
N_theta = 300
theta = np.linspace(0,2*np.pi,N_theta)
N_radii = 120
N_p = 36 #angular frequency (number of dark (bright) lines)
radii = R_max*1/1.05**np.arange(1, N_radii) ## we take a logarithmic range of radii
# center of the target (determined manually)
x_c = 1089
y_c =996
```

In [20]:

```
plt.figure(figsize=(18,12))
plt.imshow(data, origin='lower')
for r in radii:
freq = get_freq(r)
I,x,y = get_line(data,theta,r,x_c,y_c)
plt.plot(x,y)
```