old_contents: import nose.tools
  import os.path
  from calm.pandas_time_series import PandasTimeSeries
  from calm.pandas_calculator import PandasCalculator
  from calm.global_median_denoiser import GlobalMedianDenoiser
  from calm.jump_penalty_denoiser import JumpPenaltyDenoiser
  
  @nose.tools.istest
  def apply_global_median_denoiser_to_time_series():
      noisy_ts = PandasTimeSeries()
      input_csv_path = os.path.join("test_data", "noisy_simple_3state.csv")
      noisy_ts.load_csv(input_csv_path)
  
      calculator = PandasCalculator()
      gm_denoiser = GlobalMedianDenoiser(calculator)
      denoised_ts = gm_denoiser.run_denoising(noisy_ts)
      output_csv_path = os.path.join("test_data", "output_from_gm_test.csv")
      denoised_ts.write_csv(output_csv_path)
  
      nose.tools.ok_(os.path.exists(output_csv_path))
      nose.tools.eq_(len(noisy_ts), len(denoised_ts))
      median_of_ts = noisy_ts.series.median()
      nose.tools.ok_((denoised_ts.series == median_of_ts).all())
  
  
  @nose.tools.istest
  def jump_penalty_output_matches_matlab_output():
      noisy_ts = PandasTimeSeries()
      input_csv_path = os.path.join("test_data", "noisy_simple_3state.csv")
      noisy_ts.load_csv(input_csv_path)
  
      matlab_ts = PandasTimeSeries()
      input_csv_path = os.path.join("test_data", "freemat_jump.csv")
      matlab_ts.load_csv(input_csv_path)
  
      calculator = PandasCalculator()
      jp_denoiser = JumpPenaltyDenoiser(calculator)
      denoised_ts = jp_denoiser.run_denoising(noisy_ts, square=True, gamma=0.1,
                                              noisy=True)
      output_csv_path = os.path.join("test_data", "output_from_jp_test.csv")
      denoised_ts.write_csv(output_csv_path)
      print denoised_ts
      nose.tools.ok_(denoised_ts.is_similar_to(matlab_ts), str(denoised_ts))
  
new_contents: import nose.tools
  import os.path
  from calm.pandas_time_series import PandasTimeSeries
  from calm.pandas_calculator import PandasCalculator
  from calm.global_median_denoiser import GlobalMedianDenoiser
  from calm.jump_penalty_denoiser import JumpPenaltyDenoiser
  
  @nose.tools.istest
  def apply_global_median_denoiser_to_time_series():
      noisy_ts = PandasTimeSeries()
      input_csv_path = os.path.join("test_data", "noisy_simple_3state.csv")
      noisy_ts.load_csv(input_csv_path)
  
      calculator = PandasCalculator()
      gm_denoiser = GlobalMedianDenoiser(calculator)
      denoised_ts = gm_denoiser.run_denoising(noisy_ts)
      output_csv_path = os.path.join("test_data", "output_from_gm_test.csv")
      denoised_ts.write_csv(output_csv_path)
  
      nose.tools.ok_(os.path.exists(output_csv_path))
      nose.tools.eq_(len(noisy_ts), len(denoised_ts))
      median_of_ts = noisy_ts.series.median()
      nose.tools.ok_((denoised_ts.series == median_of_ts).all())
  
  
  @nose.tools.istest
  def apply_jump_penalty_denoiser_to_time_series():
      noisy_ts = PandasTimeSeries()
      input_csv_path = os.path.join("test_data", "noisy_simple_3state.csv")
      noisy_ts.load_csv(input_csv_path)
  
      calculator = PandasCalculator()
      jp_denoiser = JumpPenaltyDenoiser(calculator)
      denoised_ts = jp_denoiser.run_denoising(noisy_ts, square=True, gamma=0.1,
                                              noisy=True)
  
      output_csv_path = os.path.join("test_data", "output_from_jp_test.csv")
      denoised_ts.write_csv(output_csv_path)
  
subject: Refactor jump penalty test. No longer concerned about producing output that matches the output from the matlab code.