GithubHelp home page GithubHelp logo

aknrdureegaesr / cabrillo Goto Github PK

View Code? Open in Web Editor NEW

This project forked from thxo/cabrillo

0.0 1.0 0.0 59 KB

A Python library to parse/construct Cabrillo amateur radio contest logs. No dependencies and decently tested.

License: BSD 2-Clause "Simplified" License

Python 100.00%

cabrillo's Introduction

cabrillo Build Status

A Python library to parse Cabrillo-format amateur radio contest logs.

Getting Started

Basic Parsing

>>> from cabrillo.parser import parse_log_file
>>> cab = parse_log_file('tests/CQWPX.log')
>>> cab.callsign
'AA1ZZZ'
>>> cab.qso
[<cabrillo.qso.QSO object at 0x10cb09f28>, <cabrillo.qso.QSO object at 0x10cbc8860>]
>>> cab.write_text()
'START-OF-LOG: 3.0\nCALLSIGN: AA1ZZZ\nCONTEST: CQ-WPX-CW\n[...snip...]END-OF-LOG:'

Matching Two QSOs in Contest Scoring

>>> # We start off with a pair with complementary data.
>>> from cabrillo import QSO
>>> from datetime import datetime
>>> qso1 = QSO('14313', 'PH', datetime.strptime('May 30 2018 10:15PM', '%b %d %Y %I:%M%p'), 'KX0XXX', 'KX9XXX', de_exch=['59', '10', 'CO'], dx_exch=['44', '20', 'IN'], t=None)
>>> qso2 = QSO('14313', 'PH', datetime.strptime('May 30 2018 10:10PM', '%b %d %Y %I:%M%p'), 'KX9XXX', 'KX0XXX', de_exch=['44', '20', 'IN'], dx_exch=['59', '10', 'CO'], t=None)
>>> qso1.match_against(qso2)
True
>>> qso1.freq = '14000'  # Same band, still will match.
>>> qso1.match_against(qso2)
True
>>> qso1.match_against(qso2, max_time_delta=1)  # Make time checking less lenient.
False
>>> # All flags.
>>> qso1.match_against(qso2, max_time_delta=30, check_exch=True, check_band=True)

Attributes

Use these attributes to access and construct individual objects.

class Cabrillo(builtins.object)
 |  Cabrillo(check_categories=True, **d)
 |  
 |  Representation of a Cabrillo log file.
 |  
 |  Attributes:
 |        version: The only supported version is '3.0'.
 |        callsign: Call sign of station.
 |        contest: Contest identification.
 |        category_assisted: One of CATEGORY_ASSISTED.
 |        category_band: One of CATEGORY_BAND.
 |        category_mode: One of CATEGORY_MODE.
 |        category_operator: One of CATEGORY_OPERATOR.
 |        category_power: One of CATEGORY-POWER.
 |        category_station: One of CATEGORY-STATION.
 |        category_time: One of CATEGORY-TIME.
 |        category_transmitter: One of CATEGORY-TRANSMITTER. Optional for
 |        multi-op.
 |        category_overlay: One of CATEGORY-OVERLAY.
 |        certificate: If certificate by post. Boolean.
 |        claimed_score: Claimed score in int.
 |        club: Club represented.
 |        created_by: Software responsible for creating this log file.
 |        Optional and defaults to "cabrillo (Python)".
 |        email: Email address of the submitter.
 |        location: State/section/ID depending on contest.
 |        name: Name.
 |        address: Mailing address in list, each entry is each line.
 |        address_city: Optional granular address info.
 |        address_state_province: Optional granular address info.
 |        address_postalcode: Optional granular address info.
 |        address_country: Optional granular address info.
 |        operators: List containing each operator's callsign of the station.
 |        offtime: List containing two datetime objects denoting start and
 |        end of off-time.
 |        soapbox: List containing each line of soapbox text at their own entry.
 |        qso: QSO data containing QSO objects.
 |        x_qso: Ignored QSO data containing QSO objects.
 |        x_anything: A dict of ignored/unknown attributes.
class QSO(builtins.object)
|  QSO(freq, mo, date, de_call, dx_call, de_exch=None, dx_exch=None, t=None)
|  
|  Representation of a single QSO.
|  
|  Attributes:
|      freq: Frequency in str representation.
|      mo: Two letter of QSO. See MODES.
|      date: UTC time in datetime.datetime object.
|      de_call: Sent callsign.
|      de_exch: Sent exchange incl. RST. List of each component.
|      dx_call: Received callsign.
|      dx_exch: Received exchange incl. RST. List of each component.
|      t: Transmitter ID for multi-transmitter categories in int. 0/1.

cabrillo's People

Contributors

thxo avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.