[libcamera-devel,13/24] utils: raspberrypi: ctt: Fix pycodestyle W605

Message ID 20200512000322.11753-14-laurent.pinchart@ideasonboard.com
State Accepted
Headers show
Series
  • utils: raspberrypi: ctt: Comply with pycodestyle
Related show

Commit Message

Laurent Pinchart May 12, 2020, 12:03 a.m. UTC
W605 invalid escape sequence '\.'

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 utils/raspberrypi/ctt/ctt.py     | 4 ++--
 utils/raspberrypi/ctt/ctt_awb.py | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

Comments

Kieran Bingham May 12, 2020, 8:25 a.m. UTC | #1
Hi Laurent,

On 12/05/2020 01:03, Laurent Pinchart wrote:
> W605 invalid escape sequence '\.'
> 

Would these be better interpreted as a 'raw' string?:

> - col = re.search('([0-9]+)[kK](\.(jpg|jpeg|brcm|dng)|_.*\.(jpg|jpeg|brcm|dng))$', string)
> + col = re.search(r'([0-9]+)[kK](\.(jpg|jpeg|brcm|dng)|_.*\.(jpg|jpeg|brcm|dng))$', string)

That is how I have been handling regexes in python:

  https://docs.python.org/3/howto/regex.html#the-backslash-plague

--
Kieran


> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> ---
>  utils/raspberrypi/ctt/ctt.py     | 4 ++--
>  utils/raspberrypi/ctt/ctt_awb.py | 4 ++--
>  2 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/utils/raspberrypi/ctt/ctt.py b/utils/raspberrypi/ctt/ctt.py
> index ff264176f040..4d8d6addf415 100755
> --- a/utils/raspberrypi/ctt/ctt.py
> +++ b/utils/raspberrypi/ctt/ctt.py
> @@ -41,8 +41,8 @@ def get_col_lux(string):
>      """
>      Extract colour and lux values from filename
>      """
> -    col = re.search('([0-9]+)[kK](\.(jpg|jpeg|brcm|dng)|_.*\.(jpg|jpeg|brcm|dng))$', string)
> -    lux = re.search('([0-9]+)[lL](\.(jpg|jpeg|brcm|dng)|_.*\.(jpg|jpeg|brcm|dng))$', string)
> +    col = re.search('([0-9]+)[kK](\\.(jpg|jpeg|brcm|dng)|_.*\\.(jpg|jpeg|brcm|dng))$', string)
> +    lux = re.search('([0-9]+)[lL](\\.(jpg|jpeg|brcm|dng)|_.*\\.(jpg|jpeg|brcm|dng))$', string)
>      try:
>          col = col.group(1)
>      except AttributeError:
> diff --git a/utils/raspberrypi/ctt/ctt_awb.py b/utils/raspberrypi/ctt/ctt_awb.py
> index 58ef8432fb86..e97d833d0e49 100644
> --- a/utils/raspberrypi/ctt/ctt_awb.py
> +++ b/utils/raspberrypi/ctt/ctt_awb.py
> @@ -256,8 +256,8 @@ def awb(Cam, cal_cr_list, cal_cb_list, plot):
>          plt.scatter(rbs_hat[0], rbs_hat[1], color='red')
>          for i, ct in enumerate(rbs_hat[2]):
>              plt.annotate(str(ct), (rbs_hat[0][i], rbs_hat[1][i]))
> -        plt.xlabel('$\hat{r}$')
> -        plt.ylabel('$\hat{b}$')
> +        plt.xlabel('$\\hat{r}$')
> +        plt.ylabel('$\\hat{b}$')
>          """
>          optional set axes equal to shortest distance so line really does
>          looks perpendicular and everybody is happy
>
Laurent Pinchart May 12, 2020, 4:38 p.m. UTC | #2
Hi Kieran,

On Tue, May 12, 2020 at 09:25:59AM +0100, Kieran Bingham wrote:
> On 12/05/2020 01:03, Laurent Pinchart wrote:
> > W605 invalid escape sequence '\.'
> > 
> 
> Would these be better interpreted as a 'raw' string?:
> 
> > - col = re.search('([0-9]+)[kK](\.(jpg|jpeg|brcm|dng)|_.*\.(jpg|jpeg|brcm|dng))$', string)
> > + col = re.search(r'([0-9]+)[kK](\.(jpg|jpeg|brcm|dng)|_.*\.(jpg|jpeg|brcm|dng))$', string)
> 
> That is how I have been handling regexes in python:
> 
>   https://docs.python.org/3/howto/regex.html#the-backslash-plague

It's a good point. I'll submit a new version.

Would you do the same for the strings in ctt_awb.py, or just for the
regexp ?

> > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> > ---
> >  utils/raspberrypi/ctt/ctt.py     | 4 ++--
> >  utils/raspberrypi/ctt/ctt_awb.py | 4 ++--
> >  2 files changed, 4 insertions(+), 4 deletions(-)
> > 
> > diff --git a/utils/raspberrypi/ctt/ctt.py b/utils/raspberrypi/ctt/ctt.py
> > index ff264176f040..4d8d6addf415 100755
> > --- a/utils/raspberrypi/ctt/ctt.py
> > +++ b/utils/raspberrypi/ctt/ctt.py
> > @@ -41,8 +41,8 @@ def get_col_lux(string):
> >      """
> >      Extract colour and lux values from filename
> >      """
> > -    col = re.search('([0-9]+)[kK](\.(jpg|jpeg|brcm|dng)|_.*\.(jpg|jpeg|brcm|dng))$', string)
> > -    lux = re.search('([0-9]+)[lL](\.(jpg|jpeg|brcm|dng)|_.*\.(jpg|jpeg|brcm|dng))$', string)
> > +    col = re.search('([0-9]+)[kK](\\.(jpg|jpeg|brcm|dng)|_.*\\.(jpg|jpeg|brcm|dng))$', string)
> > +    lux = re.search('([0-9]+)[lL](\\.(jpg|jpeg|brcm|dng)|_.*\\.(jpg|jpeg|brcm|dng))$', string)
> >      try:
> >          col = col.group(1)
> >      except AttributeError:
> > diff --git a/utils/raspberrypi/ctt/ctt_awb.py b/utils/raspberrypi/ctt/ctt_awb.py
> > index 58ef8432fb86..e97d833d0e49 100644
> > --- a/utils/raspberrypi/ctt/ctt_awb.py
> > +++ b/utils/raspberrypi/ctt/ctt_awb.py
> > @@ -256,8 +256,8 @@ def awb(Cam, cal_cr_list, cal_cb_list, plot):
> >          plt.scatter(rbs_hat[0], rbs_hat[1], color='red')
> >          for i, ct in enumerate(rbs_hat[2]):
> >              plt.annotate(str(ct), (rbs_hat[0][i], rbs_hat[1][i]))
> > -        plt.xlabel('$\hat{r}$')
> > -        plt.ylabel('$\hat{b}$')
> > +        plt.xlabel('$\\hat{r}$')
> > +        plt.ylabel('$\\hat{b}$')
> >          """
> >          optional set axes equal to shortest distance so line really does
> >          looks perpendicular and everybody is happy
Kieran Bingham May 14, 2020, 9:08 a.m. UTC | #3
Hi Laurent

On 12/05/2020 17:38, Laurent Pinchart wrote:
> Hi Kieran,
> 
> On Tue, May 12, 2020 at 09:25:59AM +0100, Kieran Bingham wrote:
>> On 12/05/2020 01:03, Laurent Pinchart wrote:
>>> W605 invalid escape sequence '\.'
>>>
>>
>> Would these be better interpreted as a 'raw' string?:
>>
>>> - col = re.search('([0-9]+)[kK](\.(jpg|jpeg|brcm|dng)|_.*\.(jpg|jpeg|brcm|dng))$', string)
>>> + col = re.search(r'([0-9]+)[kK](\.(jpg|jpeg|brcm|dng)|_.*\.(jpg|jpeg|brcm|dng))$', string)
>>
>> That is how I have been handling regexes in python:
>>
>>   https://docs.python.org/3/howto/regex.html#the-backslash-plague
> 
> It's a good point. I'll submit a new version.
> 
> Would you do the same for the strings in ctt_awb.py, or just for the
> regexp ?

the 'r' prefix is 'raw' not 'regexp', so I believe it applies to the
ct_awb.py edits too.

Might be worth testing the change somehow though to make sure it still
works with the matplot component.

I don't see a reason for it not to work ... but still.

--
Regards

Kieran


>>> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
>>> ---
>>>  utils/raspberrypi/ctt/ctt.py     | 4 ++--
>>>  utils/raspberrypi/ctt/ctt_awb.py | 4 ++--
>>>  2 files changed, 4 insertions(+), 4 deletions(-)
>>>
>>> diff --git a/utils/raspberrypi/ctt/ctt.py b/utils/raspberrypi/ctt/ctt.py
>>> index ff264176f040..4d8d6addf415 100755
>>> --- a/utils/raspberrypi/ctt/ctt.py
>>> +++ b/utils/raspberrypi/ctt/ctt.py
>>> @@ -41,8 +41,8 @@ def get_col_lux(string):
>>>      """
>>>      Extract colour and lux values from filename
>>>      """
>>> -    col = re.search('([0-9]+)[kK](\.(jpg|jpeg|brcm|dng)|_.*\.(jpg|jpeg|brcm|dng))$', string)
>>> -    lux = re.search('([0-9]+)[lL](\.(jpg|jpeg|brcm|dng)|_.*\.(jpg|jpeg|brcm|dng))$', string)
>>> +    col = re.search('([0-9]+)[kK](\\.(jpg|jpeg|brcm|dng)|_.*\\.(jpg|jpeg|brcm|dng))$', string)
>>> +    lux = re.search('([0-9]+)[lL](\\.(jpg|jpeg|brcm|dng)|_.*\\.(jpg|jpeg|brcm|dng))$', string)
>>>      try:
>>>          col = col.group(1)
>>>      except AttributeError:
>>> diff --git a/utils/raspberrypi/ctt/ctt_awb.py b/utils/raspberrypi/ctt/ctt_awb.py
>>> index 58ef8432fb86..e97d833d0e49 100644
>>> --- a/utils/raspberrypi/ctt/ctt_awb.py
>>> +++ b/utils/raspberrypi/ctt/ctt_awb.py
>>> @@ -256,8 +256,8 @@ def awb(Cam, cal_cr_list, cal_cb_list, plot):
>>>          plt.scatter(rbs_hat[0], rbs_hat[1], color='red')
>>>          for i, ct in enumerate(rbs_hat[2]):
>>>              plt.annotate(str(ct), (rbs_hat[0][i], rbs_hat[1][i]))
>>> -        plt.xlabel('$\hat{r}$')
>>> -        plt.ylabel('$\hat{b}$')
>>> +        plt.xlabel('$\\hat{r}$')
>>> +        plt.ylabel('$\\hat{b}$')
>>>          """
>>>          optional set axes equal to shortest distance so line really does
>>>          looks perpendicular and everybody is happy
>
David Plowman May 14, 2020, 9:47 a.m. UTC | #4
Hi

Thanks everyone for fixing up all this stuff. (If I'd known there was an
official "pycodestyle" I'd have done it myself ages ago!).

I actually applied all 24 of these patches including this one, yesterday,
and re-ran the tool to check that it still works. And it did, so I gave it
the nod!

Regards

David

On Thu, 14 May 2020 at 10:08, Kieran Bingham <
kieran.bingham@ideasonboard.com> wrote:

> Hi Laurent
>
> On 12/05/2020 17:38, Laurent Pinchart wrote:
> > Hi Kieran,
> >
> > On Tue, May 12, 2020 at 09:25:59AM +0100, Kieran Bingham wrote:
> >> On 12/05/2020 01:03, Laurent Pinchart wrote:
> >>> W605 invalid escape sequence '\.'
> >>>
> >>
> >> Would these be better interpreted as a 'raw' string?:
> >>
> >>> - col =
> re.search('([0-9]+)[kK](\.(jpg|jpeg|brcm|dng)|_.*\.(jpg|jpeg|brcm|dng))$',
> string)
> >>> + col =
> re.search(r'([0-9]+)[kK](\.(jpg|jpeg|brcm|dng)|_.*\.(jpg|jpeg|brcm|dng))$',
> string)
> >>
> >> That is how I have been handling regexes in python:
> >>
> >>   https://docs.python.org/3/howto/regex.html#the-backslash-plague
> >
> > It's a good point. I'll submit a new version.
> >
> > Would you do the same for the strings in ctt_awb.py, or just for the
> > regexp ?
>
> the 'r' prefix is 'raw' not 'regexp', so I believe it applies to the
> ct_awb.py edits too.
>
> Might be worth testing the change somehow though to make sure it still
> works with the matplot component.
>
> I don't see a reason for it not to work ... but still.
>
> --
> Regards
>
> Kieran
>
>
> >>> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> >>> ---
> >>>  utils/raspberrypi/ctt/ctt.py     | 4 ++--
> >>>  utils/raspberrypi/ctt/ctt_awb.py | 4 ++--
> >>>  2 files changed, 4 insertions(+), 4 deletions(-)
> >>>
> >>> diff --git a/utils/raspberrypi/ctt/ctt.py
> b/utils/raspberrypi/ctt/ctt.py
> >>> index ff264176f040..4d8d6addf415 100755
> >>> --- a/utils/raspberrypi/ctt/ctt.py
> >>> +++ b/utils/raspberrypi/ctt/ctt.py
> >>> @@ -41,8 +41,8 @@ def get_col_lux(string):
> >>>      """
> >>>      Extract colour and lux values from filename
> >>>      """
> >>> -    col =
> re.search('([0-9]+)[kK](\.(jpg|jpeg|brcm|dng)|_.*\.(jpg|jpeg|brcm|dng))$',
> string)
> >>> -    lux =
> re.search('([0-9]+)[lL](\.(jpg|jpeg|brcm|dng)|_.*\.(jpg|jpeg|brcm|dng))$',
> string)
> >>> +    col =
> re.search('([0-9]+)[kK](\\.(jpg|jpeg|brcm|dng)|_.*\\.(jpg|jpeg|brcm|dng))$',
> string)
> >>> +    lux =
> re.search('([0-9]+)[lL](\\.(jpg|jpeg|brcm|dng)|_.*\\.(jpg|jpeg|brcm|dng))$',
> string)
> >>>      try:
> >>>          col = col.group(1)
> >>>      except AttributeError:
> >>> diff --git a/utils/raspberrypi/ctt/ctt_awb.py
> b/utils/raspberrypi/ctt/ctt_awb.py
> >>> index 58ef8432fb86..e97d833d0e49 100644
> >>> --- a/utils/raspberrypi/ctt/ctt_awb.py
> >>> +++ b/utils/raspberrypi/ctt/ctt_awb.py
> >>> @@ -256,8 +256,8 @@ def awb(Cam, cal_cr_list, cal_cb_list, plot):
> >>>          plt.scatter(rbs_hat[0], rbs_hat[1], color='red')
> >>>          for i, ct in enumerate(rbs_hat[2]):
> >>>              plt.annotate(str(ct), (rbs_hat[0][i], rbs_hat[1][i]))
> >>> -        plt.xlabel('$\hat{r}$')
> >>> -        plt.ylabel('$\hat{b}$')
> >>> +        plt.xlabel('$\\hat{r}$')
> >>> +        plt.ylabel('$\\hat{b}$')
> >>>          """
> >>>          optional set axes equal to shortest distance so line really
> does
> >>>          looks perpendicular and everybody is happy
> >
>
> --
> Regards
> --
> Kieran
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel@lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel
>
Kieran Bingham May 14, 2020, 9:50 a.m. UTC | #5
Hi David,

On 14/05/2020 10:47, David Plowman wrote:
> Hi
> 
> Thanks everyone for fixing up all this stuff. (If I'd known there was an
> official "pycodestyle" I'd have done it myself ages ago!).

It used to be called 'pep8' ... but got renamed to a more
useful/representative pycodestyle ;-)


> I actually applied all 24 of these patches including this one,
> yesterday, and re-ran the tool to check that it still works. And it did,
> so I gave it the nod!

Great ;-)

--
Kieran


> 
> Regards
> 
> David
> 
> On Thu, 14 May 2020 at 10:08, Kieran Bingham
> <kieran.bingham@ideasonboard.com
> <mailto:kieran.bingham@ideasonboard.com>> wrote:
> 
>     Hi Laurent
> 
>     On 12/05/2020 17:38, Laurent Pinchart wrote:
>     > Hi Kieran,
>     >
>     > On Tue, May 12, 2020 at 09:25:59AM +0100, Kieran Bingham wrote:
>     >> On 12/05/2020 01:03, Laurent Pinchart wrote:
>     >>> W605 invalid escape sequence '\.'
>     >>>
>     >>
>     >> Would these be better interpreted as a 'raw' string?:
>     >>
>     >>> - col =
>     re.search('([0-9]+)[kK](\.(jpg|jpeg|brcm|dng)|_.*\.(jpg|jpeg|brcm|dng))$',
>     string)
>     >>> + col =
>     re.search(r'([0-9]+)[kK](\.(jpg|jpeg|brcm|dng)|_.*\.(jpg|jpeg|brcm|dng))$',
>     string)
>     >>
>     >> That is how I have been handling regexes in python:
>     >>
>     >>   https://docs.python.org/3/howto/regex.html#the-backslash-plague
>     >
>     > It's a good point. I'll submit a new version.
>     >
>     > Would you do the same for the strings in ctt_awb.py, or just for the
>     > regexp ?
> 
>     the 'r' prefix is 'raw' not 'regexp', so I believe it applies to the
>     ct_awb.py edits too.
> 
>     Might be worth testing the change somehow though to make sure it still
>     works with the matplot component.
> 
>     I don't see a reason for it not to work ... but still.
> 
>     --
>     Regards
> 
>     Kieran
> 
> 
>     >>> Signed-off-by: Laurent Pinchart
>     <laurent.pinchart@ideasonboard.com
>     <mailto:laurent.pinchart@ideasonboard.com>>
>     >>> ---
>     >>>  utils/raspberrypi/ctt/ctt.py     | 4 ++--
>     >>>  utils/raspberrypi/ctt/ctt_awb.py | 4 ++--
>     >>>  2 files changed, 4 insertions(+), 4 deletions(-)
>     >>>
>     >>> diff --git a/utils/raspberrypi/ctt/ctt.py
>     b/utils/raspberrypi/ctt/ctt.py
>     >>> index ff264176f040..4d8d6addf415 100755
>     >>> --- a/utils/raspberrypi/ctt/ctt.py
>     >>> +++ b/utils/raspberrypi/ctt/ctt.py
>     >>> @@ -41,8 +41,8 @@ def get_col_lux(string):
>     >>>      """
>     >>>      Extract colour and lux values from filename
>     >>>      """
>     >>> -    col =
>     re.search('([0-9]+)[kK](\.(jpg|jpeg|brcm|dng)|_.*\.(jpg|jpeg|brcm|dng))$',
>     string)
>     >>> -    lux =
>     re.search('([0-9]+)[lL](\.(jpg|jpeg|brcm|dng)|_.*\.(jpg|jpeg|brcm|dng))$',
>     string)
>     >>> +    col =
>     re.search('([0-9]+)[kK](\\.(jpg|jpeg|brcm|dng)|_.*\\.(jpg|jpeg|brcm|dng))$',
>     string)
>     >>> +    lux =
>     re.search('([0-9]+)[lL](\\.(jpg|jpeg|brcm|dng)|_.*\\.(jpg|jpeg|brcm|dng))$',
>     string)
>     >>>      try:
>     >>>          col = col.group(1)
>     >>>      except AttributeError:
>     >>> diff --git a/utils/raspberrypi/ctt/ctt_awb.py
>     b/utils/raspberrypi/ctt/ctt_awb.py
>     >>> index 58ef8432fb86..e97d833d0e49 100644
>     >>> --- a/utils/raspberrypi/ctt/ctt_awb.py
>     >>> +++ b/utils/raspberrypi/ctt/ctt_awb.py
>     >>> @@ -256,8 +256,8 @@ def awb(Cam, cal_cr_list, cal_cb_list, plot):
>     >>>          plt.scatter(rbs_hat[0], rbs_hat[1], color='red')
>     >>>          for i, ct in enumerate(rbs_hat[2]):
>     >>>              plt.annotate(str(ct), (rbs_hat[0][i], rbs_hat[1][i]))
>     >>> -        plt.xlabel('$\hat{r}$')
>     >>> -        plt.ylabel('$\hat{b}$')
>     >>> +        plt.xlabel('$\\hat{r}$')
>     >>> +        plt.ylabel('$\\hat{b}$')
>     >>>          """
>     >>>          optional set axes equal to shortest distance so line
>     really does
>     >>>          looks perpendicular and everybody is happy
>     >
> 
>     -- 
>     Regards
>     --
>     Kieran
>     _______________________________________________
>     libcamera-devel mailing list
>     libcamera-devel@lists.libcamera.org
>     <mailto:libcamera-devel@lists.libcamera.org>
>     https://lists.libcamera.org/listinfo/libcamera-devel
>
Laurent Pinchart May 17, 2020, 2:41 p.m. UTC | #6
Hi Kieran,

On Thu, May 14, 2020 at 10:08:43AM +0100, Kieran Bingham wrote:
> On 12/05/2020 17:38, Laurent Pinchart wrote:
> > On Tue, May 12, 2020 at 09:25:59AM +0100, Kieran Bingham wrote:
> >> On 12/05/2020 01:03, Laurent Pinchart wrote:
> >>> W605 invalid escape sequence '\.'
> >>>
> >>
> >> Would these be better interpreted as a 'raw' string?:
> >>
> >>> - col = re.search('([0-9]+)[kK](\.(jpg|jpeg|brcm|dng)|_.*\.(jpg|jpeg|brcm|dng))$', string)
> >>> + col = re.search(r'([0-9]+)[kK](\.(jpg|jpeg|brcm|dng)|_.*\.(jpg|jpeg|brcm|dng))$', string)
> >>
> >> That is how I have been handling regexes in python:
> >>
> >>   https://docs.python.org/3/howto/regex.html#the-backslash-plague
> > 
> > It's a good point. I'll submit a new version.
> > 
> > Would you do the same for the strings in ctt_awb.py, or just for the
> > regexp ?
> 
> the 'r' prefix is 'raw' not 'regexp', so I believe it applies to the
> ct_awb.py edits too.

Yes, I know it could. It's mostly useful for regexp as you know only
literal \ are needed. For other strings that need both literal \ and
escaped characters, r can't be used. I'm thus wondering if a best
practice would be to avoid it for non-regexp strings that don't make
large usage of literal \.

> Might be worth testing the change somehow though to make sure it still
> works with the matplot component.
> 
> I don't see a reason for it not to work ... but still.
>
> >>> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> >>> ---
> >>>  utils/raspberrypi/ctt/ctt.py     | 4 ++--
> >>>  utils/raspberrypi/ctt/ctt_awb.py | 4 ++--
> >>>  2 files changed, 4 insertions(+), 4 deletions(-)
> >>>
> >>> diff --git a/utils/raspberrypi/ctt/ctt.py b/utils/raspberrypi/ctt/ctt.py
> >>> index ff264176f040..4d8d6addf415 100755
> >>> --- a/utils/raspberrypi/ctt/ctt.py
> >>> +++ b/utils/raspberrypi/ctt/ctt.py
> >>> @@ -41,8 +41,8 @@ def get_col_lux(string):
> >>>      """
> >>>      Extract colour and lux values from filename
> >>>      """
> >>> -    col = re.search('([0-9]+)[kK](\.(jpg|jpeg|brcm|dng)|_.*\.(jpg|jpeg|brcm|dng))$', string)
> >>> -    lux = re.search('([0-9]+)[lL](\.(jpg|jpeg|brcm|dng)|_.*\.(jpg|jpeg|brcm|dng))$', string)
> >>> +    col = re.search('([0-9]+)[kK](\\.(jpg|jpeg|brcm|dng)|_.*\\.(jpg|jpeg|brcm|dng))$', string)
> >>> +    lux = re.search('([0-9]+)[lL](\\.(jpg|jpeg|brcm|dng)|_.*\\.(jpg|jpeg|brcm|dng))$', string)
> >>>      try:
> >>>          col = col.group(1)
> >>>      except AttributeError:
> >>> diff --git a/utils/raspberrypi/ctt/ctt_awb.py b/utils/raspberrypi/ctt/ctt_awb.py
> >>> index 58ef8432fb86..e97d833d0e49 100644
> >>> --- a/utils/raspberrypi/ctt/ctt_awb.py
> >>> +++ b/utils/raspberrypi/ctt/ctt_awb.py
> >>> @@ -256,8 +256,8 @@ def awb(Cam, cal_cr_list, cal_cb_list, plot):
> >>>          plt.scatter(rbs_hat[0], rbs_hat[1], color='red')
> >>>          for i, ct in enumerate(rbs_hat[2]):
> >>>              plt.annotate(str(ct), (rbs_hat[0][i], rbs_hat[1][i]))
> >>> -        plt.xlabel('$\hat{r}$')
> >>> -        plt.ylabel('$\hat{b}$')
> >>> +        plt.xlabel('$\\hat{r}$')
> >>> +        plt.ylabel('$\\hat{b}$')
> >>>          """
> >>>          optional set axes equal to shortest distance so line really does
> >>>          looks perpendicular and everybody is happy

Patch

diff --git a/utils/raspberrypi/ctt/ctt.py b/utils/raspberrypi/ctt/ctt.py
index ff264176f040..4d8d6addf415 100755
--- a/utils/raspberrypi/ctt/ctt.py
+++ b/utils/raspberrypi/ctt/ctt.py
@@ -41,8 +41,8 @@  def get_col_lux(string):
     """
     Extract colour and lux values from filename
     """
-    col = re.search('([0-9]+)[kK](\.(jpg|jpeg|brcm|dng)|_.*\.(jpg|jpeg|brcm|dng))$', string)
-    lux = re.search('([0-9]+)[lL](\.(jpg|jpeg|brcm|dng)|_.*\.(jpg|jpeg|brcm|dng))$', string)
+    col = re.search('([0-9]+)[kK](\\.(jpg|jpeg|brcm|dng)|_.*\\.(jpg|jpeg|brcm|dng))$', string)
+    lux = re.search('([0-9]+)[lL](\\.(jpg|jpeg|brcm|dng)|_.*\\.(jpg|jpeg|brcm|dng))$', string)
     try:
         col = col.group(1)
     except AttributeError:
diff --git a/utils/raspberrypi/ctt/ctt_awb.py b/utils/raspberrypi/ctt/ctt_awb.py
index 58ef8432fb86..e97d833d0e49 100644
--- a/utils/raspberrypi/ctt/ctt_awb.py
+++ b/utils/raspberrypi/ctt/ctt_awb.py
@@ -256,8 +256,8 @@  def awb(Cam, cal_cr_list, cal_cb_list, plot):
         plt.scatter(rbs_hat[0], rbs_hat[1], color='red')
         for i, ct in enumerate(rbs_hat[2]):
             plt.annotate(str(ct), (rbs_hat[0][i], rbs_hat[1][i]))
-        plt.xlabel('$\hat{r}$')
-        plt.ylabel('$\hat{b}$')
+        plt.xlabel('$\\hat{r}$')
+        plt.ylabel('$\\hat{b}$')
         """
         optional set axes equal to shortest distance so line really does
         looks perpendicular and everybody is happy