Currently different photons selections are identified by a string. For example 'DA' indicates all photons, 'D' donor channel photons during donor excitation, 'A' donor channel photons during donor excitation and 'AA' acceptor channel photons during acceptor excitation.
These names are ambiguous without reading the docs or the code and don't allow definition of arbitrary combinations.
Proposal
A simple and general way to handle the definition of photon selection would be defining an object with two keyword arguments:
Ph_sel(Dex='DAem', Aex='DAem')
Possible values for Dex or Aex are 'DAem' (default), 'Dem' and 'Aem'. This way the definition would be explicit and unambiguous but still compact and completely general.
To save some typing and increase legibility a useful shortcut would be Ph_sel('all') meaning all-photons (equivalent but more readable than Ph_sel(Dex='DAem', Aex='DAem')) .
Implementation
The easiest implementation would be using a dictionary or a named tuple. The named tuple has the advantage of defining the keywords (the dictionary would accept any key) and to be immutable. The latter property allow to use the Ph_sel object as dictionary key in cases where the strings 'DA', 'D', 'A' are currently used.
The only disadvantage of the named tuple is that we need to subclass it in order to support the special shortcut ('all') or default keyword values.
A quick search reveals possible solutions for the default values:
>>> from collections import namedtuple
>>> Node = namedtuple('Node', 'val left right')
>>> Node.__new__.__defaults__ = (None, None, None)
Problem
Currently different photons selections are identified by a string. For example 'DA' indicates all photons, 'D' donor channel photons during donor excitation, 'A' donor channel photons during donor excitation and 'AA' acceptor channel photons during acceptor excitation.
These names are ambiguous without reading the docs or the code and don't allow definition of arbitrary combinations.
Proposal
A simple and general way to handle the definition of photon selection would be defining an object with two keyword arguments:
Possible values for
Dex
orAex
are 'DAem' (default), 'Dem' and 'Aem'. This way the definition would be explicit and unambiguous but still compact and completely general.To save some typing and increase legibility a useful shortcut would be
Ph_sel('all')
meaning all-photons (equivalent but more readable thanPh_sel(Dex='DAem', Aex='DAem')
) .Implementation
The easiest implementation would be using a dictionary or a named tuple. The named tuple has the advantage of defining the keywords (the dictionary would accept any key) and to be immutable. The latter property allow to use the
Ph_sel
object as dictionary key in cases where the strings 'DA', 'D', 'A' are currently used.The only disadvantage of the named tuple is that we need to subclass it in order to support the special shortcut ('all') or default keyword values.
A quick search reveals possible solutions for the default values:
or
(from Named tuple and optional keyword arguments)
The latter approach would easily allow defining shortcut argument 'all'.