% This is the ADASS_template.tex LaTeX file, 25th Oct 2018.
% It is based on the ASP general author template file, but modified to reflect the specific
% requirements of the ADASS proceedings.
% Copyright 2014, Astronomical Society of the Pacific Conference Series
% Revision:  14 August 2014

% To compile, at the command line positioned at this folder, type:
% latex ADASS_template
% latex ADASS_template
% dvipdfm ADASS_template
% This will create a file called ADASS_template.pdf

\documentclass[11pt,twoside]{article}

% Do NOT use ANY packages other than asp2014. 
\usepackage{asp2014}

\aspSuppressVolSlug
\resetcounters

% References must all use BibTeX entries in a .bibfile.
% References must be cited in the text using \citet{} or \citep{}.
% Do not use \cite{}.
% See ManuscriptInstructions.pdf for more details
\bibliographystyle{asp2014}

% The ``markboth'' line sets up the running heads for the paper.
% 1 author: "Surname"
% 2 authors: "Surname1 and Surname2"
% 3 authors: "Surname1, Surname2, and Surname3"
% >3 authors: "Surname1 et al."
% Replace ``Short Title'' with the actual paper title, shortened if necessary.
% Use mixed case type for the shortened title
% Ensure shortened title does not cause an overfull hbox LaTeX error
% See ASPmanual2010.pdf 2.1.4  and ManuscriptInstructions.pdf for more details
\markboth{Saha, and Hessling}{Pulsar DigitalTwin and Detection}


\begin{document}

\title{Software framework for detecting Pulsar Signals using Digital-Twin and Machine Learning}

% Note the position of the comma between the author name and the 
% affiliation number.
% Authors surnames should come after first names or initials, eg John Smith, or J. Smith.
% Author names should be separated by commas.
% The final author should be preceded by "and".
% Affiliations should not be repeated across multiple \affil commands. If several
% authors share an affiliation this should be in a single \affil which can then
% be referenced for several author names.
% See ManuscriptInstructions.pdf and ASPmanual2010.pdf 3.1.4 for more details
\author{Tanumoy~Saha$^1$ and Hermann~Hessling $^2$
\affil{$^1$HTW Berlin, Berlin, Germany}
\affil{$^2$DZA, Gorlitz, Lower Saxony, Germany}}

% This section is for ADS Processing.  There must be one line per author.
\paperauthor{Tanumoy~Saha}{sahat@htw-berlin.de}{0009-0001-5505-2751}{HTW Berlin}{Applied Computer Science}{Berlin}{Berlin}{12459}{Germany}
\paperauthor{Hermann~Hessling}{hermann.hessling@dzastro.de}{ORCID_Or_Blank}{Deutsches Zentrum fur Astrophysik}{Author2 Department}{Gorlitz}{Saxony}{Postal Code}{Country}


% There should be one \aindex line (commented out) for each author. These are used to
% build up the author index for the Proceedings. The surname must come first, followed by
% initials. Note the use of ~ before each initial to control spacing.
% The \author entries (see above) have surname last. These \aindex entries have
% surname first.

%\aindex{Author,~A.~N.}
%\aindex{Coauthor,~A.}

% \begin{abstract}
%  The motivation here is to set the ground work necessary to detect complex astronomical phenomena predicted by theoretical models from data acquired by large radio-telescope arrays. To start with we took the example of single pulse detections from the dispersion graphs of pulsars. For that we developed a digital twin of Pulsar based on spark model, along with a noble pipeline based on UNet to segment and detect pulsar signals from the dispersion graphs. The idea here is to extend this software framework to develop more complex digital twin of pulsar based on new theoretical models to train the pipeline to identify complex pulse patterns.
% \end{abstract}

\begin{abstract}
The astronomical data collected by large radio-telescopes can be complex 
and large in volume.
%hh in nature. 
To work with these 
%hh complex 
data it is 
%hh also 
important to detect and identify the relevant %hh important 
information from it. 
%hh which is necessary and useful. 
This work aims to automatically identify pulsar signals using machine learning and simulation.
%hh This work is motivated to set a benchmark in identifying complex astronomical phenomena predicted from theoretical models. 
The pipeline of our work starts with the example of single pulse detection from disperse graphs of pulsars. A 
%hh developed 
software framework for digital twin of pulsar signals %hh Pulsar 
based on 
the %<-- hh: added
spark model is presented, along with a %hh noble 
pipeline based on UNet to segment and detect pulsar signals from the dispersion graphs. 
%Along the line we planned to develop and make the framework much more efficient for identifying more complex pulse patterns. 
We plan to further develop the framework and make it significantly more efficient in order to identify more complex signal patterns. 

\end{abstract}

% These lines show examples of subject index entries. At this stage these have to commented
% out, and need to be on separate lines. Eventually, they will be automatically uncommented
% and used to generate entries in the Subject Index at the end of the Proceedings volume.
% Don't leave these in! - replace them with ones relevant to your paper.
%\ssindex{conference!ADASS 2018}
%\ssindex{organisations!ASP}

\section{Introduction}
%Testing new theories has always been in the forefront of science. 
With the new telescopes like the Square Kilometer Array Observatory (SKAO), testing and discovering new celestial objects and rare astronomical signals becomes plausible. Recent advances in computation and machine learning aids further to that endeavor. In this project we have developed a simplistic Digital Twin based on well-established light house model and spark model of pulsars. A pipeline using legacy image-processing tools and CNN--based neural networks are also developed to detect real signals from real telescope data. The idea is to train the CNNs using synthetic data generated by the digital twin. This framework will allow scientists to add new models in the digital twin based on new theoretical model to check new hypothesis and also to detect new pulse features from data acquired by powerful telescopes like SKAO. Below we will briefly introduce the two important modules of ML-PPA, PulsarDT: the digtal twin and PulsarSA: the pipeline.


\subsection{PulsarDT}
Pulsar Digital Twin (or PulsarDT \footnote{PulsarDT Gitlab Repository \url{https://gitlab.dzastro.de/punch/ml-ppa/pulsardt}.} ) is a simple virtual magnetic non-relativistic rotator with emission regions at the magnetic poles as shown in Figure \ref{P261_f1}. The emission signals can be understood as rays emitted by a lighthouse \citet{Lorimer2004HandbookOP}. The pattern of the emission beam is animated as drifting sparks inspired by the spark model of \citet{Gil_2000}. The spark pattern and the drift velocity along other pulsar attributes like the pulsar orientation relative to earth axis and magnetic axis tilt are the parameters of the Digital-Twin. The user can tune these parameters to engineer characteristic pulse patterns. The emission from the sparks are modeled as broadband spectrum following established power-law \citet{Lee_Bhat_Sokolowski_Swainston_Ung_Magro_Chiello_2022}, which travels through homogeneous interstellar medium (ISM). The radio emissions are then detected using the virtual telescope module which are represented as dispersion graphs.

\articlefiguretwo{P261_f1_left.jpg}{P261_f1_right.jpg}{P261_f1}{Digital Twin of Pulsar.  \emph{Left:} A snapshot of the virtual rotator with
non-relativistic magnetic field lines. %Here is a animation 
\emph{Right:} A render of a spark
pattern at the magnetic pole of the virtual rotator.  }

\subsection{PulsarSA}
Pulsar signal Segmentation and Analyze (or PulsarSA \footnote{PulsarSA Gitlab Repository \url{https://gitlab.dzastro.de/punch/ml-ppa/pulsarsa}}) is a pipeline aimed at segmenting and identifying pulsar signals. The pipeline consists of three consecutive steps. The pipeline takes input of dispersion graph and identifies if and where the pulsar signal is present in the graph. The first step is to segment the dispersion graph using a CNN, for our purpose we choose a simple UNet. The second task is to filter out the segmented mask to remove noisy segments in the graph. The third step is to identify the type of the segments using connected component analysis 

\section{Current state}
As of this paper publishing date, PulsarDT can be used to simulate drifting sub-pulse patterns and pulse-pattern engineering. Based on the spark pattern parameters chosen by the user, different pulse geometries can be synthesized. For example the user can arrange the sparks around the magnetic pole to generate different pulse geometries as shown in Figure \ref{P261_f2}. Similarly different drift velocities of the spark can be applied to the spark pattern to generate drifting sub-pulse pattern as shown in Figure   \ref{P261_f2}. PulsarSA on the other hand comes with simple UNet type CNN for segmenting and filtering dispersion graphs. Legacy image-processing tool is used to further classify the segments. The steps are shown in Figure \ref{P261_f3}.  

\articlefiguretwo{P261_f2_left.jpg}{P261_f2_right.jpg}{P261_f2}{Current state of PulsarDT.  \emph{Left:} Pulse pattern modulation with different spark pattern geometries. (\emph{Top:}) Snapshots of the virtual rotator with 1,3,7,13 spark patterns respectively from left to right. (\emph{Middle:}) Dispersion graph for the respective spark patterns without noise. (\emph{Bottom:}) Dispersion graph of the respective spark pattern with noise.  \emph{Right:} Pulse pattern modulation with different drift velocity. Two different scenarios are shown. (\emph{Top Group:}) Drift velocity of 640\deg rotation around the magnetic axis of the drift patterns for 360\deg rotation of the pulsar around the rotation axis. This is denoted as 640\deg/360\deg drift velocity. The top plot shows the dispersion graph for 4 consecutive rotation phases. The plot in the middle shows the spark identified as spark IDs passing the view direction. The render plots in the bottom shows snaps at the consecutive rotation phases -12\deg, -6\deg, 6\deg, 12\deg. (\emph{Bottom Group:}) Drift velocity of 90\deg/360\deg. The render plots in the top shows snaps at the consecutive rotation phases -12\deg, -6\deg, 6\deg, 12\deg. The plot in the middle shows the spark identified as spark IDs passing the view direction. The bottom plot shows the dispersion graph for 4 consecutive rotation phases -12\deg, -6\deg, 6\deg, 12\deg. }

\articlefiguretwo{P261_f3_left.jpg}{P261_f3_right.jpg}{P261_f3}{Current state of PulsarSA.  \emph{Left:} PulsarSA Pipeline serial steps: segmentation filtration and labeling. \emph{Right:} Pipeline steps in real dispersion graphs.}
\clearpage

\section{Results and Outlook}
To determine the efficiency of the pipeline we choose the example of single pulse signal from crab pulsar \emph{B0531+21\_58713\_43190} acquired using the MeerKAT telescope. For this we generated synthetic datasets using PulsarDT with the same pulsar parameters and acquisition settings. To be specific we have generated ensemble of dispersion datasets with varying antenna sensitivity. Each ensemble contained ten-thousand dispersion graphs. Each ensemble sets were used then to train a simpler version of UNet for segmentation and filtering. The pipeline trained with synthetic data sets generated by PulsarDT showed F1-score > 0.85 for SNR>12 on real labeled datasets of crab pulsar shown in Figure \ref{P261_f4}. The current UNet has roughly 30,000 trainable parameters. The next steps include further optimizing the UNet to increase performance in wider DM ranges of pulsar signals while keeping a check in the number of trainable parameters. We are also working on a tuner module to incorporate multiple trained pipelines to be combined into one without the need of re-training. 

\articlefigure{P261_f4.jpg}{P261_f4}{Performance of the software framework. The plot shows the performance metric scores recall, accuracy, precision and F1-score for the pipelines on real labeled Pulsar data with SNR>12 trained over different ensemble of synthetic datasets based on antenna sensitivity. The pipeline showed acceptable performance in ensemble dataset \emph{work\_folder\_child\_2 } with F1-score > 0.85 }


\bibliography{P261}  % For BibTex
\end{document}
