ImageALlocal.py 3.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. #!/usr/bin/env python3
  2. # -*- coding: utf-8 -*-
  3. """
  4. Created on Sun Sep 23 15:59:15 2018
  5. @author: galizia
  6. collection of functions in ImageAL_Local_Gio
  7. """
  8. import pandas as pd
  9. def localodortext(flags_input, p1):
  10. # this function creates text chuncs that are used in VIEW
  11. # for example in file names, or in labels for images or windows
  12. # this function should be user accessible - every person needs to be able to
  13. # modify output names at will.
  14. # could be implemented with a string in an external file
  15. #flags_input should be a series - if it is not, convert it
  16. if isinstance(flags_input, pd.Series):
  17. flag = flags_input
  18. else:
  19. flag = flags_input.to_series()
  20. maxTextLength = 10
  21. # ;odorText enthält Text, der unterhalb des Bildes ist
  22. # ;odorText = p1.ex_name + '_' + p1.treatment + '_' + strtrim(string(fix(p1.treat_conc *10)),2) ; neue Listen
  23. # ;odorText = p1.odor(odor) + '_' +strTrim(string(p1.odor_nr(1)),2)
  24. # ;odorText = p1.ex_name + '_' + strmid(p1.treatment,0,1);vom treatment nur der erste buchstabe
  25. # ;odorText = p1.odor(odor) + '_' +strTrim(string(p1.stimulus_isi),2)
  26. # ;odorText = p1.odor(odor)
  27. # ;odorText = p1.ex_name
  28. #;gut f¸r 12
  29. odorText = p1.metadata.experiment[0:8] + '_' + p1.metadata.ex_name[0:8]
  30. #;gut f¸r 10 - Beateq
  31. # odorText = strmid(p1.ex_name,0,min([6,strlen(p1.ex_name)])) + '_'+strtrim(string(fix(p1.posz)),2)+'_'+strtrim(string(p1.stimulus_on),2);max text length 12 chars
  32. # odorText = strmid(odortext,0,min([15,strlen(odortext)])) ;max text length 12 chars
  33. #
  34. # ;text f¸r Ringertest
  35. # txt_VisionTag = strmid(p1.ex_name,strlen(p1.ex_name)-2,strlen(p1.ex_name)) ;letzte beide Buchstaben vom Vision File_Namen
  36. #txt_VisionTag = p1.ex_name[-2:] # ;letzte beide Buchstaben vom Vision File_Namen
  37. txt_odor = p1.odor #(odor) ;Duft
  38. txt_odor0 = txt_odor.strip()
  39. # ;txt_treatment: treatment, e.g. Ring
  40. txt_treatment = p1.treatment[0:4] # welcher Ringer
  41. # ;txt_treatment0: treatment, e.g. Ring, remove blanks
  42. txt_treatment0 = txt_treatment.strip() # strmid(strtrim(p1.treatment,2),0,min([4,strlen(p1.treatment)]))
  43. #txt_odorInfo = p1.odor_info.strip() #focal depth
  44. txt_odorConc = str(p1.odor_nr) # ;odor concentration
  45. #txt_exName = p1.ex_name.strip()
  46. if flag.VIEW_batchmode:# THEN begin
  47. if flag.VIEW_ReportMethod == 10: # then begin ;tiff-ausgabe ohne tiername
  48. # ;einstellung f¸r Ringer-test-Versuch
  49. # ;odorText = txt_treatment+'_' + txt_odor+'_' + txt_VisionTag ;die 3 st¸cke zusammen, mit spacern
  50. # ;einstellung kurze Filme in verschiedenen Fokusebenen
  51. # ;odorText = txt_odorInfo+'_' + txt_odor+'_' + txt_odorConc ;Fokusebene Duft Konzentration
  52. odorText = txt_odor0+'_'+txt_treatment0
  53. odorText = txt_odor0+'_'+txt_odorConc
  54. odorText = odorText[0:maxTextLength]# max text length maxTextLength chars
  55. if flag.VIEW_ReportMethod in [12, 1200]: # movie file name
  56. # odortext = p1.experiment[0:8] + '_'+ txt_odor0 +'_'+ txt_odorConc+'_'+ p1.viewlabel
  57. #odorText = flag.STG_ReportTag + '_' + p1.viewlabel
  58. #from p1.experiment e.g. 'dbb4f.pst' take only 'dbb4f'
  59. odorText = str(p1.messungszahl)+ '_' + p1.odor[0:4] + '_' +p1.experiment.split('.')[0]
  60. odorText = str(p1.messungszahl)+ '_' + flag["STG_OdorReportFile"]
  61. # endIF
  62. if flag.VIEW_ReportMethod == 15: ## then begin ;filmausgabe mit tiername
  63. odorText = txt_odor + '_'+ flag.stg_reporttag +'_'+ str(p1.messungszahl) + '_' + p1.viewlabel
  64. # endIF
  65. else:
  66. # ;working in view-gui
  67. odorText = p1.ex_name[0:6] + '_'+ str(p1.posz) + '_' + str(p1.stimulus_on) #max text length 12 chars
  68. odorText = odorText[0:maxTextLength] #)) ;max text length maxTextLength chars
  69. return odorText