dataesr/scientific-paragraphs-categorization huggingface dataset:
COMPILATION Modern compilers for dataflow synchronous languages, like the SCADE Suite KCG code generator  [Colaço et al. 2017 ] and the academic Heptagon  [Gérard et al. 2012 ] and Lustre v6  [Jahier et al. 2019 ] compilers, follow the scheme outlined by  Biernacki et al. 2008 : control structures are successively translated into combinations of primitive operators, equations are normalized and scheduled, each node is translated into reset and step methods in a simple object-oriented language, and, finally, imperative functions with explicit state arguments are generated. This scheme was formalized and verified by  Bourke et al. 2017  for the dataflow primitives. We build on their work to add support for the reset operator. The basic idea is simple: a node instantiation with reset is translated into a conditional call to a reset method followed by a call to a step method.
1, but as we have not yet treated these transforms, elaboration currently produces an NLustre program. In the original compiler, the NLustre equations are scheduled before translation directly into Obc, which is further transformed to ensure variable initialization and fuse adjacent conditionals before Clight is generated for compilation by CompCert. In our compiler, translation occurs in two steps: i-translation introduces explicit instance memories and produces code in the new Stc language, it is this code which is scheduled, before s-translation sequentializes the program into Obc. As a concrete example of the basic translation pass, consider the ins node from section 1. 1 which does not use the reset operator. Both the original and new compilers generate practically identical Obc code; it is shown in fig.
if (r) { ins(x). reset() }; x, alarmx := ins(x). step({gps}, {xv}); if (r) { ins(y). reset() }; y, alarmy := ins(y). step({gps}, {yv}); if (r) { ins(x). reset(); ins(y). reset() }; x, alarmx := ins(x). step({gps}, {xv}); y, alarmy := ins(y). step({gps}, {yv}); The problem is that Obc is an imperative language; its semantics is defined as a sequence of updates to environments defining the state and local variables. Reordering the assignment statements in Obc or within CompCert and, above all, formally guaranteeing that their semantics is preserved is possible but needlessly difficult, and probably only really useful for the type of code generated by a dataflow synchronous language compiler. On the other hand, reordering equations in NLustre is trivial-the node rules in figs. 6 and 7 are invariant under permutations of the equations-but the reset is indissociable from instantiation.
Syntactic Transformations. The order of transition constraints in an Stc program is irrelevant to its semantics, but the s-translation pass translates the syntax directly to Obc, which has the effect of replacing constraints by assignment statements and fixing an order of evaluation. It is thus important to first schedule the transition constraints to ensure that the generated code calculates the correct result. Ideally, the schedule should try to group them based on their clock annotations and control expressions to enhance the effect of the subsequent fusion optimization. We adapted the approach of  Bourke et al. 2017  which applies a heuristic implemented in OCaml to find a suitable ordering, a sorting function in Coq whose output is guaranteed to be a permutation of its input, and a verified translation validator to establish the required well-scheduling predicate or signal an error.
The definition of s-tr-args is not presented, it adds validity assertions for variables whose initialization is guaranteed by the correctness proof  [Bourke and Pouzet 2019] , and otherwise simply invokes s-tr-exp. var x = if x ∈ mems then state (x) else x ctrl base s = s ctrl (ck on (x = true)) s = ctrl ck (if (var x) {s} else {skip}) ctrl (ck on (x = false)) s = ctrl ck (if (var x) {skip} else {s}) After translation to Obc, the existing argument initialization, fusion optimization, and generation passes and their correctness proofs, see fig. 9 , apply without modification and we rely on CompCert to produce assembly code that is guaranteed to preserve the semantics of the generated Obc and thus of the NLustre source program. Bourke et al. 2017 ( §3. 2) , our proof of s-translation correctness need not treat instance introductions, since this is done in the preceding pass, but new invariants are required to handle the intermediate states between reset and default transitions.
Translation validation is an alternative to verified code generation. Such compilers exist from Simulink to C  [Ryabtsev and Strichman 2009]  and from Signal to C  [Ngo et al. 2015 ], but the validators themselves are not verified, nor do they treat the reset operator. Our work complements general-purpose verified compilers like CompCert  [Leroy 2009 ] and CakeML  [Kumar et al. 2014 ]. We focus on the idiosyncrasies of a domain-specific language for embedded reactive systems. While the implementation is based on CompCert and Coq, the models and invariants are more general. It may be possible, for instance, to develop similar front-end passes to target CakeML at the StackLang level  [Tan et al. 2016]  where garbage collection can be avoided.
Argos formalizes a subset of Statecharts as operators on Boolean Mealy Machines Mode-Automata  [Maraninchi and Rémond 2003]  combine Argos and Lustre. They too are translated into the DC intermediate language. In Mode-Automata, all variables are global and maintain their values across mode changes, so refinement ( §3. 2. 2) no longer involves a reset. The automata of Scade 6  [Colaço et al. 2005 ] build on ideas from Statecharts, Argos, and Mode-Automata. Their compilation into dataflow primitives exploits node instantiation with reset. Esterel is a special-purpose language for real-time systems  [Berry 1989 ]. The reset operator is generalized by a loop P each d construction  [Berry 2000, §4. 7. 11] , which is, in turn, defined in terms of loop and abort constructions  [Berry 1993 ]. The semantics of Pure Esterel, a restriction to boolean signals, is defined by a statement transition relation  [Berry 2002, §6.
Berry and L. Rieg. The scheme used to compile Esterel programs to circuits is different to the one used to compile Lustre programs to sequential code. Esterel programs with data are formalized by a micro-step semantics as in standard sequential languages  [Potop-Butucaru et al. 2007, §5]. A local variable is simply (re)initialized in the environment when its declaration is (re)entered. Our constraint-based semantic models are thus not directly applicable.
Simulink and Stateflow While SCADE Suite is preferred for certified applications, Simulink, together with the state-machineinspired Stateflow block, is the de facto standard for the Model-Based Design of control software. There are many partial formalizations of Simulink/Stateflow. Alur et al. 2008  formalize a subset by translation to linear hybrid systems; enabled subsystems are treated but it is not clear whether or how resets are handled. They focus on verification and simulation, not code generation. Chapoutot and Martel 2009  apply abstract interpretation to generate numerical overapproximations; they handle subsystems but not enabled or resettable ones. Chen et al. 2009  define a transformation to the Timed Interval Calculus in PVS, treat enabled and triggered subsystems ( §4. 5 and appendix C) but not resets, and focus on verification not compilation.
Building on the ClawZ formalization  [Adams and Clayton 2005; Arthan et al. 2000]  in ProofPower,  Cavalcanti et al. 2011  propose a framework for proving refinement relations between discrete-time diagrams and parallel Spark Ada implementations. They treat enabled subsystems but do not explain if or how resets are handled. We focus on sequential code generation: any program accepted by the compiler should be correctly and automatically transformed into executable code. Bouissou and Chapoutot 2012 define an operational semantics for Simulink that treats a subset of discrete-and continuous-time blocks. Enabled and triggered subsystems are inlined and augmented with switch blocks, but resetting and code generation are ignored. Zou et al. 2013  encode diagrams as Hybrid CSP terms in Isabelle/HOL.
The work is extended to handle Stateflow  [Zou et al. 2015 ] and to provide invariant generation and proofs of program properties  [Chen et al. 2017 ]. Enabled and triggered subsystems are treated ( §3. 2. 6) by flattening them and adding a guard that synchronizes with an input trigger before executing the translated process. Resettable subsystems are not supported and the transformation to Hybrid CSP is not formally verified. The resulting process-algebraic models describe models as step-by-step calculations whereas we work with compositions of stream functions. Hamon and Rushby 2004 and Hamon 2005  formalize the semantics of Stateflow and show that it is essentially an imperative language with a graphical syntax. As for the work on Statecharts, these proposals are not directly relevant to the problems treated in earlier sections.
In terms of resets, the work of Zhou and Kumar 2012 is the most relevant. They model diagrams by composing transition systems. Enabled subsystems are reset by defining ( §4) a conditioning rule operator on subsystems. Resetting is modeled by a function that updates state and output variables. The function does not arise from compositions, as in Lustre, but is rather constructed by the transformation separately for each subsystem. Transitions are composed sequentially-according to the execution order calculated by Simulink-to update the state as in a sequential language. Like the formalizations cited above, our work treats a block-diagram language for programming embedded controllers. It is distinguished by a semantics based on streams with explicit presence and absence, and defined by mutually inductive constraints with support for resetting subsystems.
CONCLUSION We propose a constraint-based semantics to treat an often ignored but fundamental feature of programming languages for Model-Based Design. We show its utility for reasoning within an ITP by proving the correctness of two compilation passes. The proofs remain intricate, but the introduction of a model with explicit memory and a novel intermediate language based on synchronized transitions permit straightforward lemma statements and engender natural proof obligations. Corollary 3. 5 and theorem 3. 9 are chained together to recover the correctness theorem stated by  Bourke et al. 2017  that links the semantics of the source dataflow program, now extended with the reset operator, to that of the assembly code generated by the CompCert backend. Our model is stream based with an explicit representation of presence and absence to facilitate reasoning about deterministic, iterated, conditionally activated functions.
ACKNOWLEDGMENTS We thank the anonymous reviewers for their detailed suggestions,  Alain Girault  for his felicitous observations,  Cédric Pasteur  for pointing out connections with related work, and  Jean-Louis Colaço ,  Pierre-Évariste Dagand , and  Xavier Leroy  for their insightful remarks and support. This work was partially supported by the  Bpifrance Invest for the Future Program  (" Programme d'Investissements d'Avenir ") in the  ES3CAP  project.
Near-surface remote sensing image processing 2. 3. 1. Site selection Among all 508 farmers, participation was high, with producers providing approximately one image a week during the peak of the growing season (0. 7 ± 0. 3 images per week across the whole season, Appendix Fig. A1 ). To test our proposed methodology for monitoring crop phenology, we restrict our analysis to sites with picture coverage from the start of the growing season until harvest, and a minimum of 30 images roughly evenly spaced throughout the season. Time series not adhering to these standards were removed from the final dataset, so as to ensure our methodology could be tested against the best available data to minimize uncertainties introduced by lower levels of participation from some producers. The final dataset, used for all subsequent analyses, retains 52 sites (Appendix, Table  1 ), and includes 2,527 images.
Satellite remote sensing data pre-processing We compare the dates at which individual, smartphone-based ground observations identify the transition between growth stages to those identified from satellite remote sensing products using common  thresholds for both. For this, we interpreted the phenological stages from the in-situ crop imagery as our ground-truth data. Next, we used visible observations of the end-of-tillering (EOT) and start-of-heading (SOH) to derive common growth-stage vegetation index threshold values rather than arbitrarily defined values. A robust common threshold would provide a way to estimate crop phenology without a visual assessment. We compared dates at which individual Gcc time series reach the common thresholds to dates at which the vegetation index for the same plot reaches a threshold as derived from two remote sensing products, with differing spatial and temporal scales.
A4 ). Second, in addition to HLS imagery, we extracted matching EVI time series from the Moderate Resolution Imaging Spectroradiometer (MODIS) MCD43A4 (Collection 6) product at a daily interval and 500 m resolution for all sites. To assess the landscape-wide land cover class at the site locations we extracted the latest available Collection 5 MODIS Land Cover IGBP classes. All MODIS data was accessed through Google Earth Engine® and a custom subset script (GEE; Hufkens, 2017), while HLS data was downloaded through the project's data portal and subset using a custom R script. Similar to the processing of the near-surface remote sensing data, we used smoothed and normalized time series using a fitted loess model with a fixed span of 0. 4 for both remote sensing products (Appendix Fig. A5 ). Phenological thresholds used in satellite remote sensing products or analysis are rarely directly related to observed plant physiological development  (Zhang et al.
, 2003; Hufkens et al. , 2012). We derive a set of generalized phenological dates for the start of season corresponding to the end-of-tillering and start-of-heading based on a range of potential arbitrary VI amplitude thresholds (10-90% with 20% increments) for both remote sensing datasets and GCC time series. Comparison with GCC-derived phenological dates based on common thresholds described in Section 2. 4 is then used to evaluate possible errors in estimation of crop phenology based on use of arbitrary amplitude thresholds commonly used in analysis of satellite remote sensing imagery.
Differences in growth stage as a function of image data and resolution We assess the spatial heterogeneity (or lack thereof) in growth stage timing within and among sites to quantify the degree of spatial and temporal consistency in crop phenology between the in-situ crop imagery and remote sensing products. We estimate local spatial heterogeneity in the HLS data across a region of both 3 × 3 and 5 × 5 pixels surrounding each site location by describing the mean difference in days between the EOT (or SOH) of the pixel containing the in-situ crop imaging site location, and EOT (or SOH), of the surrounding pixels. For both the EOT and SOH we used two common amplitude thresholds for vegetation indices derived through remote sensing (10 and 50%, respectively) on the time series' ascending and descending sections.
Comparison of near-surface and satellite derived phenology metric The SOS and EOS phenological dates derived through satellite remote sensing with the discrete phenological dates of the Gcc time series (EOT and SOH) explain a limited, but significant, fraction of the variance in phenological timing/dates by near-surface remote sensing data (Table  1 ). The SOS derived from MODIS data show a positive relationship with Gcc end-of-tillering dates, explaining ∼4 to 14% of the variance. The HLS data only shows a significant relation with the Gcc-based tillering estimates for thresholds of 50 and 70% amplitude, explaining ∼16% and 9% of the variance, respectively. Start of heading dates show weaker relationships with the Gcc-derived estimates for the SOH. Here, only the MODIS EOS value for a 50% threshold shows a significant relationship with the Gccbased start of heading, explaining only 11% of the variance.
All other threshold values for both HLS and MODIS data were non-significant. Overall we note a consistent root mean squared error of ∼12 days across all comparisons, due to the monotonic increase of both curves and their relatively constant rate of change over the period considered. When comparing arbitrary amplitude thresholds between SOS/EOS dates derived from Gcc time series and satellite remote sensing we find that there are some significant relationships (Table  2 ). Agreement between HLS / MODIS and Gcc SOS and EOS values is highest for thresholds of 50 / 30%, 50 / 50% and 50 / 50%, 50 / 90% respectively. Although in this cross-comparison relationships are at times significant, they only explain a limited amount of the variance, with values generally < 20% and with a maximum of 38%. Summarizing, across both analysis and irrespective of the choice of threshold or Gcc metric, only a limited proportion of the variance in Gcc derived phenology can be explained by satellite imagery.
Importantly, we show that such phases can't be quantified through ad-hoc thresholds of high-resolution satellite remote sensing vegetation indices. Several factors may explain the improved performance of phenological estimation from near-surface imagery compared with satellitebased data. Smallholder agricultural systems, in particular in the tropics, are characterized by small plot sizes, intercropping, and cloud cover during the main agricultural production season. Despite advances in both the processing and the resolution of satellite imagery, use of earth observation datasets for assessing smallholder crop production remains a challenge due to the small size of fields (e. g. < 1 ha) and the heterogeneous nature of cropping patterns, with multiple vegetation/ crop types and fallow areas interspersed  (Duncan et al.
, 2015; Mann and Warner, 2017). In addition, existing assessments of crop yields using satellite remote sensing  (Gao et al. , 2017; Johnson et al. , 2016; Kouadio et al. , 2014)  typically do not control for effects of field-level crop phenology  (Dalhaus et al. , 2018; Tariq et al. , 2017). In this context, phenocam-type data using smartphone cameras on the ground provide high-resolution plot-level data, with consistent coverage in cloudy environments that cannot be achieved using existing satellite datasets. Additionally, improved performance from near-surface imagery may also reflect fundamental differences in the properties of vegetation indices derived from satellite and near-surface remote sensing. In our study, near-surface remote sensing registers the greenness of vegetation while the EVI derived from satellite data registers both photosynthetic and structural canopy properties.
Implications for monitoring and managing agricultural production risk Near-surface imagery from phenocam-type data could provide valuable additional information about field-scale variability in crop phenology, which may help explain some of the heterogeneity in crop yield estimates observed in satellite-based assessments of smallholder crop yields in our study region  (Jain et al. , 2017)  and elsewhere  (Azzari et al. , 2017). In contrast to satellite data, use of near-surface crop imagery also enables detection of yield loss events that do not appreciably change vegetation greenness, irrespective of the resolution of the earth observation dataset. For example, lodging impacts on wheat yields result from reductions in net photosynthesis as the more photosynthetically active upper leaves are unable to function effectively, along with physical difficulties in harvesting grain in lodged crops.
Previous research has shown that machine learning in combination with large image databases can successfully detect plant stress  (Ghosal et al. , 2018)  or complex leaf venenation patterns  (Wilf et al. , 2016). Preliminary machine learning classification experiments of winter wheat growth stages by the authors are promising (data not shown) and will be important for the potential to scale our proposed approach across smallholder landscapes such as the Indo-Gangetic Plain and others.
Acknowledgements This work was undertaken as part of the  CGIAR Research Program on Policies, Institutions, and Markets (PIM)  led by the  International Food Policy Research Institute (IFPRI). Funding support for this study was provided by the  CGIAR Research Programs on Climate Change and Agricultural Food Security (CCAFS)  and  Policies, Institutions, and Markets (PIM) ; the  CGIAR Platform for Big Data in Agriculture ;  3ie  Award No. TW13-1038 ; and  NERC-ESRC-DFID  Award No. NE/ R014094/1. KH acknowledges support from the  National Science Foundation's Macro-system Biology Program  (award  EF-1065029 ) and the  Belgian Science Policy Office  (contract  BR/175/A3/COBECORE ). EKM acknowledges support from  NASA  grant number  NNH14ZDA001N-LCUC. This paper has not gone through IFPRI's standard peer-review procedure.
HLA*LA implements a new graph alignment model for human leukocyte antigen (HLA) type inference, based on the projection of linear alignments onto a variation graph. It enables accurate HLA type inference from whole-genome (99% accuracy) and whole-exome (93% accuracy) Illumina data; from long-read Oxford Nanopore and Pacific Biosciences data (98% accuracy for whole-genome and targeted data) and from genome assemblies. Computational requirements for a typical sample vary between 0. 7 and 14 CPU hours per sample.
, 2002). For each identified contig and each reference haplotype  (Schneider et al. , 2017) , a semi-global alignment is computed heuristically (see below); the annotations of the haplotype underlying the highest-scoring alignment are projected onto the contig; HLA gene and exon sequences are extracted based on the projected coordinates. HLA typing is carried out by IMGT database matching (minimum edit distance). The global alignment heuristic uses BWA-MEM for the identification of local alignments ('diagonals') between the input sequences; dynamic programming is used to identify the highest-scoring traversal of the global alignment matrix limited to the identified diagonals connected with horizontal or vertical jumps. This approach accounts for different MHC haplotype structures and ensures that each gene is used only once per contig.
Acknowledgements We thank  Tina Graves Lindsay  and  Washington University in St. Louis  for public release of the PacBio NA12878 data. We would also like to thank  Adrian V Hill ,  Manjinder Sandhu  and others in his group ( Cristina Pomilla ) and the study participants and the clinic, laboratory, statistical and support staff at  RMPRU  for providing the South African data available for this study and for their helpful comments during manuscript preparation. We are grateful to all staff at Histogenetics for their involvement in PacBio and Miseq exon-targeted SBT of the South African samples.
Funding This work was supported by the  Intramural Research Program of the National Human Genome Research Institute, National Institutes of Health ; the  Ju ¨rgen Manchot Foundation , the  Agence Nationale de la Recherche  ( ANR-11-LABX-0070_TRANSPLANTEX  to S. B. ); the  INTERREG V European regional development fund (European Union )  program  (project 3. 2 TRIDIAG to R. C. , S. B. ); a  Wellcome Trust Fellowship  ( 106289/Z/14/Z  to A. J. M. ); a  European Research Council Advanced Grant  ( 294557  to  Adrian Hill ); the  Korean Visiting Scientist Training Award  through the  Korea Health Industry Development Institute , funded by the  Ministry of Health & Welfare, Republic of Korea  ( HI17C2098  to A. R. ).