Skip to content

Stimulator analysis pipeline#1659

Open
YudaiSeino wants to merge 33 commits into
masterfrom
stimulator_analysis_pipeline
Open

Stimulator analysis pipeline#1659
YudaiSeino wants to merge 33 commits into
masterfrom
stimulator_analysis_pipeline

Conversation

@YudaiSeino

Copy link
Copy Markdown

I wrote stimulator analysis code. Main functions are calc_gain() and calc_timeconstant(). calc_gain() calculates stimulator's signal amplitude. calc_timeconstant() calculates optical time constant and readout delay.

@ykyohei ykyohei left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's great to see the simulator pipeline in sotodlib!

Preliminary review comments. sotodlib follows PEP8, but whitespace is missing after commas in many places. I suggest running a linter and correcting them.

Comment thread sotodlib/stimulator/stimulator.py Outdated
Comment thread sotodlib/stimulator/stimulator.py Outdated
Comment thread sotodlib/stimulator/stimulator.py Outdated
Comment thread sotodlib/stimulator/stimulator.py Outdated
Comment thread sotodlib/stimulator/stimulator.py Outdated
Comment thread sotodlib/stimulator/stimulator.py Outdated
Comment thread sotodlib/stimulator/stimulator.py Outdated
Comment thread sotodlib/stimulator/stimulator.py Outdated
Comment thread sotodlib/stimulator/stimulator.py Outdated
Comment thread sotodlib/stimulator/stimulator.py Outdated

@ykyohei ykyohei left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! it's getting much better!
I guess I found few bugs, please check.

Comment thread sotodlib/stimulator/stimulator.py Outdated
Comment thread sotodlib/stimulator/stimulator.py Outdated
Comment thread sotodlib/stimulator/stimulator.py Outdated
STM_NORMALIZE_TEMP = 750 # Kelvin. Normalization temperature for stimulator signal temperature.


def get_hk(hkdb_cfg, aman=None, t_start=None, t_end=None):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't necessarily need to be implemented in this PR, but for the site-pipeline of stimulator, we need to implement hk loading from level2 not hkdb.

For example,

def _load_l2_data(config: wg_config, start_time: float, stop_time: float) -> dict:

Comment thread sotodlib/stimulator/stimulator.py Outdated
Comment thread sotodlib/stimulator/stimulator.py Outdated
Comment thread sotodlib/stimulator/stimulator.py Outdated
Comment thread sotodlib/stimulator/stimulator.py Outdated
det_mask[idxs] = True

valid_data = True
if preprocessing:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

preprocessing look common between gain and timeconstant.
I think it would be cleaner and simpler to make independent preprocessing function.

For example:

def preprocessing(aman, hkdata, idxs=None, n_bins=40, cal_type='all'):

        valid_data = get_encoder_timing(aman, hkdata)  # Get timing against encoder t0
        aman.stm_cal.wrap('sampling_rate', 1 / np.median(np.diff(aman.timestamps)), overwrite=True)
        get_chopping_status(aman)
        get_timing_cut(aman)
        get_signal_temp(aman,hkdata)
        chopping_freqs = <both gain and timeconstant>
        get_coadd_data(aman, "all", n_bins, det_mask)

       # fit_coadd with sine function is also common
        do sine fitting.

Comment thread sotodlib/stimulator/stimulator.py Outdated
Comment thread sotodlib/stimulator/stimulator.py Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants