Example #1
0
def create_plot(testpath, always_make=False):
    filename = testpath / THUMBNAIL_FILE_NAME
    if (not always_make) and filename.exists():
        log.debug(
            'File "%s" already exist for test "%s", so no need to re-create it',
            THUMBNAIL_FILE_NAME,
            str(testpath),
        )
        return filename

    try:
        a = qubicfp()
        a.read_qubicstudio_dataset(str(testpath))
        a.quicklook(xwin=False, filename=filename)
    except:
        log.error('Unable to create plot for test "%s"', str(testpath))
        # Do not bother complaining too much, just keep things going
        return None

    try:
        # Optimize the size of the PNG file
        temp_name = next(tempfile._get_candidate_names())
        full_temp_name = str(default_tmp_dir / temp_name)
        subprocess.run(
            ["pngquant", "-f", "--output", full_temp_name, "32", filename])
        subprocess.run(["optipng", full_temp_name])
        subprocess.run(["mv", "-f", full_temp_name, filename])
        log.debug('Plot for test in "%s" has been compressed successfully',
                  str(testpath))
    except CalledProcessError:
        log.warn('Unable to compress "%s", leaving it uncompressed', filename)
        pass  # Ignore the error, we'll live with an uncompressed plot!

    return filename
Example #2
0
def get_data(dirs, nf, asic, tes=28, doplot=True):
    asic = str(asic)
    thedir = dirs[nf]

    # Qubicpack object
    a = qubicfp()
    a.verbosity = 0
    a.read_qubicstudio_dataset(thedir)
    data = a.azel_etc(TES=None)

    # Signal for one TES
    t0 = data['t_data ' + asic][0]
    t_data = data['t_data ' + asic] - t0
    data = data['data ' + asic]

    if doplot:
        fig, axs = plt.subplots(1, 2, figsize=(15, 3))
        plt.subplots_adjust(wspace=0.5)

        axs[0].plot(t_data, data[tes - 1, :])
        axs[0].set_title(thedir[-5:])

        axs[1].plot(t_data, data[tes - 1, :])
        axs[1].set_title(thedir[-5:])
        axs[1].set_xlim(0, 40)

    return thedir, t_data, data
# import necessary  stuff
import os,sys
jupyter=False
if sys.argv[0].find('ipykernel')>=0:jupyter=True

# make plots within the notebook if using jupyter notebook
if jupyter:        
    %matplotlib notebook

import matplotlib.pyplot as plt
from qubicpack.qubicfp import qubicfp
from qubicpack.temperature_analysis import *


# create the qubicpack focal plane object and read the data
d0=qubicfp()
if jupyter: d0.figsize=9,5
# the first data file contains measurements at high temperature
# these are used to correct the Normal Resistance
d0.read_qubicstudio_dataset(dataset_dir)

# The data contains multiple timelines at different temperatures
# you can print out a summary table
print_datlist(d0)

# first of all, have a look at all timelines for all the TES
d0.plot_timeline_focalplane()

# now look at one in particular.
ASIC = 1
TES = 85
Example #4
0
#!/usr/bin/env python3
'''
$Id: quicklook.py<scripts>
$auth: Steve Torchinsky <*****@*****.**>
$created: Mon 23 Dec 2019 08:59:23 CET
$license: GPLv3 or later, see https://www.gnu.org/licenses/gpl-3.0.txt

          This is free software: you are free to change and
          redistribute it.  There is NO WARRANTY, to the extent
          permitted by law.

find the latest data and make a quicklook plot
'''
from glob import glob
from qubicpack.qubicfp import qubicfp
qubicfp.verbosity = 1
datadir = '/qs2'

datasets = glob('%s/20??-??-??/*' % datadir)
datasets.sort()

latest_dset = datasets[-1]

a = qubicfp()
a.read_qubicstudio_dataset(latest_dset)
a.quicklook()

prmpt = 'Press return to exit. '
ans = input(prmpt)