Features

A class for collecting infrastructure features, including OLE neutral sections, HABD and WILD, water troughs, telegraph codes and driver/guard buzzer codes.

Features.decode_vulgar_fraction(x) Decode vulgar fraction.
Features.parse_vulgar_fraction_in_length(x) Parse ‘VULGAR FRACTION’ for ‘Length’ of water trough locations.
Features.collect_habds_and_wilds([…]) Collect codes of hot axle box detectors (HABDs) and wheel impact load detectors (WILDs) from source web page.
Features.fetch_habds_and_wilds([update, …]) Fetch codes of HABDs and WILDs from local backup.
Features.collect_water_troughs([…]) Collect codes of water troughs from source web page.
Features.fetch_water_troughs([update, …]) Fetch codes of water troughs from local backup.
Features.collect_telegraph_codes([…]) Collect telegraph code words from source web page.
Features.fetch_telegraph_codes([update, …]) Fetch telegraph code words from local backup.
Features.collect_buzzer_codes([…]) Collect buzzer codes from source web page.
Features.fetch_buzzer_codes([update, …]) Fetch buzzer codes from local backup.
Features.fetch_features_codes([update, …]) Fetch features codes from local backup.
class pyrcs.other_assets.Features(data_dir=None, update=False)[source]

A class for collecting infrastructure features, including OLE neutral sections, HABD and WILD, water troughs, telegraph codes and driver/guard buzzer codes.

Parameters:
  • data_dir (str, None) – name of data directory, defaults to None
  • update (bool) – whether to check on update and proceed to update the package data, defaults to False

Example:

from pyrcs.other_assets import Features

features = Features()

print(features.Name)
# Infrastructure features
static decode_vulgar_fraction(x)[source]

Decode vulgar fraction.

parse_vulgar_fraction_in_length(x)[source]

Parse ‘VULGAR FRACTION’ for ‘Length’ of water trough locations.

collect_habds_and_wilds(confirmation_required=True, verbose=False)[source]

Collect codes of hot axle box detectors (HABDs) and wheel impact load detectors (WILDs) from source web page.

Parameters:
  • confirmation_required (bool) – whether to prompt a message for confirmation to proceed, defaults to True
  • verbose (bool, int) – whether to print relevant information in console as the function runs, defaults to False
Returns:

data of HABDs and WILDs, and date of when the data was last updated

Return type:

dict, None

Example:

from pyrcs.other_assets import Features

features = Features()

confirmation_required = True

habds_and_wilds_codes_data = features.collect_habds_and_wilds(confirmation_required)
# To collect data of HABD and WILD? [No]|Yes:
# >? yes

print(habds_and_wilds_codes_data)
# {'HABD and WILD': <codes>,
#  'Last updated date': <date>}
fetch_habds_and_wilds(update=False, pickle_it=False, data_dir=None, verbose=False)[source]

Fetch codes of HABDs and WILDs from local backup.

Parameters:
  • update (bool) – whether to check on update and proceed to update the package data, defaults to False
  • pickle_it (bool) – whether to replace the current package data with newly collected data, defaults to False
  • data_dir (str, None) – name of package data folder, defaults to None
  • verbose (bool) – whether to print relevant information in console as the function runs, defaults to False
Returns:

data of hot axle box detectors (HABDs) and wheel impact load detectors (WILDs), and date of when the data was last updated

Return type:

dict

Example:

from pyrcs.other_assets import Features

features = Features()

update = False
pickle_it = False
data_dir = None

habds_and_wilds_codes_data = features.fetch_habds_and_wilds(update, pickle_it, data_dir)

print(habds_and_wilds_codes_data)
# {'HABD and WILD': <codes>,
#  'Last updated date': <date>}
collect_water_troughs(confirmation_required=True, verbose=False)[source]

Collect codes of water troughs from source web page.

Parameters:
  • confirmation_required (bool) – whether to prompt a message for confirmation to proceed, defaults to True
  • verbose (bool, int) – whether to print relevant information in console as the function runs, defaults to False
Returns:

data of water troughs, and date of when the data was last updated

Return type:

dict, None

Example:

from pyrcs.other_assets import Features

features = Features()

confirmation_required = True

water_troughs_data = features.collect_water_troughs(confirmation_required)
# To collect data of water troughs? [No]|Yes:
# >? yes

print(water_troughs_data)
# {'Water troughs': <codes>,
#  'Last updated date': <date>}
fetch_water_troughs(update=False, pickle_it=False, data_dir=None, verbose=False)[source]

Fetch codes of water troughs from local backup.

Parameters:
  • update (bool) – whether to check on update and proceed to update the package data, defaults to False
  • pickle_it (bool) – whether to replace the current package data with newly collected data, defaults to False
  • data_dir (str, None) – name of package data folder, defaults to None
  • verbose (bool) – whether to print relevant information in console as the function runs, defaults to False
Returns:

data of water troughs, and date of when the data was last updated

Return type:

dict

Example:

from pyrcs.other_assets import Features

features = Features()

update = False
pickle_it = False
data_dir = None

water_troughs_data = features.fetch_water_troughs(update, pickle_it, data_dir)

print(water_troughs_data)
# {'Water troughs': <codes>,
#  'Last updated date': <date>}
collect_telegraph_codes(confirmation_required=True, verbose=False)[source]

Collect telegraph code words from source web page.

Parameters:
  • confirmation_required (bool) – whether to prompt a message for confirmation to proceed, defaults to True
  • verbose (bool, int) – whether to print relevant information in console as the function runs, defaults to False
Returns:

data of telegraph code words, and date of when the data was last updated

Return type:

dict, None

Example:

from pyrcs.other_assets import Features

features = Features()

confirmation_required = True

telegraph_codes_data = features.collect_telegraph_codes(confirmation_required)
# To collect data of telegraphic codes? [No]|Yes:
# >? yes

print(telegraph_codes_data)
# {'Telegraphic codes': <codes>,
#  'Last updated date': <date>}
fetch_telegraph_codes(update=False, pickle_it=False, data_dir=None, verbose=False)[source]

Fetch telegraph code words from local backup.

Parameters:
  • update (bool) – whether to check on update and proceed to update the package data, defaults to False
  • pickle_it (bool) – whether to replace the current package data with newly collected data, defaults to False
  • data_dir (str, None) – name of package data folder, defaults to None
  • verbose (bool) – whether to print relevant information in console as the function runs, defaults to False
Returns:

data of telegraph code words, and date of when the data was last updated

Return type:

dict

Example:

from pyrcs.other_assets import Features

features = Features()

update = False
pickle_it = False
data_dir = None

telegraph_codes_data = features.fetch_telegraph_codes(update, pickle_it, data_dir)

print(telegraph_codes_data)
# {'Telegraphic codes': <codes>,
#  'Last updated date': <date>}
collect_buzzer_codes(confirmation_required=True, verbose=False)[source]

Collect buzzer codes from source web page.

Parameters:
  • confirmation_required (bool) – whether to prompt a message for confirmation to proceed, defaults to True
  • verbose (bool, int) – whether to print relevant information in console as the function runs, defaults to False
Returns:

data of buzzer codes, and date of when the data was last updated

Return type:

dict, None

Example:

from pyrcs.other_assets import Features

features = Features()

confirmation_required = True

buzzer_codes_data = features.collect_buzzer_codes(confirmation_required)
# To collect data of buzzer codes? [No]|Yes:
# >? yes

print(buzzer_codes_data)
# {'Buzzer codes': <codes>,
#  'Last updated date': <date>}
fetch_buzzer_codes(update=False, pickle_it=False, data_dir=None, verbose=False)[source]

Fetch buzzer codes from local backup.

Parameters:
  • update (bool) – whether to check on update and proceed to update the package data, defaults to False
  • pickle_it (bool) – whether to replace the current package data with newly collected data, defaults to False
  • data_dir (str, None) – name of package data folder, defaults to None
  • verbose (bool) – whether to print relevant information in console as the function runs, defaults to False
Returns:

data of buzzer codes, and date of when the data was last updated

Return type:

dict

Example:

from pyrcs.other_assets import Features

features = Features()

update = False
pickle_it = False
data_dir = None

buzzer_codes_data = features.fetch_buzzer_codes(update, pickle_it, data_dir)

print(buzzer_codes_data)
# {'Buzzer codes': <codes>,
#  'Last updated date': <date>}
fetch_features_codes(update=False, pickle_it=False, data_dir=None, verbose=False)[source]

Fetch features codes from local backup.

Parameters:
  • update (bool) – whether to check on update and proceed to update the package data, defaults to False
  • pickle_it (bool) – whether to replace the current package data with newly collected data, defaults to False
  • data_dir (str, None) – name of package data folder, defaults to None
  • verbose (bool) – whether to print relevant information in console as the function runs, defaults to False
Returns:

data of features codes and date of when the data was last updated

Return type:

dict

Example:

from pyrcs.other_assets import Features

features = Features()

update = False
pickle_it = False
data_dir = None

features_codes = features.fetch_features_codes(update, pickle_it, data_dir)

print(features_codes)
# {'Features': <codes>,
#  'Last updated date': <date>}