<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def rdsamp(record_name, sampfrom=0, sampto=None, channels=None, pb_dir=None, channel_names=None, warn_empty=False):
 """ Read a WFDB record, and return the physical signals and a few important descriptor fields. Parameters record_name : str The name of the WFDB record to be read (without any file extensions). If the argument contains any path delimiter characters, the argument will be interpreted as PATH/baserecord and the data files will be searched for in the local path. sampfrom : int, optional The starting sample number to read for all channels. sampto : int, or 'end', optional The sample number at which to stop reading for all channels. Reads the entire duration by default. channels : list, optional List of integer indices specifying the channels to be read. Reads all channels by default. pb_dir : str, optional Option used to stream data from Physiobank. The Physiobank database directory from which to find the required record files. eg. For record '100' in 'http://physionet.org/physiobank/database/mitdb' pb_dir='mitdb'. channel_names : list, optional List of channel names to return. If this parameter is specified, it takes precedence over `channels`. warn_empty : bool, optional Whether to display a warning if the specified channel indices or names are not contained in the record, and no signal is returned. Returns ------- signals : numpy array A 2d numpy array storing the physical signals from the record. fields : dict A dictionary containing several key attributes of the read record: - fs: The sampling frequency of the record - units: The units for each channel - sig_name: The signal name for each channel - comments: Any comments written in the header Notes ----- If a signal range or channel selection is specified when calling this function, the resulting attributes of the returned object will be set to reflect the section of the record that is actually read, rather than necessarily the entire record. For example, if `channels=[0, 1, 2]` is specified when reading a 12 channel record, the 'n_sig' attribute will be 3, not 12. The `rdrecord` function is the base function upon which this one is built. It returns all attributes present, along with the signals, as attributes in a `Record` object. The function, along with the returned data type, has more options than `rdsamp` for users who wish to more directly manipulate WFDB content. Examples -------- sampfrom=800, channel =[1,3]) """

    record = rdrecord(record_name=record_name, sampfrom=sampfrom,
                      sampto=sampto, channels=channels, physical=True,
                      pb_dir=pb_dir, m2s=True, channel_names=channel_names,
                      warn_empty=warn_empty)

    signals = record.p_signal
    fields = {}
    for field in ['fs','sig_len', 'n_sig', 'base_date', 'base_time',
                  'units','sig_name', 'comments']:
        fields[field] = getattr(record, field)

    return signals, fields