# Add My Telescope

# Sigproc

> Software: Sigproc
> 
> Key Type(s): Int, String
> 
> Depends on: TEMPO1
> 
> Change at: Compilation
> 
> Repo: [https://github.com/FRBs/sigproc](https://github.com/SixByNine/sigproc)
> 
> Quick links: src/alias.c [https://github.com/FRBs/sigproc/blob/master/src/aliases.c](https://github.com/FRBs/sigproc/blob/master/src/aliases.c)

Sigproc requires a unique number for your telescope and processing machine to be identified. It must be changed prior to compiling and installing Sigproc. You can chose any 32-bit integer as your unique identifier, the existing IDs are present in the `alias.c` file you will be editing.

Any names must be less than 79 characters long, beyond that you may encounter undefined behaviour.

All changes need to be made in the `src/alias.c` file. Three changes are required,

- `char tempo_site(int telescope_id)` needs your chosen unique identifier and your TEMPO1 location code. Note, this should be a single character, not a string.

```C
	/*** Previous cases ***/
	case my_telescope_id:
		return my_tempo_char;
		break; // Unnecessary, but matches the rest of the function
	/*** Default case .... ***/
```

- `char *telescope_name (int telescope_id)` needs your chosen telescope name and unique identifier.

```C
	/*** Previous cases ***/
    case my_telescope_id:
    	strcpy(string, "my_telescope_name");
		break;
    /*** Default case ... ***/
```

- `char *backend_name (int machine_id)` needs your chosen processing machine name and another (or the same) unique identifier.

```C
	/*** Previous cases ***/
    case my_telescope_id:
    	strcpy(string, "my_processing_node_name");
		break;
    /*** Default case ... ***/
```

# PSRCHIVE / DSPSR

> Software: PSRCHIVE / DSPSR (intertwined)
> 
> Key Type(s): Int, String
> 
> Depends on: Sigproc, TEMPO, TEMPO2
> 
> Change at: Compilation
> 
> Repo: [https://sourceforge.net/projects/psrchive/](https://sourceforge.net/projects/psrchive/) [https://sourceforge.net/projects/dspsr/](https://sourceforge.net/projects/dspsr/)
> 
> Quick links:
> 
> - PSRCHIVE 
>     - Util/tempo/itoa.C [https://sourceforge.net/p/psrchive/code/ci/master/tree/Util/tempo/itoa.C](https://sourceforge.net/p/psrchive/code/ci/master/tree/Util/tempo/itoa.C)
>     - Base/Extensions/Pulsar/Telescopes.h [https://sourceforge.net/p/psrchive/code/ci/master/tree/Base/Extensions/Pulsar/Telescopes.h](https://sourceforge.net/p/psrchive/code/ci/master/tree/Base/Extensions/Pulsar/Telescopes.h)
>     - Base/Extensions/Telescopes.C [https://sourceforge.net/p/psrchive/code/ci/master/tree/Base/Extensions/Telescopes.C](https://sourceforge.net/p/psrchive/code/ci/master/tree/Base/Extensions/Telescopes.C)
> - DSPSR 
>     - Kernel/Formats/sigproc/SigProcObservation.C [https://sourceforge.net/p/dspsr/code/ci/master/tree/Kernel/Formats/sigproc/SigProcObservation.C](https://sourceforge.net/p/dspsr/code/ci/master/tree/Kernel/Formats/sigproc/SigProcObservation.C)

PSRCHIVE and DSPSR are heavily intertwined, and need multiple changes at compilation time to provide initial support for a telescope, with further changes possible by modifying your TEMPO(2) configurations at runtime.

This focuses on the base software and Sigproc reader/writers, other output types may require further changes(e.g., FITS can be modified in the DSPSR `Kernel/Formars/FITS/...` path).

You will need to chose a site or telescope name, as well as be able to characterise your type of telescope.

- PSRCHIVE 
    - Util/tempo/itoa.C: `static int default_aliases ()` needs you to tie your TEMPO1 code to your chosen site / telescope name.

```C
	/*** Previous aliases ***/
	add_alias (TEMPO_CODE, "MYSITENAME");
	/*** Further aliases ***/
```

- - The itoa switch statement or the tempo2 logic needs to be able to identify your telescope. An example is not provided for this step.
    - Base/Extensions/Pulsar/Telescopes.h: A new function prototype following the signature `<span class="kt">void</span> <span class="n">Pulsar</span><span class="o">::</span><span class="n">Telescopes</span><span class="o">::MYSITENAME</span><span class="p">(</span><span class="n">Telescope</span> <span class="o">*</span><span class="n">t</span><span class="p">)</span>` inside the namespace "`Telescopes`"

```C
	/*** Previous Prototypes ***/
	void Pulsar::Telescopes::MYSITENAME(Telescope *t)
	/*** More prototypes ***/
```

- - Base/Extensions/Telescopes.C: A new function with signature following the prototype you just defined

```C
/*** Other telescope definitions ***/

void Pulsar::Telescopes::MYSITENAME(Telescope *t)
{
    t->set_name ("MYSITENAME");
  	// You will need to describe the properties of your telescope as well, check other entries in this file for further details.
}
/*** Further telescope definitions ***/
```

- DSPSR 
    - Kernel/Formats/sigproc/SigProcObservation.C: static std::string get\_sigproc\_telescope\_name (int \_id) needs your Sigproc site identifier and name.

```C
	/*** Previous Sigproc ID cases ***/
    case MY_SIGPROC_SITE_ID:
    	return "MYSITENAME";
    /*** Further Sigproc ID cases ***/
```

- - Kernel/Formats/sigproc/SigProcObservation.C: static int get\_sigproc\_telescope\_id (string name) needs your Sigproc site name and TEMPO1/ITOA identifier.

```C
	/*** Other site code ifs ***/
	else if (itoa == "MY_TEMPO_CODE") return MY_SIGPROC_SITE_ID;
	/*** Further site code ifs ***/
```

- - Kernel/Formats/sigproc/SigProcObservation.C: static std::string get\_sigproc\_machine\_name (int \_id, int \_telescope) needs your Sigproc processing node identifier and name.

```C
 	/*** Previous Sigproc ID cases ***/
    case MY_SIGPROC_PROCESSING_NODE_ID:
    	return "MYNODENAME";
    /*** Further Sigproc ID cases ***/
```

- - <span class="kt">Kernel/Formats/sigproc/SigProcObservation.C: void</span> <span class="n">dsp</span><span class="o">::</span><span class="n">SigProcObservation</span><span class="o">::</span><span class="n">unload\_global</span> <span class="p">() needs your Sigproc processing node identifier and name.</span>

```C
	/*** Other processing node ID ifs ***/
	else if(get_machine().compare("MYNODENAME")==0)machine_id=MY_NODE_ID;
	/*** Further processing node ID ifs ***/
```