pygwinc issueshttps://git.ligo.org/gwinc/pygwinc/-/issues2024-02-22T19:28:09Zhttps://git.ligo.org/gwinc/pygwinc/-/issues/114load_hdf5 should load metadata in addition to just the traces and ifo struct2024-02-22T19:28:09ZKevin Kunsload_hdf5 should load metadata in addition to just the traces and ifo structYou can currently save any metadata along with the budget traces and ifo struct with `io.save_hdf5` like
```python
traces = budget.run()
metadata = {
"gps_time": 123,
"other_stuf": "blah blah",
}
io.save_hdf5(traces, path, ifo=bu...You can currently save any metadata along with the budget traces and ifo struct with `io.save_hdf5` like
```python
traces = budget.run()
metadata = {
"gps_time": 123,
"other_stuf": "blah blah",
}
io.save_hdf5(traces, path, ifo=budget.ifo, **extra_metadata)
```
This [does save](https://git.ligo.org/gwinc/pygwinc/-/blob/master/gwinc/io.py?ref_type=heads#L46) `extra_metadata` in `attrs`, however `load_hdf5` [only loads](https://git.ligo.org/gwinc/pygwinc/-/blob/master/gwinc/io.py?ref_type=heads#L115) the traces and ifo back (in SCHEMA_VERSION 2).
Furthermore, it adds the ifo struct to traces, which I don't like. I propose doing something like returning traces, ifo, and everything in attrs except `ifo` (and maybe not `SCHEMA` or `SCHEMA_VERSION` either). Or maybe make a SCHEMA 3 which saves any metadata to a separate metadata dict in attrs. Something like
```python
traces = io.load_hdf5(file_name) # if only the traces were saved
traces, ifo = io.load_hdf5(file_name) # if traces and ifo were saved
traces, ifo, metadata = io.load_hdf5(file_name) # if all three were saved
```
The one problem being knowing how many variables to expect, but maybe that's not so bad.
This kind of thing would be very useful for the LHO noise budget, for example. Right now I have them saving any extra metadata that they want as I did in the example above. If the conclusion is to move to some other slightly different SCHEMA where the metadata is saved in some other way in the hdf5 file, it will be trivial to manually fix the few budgets that they've saved as in the above example to work with whatever we eventually decide.https://git.ligo.org/gwinc/pygwinc/-/issues/111add unit test for accumulate2023-11-04T18:12:50ZKevin Kunsadd unit test for accumulateThe `nb.Budget` `accumulate` function is missing on some branches. It should be tested.The `nb.Budget` `accumulate` function is missing on some branches. It should be tested.Kevin KunsKevin Kunshttps://git.ligo.org/gwinc/pygwinc/-/issues/110unit tests for io2023-11-04T16:46:02ZKevin Kunsunit tests for ioWe need unit tests for `load_hdf5` and `save_hdf5`. This shouldn't hold up any merge requests, but things have broken them before and been accidentally caught (or not).We need unit tests for `load_hdf5` and `save_hdf5`. This shouldn't hold up any merge requests, but things have broken them before and been accidentally caught (or not).https://git.ligo.org/gwinc/pygwinc/-/issues/108add deepcopy to traces2023-04-04T03:30:57ZKevin Kunsadd deepcopy to tracesIt would be convenient if traces could be deepcopied.It would be convenient if traces could be deepcopied.https://git.ligo.org/gwinc/pygwinc/-/issues/107Add option of auxiliary wavelengths resonating in arm cavity and related calc...2021-12-09T21:30:31ZAnchal GuptaAdd option of auxiliary wavelengths resonating in arm cavity and related calculationsSince Arm Length Stabilization (ALS) is an important part of ifo design and requirements, it would be nice to allow adding auxiliary wavelength(s) that are assumed to be circulating in the arm cavities. The helper function [arm_cavity(if...Since Arm Length Stabilization (ALS) is an important part of ifo design and requirements, it would be nice to allow adding auxiliary wavelength(s) that are assumed to be circulating in the arm cavities. The helper function [arm_cavity(ifo)](https://git.ligo.org/gwinc/pygwinc/-/blob/master/gwinc/ifo/noises.py#L42) can be expanded to calculate cavity parameters for the auxiliary wavelengths. This could be the start of supporting the calculation of noise contributions to auxiliary wavelength loops as well.
I believe there is more potential for development once we have the wavelengths as an ifo parameter.https://git.ligo.org/gwinc/pygwinc/-/issues/106BS losses are only single passed in PRC for calculation of power recycling ga...2021-12-03T05:51:01ZSheila DwyerBS losses are only single passed in PRC for calculation of power recycling gain, shouldn't they be double passed?In ifo/noises.py line 105:
```
`prfactor = t5**2 / (1 + r5 * rarm * sqrt(1-bsloss))**2`
```
I'm thinking that the BS is double passed in the PRC, so this should be:
```
`prfactor = t5**2 / (1 + r5 * rarm * (1-bsloss))**2`
```
or
```
...In ifo/noises.py line 105:
```
`prfactor = t5**2 / (1 + r5 * rarm * sqrt(1-bsloss))**2`
```
I'm thinking that the BS is double passed in the PRC, so this should be:
```
`prfactor = t5**2 / (1 + r5 * rarm * (1-bsloss))**2`
```
or
```
`prfactor = t5**2 / (1 + r5 * rarm * sqrt(1-2*bsloss))**2`
```
Is that right? This may be inconsequential for the IFO models gwinc has because the BS losses are small, but we are thinking that we need to use larger PRC losses if we want to make a model to match H1.https://git.ligo.org/gwinc/pygwinc/-/issues/105pytest_addoption not doing its job2021-11-23T15:54:23ZKevin Kunspytest_addoption not doing its jobWhen trying to running pytest in the pygwinc/test directory as
```shell
pytest
```
all of the tests work. When running it from the gwinc directory I get the following error
<details>
<summary> Error </summary>
```shell
================...When trying to running pytest in the pygwinc/test directory as
```shell
pytest
```
all of the tests work. When running it from the gwinc directory I get the following error
<details>
<summary> Error </summary>
```shell
==================================== ERRORS ====================================
________________________ ERROR collecting test session _________________________
/home/kevin/.local/lib/python3.7/site-packages/_pytest/config/__init__.py:458: in _importconftest
return self._conftestpath2mod[key]
E KeyError: PosixPath('/home/kevin/Documents/Research/GWdetectionCode/pygwinc/gwinc/test/cache/7bda7f0598e6b78ac90f9d986e105469bbed08d0/gwinc/conftest.py')
During handling of the above exception, another exception occurred:
/home/kevin/.local/lib/python3.7/site-packages/py/_path/common.py:383: in visit
for x in Visitor(fil, rec, ignore, bf, sort).gen(self):
/home/kevin/.local/lib/python3.7/site-packages/py/_path/common.py:435: in gen
for p in self.gen(subdir):
/home/kevin/.local/lib/python3.7/site-packages/py/_path/common.py:435: in gen
for p in self.gen(subdir):
/home/kevin/.local/lib/python3.7/site-packages/py/_path/common.py:435: in gen
for p in self.gen(subdir):
/home/kevin/.local/lib/python3.7/site-packages/py/_path/common.py:435: in gen
for p in self.gen(subdir):
/home/kevin/.local/lib/python3.7/site-packages/py/_path/common.py:424: in gen
dirs = self.optsort([p for p in entries
/home/kevin/.local/lib/python3.7/site-packages/py/_path/common.py:425: in <listcomp>
if p.check(dir=1) and (rec is None or rec(p))])
/home/kevin/.local/lib/python3.7/site-packages/_pytest/main.py:622: in _recurse
ihook = self.gethookproxy(dirpath)
/home/kevin/.local/lib/python3.7/site-packages/_pytest/main.py:441: in gethookproxy
my_conftestmodules = pm._getconftestmodules(fspath)
/home/kevin/.local/lib/python3.7/site-packages/_pytest/config/__init__.py:436: in _getconftestmodules
mod = self._importconftest(conftestpath)
/home/kevin/.local/lib/python3.7/site-packages/_pytest/config/__init__.py:483: in _importconftest
self.consider_conftest(mod)
/home/kevin/.local/lib/python3.7/site-packages/_pytest/config/__init__.py:536: in consider_conftest
self.register(conftestmodule, name=conftestmodule.__file__)
/home/kevin/.local/lib/python3.7/site-packages/_pytest/config/__init__.py:342: in register
ret = super().register(plugin, name)
/home/kevin/.local/lib/python3.7/site-packages/pluggy/manager.py:127: in register
hook._maybe_apply_history(hookimpl)
/home/kevin/.local/lib/python3.7/site-packages/pluggy/hooks.py:333: in _maybe_apply_history
res = self._hookexec(self, [method], kwargs)
/home/kevin/.local/lib/python3.7/site-packages/pluggy/manager.py:93: in _hookexec
return self._inner_hookexec(hook, methods, kwargs)
/home/kevin/.local/lib/python3.7/site-packages/pluggy/manager.py:87: in <lambda>
firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,
gwinc/test/cache/7bda7f0598e6b78ac90f9d986e105469bbed08d0/gwinc/conftest.py:26: in pytest_addoption
help = "Have tests update plots (it is slow)",
/home/kevin/.local/lib/python3.7/site-packages/_pytest/config/argparsing.py:78: in addoption
self._anonymous.addoption(*opts, **attrs)
/home/kevin/.local/lib/python3.7/site-packages/_pytest/config/argparsing.py:314: in addoption
raise ValueError("option names %s already added" % conflict)
E ValueError: option names {'--plot'} already added
!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!
=============================== 1 error in 2.08s ===============================
```
</details>
I think this is a problem in the `pytest_addoption` function in conftest.py
This isn't an emergency since pytest watch still works when called in the gwinc directory and all the tests run when called in gwinc/test.Lee McCullerLee McCullerhttps://git.ligo.org/gwinc/pygwinc/-/issues/104Release 0.4.0 breaks residual gas noise calculation in existing budgets2021-11-23T00:32:12ZChristopher WipfRelease 0.4.0 breaks residual gas noise calculation in existing budgetsSince !121 they fail with error `Struct object has no attribute 'H2'`.Since !121 they fail with error `Struct object has no attribute 'H2'`.Kevin KunsKevin Kunshttps://git.ligo.org/gwinc/pygwinc/-/issues/103No easy way to remove filter cavity2021-11-23T00:15:53ZKevin KunsNo easy way to remove filter cavityThere's no easy way to remove the filter cavity from budgets right now because the filter cavity loss needs to be manually removed. This will maybe be solved if sub-budgets are defined at runtime (#83) depending on how that's implemented...There's no easy way to remove the filter cavity from budgets right now because the filter cavity loss needs to be manually removed. This will maybe be solved if sub-budgets are defined at runtime (#83) depending on how that's implemented. In particular, setting `ifo.Squeezer.Type = 'Freq Independent'` for the default A+ will calculate the quantum noise with frequency independent squeezing, but will fail because `QuantumVacuumFilterCavity` is hard-coded in the A+ init file. The proper way to do this is to define an ifo without `QuantumVacuumFilterCavity`, like aLIGO, but this is not obvious to a beginner. I'd love it if there was a way to inherit budgets instead of just ifo structs, but that's a long ways away.https://git.ligo.org/gwinc/pygwinc/-/issues/102add version specification to yaml files2021-10-04T18:38:15ZKevin Kunsadd version specification to yaml filesyaml files should have a field that specifies which version of gwinc to use.yaml files should have a field that specifies which version of gwinc to use.https://git.ligo.org/gwinc/pygwinc/-/issues/101how to setup matlab gwinc path2021-09-02T23:23:39ZRana Adhikarihow to setup matlab gwinc pathHaving trouble getting my old pygwinc code to find the correct matlab gwinc codes when load a coating config file.
How about adding a readme to the repo describing how to set that up?Having trouble getting my old pygwinc code to find the correct matlab gwinc codes when load a coating config file.
How about adding a readme to the repo describing how to set that up?https://git.ligo.org/gwinc/pygwinc/-/issues/100Examples2021-08-03T22:54:47ZRana AdhikariExamplesI think it would be good to have something akin to Finesse_playground where people can upload a bunch of examples where people do things that are commonly done with gwinc.
For example, optimizing for a specific cost function.
Could tha...I think it would be good to have something akin to Finesse_playground where people can upload a bunch of examples where people do things that are commonly done with gwinc.
For example, optimizing for a specific cost function.
Could that be another repo in the gwinc group?Christopher WipfChristopher Wipfhttps://git.ligo.org/gwinc/pygwinc/-/issues/99bug in load_hdf52021-05-20T22:21:50ZKevin Kunsbug in load_hdf5Trying something like
```python
import gwinc.io as io
traces = io.load_hdf5('QuantumRelGamma.h5')
```
usually works for me. However, when trying this on the attached file I get the following error:
```
-----------------------------------...Trying something like
```python
import gwinc.io as io
traces = io.load_hdf5('QuantumRelGamma.h5')
```
usually works for me. However, when trying this on the attached file I get the following error:
```
---------------------------------------------------------------------------
ConstructorError Traceback (most recent call last)
<ipython-input-2-09781378b8b1> in <module>
----> 1 traces = io.load_hdf5('QuantumRelGamma.h5')
~/Documents/Research/GWdetectionCode/pygwinc/gwinc/io.py in load_hdf5(path)
142 with h5py.File(path, 'r') as f:
143 version = f.attrs.get('SCHEMA_VERSION', 1)
--> 144 return loaders[version](f)
~/Documents/Research/GWdetectionCode/pygwinc/gwinc/io.py in _load_hdf5_v2(f)
121 except yaml.constructor.ConstructorError:
122 logger.warning("HDF5 load warning: Could not de-serialize 'ifo' YAML attribute.")
--> 123 trace.plot_style = yaml.safe_load(attrs.get('plot_style', ''))
124 return trace
125
~/.local/lib/python3.7/site-packages/yaml/__init__.py in safe_load(stream)
160 to be safe for untrusted input.
161 """
--> 162 return load(stream, SafeLoader)
163
164 def safe_load_all(stream):
~/.local/lib/python3.7/site-packages/yaml/__init__.py in load(stream, Loader)
112 loader = Loader(stream)
113 try:
--> 114 return loader.get_single_data()
115 finally:
116 loader.dispose()
~/.local/lib/python3.7/site-packages/yaml/constructor.py in get_single_data(self)
41 node = self.get_single_node()
42 if node is not None:
---> 43 return self.construct_document(node)
44 return None
45
~/.local/lib/python3.7/site-packages/yaml/constructor.py in construct_document(self, node)
50 self.state_generators = []
51 for generator in state_generators:
---> 52 for dummy in generator:
53 pass
54 self.constructed_objects = {}
~/.local/lib/python3.7/site-packages/yaml/constructor.py in construct_yaml_map(self, node)
402 data = {}
403 yield data
--> 404 value = self.construct_mapping(node)
405 data.update(value)
406
~/.local/lib/python3.7/site-packages/yaml/constructor.py in construct_mapping(self, node, deep)
208 if isinstance(node, MappingNode):
209 self.flatten_mapping(node)
--> 210 return super().construct_mapping(node, deep=deep)
211
212 def construct_yaml_null(self, node):
~/.local/lib/python3.7/site-packages/yaml/constructor.py in construct_mapping(self, node, deep)
133 raise ConstructorError("while constructing a mapping", node.start_mark,
134 "found unhashable key", key_node.start_mark)
--> 135 value = self.construct_object(value_node, deep=deep)
136 mapping[key] = value
137 return mapping
~/.local/lib/python3.7/site-packages/yaml/constructor.py in construct_object(self, node, deep)
90 constructor = self.__class__.construct_mapping
91 if tag_suffix is None:
---> 92 data = constructor(self, node)
93 else:
94 data = constructor(self, tag_suffix, node)
~/.local/lib/python3.7/site-packages/yaml/constructor.py in construct_undefined(self, node)
418 raise ConstructorError(None, None,
419 "could not determine a constructor for the tag %r" % node.tag,
--> 420 node.start_mark)
421
422 SafeConstructor.add_constructor(
ConstructorError: could not determine a constructor for the tag 'tag:yaml.org,2002:python/tuple'
in "<unicode string>", line 9, column 14:
ylim_limits: !!python/tuple
^
```
[QuantumRelGamma.h5](/uploads/de29c04def27712062067ab45e8c8d2f/QuantumRelGamma.h5)Jameson Rollinsjameson.rollins@ligo.orgJameson Rollinsjameson.rollins@ligo.orghttps://git.ligo.org/gwinc/pygwinc/-/issues/98Documentation for budget items of the same name2021-05-18T19:02:45ZSam ScherfDocumentation for budget items of the same nameWhen adding nb.Noise/nb.Calibration objects to a budget, the object is copied into the nb.Budget class namespace with the object's original name. This means you cannot import nb.Noise/nb.Calibrations objects with the same name from diffe...When adding nb.Noise/nb.Calibration objects to a budget, the object is copied into the nb.Budget class namespace with the object's original name. This means you cannot import nb.Noise/nb.Calibrations objects with the same name from different files as they will conflict with each other in the nb.Budget namespace. This issue is subtle and relatively uncommon but it might be worth mentioning somewhere in the documentation.https://git.ligo.org/gwinc/pygwinc/-/issues/97Restore gwinc TCS calculation2021-12-03T05:51:10ZChristopher WipfRestore gwinc TCS calculationA calculation of the TCS efficiency required to achieve a given SRC loss is described in the comments of our ifo.yaml files. But at some point the implementation was removed from pygwinc. TCS can be an important consideration, so we sh...A calculation of the TCS efficiency required to achieve a given SRC loss is described in the comments of our ifo.yaml files. But at some point the implementation was removed from pygwinc. TCS can be an important consideration, so we should put this back in.
We should check it for correctness, and I think it will need updating to scale with material parameters, and integrate with the new quantum code once that is merged.https://git.ligo.org/gwinc/pygwinc/-/issues/96Alternative suspension models2021-04-20T13:42:35ZSebastian SteinlechnerAlternative suspension modelsFor ET (and Virgo), we will want to include a different or at least modified suspension model. It is not completely clear to me how we could go about that. There is currently an (unused) `ifo.Suspension.Type` parameter in most of the YAM...For ET (and Virgo), we will want to include a different or at least modified suspension model. It is not completely clear to me how we could go about that. There is currently an (unused) `ifo.Suspension.Type` parameter in most of the YAML files. It seems natural to use this in `precomp_suspension` to call the appropriate code, instead of always calling `suspQuad`. Unsure where the code then would live, however. Adding it to `suspension.py` seems too much, but if it lives in a different file, we might need some additional glue logic to import the correct file. This may be overthinking it, however... it's unlikely we'll have _that_ many models. Also, is the function's signature how we want it and should we use this to make other models take exactly the same parameters and return the same TFs? Are there any other places that need to be adapted? The functions in `suspensionthermal.py` may actually be general enough to be reused, however the names of individual contributions in `noises.py` (e.g. `SuspensionThermalHorizAPM`) are "quad-centric".
Somewhat related to !105, #80, #92.https://git.ligo.org/gwinc/pygwinc/-/issues/95ITM Thermorefractive noise optical gain2021-04-14T03:48:30ZLee McCullerITM Thermorefractive noise optical gainI haven't thought about the current code totally, but the adjustment for the relative length sensitivity in the SRC vs. the ARMs should be more than just the arm finesse, due to the cavity effect of the SRC. At low frequencies the length...I haven't thought about the current code totally, but the adjustment for the relative length sensitivity in the SRC vs. the ARMs should be more than just the arm finesse, due to the cavity effect of the SRC. At low frequencies the length sensitivity in the SRC is suppressed from anti-resonance and above the CC-pole it is enhanced from SRC resonance. The suppression and enhancements are about ~3x (a 3^2 swing over the CC-pole) in aLIGO with .325 SRM. This swing will be substantially larger in detectors with a lower SRM transmission.
```python
class ITMThermoRefractive(nb.Noise):
"""ITM Thermo-Refractive
"""
style = dict(
label='ITM Thermo-Refractive',
color='#448ee4',
linestyle='--',
)
def calc(self):
power = ifo_power(self.ifo)
gPhase = power.finesse * 2/np.pi
cavity = arm_cavity(self.ifo)
n = noise.substratethermal.substrate_thermorefractive(
self.freq, self.ifo.Materials, cavity.wBeam_ITM)
return n * 2 / gPhase**2
```
We need to change the 1/gPhase**2 term to be based on the quantum code.https://git.ligo.org/gwinc/pygwinc/-/issues/92SuspensionThermal noise budget class does not include SuspensionThermalVertTM...2021-04-20T12:55:44ZMatteo CarlassaraSuspensionThermal noise budget class does not include SuspensionThermalVertTM in .\ifo\noises.pyIn .\ifo\noises.py, the SuspensionThermalVertTM sub-budget is not included in the SuspensionThermal noise budget definition (.\ifo\noises.py, lines 615 to 636).
I'm interested in this term for my simulations, so I redefined the Suspens...In .\ifo\noises.py, the SuspensionThermalVertTM sub-budget is not included in the SuspensionThermal noise budget definition (.\ifo\noises.py, lines 615 to 636).
I'm interested in this term for my simulations, so I redefined the SuspensionThermal noise by adding this term in an __init__.py file inside my ifo folder.
Then, I called and plotted all the sub-budgets and I found out that the SuspensionThermalVertTM asd is equally zero for all the frequency band.
Is there a known reason for this? If yes, could you please tell me where I can find the discussion on this topic? I will be very grateful for this.
I tried to recursively follow the functions, but I was not able to find the reason why this sub-budget is returned as zero.
Thank you.https://git.ligo.org/gwinc/pygwinc/-/issues/90Documentation for yaml files2021-01-14T22:00:14ZKevin KunsDocumentation for yaml filesRelated to #88, we should add documentation for the yaml files instead of relying on the canonical IFOs as examples. There are options in the noise functions that don't have examples in these files or where the conventions and defaults a...Related to #88, we should add documentation for the yaml files instead of relying on the canonical IFOs as examples. There are options in the noise functions that don't have examples in these files or where the conventions and defaults are not obvious (for example the complicated behavior of [`getJointParams`](https://git.ligo.org/gwinc/pygwinc/-/blob/master/gwinc/suspension.py#L69) for specifying the suspensions or [`platform_motion`](https://git.ligo.org/gwinc/pygwinc/-/blob/master/gwinc/noise/seismic.py#L33) for specifying platform motion), and addressing #63 will introduce more.https://git.ligo.org/gwinc/pygwinc/-/issues/89Add multi-material coating support2021-01-12T22:47:12ZChristopher WipfAdd multi-material coating supportpygwinc should allow for coating stacks with more than two materials in them. !52 by @anchal.gupta got us most of the way there, but the code may need to be generalized slightly, and we need a more scalable way to represent the material...pygwinc should allow for coating stacks with more than two materials in them. !52 by @anchal.gupta got us most of the way there, but the code may need to be generalized slightly, and we need a more scalable way to represent the material parameters.