original_docstring: 
          Generate two charts to summarize the breakdown of spectral features.
          The left column plot shows the number of ulines being assigned by
          the various sources of frequency data.
  
          Artifacts - instrumental interference, from the function `process_artifacts`
          Splatalogue - uses the astroquery API, from the function `splat_assign_spectrum`
          Published - local catalogs, but with the `public` kwarg flagged as True
          Unpublished - local catalogs, but with the `public` kwarg flagged as False
          :return: Plotly FigureWidget object
          
docstring: Generate two charts to summarize the breakdown of spectral features.
  The left column plot shows the number of ulines being assigned by
  the various sources of frequency data.
  
  
docstring_tokens: Generate two charts to summarize the breakdown of spectral features . The left column plot shows the number of ulines being assigned by the various sources of frequency data .
code: def plot_breakdown(self):
          """
          Generate two charts to summarize the breakdown of spectral features.
          The left column plot shows the number of ulines being assigned by
          the various sources of frequency data.
  
          Artifacts - instrumental interference, from the function `process_artifacts`
          Splatalogue - uses the astroquery API, from the function `splat_assign_spectrum`
          Published - local catalogs, but with the `public` kwarg flagged as True
          Unpublished - local catalogs, but with the `public` kwarg flagged as False
          :return: Plotly FigureWidget object
          """
          fig = figurefactory.init_plotly_subplot(
              nrows=1,
              ncols=2,
              **{"subplot_titles": ("Reference Breakdown", "Intensity Breakdown")},
          )
          fig.layout["title"] = "Spectral Feature Breakdown"
          fig.layout["showlegend"] = False
          reduced_table = self.table[
              [
                  "frequency",
                  "intensity",
                  "formula",
                  "name",
                  "catalog_frequency",
                  "deviation",
                  "ustate_energy",
                  "source",
                  "public",
              ]
          ]
          artifacts = reduced_table.loc[reduced_table["name"] == "Artifact"]
          splat = reduced_table.loc[reduced_table["source"] == "CDMS/JPL"]
          local = reduced_table.loc[
              (reduced_table["source"] != "Artifact")
              & (reduced_table["source"] != "CDMS/JPL")
          ]
          public = local.loc[local["public"] == True]
          private = local.loc[local["public"] == False]
          sources = [
              "Artifacts",
              "Splatalogue",
              "Published molecules",
              "Unpublished molecules",
          ]
          # Added up the total number of lines
          ulines = self.line_lists["Peaks"].get_ulines()
          assignments = self.line_lists["Peaks"].get_assignments()
          total_lines = len(ulines) + len(assignments)
          # Add up the total intensity
          total_intensity = np.sum([uline.intensity for uline in ulines])
          total_intensity += np.sum(reduced_table["intensity"])
          line_breakdown = [total_lines]
          intensity_breakdown = [total_intensity]
          for source in [artifacts, splat, public, private]:
              line_breakdown.append(-len(source))
              intensity_breakdown.append(-np.sum(source["intensity"]))
          line_breakdown = np.cumsum(line_breakdown)
          intensity_breakdown = np.cumsum(intensity_breakdown)
          labels = ["Total"] + sources
          colors = ["#d7191c", "#fdae61", "#ffffbf", "#abdda4", "#2b83ba"]
          # Left column plot of the number of lines assigned
          fig.add_trace(
              go.Scattergl(x=labels, y=line_breakdown, fill="tozeroy", hoverinfo="x+y"),
              1,
              1,
          )
          # Bar charts showing the number of lines from each source
          fig.add_trace(
              go.Bar(
                  x=labels,
                  y=[0.0]
                  + [len(source) for source in [artifacts, splat, public, private]],
                  hoverinfo="x+y",
                  width=0.5,
                  marker={"color": colors},
              ),
              1,
              1,
          )
          # Right column plot of the intensity contributions
          fig.add_trace(
              go.Scattergl(
                  x=labels, y=intensity_breakdown, fill="tozeroy", hoverinfo="x+y"
              ),
              1,
              2,
          )
          # Bar chart showing the intensity contribution from each source
          fig.add_trace(
              go.Bar(
                  x=labels,
                  y=[0.0]
                  + [
                      np.sum(source["intensity"])
                      for source in [artifacts, splat, public, private]
                  ],
                  hoverinfo="x+y",
                  width=0.5,
                  marker={"color": colors},
              ),
              1,
              2,
          )
          fig["layout"]["xaxis1"].update(title="Source", showgrid=True)
          fig["layout"]["yaxis1"].update(
              title="Cumulative number of assignments", range=[0.0, total_lines * 1.05]
          )
          fig["layout"]["xaxis2"].update(title="Source", showgrid=True)
          fig["layout"]["yaxis2"].update(
              title="Cumulative intensity", range=[0.0, total_intensity * 1.05]
          )
          return fig
code_tokens: def plot_breakdown ( self ) : fig = figurefactory . init_plotly_subplot ( nrows = 1 , ncols = 2 , ** { "subplot_titles" : ( "Reference Breakdown" , "Intensity Breakdown" ) } , ) fig . layout [ "title" ] = "Spectral Feature Breakdown" fig . layout [ "showlegend" ] = False reduced_table = self . table [ [ "frequency" , "intensity" , "formula" , "name" , "catalog_frequency" , "deviation" , "ustate_energy" , "source" , "public" , ] ] artifacts = reduced_table . loc [ reduced_table [ "name" ] == "Artifact" ] splat = reduced_table . loc [ reduced_table [ "source" ] == "CDMS/JPL" ] local = reduced_table . loc [ ( reduced_table [ "source" ] != "Artifact" ) & ( reduced_table [ "source" ] != "CDMS/JPL" ) ] public = local . loc [ local [ "public" ] == True ] private = local . loc [ local [ "public" ] == False ] sources = [ "Artifacts" , "Splatalogue" , "Published molecules" , "Unpublished molecules" , ] ulines = self . line_lists [ "Peaks" ] . get_ulines ( ) assignments = self . line_lists [ "Peaks" ] . get_assignments ( ) total_lines = len ( ulines ) + len ( assignments ) total_intensity = np . sum ( [ uline . intensity for uline in ulines ] ) total_intensity += np . sum ( reduced_table [ "intensity" ] ) line_breakdown = [ total_lines ] intensity_breakdown = [ total_intensity ] for source in [ artifacts , splat , public , private ] : line_breakdown . append ( - len ( source ) ) intensity_breakdown . append ( - np . sum ( source [ "intensity" ] ) ) line_breakdown = np . cumsum ( line_breakdown ) intensity_breakdown = np . cumsum ( intensity_breakdown ) labels = [ "Total" ] + sources colors = [ "#d7191c" , "#fdae61" , "#ffffbf" , "#abdda4" , "#2b83ba" ] fig . add_trace ( go . Scattergl ( x = labels , y = line_breakdown , fill = "tozeroy" , hoverinfo = "x+y" ) , 1 , 1 , ) fig . add_trace ( go . Bar ( x = labels , y = [ 0.0 ] + [ len ( source ) for source in [ artifacts , splat , public , private ] ] , hoverinfo = "x+y" , width = 0.5 , marker = { "color" : colors } , ) , 1 , 1 , ) fig . add_trace ( go . Scattergl ( x = labels , y = intensity_breakdown , fill = "tozeroy" , hoverinfo = "x+y" ) , 1 , 2 , ) fig . add_trace ( go . Bar ( x = labels , y = [ 0.0 ] + [ np . sum ( source [ "intensity" ] ) for source in [ artifacts , splat , public , private ] ] , hoverinfo = "x+y" , width = 0.5 , marker = { "color" : colors } , ) , 1 , 2 , ) fig [ "layout" ] [ "xaxis1" ] . update ( title = "Source" , showgrid = True ) fig [ "layout" ] [ "yaxis1" ] . update ( title = "Cumulative number of assignments" , range = [ 0.0 , total_lines * 1.05 ] ) fig [ "layout" ] [ "xaxis2" ] . update ( title = "Source" , showgrid = True ) fig [ "layout" ] [ "yaxis2" ] . update ( title = "Cumulative intensity" , range = [ 0.0 , total_intensity * 1.05 ] ) return fig
short_docstring: Generate two charts to summarize the breakdown of spectral features.
short_docstring_tokens: Generate two charts to summarize the breakdown of spectral features .
comment: """
          Generate two charts to summarize the breakdown of spectral features.
          The left column plot shows the number of ulines being assigned by
          the various sources of frequency data.
  
          Artifacts - instrumental interference, from the function `process_artifacts`
          Splatalogue - uses the astroquery API, from the function `splat_assign_spectrum`
          Published - local catalogs, but with the `public` kwarg flagged as True
          Unpublished - local catalogs, but with the `public` kwarg flagged as False
          :return: Plotly FigureWidget object
          """$SEP$# Added up the total number of lines$SEP$# Add up the total intensity$SEP$# Left column plot of the number of lines assigned$SEP$# Bar charts showing the number of lines from each source$SEP$# Right column plot of the intensity contributions$SEP$# Bar chart showing the intensity contribution from each source