0

I try to correct some glitches in my spectra and I got stuck on the last part, the implementation... FML I have cleaend and prepared the file.

Between the times 70 and 75 lies a glitch in the detector which we need to correct. We identified and obtained the difference now we need to add this difference to each of the 1024 rows up to 70 and leave the 75 and further without any change. Adding the corrected and non-corrected values.

I have really tryied several ways and I cannot seem to obtain result, I am unsure on how to approach this correctly or if I need to define the indexes clearer.

spec= raw_spec_raw  # 1024 x 199 csv wavelength/time
pre_glitch = spec['70.197969989']
post_glitch = spec['75.281351195']
diff = post_glitch - pre_glitch   # series with 1024 elements
corr=[]

Any help would be appreciated, at least a hint. I have seen so many complex examples or other which are crazy over-simplified and do no teach anything.

Thank you and have a good day. This a graphical description of how simple it is, :(

  • Is `diff` a single value? You should always include a minimal example of your data. Please read [mre]. [How to make good reproducible pandas examples](https://stackoverflow.com/questions/20109391/how-to-make-good-reproducible-pandas-examples) – wwii Sep 02 '20 at 14:01
  • Related: [Modifying a subset of rows in a pandas dataframe](https://stackoverflow.com/questions/12307099/modifying-a-subset-of-rows-in-a-pandas-dataframe). Applies to columns also - `df.loc[:,column_slice] = df.loc[:,column_slice] +1` where `column_slice` might be `'75.281351195':`. – wwii Sep 02 '20 at 14:52
  • [https://pandas.pydata.org/docs/user_guide/indexing.html#indexing-and-selecting-data](https://pandas.pydata.org/docs/user_guide/indexing.html#indexing-and-selecting-data) – wwii Sep 02 '20 at 14:54

0 Answers0