Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Jun 21 2019 16:00
    GitLab | David Lucsanyi pushed 3 commits to Pyxel
  • Jun 21 2019 13:31
    GitLab | David Lucsanyi pushed 3 commits to Pyxel
  • Jun 21 2019 13:31
    GitLab | David Lucsanyi pushed 3 commits to Pyxel
  • Jun 21 2019 13:31
    GitLab | David Lucsanyi pushed 3 commits to Pyxel
  • Jun 21 2019 13:31
    GitLab | David Lucsanyi pushed 3 commits to Pyxel
  • Jun 21 2019 13:31
    GitLab | David Lucsanyi pushed 3 commits to Pyxel
  • Jun 21 2019 13:31
    GitLab | David Lucsanyi pushed 3 commits to Pyxel
David Lucsanyi
@david.lucsanyi_gitlab

Welcome in the Pyxel community!

Let's discuss, share, exchange knowledge, models, ideas, tools with each other about imaging detector modelling using the Pyxel framework and community!
David Lucsanyi
@david.lucsanyi_gitlab
Links:
Elizabeth George
@lizinvt_gitlab
Hello everyone. We've agreed to keep track of which models we would like to include in Pyxel by raising an issue for each model, with a detailed enough description that anyone could take over the issue and implement the model.
Paolo Caputo
@paolcaputo_gitlab
image.png
Hello! I am trying to access the GitLab repository but it seems not to exist. Maybe is not public?
Benoît Serra
@benoit.serra_gitlab
Hi Paolo, the repository is not public -yet-. To be able to checkout PyXel you would have to access the repository and send a request to a maintainer or owner. Do you still have the error 404? The page seems to be accessible for me.
Israel Vaughn
@israel.vaughn_gitlab
Hello @benoit.serra_gitlab it is also giving me the 404. I've partially developed something similar in Matlab, which I'm porting to Python, but then I found this. I noticed that the Optics module is not propagated in the documentation, I could write some of the technical code for optical systems, but it would be not as robust as ZEMAX for example, however it can take an arbitrary wavefront aberration function in the pupil and propagate it to the image plane. Cheers,
Lawrence Jones
@l_jones_gitlab

Hello!

Thank you for the repository access, I am finding Pyxel to be an incredibly useful tool and wanted to share a small change I have made while using it.

I have been attempting to use Pyxel to generate data that matches results I am getting off of a lab CMOS image sensor. The built in pipeline works exactly as needed, however the charge_generation.photoelectrons.simple_conversion model appears to be suppressing noise, changing the Noise=Signal Noise = \sqrt{Signal} shot noise relationship expected at that point in the detector.

The current modification I have made is to models.charge_generation.photoelectrons.simple_conversion (line 35):

detector_charge[slice(0, photon_rows), slice(0, photon_cols)] = (
        ph.array * ch.qe * ch.eta
    )

changing it to (in a fresh function):

detector_charge[slice(0, photon_rows), slice(0, photon_cols)] = (
        ph.array * ch.qe * ch.eta
    )

This changes the calculation from a linear multiplication to binomial sampling, which primarily changes the noise in the output pixel values. Considering the contributions to the output noise by the input noise (Noisein Noise_{in} ) and the noise of the charge generation model (Noisemodel Noise_{model} ) (I have taken the signal to be the mean pixel value):
-
Noiseout2=(Noisein.Gainmodel)2+Noisemodel2 Noise_{out}^2 = (Noise_{in}.Gain_{model})^2 + Noise_{model}^2
-
For linear multiplication:
-
Noiseout2=(Signalin.QE)2+02 Noise_{out}^2 = (\sqrt{Signal_{in}}.QE)^2 + 0^2

-
Noiseout2=(Signalout.QE)2 Noise_{out}^2 = (\sqrt{Signal_{out}}.\sqrt{QE})^2
-
Noiseout=Signalout.QE Noise_{out} = \sqrt{Signal_{out}} .\sqrt{QE}
-
Which is less than expected (when QE<1), however for binomial sampling:
-
Noiseout2=(Signalin.QE)2+Noisechargegeneration2Noise_{out}^2 = (\sqrt{Signal_{in}}.QE)^2 + Noise_{charge generation}^2
-
=Signalin.QE2+np(1p) = Signal_{in}.QE^2 + np(1-p) <- the variance of the binomial distribution
-
( QE QE is the probability of success, p p, and Signalin Signal_{in} (in photons) is the number of trials, n n, of the binomial distribution)
-
=Signalin.QE2+Signalin.QE(1QE) = Signal_{in}.QE^2 + Signal_{in}.QE(1-QE)
-
=Signalin.QE2+Signalin.QESignalin.QE2 = Signal_{in}.QE^2 + Signal_{in}.QE - Signal_{in}.QE^2
-
=Signalin.QE= = Signal_{in}.QE=
-
Noiseout=Signalin.QE=Signalout Noise_{out} = \sqrt{Signal_{in}.QE} = \sqrt{Signal_{out}}

-
Which matches the expected signal to noise relationship. Making this change has resulted in excellent agreement between the Pyxel outputs and my lab data. For example the plot below includes three sets of PTC data, two generated by Pyxel, with this modification ('Binomial Charge Generation') and without ('Linear Charge Generation'), alongside PTC data points captured from the lab sensor ('Experimental Results'). The plot demonstrates the lower noise seen in the output data using the linear charge_generation model. Both simulation runs were made with the parametric_ptc.yaml example script with changes to the detector values to match the lab sensor, the simulation was completed with a QE of 60%.

PTC_Comparison

I am aware that numpy.random.binomial will break when (ch.qe * ch.eta) > 1, or when any elements of ph.array are not ints. I have stopped the latter from crashing the program by using the numpy.random.default_rng.binomial function, but the change is less elegant.

Lawrence Jones
@l_jones_gitlab
Apologies, I have made an error while transcribing my previous comment, the changed function is:
detector_charge[slice(0, photon_rows), slice(0, photon_cols)] = (
        numpy.random.binomial(n = ph.array ,p =(ch.qe * ch.eta))
    )
Brad Kelman
@Brad96_gitlab
Hi, I'm still getting used to the YAML format of the configuration but was wondering what inputs are definitely required to be in the file and if there are any default values that the config uses?
1 reply
Brad Kelman
@Brad96_gitlab
I'm adding a new model but a new external library module is needed, it can be easily be installed using 'pip install...' etc, but what is the best practice when it comes to installing it? Do I install it and add it to git in the external libraries or do I just add it as a dependency somewhere?
Frederic Lemmel
@frederic.lemmel_gitlab

Hi Brad,

You can add the new external library in ‘setup.cfg’ under section [options] / install_requires.

If this package cannot be easily installed with pip on all platforms (Windows, Mac and Linux) then you have to consider to add this package as an optional package (also in ‘setup.cfg’ under section [options.extras_require]).

2 replies
Which package to you want to add ?
Brad Kelman
@Brad96_gitlab
I have noticed a couple of issues in the Pyxel example notebooks that I haven't seen before when using them. The import of Pyxel modules no longer work without installing 'holoviews' first, it works fine if you just pip install the module but I'm not sure why it has suddenly cropped up.
7 replies
Also when trying to view the image using jp.display_detector(detector, array=detector.image) the error TypeError: display_detector() got an unexpected keyword argument 'array' and I'm unsure how to fix this
3 replies
Matej Arko
@matejarko_gitlab
Output of jp.display_detector(detector) should be an interactive bokeh viewer of the stored arrays. You can set jp.display_detector(detector, hist=False)to just display the array.
alt
3 replies
Brad Kelman
@Brad96_gitlab
Is there an easy way to use debug mode to test new models / newly created yaml files? I have something wrong with my implemented model and I can't find out what is wrong with it so need to use debugging mode instead
Matej Arko
@matejarko_gitlab
Not sure what you mean, is the error caught by Pyxel or Arctic? Do you have an error report?
Frederic Lemmel
@frederic.lemmel_gitlab

Hi Brad,

There are several ways to debug a Python program (see https://towardsdatascience.com/ultimate-guide-to-python-debugging-854dea731e1b or https://medium.com/techtofreedom/six-debugging-techniques-for-python-programmers-cb25a4baaf4b).

However, it is easier to use a IDE software such as PyCharm with an embedded debugger (see https://www.jetbrains.com/help/pycharm/debugging-python-code.html).

Brad Kelman
@Brad96_gitlab
It's an error in the arctic model, I know how to use the simple debugging mode in Pycharm but was wondering the easiest way to use it while incorporating my model but I think I'll have to make a simple script for it and then call that in debug mode - thanks!
Brad Kelman
@Brad96_gitlab
I'm trying to read through the documentation and understand what I can with different CCD objects in the yaml file. I'm not quite sure what the numbytes or the horizontal_pixel_center_pos_list do as I am struggling to also understand how to implement them into the yaml file - would you be able to give me an example of how to implement these please?
3 replies
Brad Kelman
@Brad96_gitlab
I also realise to observe the resulting histogram data better in a jupyter notebook I need to change from a linear to a log scale, is it possible to change this?
3 replies
Saad Ahmed
@SaadAhmedCoder_gitlab
I having an issue running the calibration-example on my local PC; I keep getting an attribute error. This happens both in the Jupyter notebook and when I try and run the yaml file through the command prompt. The example runs fine in binder
MicrosoftTeams-image.png
3 replies
Saad Ahmed
@SaadAhmedCoder_gitlab
On a related note, how can I see the best-fit calibration parameters after it has run? Both numerically and graphically if possible. I don't believe the current tutorial example explains this
21 replies
Saad Ahmed
@SaadAhmedCoder_gitlab
I have a question about the calibration mode. In the example file, fitting is done for 4 emission time constants and their densities. Is it possible, for example, to fit for only two emission time constants and keep the other two fixed? On a related note, is it possible to view all the final parameters, not just the fitted ones?
5 replies
James Gilbert
@labjg_gitlab
Hi all - I am new to Pyxel and having trouble running the first tutorial (01_first_simulation)
6 replies