Issues using pygwinc for a non-LIGO interferometer
I recently tried to implement a noise budget with GWINC for the AEI 10 m prototype. I want to avoid having to edit core pygwinc code to add my IFO parameters and calculations, but instead use GWINC as a library for code elsewhere. That way we don't end up with diverging pygwinc library code, which is a huge problem with matgwinc where everyone copies and modifies the whole library. Furthermore I'd like to re-use pygwinc's CLI in __main__.py
.
I should start by saying it's awesome work you've done on pygwinc, and it's so much nicer to use already than matgwinc. However, I've got a few suggestions for making pygwinc more generic so that others can re-use the LIGO calculations with small modifications without having to reimplement whole functions. On a more general note, it seems like if pygwinc were more object oriented (noises are already, but e.g. the precomp file and suspension models are not) this would be less of a problem.
Here are some issues I encountered and suggestions where possible improvements could be made:
Lack of way to dynamically register new IFOs
I'd like to re-use the nice pygwinc CLI so I can easily plot stuff, and run my own IFO's noise budget as well as the standard ones. Ideally I'd like to be able to add my IFO to the list of available IFOs in my own project's __main__
module before calling pygwinc's __main__.main()
, so that it can be called with e.g. python -m myifo MY_IFO
:
/path/to/my/project/__main__.py
:
"""Run AEI prototype noise budget."""
from . import MyIFO # <- My nb.Budget class
from gwinc import register_ifo
from gwinc.cli import main # <- currently this is in __main__.py but could be moved so that external
# libraries don't need to import __main__
register_ifo(MyIFO)
if __name__ == "__main__":
main()
Proposed solution: ideally it should be possible to register an IFO so that it is contained in the list returned by gwinc.ifo.available_ifos
. That way the CLI is able to run the custom budget simply using the IFO's name.
precomp.py requires recycling cavities
The AEI prototype doesn't have recycling cavities, yet precomp.py
requires ifo.Optics.PRM.Transmittance
to be specified. I'd rather not monkey patch precomp.py
to get rid of the PRM stuff, since it's doing a lot of other useful stuff.
Idea: make precomp.py
contain a class (e.g. BasePrecomp
) that implements the various tools in the existing precomp module. Allow this to be overridden so that particular precomputations can be changed or switched off, and new ones added. Have pygwinc look for a Precomp[IFO]
class on the system path and if it finds it, use that instead of BasePrecomp
.
Alternatively, since some of precomp is interferometer-specific (e.g. recycling cavity finesses etc.) and some of it is not (e.g. mirror masses), split these into some core precomp functions/class and some inside the gwinc.ifo
subpackages.
Can't easily reuse parameters from other IFOs, or common material params etc.
The LIGO files have better researched material parameters than mine. I'd like to just use the parameters for silica etc. from the aLIGO.yaml file. Currently it seems I have to copy and paste these manually, but I'd like to be able to pull in the materials from the aLIGO file programmatically.
At the prototype we will also run our interferometer with different sets of optics with different coatings. It would be great if we could create a second budget for the second coatings and inherit everything except the coating parameters in this file.
Idea: split existing YAML materials into a separate materials database. Give these materials keys that can be used inside the main YAML file to specify material properties. Allow material properties from the loaded database to be overridden, e.g. by making the block look like:
Materials:
MassRadius: 0.024 # m
MassThickness: 0.024 # m
## Coating material parameters-----------------------------------------
Coating:
use: 'materials.coatings.aLIGO' # imports default aLIGO coatings block
Yhighn: 100e9 # overrides Yhighn from aLIGO coatings block
Alternatively/additionally: allow parameter files to be loaded hierarchically. A base file could be loaded, and additional parameters overridden by a later file.
Including another budget inside a budget, but with a coupling factor
Our laser frequency noise depends on the noise budget for our reference cavity, but via a coupling factor (i.e. it doesn't appear 1:1 in the main IFO readout). Can I make a gwinc package for the reference cavity and include it into the main IFO budget with this coupling in such a way that its noises appear, appropriately scaled, in the main budget?
Can't plot with the CLI in m/sqrt(Hz)
It'd be nice if the CLI had a flag to plot/save in m/sqrt(Hz) and not strain.