.. _simulating: ============================= Finding Simulated Transients ============================= It is useful to simulate transients for testing purposes. This is done by defining parameters of a set of transient in the ``Preferences``. The ``simulated_transient`` preference expects a list of tuples defined as:: simulated_transient = [(segment, integration, dm, dt, amplitude, l, m)] The ``dm`` and ``dt`` parameters are in units of pc/cm3 and s, respectively. The ``amplitude`` defines the strength of the signal per time, baseline, and frequency bin and is added to the data after calibration. The ``l`` and ``m`` define the location of the transient in radians of phase relative to the phase center; be sure to choose values small enough to fit in the field of view. Starting with an SDM file, we can add transients with some freedom. Here is a simple one:: > import rfpipe > st = rfpipe.state.State(sdmfile='16A-459_TEST_1hr_000.57633.66130137732.scan7.cut', sdmscan=7, inprefs={'dmarr': [0, 565], 'dtarr': [1], 'npix_max': 512, 'gainfile': '16A-459_TEST_1hr_000.57633.66130137732.GN', 'simulated_transient': [(0, 10, 0, 5e-5, 0.1, 0., 0.)], 'savecands': True}) The preparation of data by the ``rfpipe.source.data_prep`` function includes adding simulated transients. The data is modified by adding to the data a numpy array generated by this function. .. autofunction:: rfpipe.source.generate_transient :noindex: Running the search pipeline, we get the following:: > cc = rfpipe.pipeline.pipeline_scan(st) Reading scan 7, segment 0/0, times 16:18:58.220 to 16:19:02.220 ... Adding transient to segment 0 at int 10, DM 0, dt 5e-05 with amp 0.1 and l,m=0.0,0.0 ... flag by badchtslide: 0/1600 pol-times and 0/512 pol-chans flagged. flag by blstd: 662 of 409600 total channel/time/pol cells flagged. Correcting by delay/resampling 0/1 ints in single mode Imaging 800 ints (0-799) in seg 0 at DM/dt 0.0/1 with image 512x512 (uvres 104) with fftw Got one! SNR 72.0 candidate at (0, 10, 0, 0, 0) and (l,m) = (0.0,0.0) Got one! SNR 7.5 candidate at (0, 404, 0, 0, 0) and (l,m) = (-0.0012770432692307692,0.00015024038461538462) Calculating features for 2 candidates. 2 candidates returned for (seg, dmind, dtind) = (0, 0, 0) ... In this case, we have added a transient to data read from a file with a known FRB (see :ref:`pipeline`). However, since the FRB was added at ``DM=0``, it appears strongest there. However, some of the signal from the highly-dispersed FRB still appears at another integration.