Code Monkey home page Code Monkey logo

bolo-calc's People

Contributors

eacharles avatar johnruhl avatar paulkgrimes avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

paulkgrimes

bolo-calc's Issues

Loop gain

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.

Implement real unit testing.

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.

Agree on handling of parameters that can be sampled or take from frequency dependent distributions

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')

  1. const: A constant value, no sampling
  2. gauss: A value and errors. Will sample from a Gaussian distribution, if no sampling is requested will return the central value.
  3. pdf: provide a text file with a column of values and column of probabilities for each value. If no sampling is requested it will return the weighted mean.
  4. dist: provide a text file with a column of frequencies a column of values and optionally a column of errors. If the errors are provided will sample interpolate values and errors at the input frequencies and then sample from a gaussian at each input frequency. If no sampling is requested will interpolate the values at the input frequencies.

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.

Implement noise correlations.

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.

Agree on output format

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.

Report internal variables

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")

Agree on units handling conventions.

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.

get the value in SI units

self.scale_temperature.SI # returns 1e11
self.scale_temperature() # also returns 1e11

We should confirm that this is acceptable.

See if Bolocalc inputs can be made compatible with S4 instrument model

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.

Johnson noise

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).

Save noises as NEI's as well

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.

Agree on scheme for intergration over frequency bands

The OG BoloCalc code has a couple of different things that it down in terms of defining frequency bands.

  1. It computes frequency dependent quantities at a number of frequency points, as specified by either the channel BANDS file, or the channel bandwidth, and the frequency resolution parameter.
  2. It defines a top-hat window function using the 3dB roll-off points on either edge of the band, and uses this for any computations that involve quoting efficiencies.
  3. All integration over bands is done with trapezoid rule integration.

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.