Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Overall Program The Search for Extra-Terrestrial Intelligence (SETI) is an organisation that exists to try and detect intelligent extra-terrestrial life in the universe. They operate

Overall Program

The Search for Extra-Terrestrial Intelligence (SETI) is an organisation that exists to try and detect intelligent extra-terrestrial life in the universe. They operate several radio telescopes from around the world to listen for intelligent signals from space. You have been contracted to write a C application to analyse data that has been flagged as a possible signal of interest. Each data file contains a collection of signals collected in one day from different telescopes. Your program is to read a collection of these signals from text files into one or more Linked List data structures and perform the required processing operations on the data. Your program should be compiled with make and contain a working makefile.

Task 1 Data Types (15 Marks)

Declare suitable C datatypes to represent each of the following sets of information in a header file.

  1. A SETIData type that includes

    • Telescopes (A collection of telescope data)

    • Date (the day, month and year when the data was collected)

  2. A Telescope type that includes:

    • Name (Max 127 characters)

    • Latitude (A float)

    • Longitude (A float)

    • Signals (A collection of signal data) Hint: Marks have been allocated for using a linked list

  3. A Signal data type that includes:

    • start_time (a UNIX timestamp)

    • end_time (a UNIX timestamp)

    • probability (a percentage)

    • content (a string of characters received by the telescope)

Task 2 Loading Data (25 Marks)

Write a function (or collection of functions) that will read a SETI data file and populate the data types declared in Task 1.

Data is saved in .txt files.

The name of the Telescope is shown on the first line of the file. After that, the location is stored in the form of an (latitude, longitude) coordinate. Then the signal data received from that telescope is listed. Each signal comprises four lines with the first two lines containing the start time and end time in UNIX format, followed by the probability percentage and the content of the signal.

The following is a sample from an example data file named 2022-01-26.txt :

Parkes Observatory (-32.99778, 148.26292) 
1643142183 1643142186 0.5% '//!//W' 
1643149259 1643149265 0.8% '!//W///!' 
Green Bank (38.437896, - 79.836169) 
1643188172 1643188180 38.5% '////MC@@_///' 

Your function should:

  • Take in a date to be used for the data file.

  • Dynamically allocate the structures you designed in Task 1.

  • Read the Telescope data.

  • Read each of the Signals that came from each telescope.

  • Return a pointer to a single SETIData structure you designed in Task 1.

    If the file cannot be opened, your function should return NULL. An error message is not required.

Task 3 Finding Messages from Space (15 Marks)

Write a function (or collection of functions) that will import a pointer to a SETIData. This function should go through each of the signals and print any that might contain proof of intelligent life.

A signal might contain proof of intelligent life if the probability value is at least 35%.

Because of the way the signals have been recorded, the polarity of the signal switches every 4 bits. This means that parts of the signal content are not correctly encoded. To fix this, flip the last 4 bits of each character (any 0s will become 1s and 1s will become 0s)

For example:

if the unprocessed content looked like this:

'Gjcc`' In binary those characters are: 01000111 01101010 01100011 01100011 01100000

Swapping the polarity every 4 bits would give:

01001000 01100101 01101100 01101100 01101111

The signals duration and the processed content should be printed on the screen along with the date and the name of the telescope that detected it.

Task 4 Main (15 Marks)

Write a main function that accepts any number of dates as command-line parameters. Your main function should:

Choose one of the provided dates at random: o Use the loading code from Task 2 to read the contents of a file with that date

as its filename into a SETIData. o Use the code from Task 3 to output any likely signals.

  • If a file fails to read, print an error message and return 1, otherwise return 0

  • Perform all necessary freeing of dynamically allocated memory.

Task 5 Shell Script (10 Marks)

Write a bash script named SETI.sh that will perform the following operations in order.

  1. Use make to compile your program

  2. Execute your program using the input files provided on Moodle and redirect the

    programs output to a file named output.txt

  3. Search the output.txt file for any word that starts with the letter P and ends with an

    exclamation mark !

If your program does not return 0 when executed in step 2, the bash script should echo an error message.

INPUT FILE:

2022-01-26.txt

Parkes Observatory (-32.99778, 148.26292)

1643142183 1643142186 0.5% '//!//W'

1643149259 1643149265 0.8% '!//W///!'

Green Bank (38.437896, -79.836169)

1643188172 1643188180 38.5% '////MC@@_///'

Hat Creek (40.8178, -121.473)

1643166285 1643166397 38.5% '//!!/X@X./!s!!/'

2022-01-28.txt

Lick Observatory (37.341389, -121.642778)

1643306983 1643306989 9.5% 'W../Wj./W'

1643307408 1643307412 5.5% 'W......./W'

1643361268 1643361274 39.5% '//}b!///'

Green Bank (38.437896, -79.836169)

1643361274 1643361403 93.5% 'Xj/L`bj/Fa/_jnlj.'

Parkes Observatory (-32.99778, 148.26292)

1643338452 1643338454 0.5% './//////../WL/'

2022-01-25.txt

Lick Observatory (37.341389, -121.642778)

1643089752 1643089757 26.5% 'W.a.////W'

1643121845 1643121854 7.5% 'W..../W//'

Parkes Observatory (-32.99778, 148.26292)

1643117720 1643117723 0.5% './//////../WL/'

1643126370 1643126399 62.5% 'nnnnnnnnng.///'

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Graph Databases In Action

Authors: Dave Bechberger, Josh Perryman

1st Edition

1617296376, 978-1617296376

More Books

Students also viewed these Databases questions