Giter Club home page Giter Club logo

pyzelda's People

Contributors

astromam avatar avigan avatar jmilou avatar raphaelpclt avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Forkers

jmilou

pyzelda's Issues

Possibility to have multiple clear pupil images

Currently the code assumes that there is only a single clear pupil image for one or multiple ZELDA pupil images, but for some sequences, there can be one clear pupil image for each ZELDA pupil image. Supporting multiple clear pupil images needs to adapt the following methods:

  • read_files() and read_files_sequence() (or their merged version, see #3)
  • analyze()

Add different ZWFS

Instruments

  • SPHERE-IRDIS
  • SPHERE-IFS
  • VISIR
  • SCExAO

Testbeds

  • MITHIC
  • SPEED
  • HiCAT

Generate zelda simulation tools

create tools to make simulations with zelda (propagation of aberration, gamme dynamique, etc)

next step:
pyZELDA in two modules:

  • simulations
  • data processing

Check python version at the beginning of the code

Code only support Python 3, but could probably support Python 2.7 with following imports:

import sys
if sys.version_info < (3,0):
    from __future__ import absolute_import, division, print_function

problem with the exemple?

Hello @astromam and @avigan ,

I am trying to learn how to use your library using the code in the example repertory (simple_zelda_analysis.py).
however something is not working, I get this error message:

TypeError: only size-1 arrays can be converted to Python scalars
The above exception was the direct cause of the following exception:

Traceback (most recent call last):

  File "~\simulations\python\pyZELDA\examples\simple_zelda_analysis.py", line 39, in <module>
    basis, coeff, opd_zern = ztools.zernike_expand(opd_map.mean(axis=0), 20)

  File "~\anaconda3\envs\poppystable\lib\site-packages\pyzelda-1.1-py3.8.egg\pyzelda\ztools.py", line 688, in zernike_expand
    reconstructed_opd[i] += coeffs_tmp[z] * basis[z, :, :]

ValueError: setting an array element with a sequence.

This is happening in function zernike_expand in the ztools.py.
I have been at it all morning I actually do not see how this can work:
reconstructed_opd[i] is a float
coeffs_tmp[z] is a float
basis[z, :, :] is a 2 dimensional array

So multiplying a float by an array is fine but trying to add an array into a single numpy array element will not work.
After investigation I think the culprit is line 39 of simple_zelda_analysis.py :

basis, coeff, opd_zern = ztools.zernike_expand(opd_map.mean(axis=0), 20)

The the script works for me if i remove that .mean. Can you confirm that this is the way to go please?
I suspect that this was made this way in cases where opd_map actually has three dimension ? (why would it though?)
I put there after the entire script that works for me with both datasets you provide.
I left #FIXME comment where I changed something, the original lines are commented and the following line is the one that fixes the problem for me.

import matplotlib.pyplot as plt
import numpy as np

import pyzelda.zelda as zelda
import pyzelda.ztools as ztools
import pyzelda.utils.aperture as aperture

from pathlib import Path

# path = Path('/Users/mndiaye/Dropbox/python/zelda/pyZELDA/')
# path = Path('/Users/avigan/Work/GitHub/pyZELDA/data/')
# path = Path('D:/Programmes/GitHub/pyZELDA/')
path = Path('../data')

wave = 1.642e-6

# internal data
# clear_pupil_files = ['SPHERE_CLEAR_PUPIL_CUBE1_NDIT=3', 'SPHERE_CLEAR_PUPIL_CUBE1_NDIT=3']
# zelda_pupil_files = ['SPHERE_ZELDA_PUPIL_CUBE1_NDIT=3', 'SPHERE_ZELDA_PUPIL_CUBE2_NDIT=3']

# dark_file  = 'SPHERE_BACKGROUND'
# pupil_tel  = False

# on-sky data
clear_pupil_files = ['SPHERE_GEN_IRDIS057_0002']
zelda_pupil_files = ['SPHERE_GEN_IRDIS057_0001']
dark_file  = 'SPHERE_GEN_IRDIS057_0003'
pupil_tel  = True

# ZELDA analysis
z = zelda.Sensor('SPHERE-IRDIS', pupil_telescope=pupil_tel)

clear_pupil, zelda_pupil, center = z.read_files(path, clear_pupil_files, zelda_pupil_files, dark_file,
                                                collapse_clear=True, collapse_zelda=True)

opd_map = z.analyze(clear_pupil, zelda_pupil, wave=wave)

# decomposition on Zernike polynomials
#FIXME
# basis, coeff, opd_zern = ztools.zernike_expand(opd_map.mean(axis=0), 20)
basis, coeff, opd_zern = ztools.zernike_expand(opd_map, 20)

# plot
fig = plt.figure(0, figsize=(16, 4))
plt.clf()

ax = fig.add_subplot(141)
ax.imshow(clear_pupil.mean(axis=0), aspect='equal', vmin=0, vmax=15000, origin='lower')
ax.set_title('Clear pupil')

ax = fig.add_subplot(142)
ax.imshow(zelda_pupil.mean(axis=0), aspect='equal', vmin=0, vmax=15000, origin='lower')
ax.set_title('ZELDA pupil')

ax = fig.add_subplot(143)
#FIXME
# ax.imshow(opd_map.mean(axis=0), aspect='equal', vmin=-150, vmax=150, cmap='magma', origin='lower')
ax.imshow(opd_map, aspect='equal', cmap='magma', origin='lower')
ax.set_title('OPD map')

ax = fig.add_subplot(144)
#FIXME
# cax = ax.imshow(opd_zern.mean(axis=0), aspect='equal', vmin=-150, vmax=150, cmap='magma', origin='lower')
cax = ax.imshow(opd_zern[0], aspect='equal', cmap='magma', origin='lower')
ax.set_title('Zernike projected OPD map')

cbar = fig.colorbar(cax)
cbar.set_label('OPD [nm]')

plt.tight_layout()
plt.show()

Cheers,
Anne-Laure

Compatibility with Windows

Hi,
trying to use pyZelda on a windows machine, we got some trouble with the 'pathlib' module (creating a 'WindowsPath' object) and 'ConfigParser'.

The fix was in the 'Sensor' class (line 105) to replace:

config.read(configfile)
by
config.read(configfile.as_posix())

should be compatible with linux.

cheers,
Gilles

Refractive index of Germanium

Find the right reference to compute the refractive index of Germanium at T=60K and wave=11.2 um.

So far, two references: Barnes & Piltch (1979) and Li et al. (1980).
Li et al. (1980) give refractive index for a temperature range from 100K to 1200K and wavelength range from 1.9um to 18.0um.
Barnes & Piltch (1979) give refractive index for a temperature range from 50K to 300K and wavelength range from 2.5um to 14.0um. Barnes & Piltch (1979) seem to have underestimated refractive index with respect to Li et al. (1980) and Frey et al. (2006).

Add support for custom pupil

The pupil is currently always assumed to be circular and unobstructed, but when obtaining data on-sky the real shape of the telescope pupil should be taken into account.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.