Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 80 additions & 0 deletions src/microsim/schema/detectors/Andor_iXon_Ultra_888_BVF_QE.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
310,12.482
320,14.224
330,16.11
340,19.158
350,21.916
360,25.399
370,31.06
380,38.607
390,45.957
400,53.308
410,60.051
420,65.08
430,70.827
440,74.456
450,78.52
460,81.858
470,84.906
480,88.099
490,90.566
500,92.671
510,94.049
520,95.21
530,96.081
540,96.517
550,96.807
560,96.952
570,96.907
580,96.829
590,96.691
600,96.468
610,96.13
620,95.718
630,95.283
640,94.775
650,94.049
660,93.469
670,92.453
680,91.727
690,90.711
700,89.695
710,88.534
720,87.083
730,85.631
740,84.035
750,82.438
760,80.406
770,78.374
780,76.343
790,73.875
800,71.553
810,68.65
820,66.038
830,63.28
840,60.087
850,57.184
860,53.701
870,50.653
880,47.025
890,43.977
900,40.784
910,37.155
920,34.107
930,30.624
940,27.721
950,24.819
960,21.626
970,19.013
980,16.255
990,13.933
1000,11.466
1010,9.434
1020,7.692
1030,5.951
1040,4.499
1050,3.193
1060,2.177
1070,1.306
1080,0.653
1090,0.218
1100,0.145
80 changes: 80 additions & 0 deletions src/microsim/schema/detectors/Andor_iXon_Ultra_888_EXF_QE.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
310,8.417
320,11.412
330,14.265
340,18.545
350,23.871
360,29.957
370,39.777
380,50.839
390,60.288
400,69.126
410,76.788
420,80.171
430,82.168
440,83.167
450,84.165
460,84.879
470,85.877
480,86.733
490,87.732
500,88.231
510,88.445
520,88.745
530,88.845
540,89.158
550,89.158
560,89.444
570,89.539
580,89.872
590,90.062
600,90.442
610,90.68
620,91.013
630,91.298
640,91.441
650,91.441
660,91.441
670,91.369
680,91.191
690,91.013
700,90.514
710,89.872
720,89.016
730,88.16
740,87.019
750,85.877
760,84.165
770,82.596
780,80.456
790,78.459
800,75.892
810,73.039
820,70.471
830,67.19
840,64.337
850,60.77
860,57.632
870,53.78
880,50.499
890,46.648
900,42.796
910,39.515
920,35.663
930,32.382
940,28.816
950,25.82
960,22.539
970,19.686
980,16.833
990,14.408
1000,11.84
1010,9.558
1020,7.846
1030,5.991
1040,4.565
1050,3.138
1060,2.14
1070,1.284
1080,0.713
1090,0.285
1100,0.143
99 changes: 99 additions & 0 deletions src/microsim/schema/detectors/C15440_20UP_QE.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
308,4.73
316,7.973
324,16.757
332,30.27
340,41.622
348,45.27
356,48.649
364,52.162
372,57.432
380,62.162
388,66.351
396,70.135
404,72.703
412,74.73
420,76.757
428,78.514
436,80.405
444,82.027
452,83.784
460,85.27
468,86.351
476,87.432
484,88.649
492,89.595
500,90.405
508,91.216
516,92.027
524,92.838
532,93.514
540,94.324
548,94.595
556,94.865
564,94.865
572,94.595
580,94.459
588,94.324
596,94.054
604,93.649
612,93.108
620,92.432
628,91.892
636,91.216
644,90.541
652,89.865
660,88.919
668,87.838
676,86.622
684,85.541
692,84.189
700,82.838
708,81.351
716,79.73
724,78.108
732,76.622
740,74.459
748,72.297
756,70
764,67.568
772,65.27
780,63.108
788,60.811
796,58.514
804,56.216
812,53.919
820,51.892
828,50.27
836,48.784
844,47.027
852,45.27
860,42.973
868,40.676
876,38.378
884,35.946
892,33.243
900,31.216
908,29.324
916,27.568
924,25.811
932,23.784
940,21.622
948,20.27
956,18.784
964,17.432
972,16.216
980,14.865
988,13.243
996,11.486
1004,10
1012,8.784
1020,7.432
1028,6.351
1036,5.27
1044,4.189
1052,3.243
1060,2.568
1068,2.027
1076,1.514
1084,1.081
1092,0.811
75 changes: 74 additions & 1 deletion src/microsim/schema/detectors/lib.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,40 @@
"""Library of commercial detectors for the microsim schema."""

import csv
from pathlib import Path

import numpy as np

from microsim.schema.detectors._camera import CameraCCD
from microsim.schema.detectors._camera import CameraCCD, CameraCMOS, CameraEMCCD
from microsim.schema.spectrum import Spectrum


def _load_qe_from_csv(csv_filename: str) -> tuple[np.ndarray, np.ndarray]:
"""Load QE curve from CSV file.

Args:
csv_filename: Name of the CSV, first col should be wavelength in nm,
second col should be QE in %

Returns
-------
tuple: (wavelengths, qe_values) where qe_values are normalized to [0,1]
"""
csv_path = Path(__file__).parent / csv_filename
wavelengths = []
qe_values = []

with open(csv_path) as f:
reader = csv.reader(f)
for row in reader:
if len(row) >= 2:
wavelengths.append(float(row[0]))
# Convert percentage
qe_values.append(float(row[1]) / 100.0)

return np.array(wavelengths), np.array(qe_values)


# fmt: off
r2qe = [0.5188,0.5219,0.5249,0.5279,0.5307,0.5335,0.5363,0.539,0.5418,0.5445,0.5473,0.5501,0.5531,0.5561,0.5593,0.5627,0.5662,0.57,0.5738,0.5778,0.5819,0.586,0.5902,0.5943,0.5984,0.6024,0.6064,0.6102,0.6138,0.6172,0.6204,0.6234,0.6261,0.6286,0.631,0.6333,0.6356,0.6378,0.6401,0.6425,0.6451,0.6478,0.6508,0.654,0.6573,0.6607,0.6641,0.6675,0.6708,0.6739,0.6769,0.6796,0.682,0.6841,0.6859,0.6876,0.6891,0.6905,0.6919,0.6933,0.6948,0.6964,0.698,0.6997,0.7013,0.7027,0.7041,0.7053,0.7062,0.7068,0.7072,0.7072,0.707,0.7065,0.7058,0.7049,0.7039,0.7027,0.7014,0.7001,0.6988,0.6976,0.6964,0.6954,0.6946,0.6939,0.6934,0.6931,0.693,0.693,0.6931,0.6932,0.6932,0.6931,0.6928,0.6923,0.6914,0.6902,0.6886,0.6864,0.6837,0.6805,0.6769,0.673,0.6689,0.6648,0.6608,0.657,0.6536,0.6506,0.6481,0.6459,0.6442,0.6426,0.6413,0.6401,0.639,0.6378,0.6365,0.6351,0.6334,0.6315,0.6294,0.6272,0.6249,0.6224,0.6199,0.6174,0.6148,0.6123,0.6099,0.6075,0.6052,0.603,0.6009,0.599,0.5971,0.5954,0.5938,0.5923,0.5908,0.5894,0.588,0.5866,0.5853,0.5839,0.5826,0.5811,0.5797,0.5781,0.5765,0.5748,0.573,0.571,0.5689,0.5667,0.5645,0.5624,0.5604,0.5586,0.557,0.5556,0.5543,0.553,0.5517,0.5505,0.5491,0.5476,0.546,0.5442,0.5422,0.5401,0.5379,0.5356,0.5335,0.5314,0.5294,0.5275,0.5257,0.5238,0.522,0.5202,0.5184,0.5165,0.5146,0.5127,0.5107,0.5086,0.5065,0.5043,0.5021,0.4998,0.4974,0.4949,0.4923,0.4897,0.487,0.4842,0.4813,0.4784,0.4754,0.4724,0.4694,0.4664,0.4634,0.4605,0.4576,0.4548,0.4521,0.4494,0.4469,0.4445,0.4421,0.4399,0.4377,0.4356,0.4335,0.4315,0.4296,0.4277,0.4259,0.424,0.4223,0.4205,0.4188,0.4171,0.4154,0.4137,0.4119,0.4101,0.4083,0.4065,0.4045,0.4025,0.4005,0.3983,0.3961,0.3938,0.3914,0.389,0.3865,0.3841,0.3816,0.3792,0.3767,0.3743,0.372,0.3697,0.3674,0.3653,0.3633,0.3614,0.3595,0.3578,0.3561,0.3545,0.3529,0.3513,0.3497,0.3481,0.3464,0.3446,0.3427,0.3408,0.3387,0.3366,0.3345,0.3324,0.3303,0.3282,0.3262,0.3243,0.3225,0.3208,0.3193,0.3178,0.3164,0.3149,0.3134,0.3118,0.3101,0.3082,0.3062,0.3041,0.3019,0.2996,0.2974,0.2951,0.293,0.2909,0.289,0.2873,0.2856,0.2842,0.2828,0.2815,0.2803,0.2792,0.2781,0.277,0.2759,0.2748,0.2737,0.2725,0.2712,0.2699,0.2684,0.267,0.2654,0.2638,0.2621,0.2604,0.2586,0.2569,0.255,0.2532,0.2514,0.2495,0.2477,0.2459,0.2441,0.2423,0.2405,0.2388,0.2371,0.2355,0.2339,0.2324,0.2309,0.2295,0.2281,0.2267,0.2254,0.2241,0.2228,0.2215,0.2202,0.2189,0.2176,0.2162,0.2149,0.2135,0.2121,0.2106,0.2092,0.2076,0.2061,0.2045,0.2029,0.2012,0.1996,0.198,0.1964,0.1948,0.1933,0.1918,0.1903,0.1889,0.1875,0.1862,0.185,0.1839,0.1828,0.1819,0.181,0.1803,0.1796,0.1789,0.1782,0.1775,0.1768,0.176,0.1752,0.1742,0.1731,0.1719,0.1704,0.1689,0.1672,0.1654,0.1635,0.1616,0.1596,0.1577,0.1558,0.154,0.1523,0.1507,0.1492,0.1478,0.1464,0.1452,0.144,0.1429,0.1418,0.1408,0.1399,0.139,0.1381,0.1372,0.1364,0.1355,0.1347,0.1339,0.133,0.1321,0.1312,0.1303,0.1293,0.1283,0.1273,0.1262,0.1252,0.1241,0.123,0.1218,0.1207,0.1195,0.1184,0.1172,0.1161,0.1149,0.1138,0.1126,0.1115,0.1104,0.1093,0.1082,0.1071,0.106,0.105,0.104,0.1029,0.1019,0.1009,0.0999,0.099,0.098,0.0971,0.0962,0.0952,0.0943,0.0935,0.0926,0.0917,0.0909,0.09,0.0892,0.0884,0.0876,0.0868,0.086,0.0852,0.0844,0.0837,0.0829,0.0822,0.0815,0.0807,0.08,0.0793,0.0786,0.0779,0.0772,0.0766,0.0759,0.0752,0.0746,0.0739,0.0732,0.0726,0.0719,0.0713,0.0707,0.07,0.0694,0.0688,0.0681,0.0675,0.0669,0.0663,0.0656,0.065,0.0644,0.0638,0.0632,0.0626,0.0619,0.0613,0.0607,0.0601,0.0595,0.0589,0.0583,0.0577,0.057,0.0564,0.0558,0.0552,0.0546,0.054,0.0534,0.0527,0.0521,0.0515,0.0509,0.0503,0.0496,0.049,0.0484,0.0477,0.0471,0.0465,0.0458,0.0452,0.0445,0.0439,0.0432,0.0426,0.0419,0.0413,0.0406,0.04,0.0393,0.0387,0.038,0.0374,0.0367,0.0361,0.0355,0.0349,0.0343,0.0337,0.0331,0.0325,0.0319,0.0314,0.0308,0.0303,0.0298,0.0293,0.0288,0.0283,0.0278,0.0274,0.027,0.0266,0.0262,0.0258,0.0254,0.025,0.0247,0.0243,0.024,0.0237,0.0233,0.023,0.0227,0.0224,0.0221,0.0218,0.0215,0.0213,0.021,0.0207,0.0204,0.0201,0.0198,0.0195,0.0193,0.019,0.0187,0.0184,0.0181,0.0178,0.0174,0.0171,0.0168,0.0165,0.0162,0.0159,0.0155,0.0152,0.0149,0.0146,0.0142,0.0139,0.0136,0.0133,0.013,0.0127,0.0124,0.0121,0.0118,0.0115,0.0112,0.0109,0.0106,0.0103,0.0101,0.0098] # noqa
# fmt: on
Expand All @@ -23,3 +53,46 @@
# npixels_h=1344,
# npixels_v=1024,
)


# Load quantum efficiency data from CSV files
_bvf_wavelengths, _bvf_qe = _load_qe_from_csv("Andor_iXon_Ultra_888_BVF_QE.csv")
_exf_wavelengths, _exf_qe = _load_qe_from_csv("Andor_iXon_Ultra_888_EXF_QE.csv")


Andor_iXon_Ultra_888_BVF = CameraEMCCD(
# photodiode_size=13, #adding in case it's needed in the future
name="Andor iXon Ultra 888 BVF",
qe=Spectrum(wavelength=_bvf_wavelengths, intensity=_bvf_qe),
dark_current=0.0005,
full_well=80_000,
bit_depth=16,
em_gain=1000, # up to 1000x
offset=100,
read_noise=40, # Native read noise at 10MHz read speed. See https://www.biovis.com/resources/ccd/iXon_Ultra_888_EMCCD_Specifications.pdf
)


Andor_iXon_Ultra_888_EXF = CameraEMCCD(
# photodiode_size=13, #adding in case it's needed in the future
name="Andor iXon Ultra 888 EXF",
qe=Spectrum(wavelength=_exf_wavelengths, intensity=_exf_qe),
dark_current=0.0005,
full_well=80_000,
bit_depth=16,
em_gain=1000, # up to 1000x
offset=100,
read_noise=40, # Native read noise at 10MHz read speed. See https://www.biovis.com/resources/ccd/iXon_Ultra_888_EMCCD_Specifications.pdf
)

_orca_wavelengths, _orca_qe = _load_qe_from_csv("C15440_20UP_QE.csv")

C15440_20UP = CameraCMOS(
name="C15440-20UP (Hamamatsu ORCA-Fusion BT)",
qe=Spectrum(wavelength=_orca_wavelengths, intensity=_orca_qe),
dark_current=1.0, # (-8C , Ambient temperature: +25 ˚C) see https://www.hamamatsu.com/us/en/product/cameras/cmos-cameras/C15440-20UP.html
full_well=15_000,
bit_depth=16,
offset=100,
read_noise=1.0,
)
Loading