kipac / bolo-calc Goto Github PK
View Code? Open in Web Editor NEWLicense: BSD 3-Clause "New" or "Revised" License
License: BSD 3-Clause "New" or "Revised" License
bolo-calc currently assumes we are in the high loop-gain limit, setting the responsivity to 1/V_bias, when it deals with readout noise (and in the future when it deals with Johnson noise), converting NEI to NEP.
It would be nice to have the option of setting alpha = (T/R)(dR/dT) = d(lnR)/d(lnT) as an input, and using that alpha to calculate the loop gan L = (alphaP_electrical)/(GTc), and then both report that loop gain and use it to calculate and use the responsivity in calculating noise contributions.
Note that Johnson noise is suppressed by the loop gain, so this issue and the Johnson noise issue are related. A default value of loop gain (suggestion: L=30) will be required for calculating Johnson noise, if alpha is not specified.
Right now the unit tests just require that an end-to-end analysis run both in "reproducible" mode (i.e., nsample=0 and using the mean expectation value for PDF-based parameters) and "sampling" mode (i.e., nsample>0 and sampling from PDFs).
We should extend this to actually test the outputs. Also, we should add some other tests to catch functionality not implement in the example analysis.
Currently this is handled by the VariableHolder and Variable classes in python/bolo/cfg.py.
There are four options, the selection between the options is:
var_type = Choice(choices=['pdf', 'dist', 'gauss', 'const'], default='const')
Here are examples of how to set each one in a yaml configuration file:
param = 3. # const
param = { var_type='gauss', value=3., errors=0.4 } # gauss
param = { var_type='pdf', fname="PDF/param.txt" } # pdf
param = { var_type='dist', fname="BANDS/param.txt" } # distribution
Make sure that this is acceptable.
I haven't turned on the noise correlations, as implemented by the Noise class in the noise.py.
I think that most of the code is there, I just need to check it and test it against OG BoloCalc.
For now I've been using astropy tables for data format and then writing them to fits files.
It would be trivial to switch to pandas data frames, and to store those to any file format pandas supports.
We should decide soon.
After the calculations are done, we often need to access variables that are currently calculated (or could be calculated) "on the fly" and then discarded. These include:
Psat
Flink
G
P_electrical
V_bias
dP/dI (for converting NEP <-> NEI)
dP/dT_cmb
dP/dT_rj
(I'm using this "issue" as a place to keep this list and hopefully keep track of which ones are still "to do")
Currently the unit handing is part of the Parameter definition. It works like this:
#define the units associated to a parameter
scale_frequency = Parameter(required=True, help="Frequency", unit="GHz")
#set the parameter in the associated units (i.e., to set it to 100GHz you would do:
self.scale_temperature = 100.
#set the parameter in from SI units (i.e., to set it to 100GHz you could also do:
self.scale_temperature.set_from_SI(100.e9)
#get the value in the associated units
self.scale_temperature.value # returns 100.
self.scale_temperature.SI # returns 1e11
self.scale_temperature() # also returns 1e11
We should confirm that this is acceptable.
This folder has information on the instrument model we used for the S4 design tool simulations. The pdf describes all the fields and the structure of the current model, and the toml file is the output hardware model:
https://drive.google.com/drive/folders/1ohjGyjlbHgDh0z6iwzAtDwgoMBuaj08w?usp=sharing
The instrument model itself is defined by the code in config.py and sim.py here:
https://github.com/CMB-S4/s4sim/tree/85-tube_LAT/s4sim/hardware
config.py defines the structure and the default values of the instrument model. We are working toward making all the hard-coded values in this come from an input file, which would be what could possibly be shared with bolocalc. sim.py mainly deals with the layout of wafers and tubes, so is likely not as relevant.
bolo-calc currently does not include Johnson noise (of the bolometer and of the shunt resistor) in its calculations. We should add that.
Note that Johnson noise is suppressed by the loop gain, so we will need to require either that the loop gain be specified (suggestion: L=30) or that alpha is supplied so it can be calculated.
(See separate, but related, issue on loop gain).
Readout and Johnson noise are both expressed natively as NEI's. In addition to saving the NEPs, we should also save the noises as NEI's.
The OG BoloCalc code has a couple of different things that it down in terms of defining frequency bands.
Right now I'm mixing these two up a bit, but only computing frequency dependent quantities inside the band as defined by the 3dB windows. This will give identical results for efficiencies, but slightly smaller results for powers.
We should agree on how to do this.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.