Skip to content

Conversation

@lmagnus
Copy link
Contributor

@lmagnus lmagnus commented Jul 28, 2017

@spassmoor @ludwigschwardt Please can you have a look over this new phase down ... better than trying to use the phase up script with the --reset option

J0408 = 'PKS 0408-65 | J0408-6545, radec, 4:08:20.38, -65:45:09.1, (800.0 8400.0 -3.708 3.807 -0.7202)'
J1331 = '3C286 | J1331+3030, radec, 13:31:08.29, +30:30:33.0,(800.0 43200.0 0.956 0.584 -0.1644)'

observation_sources = katpoint.Catalogue(antenna=kat.sources.antenna)
Copy link
Contributor

Choose a reason for hiding this comment

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

The kat object hasn't been assigned yet. Looks like this block needs to move down, after line 41.

Copy link
Contributor

Choose a reason for hiding this comment

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

As below, I would suggest to follow calibrate_delays.py as a template. We have removed these explicit sources in the code and replaced them with the three_calib.csv file in the instruction set. The whole catalogue construction also moves down to after verify_and_connect as @ajoubertza suggests. I also pick only a single source as opposed to looping through a list containing one source.

with start_session(kat, **vars(opts)) as session:
session.standard_setup(**vars(opts))
session.cbf.correlator.req.capture_start()
channels = 32768 if session.product.endswith('32k') else 4096
Copy link
Contributor

Choose a reason for hiding this comment

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

I know this check is used in other scripts, but it isn't very robust. E.g. for a user product like c856M32k4s or bec856M32kram. There is a CBF sensor that gives the number of channels, so suggest that is used instead. Think you can use it like this: channels = session.cbf.fengine.sensor.n_chans

@ludwigschwardt, please confirm that is the correct way to use the SessionCBFStream object.

Copy link
Contributor

Choose a reason for hiding this comment

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

Indeed. My best suggestions would be to look at calibrate_delays.py as that is the most up-to-date cal/cbf-interacting script. There is a function that you can copy (and which should move into CaptureSession now that there is more than one user :-)):

# Default F-engine gain as a function of number of channels
DEFAULT_GAIN = {4096: 200, 32768: 4000}

def set_fengine_gain(session, gain):
    """Set F-engine gain to *gain* if positive, or automatic default if 0."""
    if session.kat.dry_run:
        gain = -1
    # Obtain default gain based on channel count if none specified
    if gain == 0:
        num_channels = session.cbf.fengine.sensor.n_chans.get_value()
        gain = DEFAULT_GAIN.get(num_channels, -1)
    if gain > 0:
        user_logger.info("Setting F-engine gains to %d" % (gain,))
        for inp in session.cbf.fengine.inputs:
            session.cbf.fengine.req.gain(inp, gain)

Copy link
Contributor

@ludwigschwardt ludwigschwardt left a comment

Choose a reason for hiding this comment

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

Similar comments to @ajoubertza.

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.

4 participants